0

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

2
  • The "tree of the calls" you're looking for is called a stack trace or back trace. I don't use xcode, but I assume there's a window or toolbar to display it. Commented Dec 7, 2012 at 19:52
  • When I stumbled into this, how do I know wich of the methods that currently are being executed? Why do you want to do that at all? Are you trying to understand how it works? What are you trying to accomplish? Commented Dec 7, 2012 at 21:50

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

the link is broken

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.