[Ecls-list] Segmentation faults/detected access to ...address

Seth Burleigh seth at tewebs.com
Sun Mar 14 01:15:39 UTC 2010


What platform are you using? I updated ecl from the repository and I
still get a segmentation fault with the new code. I did manage to avoid
this by wrapping the code in a handler-case block and then returning nil
on an error, which is good enough for me.

On Sat, 2010-03-13 at 19:08 -0600, Seth Burleigh wrote:
> What platform are you using? I updated ecl from the repository and I
> still get a segmentation fault with the new code. I did manage to avoid
> this by wrapping the code in a handler-case block and then returning nil
> on an error, but it would be nice if an error was indicated by a valuate
> that could never have been returned by the lisp code.
> 
> On Sat, 2010-03-13 at 23:51 +0100, Juan Jose Garcia-Ripoll wrote:
> > On Sat, Mar 13, 2010 at 5:08 PM, Seth Burleigh <seth at tewebs.com>
> > wrote:
> >         
> >              cl_object evaled = cl_safe_eval(obj,(cl_object)env,Cnil);
> > 
> > This line is wrong. The "environment" that cl_safe_eval() takes is not
> > the Lisp environment but the enviroment in which the form is compiled
> > and evaluated -- similar to the &env that a macro takes --. This was
> > an important source of problems, leaving the lisp library in an
> > unstable state.
> > 
> > As for the rest, the segmentation faults you saw were a symptom that
> > something very wrong was going on, and it was caused by a chain of
> > errors caused when the debugger was entereed. In other words,
> > ext:safe-eval was not fully protected. I have changed the way forms
> > are executed and hopefully now the debugger will not be started at
> > all.
> > 
> > Your example, with a minor change, seems to work
> > 
> > >>(prin "HI")
> > 
> > NIL
> > >>(cos 1.0)
> > 
> > 0.54030234
> > >>(/ 2 0)
> > 
> > NIL
> > >>2.0
> > 
> > 2.0
> > >>
> > 
> > Juanjo 
> > 
> > #include <ecl/ecl.h>
> > #include <stdio.h>
> > #include <string.h>
> > 
> > int main(int argc, char **argv)  {
> >  cl_boot(argc, argv);
> >  cl_env_ptr env = ecl_process_env();
> >  while (1) {
> >    printf("\n>>");
> >    int nbytes = 100;
> >    char *str = (char*)malloc(nbytes);
> >    nbytes = fgets(str, nbytes, stdin) - str;
> >    if (strcmp(str,"exit\n")==0 ) {
> >      break;
> >    }
> > 
> >    cl_object obj = c_string_to_object(str);
> > 
> >    //uncommented code below produced unprotected access error
> >    //puts(obj==OBJNULL);
> > 
> >    CL_CATCH_ALL_BEGIN(env) {
> >      cl_object evaled = cl_safe_eval(obj,Cnil,Cnil);
> >      cl_pprint(1,evaled);
> >    } CL_CATCH_ALL_IF_CAUGHT {
> >      puts("ERROR");
> >    } CL_CATCH_ALL_END;
> > 
> >    free(str);
> >  }
> >  cl_shutdown();
> > }
> > 
> > 
> > 
> > 
> > -- 
> > Instituto de Física Fundamental, CSIC
> > c/ Serrano, 113b, Madrid 28006 (Spain) 
> > http://juanjose.garciaripoll.googlepages.com
> 






More information about the ecl-devel mailing list