[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

boehm-gc



I've been looking at boehm-gc, to see what it would take to fix the
breakage for w3m et al.

The code appears to be fairly write-only, but I have at least
tracked down where it's falling over, which is at line 647 in
mark.c, within GC_mark_from():

          deferred = *limit;

Note that this appears to be different if the test program is run
under gdb, which is not surprising, giving the way boehm-gc works
(it scans memory within the process for things that look like pointers!).

Has anyone else been looking at this?

Tom
-------------------------
$ pwd
/usr/ports/devel/boehm-gc/w-boehm-gc-6.1p1/gc6.1
$ sudo make gctest
cc -DHAVE_DLFCN_H=1 -DSILENT=1 -DNO_SIGNALS=1 -DNO_EXECUTE_PERMISSION=1 -DALL_INTERIOR_POINTERS=1 -DJAVA_FINALIZATION=1 -DGC_GCJ_SUPPORT=1 -DATOMIC_UNCOLLECTABLE=1 -I. -I. -I./include     -O2 -c ./tests/test.c
/bin/sh ./libtool --mode=link cc  -O2  -o gctest   test.o ./libgc.la
cc -O2 -o .libs/gctest test.o  -L./.libs -lgc -Wl,-rpath,/usr/local/lib
./.libs/libgc.so.1.1: warning: sprintf() is often misused, please use snprintf()
creating gctest
$ ./gctest
Memory fault

<edit mark.c>

$ diff -u mark.c.orig mark.c
--- mark.c.orig Tue Aug  6 00:36:03 2002
+++ mark.c      Sun Aug 17 20:13:22 2003
@@ -644,7 +644,9 @@
        for(;;) {
          PREFETCH((ptr_t)limit - PREF_DIST*CACHE_LINE_SIZE);
          GC_ASSERT(limit >= current_p);
+printf("limit = %p, current_p = %p\n", limit, current_p) ;
          deferred = *limit;
+printf("deferred = *limit\n") ;
          limit = (word *)((char *)limit - ALIGNMENT);
          if ((ptr_t)deferred >= least_ha && (ptr_t)deferred <  greatest_ha) {
            PREFETCH(deferred);


$ sudo make
:
: (snipped)
:
$ sudo make gctest
/bin/sh ./libtool --mode=link cc  -O2  -o gctest   test.o ./libgc.la
cc -O2 -o .libs/gctest test.o  -L./.libs -lgc -Wl,-rpath,/usr/local/lib
./.libs/libgc.so.1.1: warning: sprintf() is often misused, please use snprintf()
creating gctest
$ ./gctest
:
: (snipped)
:
limit = 0x20096dbc, current_p = 0x20096da4
deferred = *limit
limit = 0x20096db4, current_p = 0x20096da4
deferred = *limit
limit = 0x20096dac, current_p = 0x20096da4
deferred = *limit
limit = 0x20096da4, current_p = 0x20096da4
deferred = *limit
limit = 0x20097198, current_p = 0x20096fa0
Memory fault
$