delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/11/07:41:45

Date: Sun, 11 Jan 1998 14:41:39 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
cc: djgpp AT delorie DOT com
Subject: Re: Call traceback.
In-Reply-To: <3.0.16.19980109194307.2a77d7ce@hem1.passagen.se>
Message-ID: <Pine.SUN.3.91.980111144120.15603V-100000@is>
MIME-Version: 1.0

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 -


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