So far SymbolFileDWARFDebugMap did only parse one compile unit per OSO entry. Thus, LLDB failed to resolve breakpoint locations in LTO objects with embedded DWARF.
This is a first minimal patch, that primairily fixes my bug. The central issues are:
- SymbolFileDWARFDebugMap::InitOSO() -- For each OSO entry we need to parse all compile units and store their individual offsets.
- SymbolFileDWARF::ParseCompileUnit() -- Parse the compile unit that matches the given dwarf_cu. At this point there is no context information except offset, so use offset mapping from InitOSO(). (The cu_idx parameter is the default from SymbolFileDWARF::GetCompUnitForDWARFCompUnit() in this execution path.)
- DWARFUnit::BuildAddressRangeTable() -- Subsequent TAG_compile_unit's have no AT_ranges. Passing true for check_hi_lo_pc enables fallback to construct the range from AT_low/high_pc. It is not fully clear to me whether the missing tags are expected and the fallback reliable.
- SymbolFileDWARFDebugMap::HasCompileUnits() -- New function with only the subset of InitOSO() required for CalculateAbilities(). Full init should only run once we're sure this is the right plugin.
Missing in the first patch:
- tests that reproduce the issue
- cleanup of dead code I found
- refactorings for involved code and data structures
FIXMEs indicate further changes I consider necessary, but I am quite new to the code base, so please don't hesitate to point out what I failed to see.
A part of this was shortly discussed on the mailing list:
http://lists.llvm.org/pipermail/lldb-dev/2018-September/014160.html
This is a noop. You can remove it without affecting anything.