How is stack-trace constructed?
Andrew Haley
aph at redhat.com
Wed Jun 17 11:15:56 UTC 2015
Hi,
On 06/17/2015 12:02 PM, Manas Thakur wrote:
>
> I haven’t done that (will do for sure if you suggest). But I thought
> this information must be available somewhere with a data structure
> in “ciMethod”. Can you tell if I am leading to the right direction?
No, those are compile-time structures. The information you seek is in
the nmethod. It has PcDescs which map a physical PC to the
corresponding source scope and bytecode index. Once you have that
it's relatively easy.
Put a breakpoint on java_lang_Throwable::fill_in_stack_trace here:
if (nm->method()->is_native()) {
method = nm->method();
bci = 0;
} else {
PcDesc* pd = nm->pc_desc_at(pc);
decode_offset = pd->scope_decode_offset();
// if decode_offset is not equal to 0, it will execute the
// "compiled java method case" at the beginning of the loop.
and you can watch it happen.
Andrew.
More information about the hotspot-dev
mailing list