I've been wondering but haven't found anywhere an useful list of commands that are useful in Xcode.
One I know, and I use a lot is Backtrace which the input command is bt
, after you encounter an app crash after uncaught exceptions it sometimes gives an int where the problem could be.
Can you share more useful commands that become handy and could let us interact with the debugger and the app itself?
Thank you
You need to click Log Navigator icon (far right in left sidebar). Then choose your Debug/Run session in left sidebar, and you will have console in editor area.
When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.
LLDB is a debugging component used in the LLVM project which was developed by the LLVM developer group. Xcode uses the LLDB as the default debugging tool. The full form of LLDB is Low-level debugger. Breakpoints help a developer to stop the execution of the program at any point.
The po command (a.k.a. expr --O -- ) does everything that p does, but instead of printing the result, if the result is a pointer to an ObjC object, it calls that object's "description" method, and prints the string returned by that method(*).
You can find it in Apple documentation: Debugging with Xcode
or check this: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html
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