On Tue, Aug 31, 2021 at 4:30 AM Poonai <rbalaji...@gmail.com> wrote:
>
> I'm trying to learn how debugger works. With the help of this blog 
> https://eli.thegreenplace.net/2011/01/27/how-debuggers-work-part-2-breakpoints
> I'm able to set breakpoint and continue.
>
> In the next step of learning, I wanted to learn how to extract values of 
> variables.
>
> But, the dwarf output says the frame base addrs as: 1 byte block: 9c 
> (DW_OP_call_frame_cfa)
>
>  <0><48a28>: Abbrev Number: 1 (DW_TAG_compile_unit)
>     <48a29>   DW_AT_name        : main
>     <48a2e>   DW_AT_language    : 22 (Go)
>     <48a2f>   DW_AT_stmt_list   : 0x26b2c
>     <48a33>   DW_AT_low_pc      : 0x498200
>     <48a3b>   DW_AT_ranges      : 0x28a70
>     <48a3f>   DW_AT_comp_dir    : .
>     <48a41>   DW_AT_producer    : Go cmd/compile go1.16.6; -N -l
>     <48a60>   Unknown AT value: 2905: main
>  <1><48a65>: Abbrev Number: 3 (DW_TAG_subprogram)
>     <48a66>   DW_AT_name        : main.main
>     <48a70>   DW_AT_low_pc      : 0x498200
>     <48a78>   DW_AT_high_pc     : 0x4982e5
>     <48a80>   DW_AT_frame_base  : 1 byte block: 9c (DW_OP_call_frame_cfa)
>     <48a82>   DW_AT_decl_file   : 0x2
>     <48a86>   DW_AT_external    : 1
>  <2><48a87>: Abbrev Number: 21 (DW_TAG_lexical_block)
>     <48a88>   DW_AT_low_pc      : 0x498223
>     <48a90>   DW_AT_high_pc     : 0x4982d9
>  <3><48a98>: Abbrev Number: 10 (DW_TAG_variable)
>     <48a99>   DW_AT_name        : variableToTrace
>     <48aa9>   DW_AT_decl_line   : 11
>     <48aaa>   DW_AT_type        : <0x4ab9f>
>     <48aae>   DW_AT_location    : 3 byte block: 91 b0 7f (DW_OP_fbreg: -80)
>
> I wanted to readt variableToTrace. to my understanding, I can read the 
> variable from CFA-80
>
> But don't know how to calculate CFA.
>
> Can anyone help me with this?

You are looking at the debug_info information, which describes a lot
of things but doesn't describe the call frame.  To see the call frame
information use "readelf --debug=frames" or "readelf
--debug=frames-interp".

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWGHNy%3DbEgEZ7nqSwGidgcTPrFC-R_cfoCjxpEGXLRdQg%40mail.gmail.com.

Reply via email to