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

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 22 16:48:45 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;
----------------
jasonmolenda wrote:

> Imagine there are two sections:
> 
> ```
> __sec_a, size 8GB, offset 0
> __sec_b, size 100, offset 0 (because of overflow when it should be 0x2_0000_0000)
> ```
> 
> Current `0x100000000ull` (4G) increment will think that `__sec_b` starts at 4G instead of 8G.

I believe this is right. Any section after a >8GB section will not be handled correctly.  But a file with many sections all less than 4GB, but totaling 8+GB in sum, will be handled correctly.

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


More information about the lldb-commits mailing list