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

Re: Questions about "mzstkchk.h"



Quoting Brent Fulgham:
> When I invoke a multi-threaded piece of scheme code in my
> embedded MzScheme I get a segfault is is_stack_too_shallow_2().

Sorry that I haven't replied to your earlier messages sooner. I haven't
had time to look into it and figure out a useful question.

But with the new information, I think I can ask some useful
questions...

> This happens even though I have pared things down to the bare

> I believe STK_COMP expands to:
>    define STK_COMP(a,b) (scheme_stack_grows_up == ((a) > (b)))
> and SCHEME_STACK_BOUNDARY expands to:
>    scheme_stack_boundary
> 
> (gdb) p scheme_stack_grows_up
> $7 = 0
> (gdb) p scheme_stack_boundary
> $8 = 3204501008
> (gdb) p _stk_pos
> $9 = 3206543056

scheme_stack_boundary should be close to _stk_pos (much closer than the
above numbers). It looks like the registered stack base is for a
different (OS-level) thread than the current one.

scheme_stack_boundary *should* have the same value as the one supplied
to GC_set_stack_base(). Can you check that it does?

Also, just to make sure: GC_set_stack_base() is called with the address
of a stack variable (i.e.: not static) in the same OS-level thread as
the one that crashes?

Matthew