[all-commits] [llvm/llvm-project] f63bc8: [lldb] Fix FindProcessImpl() for iOS simulators (#...

royitaqi via All-commits all-commits at lists.llvm.org
Wed Jun 25 16:38:50 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f63bc84b0d2a66131b8e0f69905b6aad90793fd4
      https://github.com/llvm/llvm-project/commit/f63bc84b0d2a66131b8e0f69905b6aad90793fd4
  Author: royitaqi <royitaqi at users.noreply.github.com>
  Date:   2025-06-25 (Wed, 25 Jun 2025)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/lldbutil.py
    M lldb/source/Host/macosx/objcxx/Host.mm
    M lldb/test/API/macosx/simulator/Makefile
    M lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
    R lldb/test/API/macosx/simulator/hello.c
    A lldb/test/API/macosx/simulator/hello.cpp
    M lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py

  Log Message:
  -----------
  [lldb] Fix FindProcessImpl() for iOS simulators (#139174)

# Benefit

This patch fixes:
1. After `platform select ios-simulator`, `platform process list` will
now print processes which are running in the iOS simulator. Previously,
no process will be listed.
2. After `platform select ios-simulator`, `platform attach --name
<name>` will succeed. Previously, it will error out saying no process is
found.


# Several bugs that is being fixed

1. During the process listing, add `aarch64` to the list of CPU types
for which iOS simulators are checked for.
2. Given a candidate process, when checking for simulators, the original
code will find the desired environment variable (`SIMULATOR_UDID`) and
set the OS to iOS, but then the immediate next environment variable will
set it back to macOS.
3. For processes running on simulator, set the triple's `Environment` to
`Simulator`, so that such processes can pass the filtering [in this
line](https://fburl.com/8nivnrjx). The original code leave it as the
default `UnknownEnvironment`.



# Manual test

**With this patch:**
```
royshi-mac-home ~/public_llvm/build % bin/lldb
(lldb) platform select ios-simulator

(lldb) platform process list
240 matching processes were found on "ios-simulator"

PID    PARENT USER       TRIPLE                         NAME
====== ====== ========== ============================== ============================
40511  28844  royshi     arm64-apple-ios-simulator      FocusPlayground // my toy iOS app running on simulator
... // omit
28844  1      royshi     arm64-apple-ios-simulator      launchd_sim

(lldb) process attach --name FocusPlayground
Process 40511 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000104e3cb70 libsystem_kernel.dylib`mach_msg2_trap + 8
libsystem_kernel.dylib`mach_msg2_trap:
->  0x104e3cb70 <+8>: ret
... // omit
```

**Without this patch:**
```
$ bin/lldb
(lldb) platform select ios-simulator

(lldb) platform process list
error: no processes were found on the "ios-simulator" platform

(lldb) process attach --name FocusPlayground
error: attach failed: could not find a process named FocusPlayground
```


# Unittest

See PR.



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