[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Re: crashes during return-from-callbacks
From: |
Daniel B. Faken |
Subject: |
[Chicken-users] Re: crashes during return-from-callbacks |
Date: |
Wed, 7 Sep 2005 16:37:52 -0400 (EDT) |
On Wed, 7 Sep 2005, felix winkelmann wrote:
> On 9/7/05, Daniel B. Faken <address@hidden> wrote:
> > Hi,
> >
> > I've been working on this for a few days, but can't seem to make any
> > progress...
> > I'm making callbacks via C_callback() into a closure created by eval'd
> > code. SOMETIMES when I return the value back to C, I get a crash in some
> > subroutine called by C_do_apply() when the eval'd fn is returning...
>
> First thing to make sure: are you _always_ invoking your callback via
> `foreign-safe-lambda[*]'?
I'm calling-back *into scheme* from C, after exiting the toplevel via
(return-to-host).
But yes, when I am doing scheme->c callbacks that potentially go back to
scheme, I'm doing safe-lambda/primitives.
> >
> > Its been very hard to track down what is causing this; all I can say is
> > that it is affected by calls to (print) in the called-back scheme
> > function. Specifically, if I print some of the parameters I'm passing via
> > C_callback(). But the function doesn't crash during the printing -- only
> > after it reaches the second-to-last statement (which generates output, so
> > I know it is called). The last statement just returns the value.
> > (This is after calling CHICKEN_run(C_toplevel) and after saving the
> > input params via C_save()).
>
> Second thing: are you messing with the temporary stack in some ways?
> (i.e. use C_save()/C_restore())
The only thing I do is use C_save() to pass parameters to the function
called in C_callback().
Nothing else... I manually inserted some C_stack_check code, but they
didn't report anything.
> > Are there any secret options for debugging the compiler/evaluator? :)
> > The next thing I can think of is just compiling the whole enchilada with
> > -g... yikes.
>
> Yes, that's what I would do in this case... Is your code big, does it have
> a lot of external dependencies? Can you reduce the problem to something
> I can try out myself?
Yes, quite big and dependent. This is the chromium stuff. The previous
release I made probably would have the same issues if some print statements
were
inserted.
I've tried recreating the problem, but no success so far in smaller
situations.. I'll try some more, though.
thanks!
Daniel