stack trace in c++ application

A

Ashish

Hello,

Is there a way to print stack trace in a c++ application?

I would like to do this before asserting in a situation that can't be handled.

Thanks,
-Ashish
 
V

Victor Bazarov

Ashish said:
Is there a way to print stack trace in a c++ application?

Not unless you write it yourself. There are no means in the language
to do "stack trace".
I would like to do this before asserting in a situation that can't be handled.

You should explore the means available to you in the OS and the compiler
you're using. Ask in their respective newsgroups.

V
 
K

Karl Heinz Buchegger

Ashish said:
Hello,

Is there a way to print stack trace in a c++ application?

I would like to do this before asserting in a situation that can't be handled.

Not in a standard conforming way.
You have to consult the documentation for your system or ask in a newsgrouop
dedicated to your system if this is possible and if yes, how.
 
S

Steven T. Hatton

Ashish said:
Hello,

Is there a way to print stack trace in a c++ application?

I would like to do this before asserting in a situation that can't be
handled.

Thanks,
-Ashish
I don't believe there is anything specifically addressing that in the C++
Standard document.  There is support for printing backtraces on all
platforms I have any familiarity with, but those are implementation
dependent.  I just came across the discussion on this website,  It's
probably a bit deeper than you want to go, but it should give you some
insight into the current status of this type of thing in relationship to
C++.

http://www.armdevzone.com/EABI/CppABI.html
# 20th February 2004 - Latest draft (1.01) of the exception handling
components implementation (ZIP, 37KB). [Last updated 20-February-2004]
# 15th August 2003 - Latest draft of the exception handling ABI(PDF, 259KB).
[Last updated 20-February-2004]
 
Q

qWake

Ashish said:
Hello,

Is there a way to print stack trace in a c++ application?

I would like to do this before asserting in a situation that can't be handled.

Thanks,
-Ashish

I would also like to see this facility in standard C++. I have just posted
in comp.std.c++ asking if this has ever been considered for inclusion in the
standard. Maybe the question has been asked there before, we'll find out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top