Search code examples
javabinutils

Instruction address to symbol for Java


Let's say I have a particular instruction address for a Java program (for whatever reason) and I want to know which function it belongs to.

If this was from a C++ program for example, I could use binutils (addr2line etc) to get this.

Is this even possible for a Java program as there's no ELF file as the bytecode is JIT-ted?


Solution

  • perf-map-agent solves this problem:

    perf-map-agent is an agent that will generate such a mapping file for Java applications. It consists of a Java agent written C and a small Java bootstrap application which attaches the agent to a running Java process.