Mail Archives: djgpp/1998/01/12/08:45:36
At 14.41 1998-01-11 +0200, you wrote:
>
>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).
Thanx a lot! =) Exactly what I was looking for.
I guess there isn't a portable way of doing this, i.e. a way that would
work with GCC under Linux too?? (If not, do you know how to do this under
Linux?)
-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --
*****************************************************
* A brief description of DJGPP: *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************
- Raw text -