I think LLVM produces some cases like this (maybe not at sequence end, but for other instructions (emit two copies without an advance PC between them (but maybe an advance line, etc) - in both cases, yeah, I'd consider this to be probably-valid-but-trivially-inefficient output. The way I think of reading this is that the line table describes instructions in the (empty) range [0x4004c6, 0x4004c6) as being on line 30.
On Thu, Jul 9, 2020 at 11:18 AM Tom de Vries via Dwarf-Discuss <dwarf-discuss@lists.dwarfstd.org> wrote: > > Hi, > > I came across the following line table program in gdb test-case > dw2-ranges-base.exp: > ... > $ readelf -wl outputs/gdb.dwarf2/dw2-ranges-base/dw2-ranges-base > > Line Number Statements: > [0x00000154] Extended opcode 2: set Address to 0x4004ba > [0x0000015f] Advance Line by 10 to 11 > [0x00000161] Copy > [0x00000162] Advance PC by 12 to 0x4004c6 > [0x00000164] Advance Line by 19 to 30 > [0x00000166] Copy > [0x00000167] Extended opcode 1: End of Sequence > ... > > My understanding of this is as follows. > > The Copy followed by End-of-Sequence is incorrect. > > Both the Copy and the End-of-Sequence append a row to the matrix, each > using the same address: 0x4004c6. The Copy declares a target > instruction at that address. The End-of-Sequence declares that the > sequence ends before that address. > > It's a contradiction that the target instruction is both part of the > sequence (according to Copy) and not part of the sequence (according to > End-of-Sequence). > > Can you confirm that this analysis is correct? > > If so, is there a standard term to describe this problem? > Incorrect/malformed/invalid/non-conforming/non-sensical or some such? > > [ FWIW, gdb handles this type of line table program by deleting the row > corresponding to the Copy. The related comment mentions that it removes > "empty lines" from the line table. I don't understand the use of the > term "empty line" for this. ] > > Thanks, > - Tom > > _______________________________________________ > Dwarf-Discuss mailing list > Dwarf-Discuss@lists.dwarfstd.org > http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org _______________________________________________ Dwarf-Discuss mailing list Dwarf-Discuss@lists.dwarfstd.org http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org