How is stack-trace constructed?

Manas Thakur manasthakur17 at gmail.com
Wed Jun 17 12:33:23 UTC 2015


Thanks a lot Andrew; I understood the flow now.

Regards,
Manas


> On 17-Jun-2015, at 4:45 pm, Andrew Haley <aph at redhat.com> wrote:
> 
> 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