This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help needed with browsing GDB code


Hi Nityananda,


On Sat, Feb 7, 2009 at 1:52 AM, Nityananda <j.nityananda@gmail.com> wrote:
> HI Thiago,
> Thanks for the information. I am reading the code to deal with the stack
> frame information without the debug information. Can you please point me to
> the code with the debug information? You mentioned that it uses DWARF2.

Look at gdb/dwarf2-frame.c for DWARF2 frame reading .

>So are the local variables always at the same offset of the frame base address
> or there is a possibility of these addresses changing from one process to
> another?

Local variables will always be at the same offset from the frame base
address for the same program unless you have self modifying code .
Operating Systems 101 - A process can be multiple instantiations of
the same program.

HTH

cheers
Ramana

>
> Thank you very much in advance,
> Nityananda
>
> On Feb 6, 2009, at 4:01 AM, Thiago Jung Bauermann wrote:
>
>> Hi Nityananda,
>>
>> El jue, 05-02-2009 a las 18:26 -0800, Nityananda escribió:
>>>
>>> I am looking for how
>>> GDB obtains the address of stack local variables. I am seeing some
>>> code related to frame_info but do not know how it actually works.
>>
>> Well, there are two situations: with debug information available, and
>> without. For the first case it's simple: the DWARF2 format includes the
>> frame base address as part of the unwind information, and addresses of
>> local variables in the debuginfo are relative to that base address.
>>
>> When there's no debuginfo available, GDB uses its knowledge of the OS
>> ABI for the given architecture. For example, for ppc64-linux, the stack
>> frame layout is given here:
>>
>> http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#STACK
>>
>> And the code which uses that knowledge is in
>> rs6000-tdep.c:rs6000_frame_cache. It's kinda hairy...
>> --
>> []'s
>> Thiago Jung Bauermann
>> IBM Linux Technology Center
>>
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]