1

This is a follow-up question to How can I use Swift REPL with iOS SDK. I have an app named Venmo which is already running on a simulator:

enter image description here

and I can see it in the Activity Monitor:

enter image description here

I would like to open a Swift REPL in which can use classes defined in the Venmo project. Following the instructions in that answer, I first find the app in my DerivedData directory;

$ cd ~/Library/Developer/Xcode/DerivedData
$ find . -name '*Venmo.app'
./VenmoWorkspace-apbzqcexodswkdfenhxlkpnlmvsx/Build/Products/Debug-iphonesimulator/Venmo.app

Then I launch a standalone LLDB following https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-terminal-workflow-tutorial.html. However, if I try to process attach --name 'Venmo', I get an attach failed: could not find a process named Venmo error:

~/L/D/X/DerivedData> 
lldb ./VenmoWorkspace-apbzqcexodswkdfenhxlkpnlmvsx/Build/Products/Debug-iphonesimulator/Venmo.app
(lldb) target create "./VenmoWorkspace-apbzqcexodswkdfenhxlkpnlmvsx/Build/Products/Debug-iphonesimulator/Venmo.app"
Current executable set to './VenmoWorkspace-apbzqcexodswkdfenhxlkpnlmvsx/Build/Products/Debug-iphonesimulator/Venmo.app' (x86_64).
(lldb) process attach --name 'Venmo'
error: attach failed: could not find a process named Venmo
(lldb) 

I don't understand why LLDB can't find this process, even though I see it in my Activity Monitor?

jscs
  • 63,694
  • 13
  • 151
  • 195
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
  • How did you run Venmo.app in the Simulator? By default Xcode runs simulator apps under the debugger, and on Darwin only one debugger can be attached to a process at a time. lldb's `process attach` ignores already debugged processes, which would explain why it said it couldn't find it. You can tell whether a process is being debugged by running `ps` and looking at the STAT column. If that has an `X`, then the process is being debugged. – Jim Ingham Feb 19 '19 at 18:06

0 Answers0