GDB fails to load line information for a function starting at address 0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
New
|
Undecided
|
Unassigned |
Bug Description
When loading symbols from a relocatable elf file, recent versions of GDB fail to load line information for the function located at address 0. Older versions using the same elf file have line information without any problems. Initially found with the elf used for GDB testing in pyOCD at https:/
Versions working correctly:
gcc-arm-
gcc-arm-
Versions exhibiting this problem:
gcc-arm-
gcc-arm-
gcc-arm-
gcc-arm-
gcc-arm-
gcc-arm-
Symbols loaded correctly with GDB 7.8.0.20150604-cvs in 4.9-2015-q3-update:
(gdb) add symbol table from file "gdb_test.elf" at
.text_addr = 0x1fff0000
(y or n) [answered Y; input not from terminal]
Reading symbols from gdb_test.
(gdb) Line 30 of "main.c" starts at address 0x1fff009c <function_1>
and ends at 0x1fff00a0 <function_1+4>.
(gdb) Line 76 of "main.c" starts at address 0x1fff0000 <main>
and ends at 0x1fff0006 <main+6>.
(gdb) quit
Main not loaded correctly with GDB 7.10.1.20151217-cvs in 5-2015-q4-major:
(gdb) add symbol table from file "gdb_test.elf" at
.text_addr = 0x1fff0000
(y or n) [answered Y; input not from terminal]
Reading symbols from gdb_test.
(gdb) Line 30 of "main.c" starts at address 0x1fff009c <function_1>
and ends at 0x1fff00a0 <function_1+4>.
(gdb) No line number information available for address 0x1fff0000 <main> <- Missing line info
(gdb) quit
This may be related to how the linker retains debug information for functions that have been stripped via --gc-sections, but sets the address of those functions to 0. So gdb needs to ignore functions with address 0.