This is the mail archive of the
mailing list for the GDB project.
Support for nested functions
- From: Mitar <mmitar at gmail dot com>
- To: gdb at sourceware dot org
- Date: Wed, 3 Feb 2010 17:18:01 +0100
- Subject: Support for nested functions
I would like to inquire how is it with nested functions support in
GDB? I am using 6.8 (Debian stable) and it seems that those are not
supported. Although compiler emit proper DWARF debugging data (nested
subprogram TAGs with static links defined) GDB does not seem to use
this information. "info locals" do not show variables from outer
functions and I have not found any other command which would. Am I
And one more thing. Why GDB puts a breakpoint at one more instruction
(it skips the first one) when I make a breakpoint at a function name
and properly at the beginning of the function if I use a label name.
For example, a function called "print" with asm code label "_print":
(gdb) break print
Breakpoint 1 at 0x86b0: file prg.s, line 21.
(gdb) clear print
Deleted breakpoint 1
(gdb) break _print
Breakpoint 2 at 0x86b0: file prg.s, line 18.
So it points to the same address, only instruction/line GDB chooses
differently. Why is that?
DWARF public name info for "print" shows to a subprogram TAG which has
DW_AT_low_pc set to the label "_print". So the address and line should
be the same. But it is not. So how can I instruct GDB where it should
start? Like if I want or not want that GDB skips prolog and especially
how long the prolog itself is. Is it because I use ".file" and ".loc"
to specify code lines and I use them also in prolog? But why then
Code is like this:
.type _print, %function
.loc 1 18 0
str fp, [sp, #-4]
.loc 1 21 0
mov fp, sp
(I want that line numbers in GDB point to asm code line numbers.)
(I am using GDB with a custom compiler on a custom language.)