Skip to content

Commit

Permalink
Add Exception message to Xdump stack agent output
Browse files Browse the repository at this point in the history
When Xdump:stack is used to dump stack trace filtered on an exception,
this change along with the primary exception message, displays
additional detail about the exception if any. This is similar to how
javacore displays additional detail about an exception in 1TISIGINFO
tag.

Fixes: #8435
Signed-off-by: Kabir Islam <kaislam1@in.ibm.com>
  • Loading branch information
imkabir committed Oct 12, 2022
1 parent 8186943 commit f5c8a5b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
18 changes: 16 additions & 2 deletions runtime/nls/dump/j9dmp.nls
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2000, 2021 IBM Corp. and others
# Copyright (c) 2000, 2022 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -598,4 +598,18 @@ J9NLS_DMP_JIT_TRACE_IL_CRASHED_THREAD.system_action=The JVM continues.
J9NLS_DMP_JIT_TRACE_IL_CRASHED_THREAD.user_response=Diagnostic information, provide this information to your service representative.
J9NLS_DMP_JIT_TRACE_IL_CRASHED_THREAD.link=

# END NON-TRANSLATABLE
# END NON-TRANSLATABLE

J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME=Processing dump event \"%1$s\", detail \"%3$.*2$s\", exception \"%5$.*4$s\" at %6$s - please wait.
# START NON-TRANSLATABLE
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.explanation=A dump event has occurred and is being handled.
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.system_action=The JVM generates dumps as configured for the event by the -Xdump option.
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.user_response=No response is required.
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.sample_input_1=throw
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.sample_input_2=9
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.sample_input_3=#00000000
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.sample_input_4=12
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.sample_input_5=No such file
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.sample_input_6=20220919.114434
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME.link=dita:///diag/tools/dump_agents.dita
# END NON-TRANSLATABLE
30 changes: 28 additions & 2 deletions runtime/rasdump/trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,34 @@ triggerDumpAgents(struct J9JavaVM *vm, struct J9VMThread *self, UDATA eventFlags
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
char dateStamp[64];
omrstr_ftime_ex(dateStamp, sizeof(dateStamp), "%Y/%m/%d %H:%M:%S", now, OMRSTR_FTIME_FLAG_LOCAL);
j9nls_printf(PORTLIB, J9NLS_INFO | J9NLS_STDERR | J9NLS_VITAL, J9NLS_DMP_PROCESSING_EVENT_TIME, mapDumpEvent(eventFlags), detailLength, detailData, dateStamp);
printed = 1;

/* If there are more details about the event, print them.
* During abort event detailData is empty string - skip the abort event.
*/
if (('\0' != *detailData) && (NULL != eventData->exceptionRef) && (NULL != *eventData->exceptionRef)) {
j9object_t emessage = J9VMJAVALANGTHROWABLE_DETAILMESSAGE(self, *eventData->exceptionRef);
if (NULL != emessage) {
char stackBuffer[256];
UDATA extraDetailLength = 0;
char *extraDetail = self->javaVM->internalVMFunctions->copyStringToUTF8WithMemAlloc(self, emessage,
J9_STR_NULL_TERMINATE_RESULT, "", 0, stackBuffer,
sizeof(stackBuffer), &extraDetailLength);
if (NULL != extraDetail) {
j9nls_printf(PORTLIB, J9NLS_INFO | J9NLS_STDERR | J9NLS_VITAL,
J9NLS_DMP_PROCESSING_DETAILED_EVENT_TIME, mapDumpEvent(eventFlags),
detailLength, detailData, extraDetailLength, extraDetail, dateStamp);
if (stackBuffer != extraDetail) {
j9mem_free_memory(extraDetail);
}
printed = 1;
}
}
}
if (0 == printed) {
j9nls_printf(PORTLIB, J9NLS_INFO | J9NLS_STDERR | J9NLS_VITAL, J9NLS_DMP_PROCESSING_EVENT_TIME,
mapDumpEvent(eventFlags), detailLength, detailData, dateStamp);
printed = 1;
}
}
}

Expand Down

0 comments on commit f5c8a5b

Please sign in to comment.