Source info in discontiguous hand asm files

Ross Morley
2006-05-04T01:23:02Z

Hello,

gdb 6.1, as 2.15.92.0.2, gcc 3.4.2 per FC3 distro.

GDB fails to display source file and line info for functions in
two different sections in a hand-assembly source file.

A simple test-case that demonstrates the problem follows:

> cat test.S

.text
.globl foo
foo:
nop

.globl main

#ifdef DIFFERENT_TEXT_SECTION
.section .text.with.another.name,"ax",@progbits
#endif
main:
nop

> gcc test.S -Wa,--gdwarf2
> gdb a.out
...
(gdb) b main
Breakpoint 1 at 0x804834f: file test.S, line 13.
(gdb) b foo
Breakpoint 2 at 0x8048347: file test.S, line 5.
(gdb) quit

> gcc test.S -Wa,--gdwarf2 -DDIFFERENT_TEXT_SECTION
> gdb a.out
...
(gdb) b main
Breakpoint 1 at 0x804834f
(gdb) b foo
Breakpoint 2 at 0x8048347
(gdb)

The DWARF .debug_aranges section seems to have enough information
to deal with this, but GDB doesn't use it.

We'd like to find a fix for this. Any enlightenment is appreciated.

Regards,
Ross Morley
Tensilica, Inc.