Re: Finding the callstack programmatically

From: Ashutosh (ashusharma1980_at_yahoo.co.uk)
Date: 07/16/04


Date: Fri, 16 Jul 2004 06:34:08 GMT

Thanks. That seems to work very well with STANDALONE defined. However, if I
try to compile it (with gcc -c) and link it with my program and if I call
StackTrace() from within my program, it says "No debugger found".

On debugging this, I found that 'status' after the line "rc = waitpid(pid,
&status, 0)" is 512. 'pid' was non-zero (and on doing a 'ps', it
corresponded to 'sh <defunct>'.

If I define USE_BUILTIN, it has a Segmentation fault.

Ashutosh

"Bjorn Reese" <breese@see.signature> wrote in message
news:pan.2004.07.15.17.19.43.292263@see.signature...
> On Thu, 15 Jul 2004 13:45:55 +0000, Ashutosh wrote:
>
> > Is there a way to find the call stack at any point of time inside a
(C/C++)
> > program?
> > Whenever my program raises a SIGSEGV, is it possible for me to print the
> > function call stack in the SIGSEGV handler?
>
> See stacktrace.c in http://home1.stofanet.dk/breese/debug/debug.tar.gz
>
> --
> mail1dotstofanetdotdk
>