NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Stack trace from C program



Sad Clouds(cryintothebluesky%googlemail.com@localhost) said 2010.05.25 12:43:49 
+0000:
> Hi, is there a sane way of generating a stack trace from withink a C
> program on *BSD?
> 
> For example, Solaris has walkcontext() and printstack() functions. It
> doesn't look like there is anything similar on NetBSD.

glibc also has something to print a stack trace, but NetBSD has it's own
libc. 

See: http://www.linuxjournal.com/article/6391

> Is there a portable way of implementing those functions, or does it
> heavily depend on machine architecture and operating system?

Basically, no and yes. It is very compiler, libc and machine architecture
dependent. 
The LJ article has a brief discussion on why exactly it's an extremely non
portable thing to do.

        --Wouter


Home | Main Index | Thread Index | Old Index