Hi,
Currently, SymbolFileDWARF::ParseLineTable only parses the line table .debug_line and does not store the inline information in DW_TAG_inlined_subroutine. This causes problem when users try to set breakpoint at the call site of an inlined function using b [file]:[line], example: lldb not stopped at a inline function call statement · Issue #44953 · llvm/llvm-project · GitHub.
In that example, the line table is the following:
Address Line Column File ISA Discriminator OpIndex Flags
------------------ ------ ------ ------ --- ------------- ------- -------------
0x0000000000001130 6 0 0 0 0 0 is_stmt
0x0000000000001143 3 2 0 0 0 0 is_stmt prologue_end
0x0000000000001147 3 4 0 0 0 0
0x000000000000114d 9 8 0 0 0 0 is_stmt
0x0000000000001150 9 1 0 0 0 0 epilogue_begin
0x0000000000001152 9 1 0 0 0 0 end_sequence
And here’s inline information:
0x00000053: DW_TAG_inlined_subroutine
DW_AT_abstract_origin (0x00000023 "foo")
DW_AT_low_pc (0x0000000000001143)
DW_AT_high_pc (0x000000000000114d)
DW_AT_call_file ("./small.c")
DW_AT_call_line (8)
DW_AT_call_column (0x01)
Because only line table is used, when users use command “b small.c:8”, lldb actually breaks at line 9 which is the nearest line number in line table.
If we parse inline info and store them into the line table, it benefits all users of LineTable::FindLineEntryIndexByFileIndex (I’m only aware of two commands using it b [file]:[line] and thread until [line]).
In this example, we will have an extra line entry from inline info (0x1143 line 8 column 1). When setting breakpoint using b [file]:[line], the one from inline info should be chosen because it has the exact line number.
Is there any concern for adding inline info into line table?