Most local variables have locations that do require registers. 
DW_OP_call_frame_cfa says it needs to push the value that defines the call 
frame address which is typically based on the SP or FP depending on how things 
were compiled, so you would need registers for this. DW_OP_fbreg is another 
common opcode for local variables which relies on you being able to evaluated 
the DW_TAG_subprogram's DW_AT_frame_base attribute, which is a location 
expression, that often is something like "SP + <imm>" or "FP + <imm>", so you 
will need registers for that too.

> On Mar 10, 2021, at 10:38 PM, Archana Deshmukh via Dwarf-Discuss 
> <dwarf-discuss@lists.dwarfstd.org> wrote:
> 
> Thanks Michael for the response. Actually, I have only this much information. 
>  
> 
> I need to get information related to 
> 
>  For global variables , I read the address "55b51afea000" from     > 
> /proc/<pid>/maps file. I use DW_OP_addr parameter to retrieve the address.
> 
>  55b51afea000 + DW_OP_addr gives me the address of global variables.  
> 
> For function, I read the address "55b51afea000" from     > /proc/<pid>/maps 
> file.. I use DW_AT_low_pc parameter to retrieve the function starting address
> 
> Now, I need to read the local variables address. As I am not executing the 
> process, I cannot use registers. I need to use DW_OP_call_frame_cfa. I am not 
> able to understand how to retrieve addresses using  DW_OP_call_frame_cfa.
> 
> Any pointer or suggestion are most welcome.
> 
> Best Regards,
> Archana 
> 
> 
> 
>   
> 
> On Tue, Mar 9, 2021 at 11:07 PM Michael Eager <ea...@eagercon.com 
> <mailto:ea...@eagercon.com>> wrote:
> It's difficult to offer advice with such a spare description.
> 
> You might read the executable and relocate the .debug_info and
> other debug sections using the process map.  If you have the
> process image, this probably would not be necessary.
> 
> On 3/8/21 1:49 AM, Archana Deshmukh via Dwarf-Discuss wrote:
> > Hello,
> > 
> > I have a pinatrace.out and process map of a file.
> > With this input, I need to build a symbol table.
> > 
> > Best Regards,
> > Archana Deshmukh
> > 
> > On Sun, Mar 7, 2021 at 10:29 AM Archana Deshmukh 
> > <desharchan...@gmail.com <mailto:desharchan...@gmail.com> 
> > <mailto:desharchan...@gmail.com <mailto:desharchan...@gmail.com>>> wrote:
> > 
> > 
> > 
> >     ---------- Forwarded message ---------
> >     From: *Michael Eager* <ea...@eagercon.com <mailto:ea...@eagercon.com> 
> > <mailto:ea...@eagercon.com <mailto:ea...@eagercon.com>>>
> >     Date: Sat, Mar 6, 2021 at 10:53 PM
> >     Subject: Re: [Dwarf-Discuss] Retrieving variables, function address
> >     using dwarf
> >     To: Archana Deshmukh <desharchan...@gmail.com 
> > <mailto:desharchan...@gmail.com>
> >     <mailto:desharchan...@gmail.com <mailto:desharchan...@gmail.com>>>, 
> > <dwarf-discuss@lists.dwarfstd.org <mailto:dwarf-discuss@lists.dwarfstd.org>
> >     <mailto:dwarf-discuss@lists.dwarfstd.org 
> > <mailto:dwarf-discuss@lists.dwarfstd.org>>>
> > 
> > 
> >     On 3/5/21 8:28 PM, Archana Deshmukh via Dwarf-Discuss wrote:
> >      > I need to read the address of local variable, global variable,
> >     function
> >      > name and function arguments from the process.
> >      >
> >      > For global variables , I read the address "55b51afea000" from
> >      > /proc/<pid>/maps file. I use DW_OP_addr parameter to retrieve the
> >     address.
> >      > 55b51afea000 + DW_OP_addr gives me the address of global variable.
> >      >
> >      > I need to read the stack segment, heap. Is there any way to read
> >      > segments? DW_AT_segment parameter seems to be for 16 bit.
> >      >
> >      > I need to read the following process map using dwarf.
> >      >
> >      > Any suggestion, pointers are welcome.
> >      >
> >      > 55b51afea000-55b51afeb000 r-xp 00000000 fd:00 5902563
> > 
> >     Can you explain what you are trying to do?
> > 
> >     Usually a DWARF consumer (a debugger) does not need to read the
> >     process memory map.  All of the information you mention is in
> >     the DWARF data.  You may need to relocate addresses in the DWARF
> >     debug data.
> > 
> >     DWARF does not contain information about the process memory
> >     layout, such as the location of the heap or the start of the
> >     stack.
> > 
> >     -- 
> >     Michael Eager
> > 
> > 
> > _______________________________________________
> > Dwarf-Discuss mailing list
> > Dwarf-Discuss@lists.dwarfstd.org <mailto:Dwarf-Discuss@lists.dwarfstd.org>
> > http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org 
> > <http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org>
> > 
> 
> -- 
> Michael Eager
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss@lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org

_______________________________________________
Dwarf-Discuss mailing list
Dwarf-Discuss@lists.dwarfstd.org
http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org

Reply via email to