public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* backtrace of the current process execution
@ 2004-12-03 15:06 laurent.marzullo
  2004-12-03 15:14 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: laurent.marzullo @ 2004-12-03 15:06 UTC (permalink / raw)
  To: gdb

Hello,

I would like to know if there's a way to know the call stack of a running
process into the process itself ?

I wrote a C++ program ... and when throwing exception, I would like to
print the full call stack to std::cerr. Is there a way to do so with
libgdb ? or any other lib ?

Thanks a lot
Laurent Marzullo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: backtrace of the current process execution
  2004-12-03 15:06 backtrace of the current process execution laurent.marzullo
@ 2004-12-03 15:14 ` Andreas Schwab
  2004-12-03 15:20   ` Bob Rossi
  2004-12-03 18:55   ` Andrew Burgess
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Schwab @ 2004-12-03 15:14 UTC (permalink / raw)
  To: laurent.marzullo; +Cc: gdb

laurent.marzullo@one-d.com writes:

> I would like to know if there's a way to know the call stack of a running
> process into the process itself ?

Try the backtrace function from <execinfo.h>.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: backtrace of the current process execution
  2004-12-03 15:14 ` Andreas Schwab
@ 2004-12-03 15:20   ` Bob Rossi
  2004-12-03 18:55   ` Andrew Burgess
  1 sibling, 0 replies; 4+ messages in thread
From: Bob Rossi @ 2004-12-03 15:20 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: laurent.marzullo, gdb

On Fri, Dec 03, 2004 at 04:14:27PM +0100, Andreas Schwab wrote:
> laurent.marzullo@one-d.com writes:
> 
> > I would like to know if there's a way to know the call stack of a running
> > process into the process itself ?
> 
> Try the backtrace function from <execinfo.h>.
> 
> Andreas.

I think you can link to valgrind and it knows how to give backtrace's
via a macro at any point in your code.

Bob Rossi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: backtrace of the current process execution
  2004-12-03 15:14 ` Andreas Schwab
  2004-12-03 15:20   ` Bob Rossi
@ 2004-12-03 18:55   ` Andrew Burgess
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Burgess @ 2004-12-03 18:55 UTC (permalink / raw)
  To: gdb

On Fri, 03 Dec 2004 16:14:27 +0100, Andreas Schwab <schwab@suse.de> wrote:

> laurent.marzullo@one-d.com writes:
>
>> I would like to know if there's a way to know the call stack of a  
>> running
>> process into the process itself ?
>
> Try the backtrace function from <execinfo.h>.

This is handy but gives no _static_ symbols. I start with backtrace()
and then create a pipe to addr2line (part of binutils). This gives
static symbols and the exact line numbers. You could also post-process with
addr2line I suppose...

Now if it only printed arguments like gdb...

It really seems like a useful feature for a libgdb since gdb already
knows how to do it.

HTH

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-12-03 18:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-03 15:06 backtrace of the current process execution laurent.marzullo
2004-12-03 15:14 ` Andreas Schwab
2004-12-03 15:20   ` Bob Rossi
2004-12-03 18:55   ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).