[Lldb-commits] [lldb] [lldb] Update the String table offset based on the DWARF format (PR #147054)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 4 06:38:41 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Hemang Gadhavi (HemangGadhavi)
<details>
<summary>Changes</summary>
This PR is updating the string table offset (DW_AT_str_offsets_base which is introduces in `DWARF5`) based on the DWARF format, as per the DWARF specification, For the 32-bit DWARF format, each offset is 4 bytes long; for the 64-bit DWARF format, each offset is 8 bytes long.
---
Full diff: https://github.com/llvm/llvm-project/pull/147054.diff
1 Files Affected:
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+2-1)
``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index f216ab13e8936..daaa4eca6f198 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -1077,7 +1077,8 @@ uint32_t DWARFUnit::GetHeaderByteSize() const { return m_header.getSize(); }
std::optional<uint64_t>
DWARFUnit::GetStringOffsetSectionItem(uint32_t index) const {
- lldb::offset_t offset = GetStrOffsetsBase() + index * 4;
+ lldb::offset_t offset =
+ GetStrOffsetsBase() + index * m_header.getDwarfOffsetByteSize();
return m_dwarf.GetDWARFContext().getOrLoadStrOffsetsData().GetU32(&offset);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/147054
More information about the lldb-commits
mailing list