From: kh AT wg DOT icl DOT co DOT uk (Kevin Hughes) Subject: Do signals work? 27 Nov 1997 13:49:47 -0800 Message-ID: <01BCFB43.2847DC70.cygnus.gnu-win32@rodney.wg.icl.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit To: "Gnuwin95 (E-mail)" I have the latest coolview cygwin and have been trying to use the signals. I can install the handler but cannot get the handler to be entered. I have tried the following program: #include #include #include #include #include #include #include #include #include long count=0; int handled; jmp_buf env; void sigill_handler(int sig) { printf("handler\n"); while (count >0) { count--; return; } handled=(0==0); longjmp(env,1); }; int main(int argc, char* argv[]) { long* address; long sum; int error; struct sigaction act; act.sa_handler=&sigill_handler; act.sa_flags=0; error=sigaction(SIGSEGV,&act,NULL); // install handler if (error != 0) { printf("failed to install handler\n"); return 1; } handled=(0==1); count=0; address=(long*)(((long)&count) & 0xffff0000); address+=1024*1024; if (setjmp(env)==0) { while (!handled) { address=address+4096; sum+=*address; } } return 0; } The program runs fine or unix (solaris) - it simply print handler as required. On gnuwin95 I get (c:\a.exe 28547) In cygwin_except_handler exc C0000005 at 401148 sp 240F16C I have tried debugging it using gdb which reports that the program has had a SIGSEGV but does not appear to enter my handler. Continue simply repeats the report. Has anyone any ideas why I cannot catch these signals - cleary gdb is doing. Many thanks Kevin - 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".