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 X-Sender: eliz AT is To: "Rafal 'Raf256' Maj" cc: djgpp AT delorie DOT com Subject: Re: call stack In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.