Tom Lilletveit
Tom Lilletveit

Reputation: 2002

Tracing recursive function using XCode debugger

How do I trace recursive functions like these that calls itself recursively two times? I wanted to create a tree of the calls. When I stumbled into this, how do I know which of the methods that currently are being executed? CountWays(numStairs-1) or CountWays(numStairs-2)

enter image description here

Upvotes: 0

Views: 623

Answers (1)

Argylelabcoat
Argylelabcoat

Reputation: 26

GDB answer?
If you see near the bottom-right of your screenshot there are 3 buttons in a group and the left-most button has been selected. Press either the center or the far-right button to open the debug console. In there you may type 'bt' and it will print your back-trace.

GUI answer? You need to trigger a backtrace upon your breakpoint (or exception breakpoint), instructions for this can be found here: http://www.oramind.com/index.php/articles/182-ios-5-xcode-backtrace

Upvotes: 1

Related Questions