Support recording pc offsets for native samples

Author: Baraa-HasheeshCreated Sep 14, 2026Updated Sep 14, 2026
Labelsenhancement

Describe the feature

The async-profiler currently is lacking some advanced capabilities when it comes to profiling native apps or java apps that have high native dependencies

Such capabilities include:

  1. Method signature on JFR recordings (It is supported in collapsed & flamegraph recrodings)
  2. Can't provide Line of code information
  3. Can't unwind inlined native methods

This feature request is mostly about trying to find a solution for problems 2 & 3

Currently problems 2 & 3 can be partially be solved currently by using features=pcaddr which records the top PC value

By feeding that value to a post processor that reads the debug information, I could find the top inlined methods as well as the line number information of the top method

Here I'm proposing to allow the profiler to record the PC value for each native sample to extend that possibility to intermediary native samples

Use Case

Allow user to use a post processor to find inlined native methods & line number information, which will be quite helpful when debugging memory leaks & CPU loads

For memory leaks it could lead me to know the exact allocation that leaked than just knowing the rough area where it happened

For CPU loads it makes it easier to know which exact branches/methods are exactly causing the high CPU usage

Proposed Solution

Approach#1: The profiler will simply just record a raw PC address instead of method name as it currently does for pcaddr & it's the job of the user to handle everything features=pcraw

Approach#2: The profiler will provide more information in the captured samples which can be done like this

  1. always record PC address not the method name in method_id & for bci
    • 8 bits for frame type
    • 16 bits for CodeCache offset (in the code cache array)
    • 8 bits are reserved for internal use
  2. Lazy resolution of information on in dump time, using the following proposed format methodName@{CodeCacheName}#{pc-offset} (This can be controlled via the style dumping flags)

Note: Supporting these capabilities (Inlined native methods & line number information) in the async profiler it self does not look to be a reasonable approach as it would require implementing a full DWARF parser

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Source: async-profiler/async-profiler