Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print string contents for "this" references #20933

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

h3110n3rv3
Copy link
Contributor

The changes reflect the feature request #20878.

Print string contents for this references.
Also, print address for string arguments and returns.

Closes: #20878
Signed-off-by: Nick Kamal <[email protected]>

@h3110n3rv3
Copy link
Contributor Author

@TobiAjila Could you please take a look?
Does this need to be done for compiled and native methods as well?

if ((NULL != receiver)
&& (receiverClazz == J9VMJAVALANGSTRING_OR_NULL(vm))
&& (0 != maxStringLength)
&& !J9UTF8_LITERAL_EQUALS(J9UTF8_DATA(methodName), J9UTF8_LENGTH(methodName), "<init>")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was getting a segfault for init methods if I didn't specify a particular function -Xtrace:methods={java/lang/String'()'} as compared to -Xtrace:methods={java/lang/String.concat'()'}, which worked fine.
The Unhandled exception was coming from UDATA stringLength = J9VMJAVALANGSTRING_LENGTH(vmThread, string); in copyStringToUTF8WithMemAlloc function, even though both vmThread and string weren't NULL. Not sure why.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its crashing because the string is not yet initialized, which makes sense because <init> is the initialization method

@h3110n3rv3 h3110n3rv3 force-pushed the print-string-improvements branch from dbc72d6 to 34fd8b7 Compare January 17, 2025 19:24
The changes reflect the feature request eclipse-openj9#20878.

Print string contents for this references.
Also, print address for string arguments and returns.

Closes: eclipse-openj9#20878
Signed-off-by: Nick Kamal <[email protected]>
@h3110n3rv3 h3110n3rv3 force-pushed the print-string-improvements branch from 34fd8b7 to ca5dd4d Compare January 17, 2025 19:25
@h3110n3rv3 h3110n3rv3 changed the title WIP: Print string contents for "this" references Print string contents for "this" references Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improvements for Xtrace String printing feature
2 participants