On Thu, 12 Nov 2026 01:51:57 GMT, Koichi Sakata <[email protected]> wrote:
> DebuggerException occurs in [`new > AARCH64DwarfParser(libptr)`](https://github.com/jyukutyo/jdk/blob/0af9bbc05f5909de16053a3ee65e0b0ba829d2bf/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/DwarfCFrame.java#L59) > in DwarfCFrame. The DebuggerException occurs before calling > `DwarfParser#processDwarf()`. So the fallback to `.debug_frame` doesn't > occur in this case. I think root cause is that SA does not try `.debug_frame` in executable when `DwarfParser` (C++ class) is created. I could reproduce the problem on AMD64 Linux. We can fix it with your change + following patch. We can expect `createDwarfParser()` would not throw `DebuggerException`, and we can see all of call stacks from `wait_for_release()` rather than show its frame only because `.debug_frame` has FDE for it. I recommend you to check it on Alpine Linux because its binary (e.g. musl C) does not have enough `.eh_frame` and DWARF what SA should refer is in `.debug_frame` in debuginfo. diff --git a/make/test/JtregNativeHotspot.gmk b/make/test/JtregNativeHotspot.gmk index d44cad10b1f..c84955bb36e 100644 --- a/make/test/JtregNativeHotspot.gmk +++ b/make/test/JtregNativeHotspot.gmk @@ -75,12 +75,12 @@ ifeq ($(call isTargetOs, linux), true) HOTSPOT_JTREG_LIBRARIES_LIBS_libSuspendInCritical += -latomic endif else - HOTSPOT_JTREG_EXCLUDE += libtest-rw.c libtest-rwx.c \ + HOTSPOT_JTREG_EXCLUDE += libtest-rw.c libtest-rwx.c libNoEhFrame.c \ exeinvoke.c exestack-gap.c exestack-tls.c libAsyncGetCallTraceTest.cpp endif ifneq ($(call isTargetOs, linux)+$(call isTargetCpu, aarch64), true+true) - HOTSPOT_JTREG_EXCLUDE += libTestSVEWithJNI.c libNoEhFrame.c + HOTSPOT_JTREG_EXCLUDE += libTestSVEWithJNI.c endif ifeq ($(call isTargetOs, windows), true) diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp index 83df07d7ab2..50cfe5bf859 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp @@ -431,15 +431,12 @@ bool DwarfParser::process_dwarf(const uintptr_t pc) { bool result = false; // try again with .debug_frame section if it hasn't been tried yet. if (!_lib->frame.tried_debug_frame && _lib->fd != -1) { - // attempts to load .debug_frame from executables. frame_info frame = {}; - if (!read_frame(".debug_frame", _lib->fd, &frame)) { - // attempts again to load .debug_frame from debuginfo if it could not be loaded from executables. - int debug_fd = open_debuginfo(_lib->name, _lib->fd); - if (debug_fd != -1) { - read_frame(".debug_frame", debug_fd, &frame); - close(debug_fd); - } + // attempts to load .debug_frame from debuginfo. + int debug_fd = open_debuginfo(_lib->name, _lib->fd); + if (debug_fd != -1) { + read_frame(".debug_frame", debug_fd, &frame); + close(debug_fd); } frame.tried_debug_frame = true; _lib->frame.tried_debug_frame = true; diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c index fd0f49920a9..d582ff40e30 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c @@ -305,6 +305,9 @@ lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd, if (fill_addr_info(newlib)) { if (!read_frame(".eh_frame", newlib->fd, &newlib->frame)) { print_debug("Could not find .eh_frame section in %s\n", newlib->name); + if (!read_frame(".debug_frame", newlib->fd, &newlib->frame)) { + print_debug("Could not find .debug_frame section in %s\n", newlib->name); + } } } else { print_debug("Could not find executable section in %s\n", newlib->name); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java index 2943815af8f..13ce5fee0f6 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java @@ -40,7 +40,15 @@ private static LinuxAMD64CFrame getFrameFromReg(LinuxDebugger linuxDbg, Function Address rsp = getreg.apply(AMD64ThreadContext.RSP); Address rbp = getreg.apply(AMD64ThreadContext.RBP); Address cfa = null; - DwarfParser dwarf = createDwarfParser(linuxDbg, rip); + DwarfParser dwarf; + try { + dwarf = createDwarfParser(linuxDbg, rip); + } catch (DebuggerException e) { + if (linuxDbg.findLibPtrByAddress(rip) != null) { + return new LinuxAMD64CFrame(linuxDbg, rsp, rbp, null /* no CFA */, rip, null /* no DWARF */); + } + throw e; + } if (dwarf != null) { // Native frame cfa = getreg.apply(dwarf.getCFARegister()) ------------- PR Comment: https://git.openjdk.org/jdk/pull/33839#issuecomment-6813087994
