🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
3 messages
3 total messages Started by Scott Dudley Mon, 05 Feb 2001 23:19
programatically accessing call stack information
#3579
Author: Scott Dudley
Date: Mon, 05 Feb 2001 23:19
7 lines
1448 bytes
is there a way to access call stack information at run time from within
a program?  i've been maintaining my own crude stack using __FUNCTION__
and linked lists but can't help but think there's gotta be a better
way...

thanks.
Re: programatically accessing call stack information
#3580
Author: Nate Eldredge
Date: Tue, 06 Feb 2001 01:11
18 lines
1877 bytes
Scott Dudley <scott@telesoft.com> writes:

> is there a way to access call stack information at run time from within
> a program?  i've been maintaining my own crude stack using __FUNCTION__
> and linked lists but can't help but think there's gotta be a better
> way...

It depends on your system.  If you have glibc 2.1 or newer, you may
have the `backtrace' function and its relatives.  See <execinfo.h>.
Other systems may have other ways-- what is yours?

Note that the way you're currently using is almost certainly the only
one guaranteed to work on every system.

-- 

Nate Eldredge
neldredge@hmc.edu
Re: programatically accessing call stack information
#3581
Author: Scott Dudley
Date: Tue, 06 Feb 2001 01:25
26 lines
2013 bytes
sorry for lack of specifics.  i need a solution that will work on linux and
aix.

thanks nate.


Nate Eldredge wrote:

> Scott Dudley <scott@telesoft.com> writes:
>
> > is there a way to access call stack information at run time from within
> > a program?  i've been maintaining my own crude stack using __FUNCTION__
> > and linked lists but can't help but think there's gotta be a better
> > way...
>
> It depends on your system.  If you have glibc 2.1 or newer, you may
> have the `backtrace' function and its relatives.  See <execinfo.h>.
> Other systems may have other ways-- what is yours?
>
> Note that the way you're currently using is almost certainly the only
> one guaranteed to work on every system.
>
> --
>
> Nate Eldredge
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads