Displaying of the Stack Trace

Discussion in 'C Programming' started by Guenther Sohler, Jun 24, 2003.

  1. 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
    Guenther Sohler, Jun 24, 2003
    #1
    1. Advertising

  2. Guenther Sohler

    Zoran Cutura Guest

    Guenther Sohler <> 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 ()
    "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
    Zoran Cutura, Jun 24, 2003
    #2
    1. Advertising

  3. Guenther Sohler

    Ira Baxter Guest

    "Guenther Sohler" <> wrote in message
    news:p...
    > 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/Products/TestCoverage/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 =---
    Ira Baxter, Jun 25, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rukmal Fernando
    Replies:
    4
    Views:
    838
    Richard Grimes [MVP]
    Oct 27, 2003
  2. BillGatesFan

    Displaying Line Numbers in the stack trace

    BillGatesFan, Mar 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    388
    BillGatesFan
    Mar 23, 2005
  3. Matthias S.
    Replies:
    1
    Views:
    635
    Daniel Fisher\(lennybacon\)
    Nov 30, 2005
  4. Jiho Han
    Replies:
    0
    Views:
    503
    Jiho Han
    Aug 22, 2006
  5. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    Adding my messages to the trace.axd trace?

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Apr 6, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    580
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=
    Apr 6, 2007
Loading...

Share This Page