From 343c7879044d4ec3efc61e21017280690cea10e4 Mon Sep 17 00:00:00 2001 From: Nick Kamal Date: Thu, 21 Nov 2024 08:33:04 -0500 Subject: [PATCH] The changes reflect the feature request #16416. Instead of printing the memory address for string arguments, print the actual string at max of 32 characters. There will be subsequent PRs for cmdline option for string length and tests. Closes: #16416 Signed-off-by: Nick Kamal --- runtime/rastrace/method_trace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/rastrace/method_trace.c b/runtime/rastrace/method_trace.c index 87b50bde8c3..eca88af2ea9 100644 --- a/runtime/rastrace/method_trace.c +++ b/runtime/rastrace/method_trace.c @@ -487,12 +487,12 @@ traceMethodArgObject(J9VMThread *thr, UDATA* arg0EA, char* cursor, UDATA length) char stringArgBuffer[DEFAULT_BUFFER_LENGTH]; J9InternalVMFunctions const * const vmFuncs = thr->javaVM->internalVMFunctions; - char *stringArgUTF8 = vmFuncs->copyStringToUTF8WithMemAlloc(thr, object, J9_STR_NULL_TERMINATE_RESULT, "", 0, stringArgBuffer, DEFAULT_BUFFER_LENGTH, NULL); + char *stringArgUTF8 = vmFuncs->copyStringToUTF8WithMemAlloc(thr, object, J9_STR_NULL_TERMINATE_RESULT, " ", 2, stringArgBuffer, DEFAULT_BUFFER_LENGTH, NULL); if(DEFAULT_STRING_LENGTH < strlen(stringArgUTF8)) { - j9str_printf(PORTLIB, cursor, length, "%.*s@%.32s...", (U_32)J9UTF8_LENGTH(className), J9UTF8_DATA(className), stringArgUTF8); + j9str_printf(PORTLIB, cursor, length, "(String)%.*s...", (U_32)DEFAULT_STRING_LENGTH, J9UTF8_DATA(stringArgUTF8)); } else { - j9str_printf(PORTLIB, cursor, length, "%.*s@%s", (U_32)J9UTF8_LENGTH(className), J9UTF8_DATA(className), stringArgUTF8); + j9str_printf(PORTLIB, cursor, length, "(String)%.*s", (U_32)J9UTF8_LENGTH(stringArgUTF8), J9UTF8_DATA(stringArgUTF8)); } if ((char*)stringArgBuffer != stringArgUTF8) {