Bug 25730 - GDB fails to resolve line numbers if there's no address range information for a CU
Summary: GDB fails to resolve line numbers if there's no address range information for...
Status: UNCONFIRMED
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: 9.1
: P2 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-26 15:36 UTC by Angelos Oikonomopoulos
Modified: 2020-03-27 11:01 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Testcase (895 bytes, application/x-compressed-tar)
2020-03-26 15:36 UTC, Angelos Oikonomopoulos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Angelos Oikonomopoulos 2020-03-26 15:36:30 UTC
Created attachment 12406 [details]
Testcase

When a compilation unit doesn't have any of DW_AT_{low,high}_pc or even DW_AT_ranges, find_pc_sect_compunit_symtab will not be able to resolve any PC to it and this results in the line table of the CU not being considered.

Adding a couple of symbols around the top-level inline asm statement works around the issue.

The actual example is from JavaScriptCore, but I've attached a minimal testcase for it, for which you can see the difference in the output below:

$ gdb -q without-markers 
Reading symbols from without-markers...
(gdb) b foo
Breakpoint 1 at 0x1174
(gdb) run
Starting program: without-markers 

Breakpoint 1, 0x0000555555555174 in foo ()

$ gdb -q with-markers 
Reading symbols from with-markers...
(gdb) b foo
Breakpoint 1 at 0x117b: file asm.h, line 17.
(gdb) run
Starting program: with-markers 

Breakpoint 1, foo () at asm.h:17
17      ".loc " STR(SLOT) " " STR(__LINE__) "\n movl    %edi, -4(%rbp)\n"

FWIW, both GCC and clang will generate no address range info for this CU. LLDB finds the line information regardless.