Debugging frameless code

Kevin Buettner
Thu Sep 28 16:48:00 GMT 2000

On Sep 28,  3:43pm, wrote:

> GDB documentation states that gdb has limited ability to deal with code
> compiled without frame pointer.
> Does this limitation applies to every version of gdb and every kind of
> binary/debug format?

GDB does better on some targets than others.  At the moment, I don't
think it depends too much upon the debug format.  Most targets scan
the function prologue to learn about whether the function has a frame
pointer or not and also to learn where various registers are saved. 
Some are better at handling functions that don't have frame pointers
than others.

> To be more precise, is it possible to dump stack backtrace for frameless
> code using a recent version of gdb and elf/dwarf2 (and gcc as the
> compiler)?

In some cases, yes.  For example, I've been able to do this for
Linux/IA-64.  (But it's also the case that as the optimization gets
more aggressive, this could fail.)

Which target in particular were you wondering about?

> I've been told that dwarf2 includes information that can help a debugger in
> such a case, but I don't know whether gcc actually emits these information
> and whether gdb is able to use them.

I'll let someone who is more familiar with DWARF2 than myself answer
this.  I will note, however, that gdb's DWARF2 support is far from
complete and could certainly be made better.


More information about the Gdb mailing list