cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/14/04:56:38

Date: Sun, 14 Feb 1999 10:53:00 +0100 (MET)
From: Gisle Vanem <giva AT bryggen DOT bgnett DOT no>
To: Nate Eldredge <nate AT cartsys DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Exception handling
In-Reply-To: <36C657F1.50F398A8@cartsys.com>
Message-ID: <Pine.UW2.3.95.990214104139.24547A-100000@bryggen.bgnett.no>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Sat, 13 Feb 1999, Nate Eldredge wrote:

> But under DJGPP, this looks more difficult.  I don't think a signal
> handler can get the crashing registers.  

How about saving the '__djgpp_exception_state_ptr' into your own
jmp_buf ?

> And if it returns the library
> code explicitly aborts.  (Is this done for a reason, or just because
> most signal handlers that return haven't actually fixed the problem?) 

This is from an exception-handler I once made:

static void ExcHandler (int sig)
{
  static int been_here = 0;
  static jmp_buf exc_buf;
  int    i;
 
  if (been_here)
  {
    been_here = 0;
    signal (sig,SIG_DFL);
    __djgpp_exception_state_ptr = &exc_buf;
  }
  else
  {
    memcpy (&exc_buf,__djgpp_exception_state_ptr,sizeof(exc_buf));
    been_here = 1;
 
    if (sig == SIGFPE)
    {
      _clear87();
      _fpreset();
    }
    psignal (sig, "shutdown");
    
    .. do your main exc-processing here..
  } 
  raise (SIGABRT);
}

Maybe you could do 'signal(sig,SIG_IGN)' instead of raising SIGABRT ?

Gisle V.

> 
> Nate Eldredge
> nate AT cartsys DOT com
> 

- Raw text -


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