[Lldb-commits] [lldb] Enable LLDB to load large dSYM files. (PR #164471)
Ellis Hoag via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 21 12:21:03 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;
----------------
ellishg wrote:
I know it's an edge case, but I believe this will be incorrect if `sect64.size > 2^32`. I would suggest masking out the lower 32 bits and adding that to the adjust value, but there might be a cleaner way.
```suggestion
if (is_dsym && ((uint64_t)sect64.offset + sect64.size) >= UINT32_MAX)
section_offset_adjust += ~((1 << 32) - 1) & ((uint64_t)sect64.offset + sect64.size);
```
https://github.com/llvm/llvm-project/pull/164471
More information about the lldb-commits
mailing list