KEMBAR78
JDK 25: cstack=vm is broken by JDK-8343789 · Issue #1222 · async-profiler/async-profiler · GitHub
Skip to content

JDK 25: cstack=vm is broken by JDK-8343789 #1222

@shipilev

Description

@shipilev

Describe the bug

Supplying cstack=vm when attaching to current mainline JDK quickly fails with "VMStructs stack walking is not supported on this JVM/platform". I suspect this is because JDK-8343789 moved the VMStructs::_metadata_offset field.

The following patch makes the profiling work, although lots of stacks become [unknown]:

diff --git a/src/vmStructs.cpp b/src/vmStructs.cpp
index 7aa94c9..cd0331f 100644
--- a/src/vmStructs.cpp
+++ b/src/vmStructs.cpp
@@ -509,7 +509,7 @@ void VMStructs::resolveOffsets() {
             && _data_offset >= 0
             && _scopes_data_offset != -1
             && _scopes_pcs_offset >= 0
-            && _nmethod_metadata_offset >= 0
+//            && _nmethod_metadata_offset >= 0
             && _thread_vframe_offset >= 0
             && _thread_exception_offset >= 0
             && _constmethod_size >= 0;

VMStructs parsing code might need to learn about new state of JDK 25 to work correctly.

Expected vs. actual behavior

Profiling works on JDK (25) mainline.

Reproduction Steps

Run mainline JDK with -agentpath:build/lib/libasyncProfiler.so=start,event=cpu,file=profile.html,interval=100us,cstack=vm.

Additional Information/Context

No other context, I have not debugged it further.

Async-profiler version

current HEAD

Environment details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions