Greetings, and thank you again so much! Am checking it out now. It looks like it might work on mingw too.
Take care, Bruno Haible <[email protected]> writes: > Hi Camm, > >> The mac does not >> appear to be trapping SIGSEGV via sigaction in the standard way (for >> SGC garbage collection). Under gdb, the process appears to receive >> something straight from the kernel, EXC_BAD_ACCESS, and does not >> trigger or enter the handler at all. Do you have any suggestion here? > > Use GNU libsigsegv <http://www.gnu.org/software/libsigsegv/>. It's made > for this purpose. > >> Do you know why the following simple program does not call >> the handler on macosx? >> >> ============================================================================= >> f.c >> ============================================================================= >> #include <sys/mman.h> >> #include <stdio.h> >> #include <signal.h> >> >> void >> h(int s,long c,void *scp,char *a) { >> >> printf("foo\n"); >> >> } >> >> int >> main(int argc,char * argv[]) { >> >> char b1[4096*2],*b=b1; >> struct sigaction siga; >> >> b=(char *)(((unsigned long)b+4095) & ~4095); >> siga.sa_handler=(void *)h; >> siga.sa_flags=SA_RESTART|SA_SIGINFO|SA_RESETHAND; >> sigemptyset(&siga.sa_mask); >> sigaction(SIGSEGV,&siga,0); >> mprotect(b,sizeof(b),PROT_READ); >> b[0]=1; >> return 0; >> } >> ============================================================================= > > Short explanation: Things just don't work this way on MacOS X. > > Long explanation: When a fault occurs in MacOS X, the OS (Mach) first sends a > message to the exception port of the current thread, then a message to the > exception port of the process, and that's it. You need to catch these message. > libsigsegv does that. gdb does that as well. > > Bruno > > > > -- Camm Maguire [email protected] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/gcl-devel
