Is it possible to use GDB or LLDB from the Terminal command-line under Mac OS X to debug apps running on the iOS Simulator? (e.g. not from within Xcode's GUI or console, but using an external command-line or process). If so, how?
You'll need to go to Settings > Advanced and check the Show Debug Menu option. Then you'll see the option to open the web inspector for the Simulator right from that menu. With the Web Inspector open, you can debug inside the Simulator just like you could right in a desktop browser with DevTools.
If you wish to run your app on an iPhone SE (2nd generation), run npx react-native run-ios --simulator='iPhone SE (2nd generation)' . The device names correspond to the list of devices available in Xcode. You can check your available devices by running xcrun simctl list devices from the console.
Just type this command in Terminal: open -a Simulator. app to launch the most recent simulator. Type this command in Terminal to run the Simulator rigth from the its folder.
To simulate a background fetch, launch your app in Simulator and then go to Xcode and choose Debug > Simulate Background Fetch.
You'll need to have the app already in the simulator's Springboard; you can't launch the app in the simulator from Xcode and then expect to be able to have a command line instance of gdb attach to it.
So:
% gdb ... (gdb) attach --waitfor 'Name Of Your App'
main()
is executed. So you can set some breakpoints, or whatever. Then:(gdb) continue
The procedure for lldb
is similar:
% lldb (lldb) process attach -n 'Name Of Your App' --waitfor <launch your app in the simulator> (lldb) continue
I am not sure why you'd want or need to do this, but as an old command line gdb (and dbx) guy, I can appreciate it. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With