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]

Support for nested functions


Hi!

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
missing something?

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
different behaviour?

Code is like this:

...
.text
.align 2
.global _print
.type _print, %function
_print:
    .loc 1 18 0
    str fp, [sp, #-4]
.L_print_fp_stored:
    .loc 1 21 0
    mov fp, sp
.L_print_sp_stored:
...

(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.)


Mitar


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