Skip to content

Commit

Permalink
The changes reflect the feature request eclipse-openj9#16416 - part 2…
Browse files Browse the repository at this point in the history
… of eclipse-openj9#20641

Adding cmdline option to specify string length to be printed.
-Xtrace:methodstrarglen=[1-128]
methodStrArgLen takes an unsigned integer value from 1 to 128
If no methodStrArgLen is specified, or is set to 0, the printed length is the default value of 32.
Other invalid inputs result in the following:
"Error processing trace option, detail: methodstrarglen takes an unsigned integer value from 0 to 128
 Trace option unrecognized: -Xtrace:methodStrArgLen
 Error processing trace option: -Xtrace:methodStrArgLen=<invalid input>
"

There will be subsequent PRs for tests (part 3).

Signed-off-by: Nick Kamal <[email protected]>
  • Loading branch information
h3110n3rv3 committed Nov 21, 2024
1 parent 15797e8 commit b860ff4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/rastrace/method_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ traceMethodArgObject(J9VMThread *thr, UDATA* arg0EA, char* cursor, UDATA length)
J9InternalVMFunctions const * const vmFuncs = thr->javaVM->internalVMFunctions;
char *stringArgUTF8 = vmFuncs->copyStringToUTF8WithMemAlloc(thr, object, J9_STR_NULL_TERMINATE_RESULT, " ", 2, stringArgBuffer, DEFAULT_BUFFER_LENGTH, NULL);

if(DEFAULT_STRING_LENGTH < strlen(stringArgUTF8)) {
if(strArgLength < strlen(stringArgUTF8)) {
j9str_printf(PORTLIB, cursor, length, "(String)%.*s...", (U_32)strArgLength, J9UTF8_DATA(stringArgUTF8));
} else {
j9str_printf(PORTLIB, cursor, length, "(String)%.*s", (U_32)J9UTF8_LENGTH(stringArgUTF8), J9UTF8_DATA(stringArgUTF8));
Expand Down

0 comments on commit b860ff4

Please sign in to comment.