Mail Archives: djgpp/2002/02/17/01:03:49
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 -