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: GDB interactions with GCC


On Tue, Nov 3, 2009 at 9:22 AM, Jean Christophe Beyler
<jean.christophe.beyler@gmail.com> wrote:

> If so, doesn't that mean that if we want GDB on an architecture that
> does not require any stack copies, we still have to generate those
> uselessly (except for GDB ;-)) ?

You appear to be under mistaken assumption that GDB can only access stack
in the inferior process.

GDB can access *any* memory in the inferior, as well as registers. DWARF
debug info (which GCC generates) tells GDB where to find any variable. The
location (described by DWARF) could be "in register", "in memory at address
NNNN", or a complicated expression involving possibly multiple registers,
offsets and memory.

DWARF also describes how the register set changes when you step to
previous frame, so once you get to (say) frame #5, GDB knows the values
registers had in that frame, and can again (using DWARF debug info) tell you
values of parameters, locals, etc.

I think you should give http://dwarfstd.org/Dwarf3Std.php (and in particular
2.6: Location Descriptions) at least a quick read.

Cheers,
-- 
Paul Pluzhnikov


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