Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Useful Xcode DEBUG commands to use in console

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

like image 466
Ivan Cantarino Avatar asked Jul 19 '17 14:07

Ivan Cantarino


People also ask

How do I use console in Xcode?

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.

How do I debug in Xcode step by step?

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.

What is LLDB in Xcode?

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.

What is the use of PO command in Xcode?

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(*).


1 Answers

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

like image 117
Bisca Avatar answered Sep 23 '22 20:09

Bisca