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

From: Shu-yu Guo (arc at cs.uchicago.edu)
Date: Sun Nov 4 00:52:52 EDT 2007

A quick and correct response! Indeed it seems like FreeBSD 7 has
changed the behavior to be SIGSEGV instead of SIGBUS.

I've committed the fix to the trunk, thanks for the help.

There is also a problem with src/mred/wx_keym.cxx being fed through
xform, namely

Error [ASSIGN] 522 in ../../../trunk/src/mred/gc2/../wxme/wx_keym.cxx:
suspicious assignment with a function call, LHS ends "["
Error [ASSIGN] 516 in ../../../trunk/src/mred/gc2/../wxme/wx_keym.cxx:
suspicious assignment with a function call, LHS ends "["

This is due to gcc 4.2 generating different output with g++ -E than
gcc 3.4. This can be worked around by the attached following patch,
but a real fix probably needs to be done in xform.ss.

On 11/3/07, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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
>
>


-- 
                shu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wx_keym.cxx.freebsd7.diff
Type: text/x-patch
Size: 696 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20071103/754585cf/attachment.bin>

Posted on the users mailing list.