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.
-
1possible duplicate of [Objective C - getting line number or full stack trace from debugger error?](http://stackoverflow.com/questions/10501358/objective-c-getting-line-number-or-full-stack-trace-from-debugger-error) – Mike Weller Apr 11 '13 at 10:40
-
Programmatically, you can use callStackSymbols as Mihir describes. But of course you can also stop in Xcode, at a breakpoint (or just pressing "pause") and examine the stack in the left-hand column. (Always enable an exception breakpoint.) – Hot Licks Apr 11 '13 at 10:47
-
1(+1 for realizing that examining the stack is important. Far too few folks starting out on Xcode appreciate this.) – Hot Licks Apr 11 '13 at 10:49
-
I am doing same, but in stack trace I can see just 5 or 6 method calls and after that on 25 its UIApplicationMain and on 26 its main. I can't see the methods between 6 and 25. I want to see complete stack trace. – NaXir Apr 11 '13 at 11:00
-
1I got it via nslog. thanks guys – NaXir Apr 11 '13 at 11:05
5 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.

- 9,564
- 146
- 81
- 122

- 1,679
- 1
- 11
- 6
-
Awesome tip for tracking down a constraint issue after setting the symbolic breakpoint. – Alex Walczak Feb 22 '20 at 00:12
-
1You can also mention the thread id (from the debug pane) for capturing stack of that particular thread. For example, in case of Thread 42, you'd do - "bt 42" – rivaldo4t May 08 '20 at 22:25
-
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)}

- 3,744
- 1
- 22
- 43

- 13,743
- 3
- 64
- 88
-
11within lldb it can be printed with: po [NSThread callStackSymbols] – Max MacLeod Apr 23 '14 at 08:32
-
-
po Thread.callStackSymbols returns `cannot use dot operator on a type` – pho_pho Sep 04 '18 at 12:51
In Xcode 6 you can click the button at the bottom left corner of the pane which shows the full stack trace.

- 971
- 7
- 14
-
1This answer is still current in Xcode 11, but the button has been moved slightly. ;) – ReinstateMonica3167040 May 15 '20 at 15:14
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.

- 455
- 6
- 9
-
6
-
3This slider appears to have been removed in XCode6... if anyone knows how to do this under XCode6 you would be my hero. – Steazy Oct 21 '14 at 18:07
-
@Steazy See Gong Pengjun's answer for Xcode 6-11 (or possibly later, 11.x is current at this moment) – ReinstateMonica3167040 May 16 '20 at 00:51
You can add breakpoint
before exception is thrown. First go to Breakpoint Navigator
(cmd + 6). In the bottom left corner mouse click plus button. OR
You can use Instruments
(/Developer/Applications/Instruments) to help detect usage of zombie
objects
.
Reference
And When you add breakpoint review the picture will create by Xcode
.
You can expand the stack trace using the slider at bottom use step over
and over
for line by line logs.
thanks hope this will help you

- 7,345
- 1
- 31
- 51