[Lldb-commits] [PATCH] D107470: 2/4: [llvm+lldb] Remove dead-code in DWARFListTableHeader::extract modifying DWARFDataExtractor

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 4 08:33:07 PDT 2021


jankratochvil created this revision.
jankratochvil added reviewers: ikudrin, dblaikie, labath, clayborg.
jankratochvil added projects: LLDB, LLVM.
Herald added subscribers: JDevlieghere, hiraditya.
jankratochvil requested review of this revision.

@ikudrin has correctly noticed <https://reviews.llvm.org/D106466#inline-1021833> modifying a copy of `DWARFDataExtractor` makes no sense. Removed it as it currently has no effect. In fact one caller needs it as otherwise it assumes `.debug_rnglists` width from ELF width which in practice works but it is not correct. All callers of `DWARFListTableHeader::extract`:

- llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp <https://github.com/llvm/llvm-project/blob/e4977f9cb58ff7820d0287ba309490af57787749/llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp> - not using address parsing
- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp <https://github.com/llvm/llvm-project/blob/e4977f9cb58ff7820d0287ba309490af57787749/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp#L314> `dumpLoclistsSection` - it uses: `Data.setAddressSize(Header.getAddrSize());`
- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp <https://github.com/llvm/llvm-project/blob/e4977f9cb58ff7820d0287ba309490af57787749/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L464> `SetLoclistsBase` - it sets `m_loclist_table_header` which is never used for parsing addresses
- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp <https://github.com/llvm/llvm-project/blob/e4977f9cb58ff7820d0287ba309490af57787749/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L450> `ParseListTableHeader` - called only by `GetRnglistTable`

Callers of `GetRnglistTable`:

- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp <https://github.com/llvm/llvm-project/blob/e4977f9cb58ff7820d0287ba309490af57787749/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L530> `GetRnglistOffset` - not used for parsing addresses
- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp <https://github.com/llvm/llvm-project/blob/e4977f9cb58ff7820d0287ba309490af57787749/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L985> `FindRnglistFromOffset` - calling findList <https://github.com/llvm/llvm-project/blob/e4977f9cb58ff7820d0287ba309490af57787749/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h#L278> which does not set the address size. So this part needed a fix in this patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107470

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/unittests/SymbolFile/DWARF/DWARFUnitTest.cpp
  llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107470.364127.patch
Type: text/x-patch
Size: 12674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210804/2fe5445f/attachment-0001.bin>


More information about the lldb-commits mailing list