This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Help needed with browsing GDB code
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: Nityananda <j dot nityananda at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Fri, 06 Feb 2009 10:01:05 -0200
- Subject: Re: Help needed with browsing GDB code
- References: <249DE25A-9555-4D36-8C59-56EF08F2E34A@gmail.com>
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