Skip to content

Commit bd5476e

Browse files
committed
Add info about perf record --call-graph dwarf
1 parent 3fdc56d commit bd5476e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/reference-manual/native-image/DebugInfo.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,15 @@ When `callgrind` is used in combination with a viewer like
991991
information about native image execution aand relate it back to
992992
specific source code lines.
993993

994-
### Related Documentation
994+
### Call-graph recording with `perf record`
995+
996+
Normally when perf does stack frame recording (i.e. when `--call-graph` is used), it uses frame pointers to recognize the individual stack frames.
997+
This assumes that the executable that gets profiled actually preserves frame pointers whenever a function gets called.
998+
For native-images this can be achieved by using `-H:+PreserveFramePointer` as an image build argument.
999+
1000+
An alternative solution is to make perf use dwarf debug info (specifically debug_frame data) to help unwinding stack frames.
1001+
To make this work, the image needs to be built with `-g` (to generate debuginfo) and `perf record` needs to use argument `--call-graph dwarf` to make sure dwarf debug info (instead of frame pointers) is used for stack unwinding.
1002+
1003+
## Related Documentation
9951004

9961005
- [Debug Native Executables with GDB](guides/debug-native-executables-with-gdb.md)

0 commit comments

Comments
 (0)