Skip to content

Commit

Permalink
Merge pull request #18218 from fengxue-IS/javacore
Browse files Browse the repository at this point in the history
Add Unmounted Thread info to javacore
  • Loading branch information
keithc-ca authored Jan 9, 2024
2 parents 44a4d65 + d8387b4 commit 0cd684e
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 30 deletions.
15 changes: 8 additions & 7 deletions runtime/oti/j9dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ typedef struct RasDumpGlobalStorage {
UDATA allocationRangeMin;
UDATA allocationRangeMax;

U_32 noProtect; /* If set, do not take dumps under their own signal handler */
U_32 noFailover; /* If set, do not failover to /tmp etc if unable to write dump */
U_32 noProtect; /* If set, do not take dumps under their own signal handler. */
U_32 noFailover; /* If set, do not failover to /tmp etc if unable to write dump. */

U_32 showNativeSymbols; /* How to handle resolving native stack symbols. */
U_32 dumpFlags; /* Flags to control java dump behaviour. */
} RasDumpGlobalStorage;

/* Values for RasDumpGlobalStorage.showNativeSymbols. */
#define J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_NONE 0
#define J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_BASIC 1
#define J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_ALL 2
/* Flags on how to handle resolving native stack symbols. */
#define J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_BASIC 0x1
#define J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_ALL 0x2
/* Flag to show unmounted Thread stacktrace in java dump. */
#define J9RAS_JAVADUMP_SHOW_UNMOUNTED_THREAD_STACKS 0x4

struct J9RASdumpAgent; /* Forward struct declaration */
struct J9RASdumpContext; /* Forward struct declaration */
Expand Down
6 changes: 6 additions & 0 deletions runtime/oti/jvminit.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ enum INIT_STAGE {
#define VMOPT_XXSHOWNATIVESTACKSYMBOLS_BASIC "-XX:+ShowNativeStackSymbols=basic" /* show only easily acquired native stack symbols */
#define VMOPT_XXSHOWNATIVESTACKSYMBOLS_ALL "-XX:+ShowNativeStackSymbols=all" /* show all available native stack symbols */

#if JAVA_SPEC_VERSION >= 21
/* Option to control if unmounted thread stacktraces are shown in java core dumps. */
#define VMOPT_XXSHOWUNMOUNTEDTHREADSTACKS "-XX:+ShowUnmountedThreadStacks"
#define VMOPT_XXNOSHOWUNMOUNTEDTHREADSTACKS "-XX:-ShowUnmountedThreadStacks"
#endif /* JAVA_SPEC_VERSION >= 21 */

/* Option to turn on exception on synchronization on instances of value-based classes */
#define VMOPT_XXDIAGNOSE_SYNC_ON_VALUEBASED_CLASSES_EQUALS1 "-XX:DiagnoseSyncOnValueBasedClasses=1"
/* Option to turn on warning on synchronization on instances of value-based classes */
Expand Down
27 changes: 19 additions & 8 deletions runtime/rasdump/dmpsup.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,28 @@ configureDumpAgents(J9JavaVM *vm, J9VMInitArgs *j9vm_args, BOOLEAN isBootup)
IDATA allSymbols = FIND_AND_CONSUME_ARG(j9vm_args, EXACT_MATCH, VMOPT_XXSHOWNATIVESTACKSYMBOLS_ALL, NULL);
IDATA basicSymbols = FIND_AND_CONSUME_ARG(j9vm_args, EXACT_MATCH, VMOPT_XXSHOWNATIVESTACKSYMBOLS_BASIC, NULL);

/* set default */
dumpGlobal->showNativeSymbols = J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_BASIC;

if ((noSymbols > allSymbols) && (noSymbols > basicSymbols)) {
/* no symbols requested */
dumpGlobal->showNativeSymbols = J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_NONE;
} else if ((allSymbols > basicSymbols) && (allSymbols > noSymbols)) {
if ((allSymbols > basicSymbols) && (allSymbols > noSymbols)) {
/* all symbols requested */
dumpGlobal->showNativeSymbols = J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_ALL;
dumpGlobal->dumpFlags |= J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_ALL;
} else if (!((noSymbols > allSymbols) && (noSymbols > basicSymbols))) {
/* no symbols not requested, default to basic symbols */
dumpGlobal->dumpFlags |= J9RAS_JAVADUMP_SHOW_NATIVE_STACK_SYMBOLS_BASIC;
}
}

#if JAVA_SPEC_VERSION >= 21
/* -XX:[+/-]ShowUnmountedThreadStacks */
{
IDATA showUnmountedThreadStacks = FIND_AND_CONSUME_ARG(j9vm_args, EXACT_MATCH, VMOPT_XXSHOWUNMOUNTEDTHREADSTACKS, NULL);
IDATA noShowUnmountedThreadStacks = FIND_AND_CONSUME_ARG(j9vm_args, EXACT_MATCH, VMOPT_XXNOSHOWUNMOUNTEDTHREADSTACKS, NULL);

if (showUnmountedThreadStacks > noShowUnmountedThreadStacks) {
/* Unmounted thread stacktrace requested. */
dumpGlobal->dumpFlags |= J9RAS_JAVADUMP_SHOW_UNMOUNTED_THREAD_STACKS;
}
/* Do not show unmounted thread stacktrace in javadump by default. */
}
#endif /* JAVA_SPEC_VERSION >= 21 */

agentOpts = j9mem_allocate_memory(sizeof(J9RASdumpOption)*MAX_DUMP_OPTS, OMRMEM_CATEGORY_VM);
if( NULL == agentOpts ) {
Expand Down
Loading

0 comments on commit 0cd684e

Please sign in to comment.