delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/09/16/03:52:11

From: Steven DOT Pemberton AT cwi DOT nl (Steven Pemberton)
Subject: RE: b18: cygwin_except_handler failure on deref NULL
16 Sep 1997 03:52:11 -0700 :
Message-ID: <UTC199709161043.MAA06363.steven.cygnus.gnu-win32@schoener.cwi.nl>
References: <009B9C5E DOT 173D3DA0 DOT 22545 AT ifk20 DOT mach DOT uni-karlsruhe DOT de>
Mime-Version: 1.0
To: dahms AT ifk20 DOT mach DOT uni-karlsruhe DOT de
Cc: gnu-win32 AT cygnus DOT com

 > Hi Steven, you wrote:
 > 
 > : 	(ENQUIRE.EXE 1011) In cygwin_except_handler
 > 
 > : It failed at the point where the program looks to see if dereferencing
 > : NULL causes a trap (which is done using setjmp, and dereferencing NULL).
 > 
 > I think it worked, because cygwin_except_handler *is* the trap handler!
 > Do you have an complete example in a dozen of source lines or so?

My guess is that this would cause the same fault (but I don't have a
PC to hand):

#include <stdio.h>
#include <signal.h>
#include <setjmp.h>

jmp_buf mlab; int v, *p;

void address(sig) int sig; { /* what to do on an address error */
  signal(sig, address);
  longjmp(mlab, 1);
}

main() {
#ifdef SIGBUS
	signal(SIGBUS, address);
#endif
#ifdef SIGSEGV
	signal(SIGSEGV, address);
#endif
	if (setjmp(mlab) == 0) {
		p= 0;
		v= *p;
		printf("Dereferencing NULL doesn't cause a trap\n");
	} else {
		printf("Dereferencing NULL causes a trap\n");
	}
}

Best wishes,

Steven Pemberton
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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