[all-commits] [llvm/llvm-project] 1ab9e5: [lldb][Mach-O corefiles] Don't init Target arch to...

Jason Molenda via All-commits all-commits at lists.llvm.org
Mon Apr 21 10:59:19 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ab9e53e4910557f2a4c0f00c7a7f8b5ac493b48
      https://github.com/llvm/llvm-project/commit/1ab9e53e4910557f2a4c0f00c7a7f8b5ac493b48
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2025-04-21 (Mon, 21 Apr 2025)

  Changed paths:
    M lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp

  Log Message:
  -----------
  [lldb][Mach-O corefiles] Don't init Target arch to corefile (#136065)

This patch is making three changes, when loading a Mach-O corefile:

1. At the start of `DoLoadCore`, if a binary was provided in addition to
the corefile, initialize the Target's ArchSpec.

2. Before ProcessMachCore does its "exhaustive search" fallback, looking
through the corefile contents for a userland dyld or mach kernel, we
must make sure the Target has an ArchSpec, or methods that check the
address word size, or initialize a DataExtractor based on the Target
arch will not succeed.

3. Add logging when setting the Target's arch listing exactly what that
setting was based on -- the corefile itself, or the main binary.

Jonas landed a change last August (started with a patch from me) which
removed the Target ArchSpec initialization at the start of DoLoadCore,
in a scenario where the corefile had arch armv7 and the main binary had
arch armv7em (Cortex-M), and there was python code in the main binary's
dSYM which sets the operating system threads provider based on the
Target arch. It did different things for armv7 or armv7em, and so it
would fail.

Jonas' patch removed any ArchSpec setting at the start of DoLoadCore, so
we wouldn't have an incorrect arch value, but that broke the exhaustive
search for kernel binaries, because we didn't have an address word size
or endianness.

This patch should navigate the needs of both use cases.

I spent a good bit of time trying to construct a test to capture all of
these requirements -- but it turns out to be a good bit difficult,
encompassing both a genuine kernel corefiles and a microcontroller
firmware corefiles.

rdar://146821929



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