Hi,

On Sun, Mar 13, 2005 at 03:01:00PM +0200, Kai Henningsen wrote:
> Most of the rest of the error handling in this project is concerned with  
> the absence of the feature I loved in the IBM PL/I compilers under the  
> name "SNAP;" - putting out a stack backtrace (the usual idiom for abort()  
> was "SNAP; STOP;" IIRC). Now *that* would be a useful feature to have.  

It is there: __builtin_return_address(n)

I have a small example of how to use that on my homepage:

        http://www.clifford.at/cfun/elfstuff/backtrace.c

This example is using the ELF dladdr() function - so it can only resolve
symbols in a .so file - not in the main program. (I think it works if the
main program is compiled with -rdynamic - but I didn't check that).

I hope that helps.

yours,
 - clifford

-- 
  _________  ____ __      __  $_ = q 7nz!y="Ccv'Dpgiutvcbb'oj'Pocj'*'qqq[
 / ___/ __ \/ __ `/ | /| / /  ej`q[iv`";!|=1;!y=~t%].[%nz!z=!1;gps]1..6[{
/ /__/ / / / /_/ /| |/ |/ /   qsjou"!z\c";tfmfdu]voefg,voefg,voefg,0.05[;
\___/_/ /_/\__, / |__/|__/    !z=~t/].[/dis]pse]!1[^!_[/fh;}qsjou !z;%fh;
 CCC Wien /____/www.cngw.org  qsjou "\o"7;s/\n//g;y/[b-za]!/)a-z($/;eval;
 
Unix is the answer, but only if you phrase the question very carefully.
 

Attachment: pgpWZjTpDIdF3.pgp
Description: PGP signature

Reply via email to