Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Juan Jose Garcia-Ripoll <juanjose.garciaripoll-gM/Ye1E23mwN+BqQ9rBEUg <at> public.gmane.org>
Subject: Re: Segmentation faults/detected access to ...address
Newsgroups: gmane.lisp.ecl.general
Date: Saturday 13th March 2010 22:51:11 UTC (over 7 years ago)
On Sat, Mar 13, 2010 at 5:08 PM, Seth Burleigh
 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 
#include 
#include 

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
 
CD: 3ms