How to lookup the value of each parameter from dwarf and memory location

How to lookup the value of each parameter from dwarf and memory location

2015/06/18 Debugger 1

Here are the steps to lookup the parameter value

1) Look into the “info” section from dwarf, “objdump –dwarf=info”. There is a die DW_AT_LOCATION (DW_OP_freg:0), telling you the offset to the frame register.

2) Look at the CIE from .eh_frames section, “objdump –dwarf=frames”. It will tell you the formula of calculating the CFA, such as DW_CFA_def_cfa: r4 (esp) of 4

3) Add the value of DW_OP_freg as an offset to DW_CFA_def_cfa and get the value from that memory location, it is a virtual address, not physical address.