[lld] [lld][ELF] Add --debug-names to create merged .debug_names. (PR #86508)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 14 21:02:42 PDT 2024
dwblaikie wrote:
> I tried very hard to craft a test for the error for 'if (locs.EntriesBase > namesExtractor.getData().size())', but was unable to create one; either my changes would cause NameIndex::extract() to error out. before we get to this code; or it would trigger the other ' index entry out of bounds' error , but not this one. I'm open to suggestions.
Yes, `NameIndex::extract` checks this property:
https://github.com/llvm/llvm-project/blob/f811d7b50957b801788d7b171ddeb25b1fda415a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp#L585
So it'll error if the offsets at least up to the end of the abbrev table are larger than the data available in the section. The only errors not caught by this are offsets to entries themselves (and not the first entry - because that is checked by the above, `NameIndex::extract` will error if there isn't at least one byte after the abbrevs - the first entry)
So, yes, this particular error case should be an assert with a message that describes basically this ^ that `NameIndex::extract` should've caught this case already.
https://github.com/llvm/llvm-project/pull/86508
More information about the llvm-commits
mailing list