Mail Archives: djgpp/1998/01/11/07:41:45
On Fri, 9 Jan 1998, Peter Palotas wrote:
> I was wondering if it is somehow possible to get a call traceback, during
> the execution of a program, i.e. *without* terminating the program or
> causing a GPF! (Perhaps even the function names, although this would
> probably be kind of hard I suppose).
You need to call setjmp with the address of the exception structure
and then call the equivalent of `do_faulting_finish_message' function
from the library sources, but with the call to `exit' removed. An
untested fragment follows:
#include <setjmp.h>
#include <sys/exceptn.h>
jmp_buf fake_exception;
__djgpp_exception_state_ptr = &fake_exception;
if (setjmp(__djgpp_exception_state)
{
/* Error action. You shouldn't get here, ever. */
}
else
print_traceback();
`print_traceback' should have the code in `do_faulting_finish_message'
(defined on src/libc/go32/dpmiexcp.c which is in djlsr201.zip) that
walks the stack frames.
To have the function names printed also, you will need to add to
`print_traceback' the necessary code from `symify' (also in
djlsr201.zip).
- Raw text -