2

Is there any methods to implement a 'printstacktrace' method in C++ like the Java do?

yuki070
  • 53
  • 2
  • 4
  • the code would be platform dependent and also you need to check the abi used by your program, say, if there is frame pointer saved on stack, etc. – tristan Oct 11 '13 at 04:44
  • possible duplicate of [C++ display stack trace on exception](http://stackoverflow.com/questions/691719/c-display-stack-trace-on-exception) – Adam Oct 11 '13 at 04:47

1 Answers1

2

Use backtrace() or StackWalker for Unix or Windows.

See this previous SO question:

C++ display stack trace on exception

Community
  • 1
  • 1
Duncan Smith
  • 530
  • 2
  • 10