[plt-scheme] 3m problems on FreeBSD-7

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Nov 3 23:32:58 EDT 2007

At Sat, 3 Nov 2007 22:20:03 -0500, "Shu-yu Guo" wrote:
> After some fiddling with instrumenting printf's and gdb, it turns out
> that things get screwed up after a garbage collection. The
> garbage_collect function seems long and complicated, so I didn't
> investigate further.
> 
> I would provide a gdb backtrace, but it doesn't really help to
> illustrate the problem. So I'm going to explain in English instead:
> the problem occurs on my machine at
> 
> src/mzscheme/src/hash.c:631 : table->buckets = ba;
> 
> It just happens that that's the piece of code that gets executed
> immediately after the first garbage collection. I instrumented the
> code to print the address of table->buckets before and after the
> GC_malloc in the xsrc, and when GC_malloc calls garbage_collect, the
> address gets changed. Here's a sample output:
> 
> table->buckets before = 0x2845e858
> **************** collecting
> table->buckets after = 0x28485888

The write is supposed to trigger a signal, which is to be handled to
implement a write barrier.

But if the signal is SIGSEGV instead of SIGBUS, then that's the
problem. Unlike other variants of Unix, FreeBSD (version 6 and earlier)
signals a SIGBUS for a write to an mprotect()ed page. If FreeBSD has
changed to signal SIGSEGV, then 3m needs to adapt. Try changing line 37
of plt/src/mzscheme/gc2/sighand.c to end with "SIGSEGV" instead of
"SIGBUS".


If the signal is SIGBUS (as in previous versions of FreeBSD), then you
can use the gdb command

   handle SIGBUS nostop noprint

to continue debugging.

Matthew



Posted on the users mailing list.