Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Displaying of the Stack Trace

Reply
Thread Tools

Displaying of the Stack Trace

 
 
Guenther Sohler
Guest
Posts: n/a
 
      06-24-2003
I have written a program, which is very compicated
and so it happens quite often, that it has to exit itself,
because its handling an invalid index of an array.
(It never crashes, it always nicely exits).
Nevertheless - in that case, It would be very nice
if my program could display the function hierarchy,
how my program reached that exit.
I have already seen programs doing that, before they crashed.
How can I do this on a unix/linux system ?
Are there special functions to read the symbols contained within the ELF
File ?

rds

 
Reply With Quote
 
 
 
 
Zoran Cutura
Guest
Posts: n/a
 
      06-24-2003
Guenther Sohler <(E-Mail Removed)> wrote:
> I have written a program, which is very compicated
> and so it happens quite often, that it has to exit itself,
> because its handling an invalid index of an array.
> (It never crashes, it always nicely exits).
> Nevertheless - in that case, It would be very nice
> if my program could display the function hierarchy,
> how my program reached that exit.
> I have already seen programs doing that, before they crashed.
> How can I do this on a unix/linux system ?


The way you asked your question already should have suggested to you
that you want to ask it in a newsgroup related to your system rather
than a language group.

> Are there special functions to read the symbols contained within the ELF
> File ?


comp.unix.programmer
comp.os.linux.development.apps

--
Z ((E-Mail Removed))
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond
 
Reply With Quote
 
 
 
 
Ira Baxter
Guest
Posts: n/a
 
      06-25-2003
"Guenther Sohler" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> I have written a program, which is very compicated
> and so it happens quite often, that it has to exit itself,
> because its handling an invalid index of an array.
> (It never crashes, it always nicely exits).
> Nevertheless - in that case, It would be very nice
> if my program could display the function hierarchy,
> how my program reached that exit.


You either have to depend on some specific compiler feature that does this
(your compiler mileage will vary significantly) or you will have to
ensure this yourself.

A compiler-independent way to do it is to decorate each
function entry/exit with instrumentation that keeps track
of this information on your own private stack. You can
do this by hand, with a few macros and lot of editing.

Or, you can use a tool that could automatically place such
probes in all your source files. A white paper on inserting
probes using automated tools can be found on the web page,
http://www.semanticdesigns.com/Produ...age/index.html.


--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
How to redirect output from Diagnostics.Trace to Page.Trace? Matthias S. ASP .Net 1 11-30-2005 09:01 AM
Displaying Line Numbers in the stack trace BillGatesFan ASP .Net 0 03-23-2005 04:33 PM
Trace: Can anyone suggest a good tool to catch trace messages? Rukmal Fernando ASP .Net 4 10-27-2003 09:03 PM



Advertisments