dumping current stack

Discussion in 'C Programming' started by Richard Bos, Jan 18, 2008.

  1. Richard Bos

    Richard Bos Guest

    SNagar78 <> wrote:

    > is there is a way to print the stack trace inside a running C program
    > to find the trace of calls that made it to reach at that point?


    Not portably; and indeed, because of optimisations, there may in some
    cases simply be no stack trace of a form you'd recognise. Think, for
    example, about tail optimisation of recursive calls.
    It is possible that whatever development platform you're using has a
    tool, or even a set of C-callable functions, that you can use. But these
    will vary rather strongly between platforms, so you'll have to ask about
    those in a newsgroup and/or mailing list or web forum dedicated to that
    platform.

    Richard
     
    Richard Bos, Jan 18, 2008
    #1
    1. Advertisements

  2. Richard Bos

    SNagar78 Guest

    Hi All,
    is there is a way to print the stack trace inside a running C program
    to find the trace of calls that made it to reach at that point?
    like in java
    Thread.dumpStack();
    dumps the entire stack of the current thread.

    Regards
    Suresh Nagar.
     
    SNagar78, Jan 18, 2008
    #2
    1. Advertisements

  3. Richard Bos

    CBFalconer Guest

    SNagar78 wrote:
    >
    > is there is a way to print the stack trace inside a running C
    > program to find the trace of calls that made it to reach at that
    > point? like in java
    > Thread.dumpStack();
    > dumps the entire stack of the current thread.


    No, because there is no reason for a C program to have a stack.
    Thus this question is installation dependant, and off-topic. Try a
    group that deals with your particular system.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.



    --
    Posted via a free Usenet account from http://www.teranews.com
     
    CBFalconer, Jan 18, 2008
    #3
    1. Advertisements

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. Manu
    Replies:
    1
    Views:
    6,436
    Natty Gur
    Jul 20, 2003
  2. Replies:
    4
    Views:
    610
    Branimir Maksimovic
    Oct 20, 2005
  3. Surinder Singh
    Replies:
    1
    Views:
    1,454
    Richard Bos
    Dec 20, 2007
  4. Nelson Ashton
    Replies:
    15
    Views:
    9,611
    Nelson Ashton
    Oct 15, 2008
  5. Casey Hawthorne
    Replies:
    3
    Views:
    1,400
    Flash Gordon
    Nov 1, 2009
  6. Debajit Adhikary
    Replies:
    36
    Views:
    3,144
    Andre Kaufmann
    Feb 10, 2011
  7. Sam Roberts
    Replies:
    1
    Views:
    369
    Yukihiro Matsumoto
    Feb 11, 2005
  8. Kenneth McDonald

    Why stack overflow with such a small stack?

    Kenneth McDonald, Aug 30, 2007, in forum: Ruby
    Replies:
    7
    Views:
    533
    Kenneth McDonald
    Sep 1, 2007
Loading...