Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode full stack trace

While debugging is there anyway to see a complete stack trace, list of methods called in main thread. Or any way to print them on command window.

like image 711
NaXir Avatar asked Apr 11 '13 10:04

NaXir


People also ask

How do I trace in xcode?

Use the bt command in (lldb). Once paused or after a crash, just type bt into the debug console. It will print the full stack trace. Awesome tip for tracking down a constraint issue after setting the symbolic breakpoint.

What does full stack trace mean?

In computing, a stack trace (also called stack backtrace or stack traceback) is a report of the active stack frames at a certain point in time during the execution of a program.

How do I print a stack trace in Swift?

In Objective-C, you can print the call stack by doing the following: NSLog(@"%@", [NSThread callStackSymbols]);


4 Answers

Use the bt command in (lldb).

Once paused or after a crash, just type bt into the debug console.
It will print the full stack trace.

sample output of bt command

like image 114
Alex Iceman Avatar answered Nov 22 '22 23:11

Alex Iceman


You can print the stack trace in the NSLog by

NSLog(@"Stack trace : %@",[NSThread callStackSymbols]);

Upon a crash, next to the word (lldb), you can type:

po [NSThread callStackSymbols]

Edit:

For better output on console on Swift you can use following line instead:

Thread.callStackSymbols.forEach{print($0)}
like image 29
Mihir Mehta Avatar answered Nov 23 '22 00:11

Mihir Mehta


In Xcode 6 you can click the button at the bottom left corner of the pane which shows the full stack trace. Xcode 6 show full stack trace

like image 29
Gong Pengjun Avatar answered Nov 22 '22 23:11

Gong Pengjun


In Xcode 5 you can move the slider at the bottom of the pane which shows the stack trace. It controls how much of the struck trace is shown.

Slider controlling the stack trace

like image 37
Sergey A. Novitsky Avatar answered Nov 23 '22 00:11

Sergey A. Novitsky