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. Advertising

  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. Advertising

  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. 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. Surinder Singh
    Replies:
    1
    Views:
    1,175
    Richard Bos
    Dec 20, 2007
  2. Casey Hawthorne
    Replies:
    3
    Views:
    1,064
    Flash Gordon
    Nov 1, 2009
  3. Debajit Adhikary
    Replies:
    36
    Views:
    2,242
    Andre Kaufmann
    Feb 10, 2011
  4. Sam Roberts
    Replies:
    1
    Views:
    212
    Yukihiro Matsumoto
    Feb 11, 2005
  5. Kenneth McDonald

    Why stack overflow with such a small stack?

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

Share This Page