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

Daniel Rodríguez Troitiño via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 24 14:08:52 PDT 2025


================
@@ -1697,6 +1701,15 @@ void ObjectFileMachO::ProcessSegmentCommand(
     // isn't stored in the abstracted Sections.
     m_mach_sections.push_back(sect64);
 
+    // Make sure we can load sections in mach-o files where some sections cross
+    // a 4GB boundary. llvm::MachO::section_64 have only 32 bit file offsets
+    // for the file offset of the section contents, so we need to track and
+    // sections that overflow and adjust the offsets accordingly.
+    const uint64_t section_file_offset = sect64.offset + section_offset_adjust;
+    const uint64_t end_section_offset = (uint64_t)sect64.offset + sect64.size;
----------------
drodriguez wrote:

The integer promotion rules quick in with that `+`. In the first line `uint32_t + uint64_t`, so the left hand side is promoted to `uint64_t`. In the second line it would be `uint32_t + uint64_t` as well if the casting was not there, so the left hand would be promoted. The casting is not necessary, but I think it leaves clear the author knows what they are doing. I would like the consistency of both having or not having the casting, thought.

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


More information about the lldb-commits mailing list