[Lldb-commits] [lldb] Enable LLDB to load large dSYM files. (PR #164471)

Peter Rong via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 21 13:58:31 PDT 2025


================
@@ -1697,6 +1701,14 @@ void ObjectFileMachO::ProcessSegmentCommand(
     // isn't stored in the abstracted Sections.
     m_mach_sections.push_back(sect64);
 
+    // Make sure we can load dSYM files whose __DWARF sections exceed the 4GB
+    // barrier. llvm::MachO::section_64 have only 32 bit file offsets for the
+    // section contents.
+    const uint64_t section_file_offset = sect64.offset + section_offset_adjust;
+    // If this section overflows a 4GB barrier, then we need to adjust any
+    // subsequent the section offsets.
+    if (is_dsym && ((uint64_t)sect64.offset + sect64.size) >= UINT32_MAX)
+      section_offset_adjust += 0x100000000ull;
----------------
DataCorrupted wrote:

Imagine there are two sections:

```
__sec_a, size 8GB, offset 0
__sec_b, size 100, offset 0
```

Current `0x100000000ull` (4G) increment will think that `__sec_b` starts at 4G instead of 8G.

https://github.com/llvm/llvm-project/pull/164471


More information about the lldb-commits mailing list