delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/17/01:03:49

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Date: Sun, 17 Feb 2002 08:01:23 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Rafal 'Raf256' Maj" <raf256 AT szybkapoczta DOT pl>
cc: djgpp AT delorie DOT com
Subject: Re: call stack
In-Reply-To: <Xns91B8209A781BDrfdfciasdsdj412tr@213.180.128.20>
Message-ID: <Pine.SUN.3.91.1020217075424.23147B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 17 Feb 2002, Rafal 'Raf256' Maj wrote:

> How can get current call stack, and acces informations about __LINE__ 
> __FILE__ and name of all functions from call stack ?

For the former, look at the function __djgpp_traceback_exit and its 
subroutines, defined on dpmiexcp.c in the library sources.  That function 
exits after it's done its thing, but you can copy the code and modify it 
not to exit.

For the latter, you need code that reads the debug info and finds file 
and line for a given address.  For COFF debug info, the functions 
syms_val2name and syms_val2line from libdbg.a will do what you want.  
For other types of debug info (stabs and DWARF2), you need to use 
functions from libbfd.a in a manner similar to what the program 
addr2line (from Binutils) does; or you could run addr2line via a 
pipe and use its output.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019