[Lldb-commits] [PATCH] D106466: 3/3: [llvm+lldb] Fix#2 of DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 4 11:03:17 PDT 2021


jankratochvil marked an inline comment as done.
jankratochvil added a comment.

In D106466#2922549 <https://reviews.llvm.org/D106466#2922549>, @ikudrin wrote:

> As far as I understand it, you need a specially constructed `llvm::DWARFDebugRnglistTable` object so that `DWARFUnit::FindRnglistFromOffset()` can call its `findList()` method and get a list of records located at a specific offset.

Yes.

> It looks like a newly created `llvm::DWARFDebugRnglistTable` object has its `Header.Length` set to `0`,

No; it fakes this list table covers the whole section. There is:

  HeaderData.Length = Data.size() - dwarf::getUnitLengthFieldByteSize(Format);



> so it already works as required for the usage, and there is no need to fill its fields with artificial values that do not represent real content of the section. Am I right?

One needs to set at least `AddrSize` and `OffsetEntryCount` as callers do use it. Not sure now with the other fields but in such case one would remove them and also from existing `DWARFListTableHeader::extract`. `DWARFListTableHeader::create` should be as much similar to `DWARFListTableHeader::extract` as possible. Maybe we could make some `[nfc]` patches to make `DWARFListTableHeader::Header` smaller but it is now only 16 bytes already so I do not find that much useful. It would be also orthogonal to this patch.



================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp:54
+
+  Data.setAddressSize(HeaderData.AddrSize);
+  return Error::success();
----------------
ikudrin wrote:
> The line looks suspicious because `Data` is a local variable that is destroyed right after the statement.
You are right. Although existing `DWARFListTableHeader::extract` had the same problem from where I did copy-paste it. Filed for it D107470.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106466/new/

https://reviews.llvm.org/D106466



More information about the lldb-commits mailing list