Get StackTrace Info?

Monkey Forums/Monkey Programming/Get StackTrace Info?

Shinkiro1(Posted 2012) [#1]
Is it somehow possible to get a complete (or several level deep) stack trace like shown when an error occurs in monkey. I mean programatically and save it into a String.

The reason is because I want to draw the stacktrace onto the screen.


maltic(Posted 2012) [#2]
Probably not because GCC will do TCO.

However can't you just make your own global stack and have every function call add itself to the global stack. Then just traverse the stack and output it when you want to output your data (ie. when some exception is thrown or assertion fails). Just make sure you store the parent caller function on the stack, or at least the call depth, so you can indent it nicely.