Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printStackTrace in C++ ?

Status
Not open for further replies.

rveina

Programmer
Aug 4, 2003
9
RO
Hello

Is there a way to see (using C++) the stack trace of a sequence of calls ? I'm talking about the same functionality of the printStackTrace() method from Java.
Example:
Print StackTrace
NewEx01: Thrown from meth02
at Class01.meth02(StackTr01.java:92)
at Class01.meth01(StackTr01.java:60)
at StackTr01.main(StackTr01.java:52)
Caused by: NewEx02: Thrown from meth03
at Class01.meth03(StackTr01.java:102)
at Class01.meth02(StackTr01.java:85)
... 2 more
Caused by: NewEx03: Thrown from meth04
at Class01.meth04(StackTr01.java:112)
at Class01.meth03(StackTr01.java:100)
... 3 more

Thank you.
 
in C++ is no PrintStackTrace.

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
try compiling the code with debug options(-g in gcc/g++).
Run your application with dbx(c++) or gdb(C)...
keep a breakpoint at the required point and you can backtrace...

Also you can run truss <exename> from command prompt.. But this will show the system calls being called..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top