[all-commits] [llvm/llvm-project] dfcef3: [lldb][NFC][MachO] Clean up LC_THREAD reading code...

Jason Molenda via All-commits all-commits at lists.llvm.org
Wed Jul 2 10:21:59 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dfcef35ff1d30d112362645ec2cd0d5e99952b0f
      https://github.com/llvm/llvm-project/commit/dfcef35ff1d30d112362645ec2cd0d5e99952b0f
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2025-07-02 (Wed, 02 Jul 2025)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt
    R lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
    R lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h
    M lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
    M lldb/source/Plugins/Process/Utility/CMakeLists.txt
    R lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
    R lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
    R lldb/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
    R lldb/source/Plugins/Process/Utility/RegisterContextMach_i386.h
    M llvm/utils/gn/secondary/lldb/source/Plugins/Process/Utility/BUILD.gn

  Log Message:
  -----------
  [lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (#146480)

While fixing bugs in the x86_64 LC_THREAD parser in ObjectFileMachO, I
noticed that the other LC_THREAD parsers are all less clear than they
should be.

To recap, a Mach-O LC_THREAD load command has a byte size for the entire
payload. Within the payload, there will be one or more register sets
provided. A register set starts with a UInt32 "flavor", the type of
register set defined in the system headers, and a UInt32 "count", the
number of UInt32 words of memory for this register set. After one
register set, there may be additional sets. A parser can skip an unknown
register set flavor by using the count field to get to the next register
set. When the total byte size of the LC_THREAD load command has been
parsed, it is completed.

This patch fixes the riscv/arm/arm64 LC_THREAD parsers to use the total
byte size as the exit condition, and to skip past unrecognized register
sets, instead of stopping parsing.

Instead of fixing the i386 corefile support, I removed it. The last
macOS that supported 32-bit Intel code was macOS 10.14 in 2018. I also
removed i386 KDP support, 32-bit intel kernel debugging hasn't been
supported for even longer than that.

It would be preferable to do these things separately, but I couldn't
bring myself to update the i386 LC_THREAD parser, and it required very
few changes to remove this support entirely.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list