[Dwarf-Discuss] Retrieving variables, function address using dwarf
Michael Eager
eager@eagercon.com
Thu Mar 11 10:23:34 GMT 2021
On 3/10/21 10:38 PM, Archana Deshmukh 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.
Attach to the process using ptrace() and you can get process registers.
>
> Best Regards,
> Archana
>
>
>
>
> On Tue, Mar 9, 2021 at 11:07 PM Michael Eager <eager at eagercon.com
> <mailto:eager at 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
> > <desharchana19 at gmail.com <mailto:desharchana19 at gmail.com>
> <mailto:desharchana19 at gmail.com <mailto:desharchana19 at gmail.com>>>
> wrote:
> >
> >
> >
> >? ? ?---------- Forwarded message ---------
> >? ? ?From: *Michael Eager* <eager at eagercon.com
> <mailto:eager at eagercon.com> <mailto:eager at eagercon.com
> <mailto:eager at eagercon.com>>>
> >? ? ?Date: Sat, Mar 6, 2021 at 10:53 PM
> >? ? ?Subject: Re: [Dwarf-Discuss] Retrieving variables, function
> address
> >? ? ?using dwarf
> >? ? ?To: Archana Deshmukh <desharchana19 at gmail.com
> <mailto:desharchana19 at gmail.com>
> >? ? ?<mailto:desharchana19 at gmail.com
> <mailto:desharchana19 at gmail.com>>>,
> <dwarf-discuss at lists.dwarfstd.org
> <mailto:dwarf-discuss at lists.dwarfstd.org>
> >? ? ?<mailto:dwarf-discuss at lists.dwarfstd.org
> <mailto:dwarf-discuss at 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 at lists.dwarfstd.org
> <mailto:Dwarf-Discuss at 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
>
--
Michael Eager
More information about the Dwarf-discuss
mailing list