GDB fails to load line information for a function starting at address 0

Bug #1700646 reported by Russ Butler
6
This bug affects 1 person
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://github.com/mbedmicro/pyOCD/tree/146e6bc6b7790fcb80fc0a1d86a52ba73ae2a16a/test/gdb_test_program.

Versions working correctly:
gcc-arm-none-eabi-4_9-2015q2-20150609-win32.exe
gcc-arm-none-eabi-4_9-2015q3-20150921-win32.exe

Versions exhibiting this problem:
gcc-arm-none-eabi-5_2-2015q4-20151219-win32.exe
gcc-arm-none-eabi-5_3-2016q1-20160330-win32.exe
gcc-arm-none-eabi-5_4-2016q2-20160622-win32.exe
gcc-arm-none-eabi-5_4-2016q3-20160926-win32.exe
gcc-arm-none-eabi-6_2-2016q4-20161216-win32.exe
gcc-arm-none-eabi-6-2017-q1-update-win32.exe

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.elf...done.
(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.elf...done.
(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

Revision history for this message
Russ Butler (c1728p9) wrote :
Revision history for this message
Chris Reed (crflit) wrote :

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.

Revision history for this message
Russ Butler (c1728p9) wrote :

Yeah, that is a possibility, but the fact that the same elf file works with GDB 7.8 but not GDB 7.10 makes me think its a regression. Also, for further visibility there is also a ticket here to track this issue:
https://sourceware.org/bugzilla/show_bug.cgi?id=21695

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.