<div class="gmail_quote">On Tue, Feb 22, 2011 at 6:07 AM, <span dir="ltr"><<a href="mailto:aaron@pageofswords.net">aaron@pageofswords.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi, I am having a lot of trouble figuring out how to prevent the debugger<br>
becoming active in embedded mode.<br>
I have tried:<br>
+ Calling ecl_disable_interrupts(); before cl_eval()<br></blockquote><div><br></div><div>Nothing to do with that. These are Unix interrupts</div><div> </div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
+ And also this: (setf si::*interrupt-enable* nil)<br></blockquote><div><br></div><div>See above.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+ Executing the following in ecl: (setf *debugger-hook* #'debug-ignore)<br></blockquote><div><br></div><div>What does your *debugger-hook* function do? Just returning? This is not going to work at all. First try doing it in Common Lisp, then port the stuff to your program</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Mmm... I want to evaluate something like<br>
si_safe_eval(3,c_string_to_object("(vvvvformat t \"Hello\")"), Cnil,<br>
OBJNULL);<br></blockquote><div><br></div><div>Problem 1: the expression you are going to evaluate is ill formed. SAFE-EVAL can not protect you because the error happens _before_ this function is ever invoked.</div><div><br>
</div><div>Problem 2: your debug-ignore function does not do what is expected to do. When an error handler is invoked it should either offer an interactive debugger or perform some transfer of control to an outer point, as in</div>
<div><br></div><div>(block nil (handler-bind ((error #'(lambda (c) (return 2)))) (cos 'a)))</div><div><br></div><div>I presume that debug-ignore does not do this: it simply returns and the debugger just gets invoked again (the error has not been solved).</div>
<div><br></div><div>Alternative: if you know you are going to get ill formed expressions, convert the READ_CL forms into a standalone function that detects and ignores errors. Fortunately there is an undocumented function that c_string_to_object is based on</div>
<div><br></div><div><div>#define ecl_read_from_cstring(s) si_string_to_object(1,make_constant_base_string(s))</div><div>#define ecl_read_from_cstring_safe(s,v) si_string_to_object(2,make_constant_base_string(s),(v))</div>
</div><div><br></div><div>The second version does it safely.</div><div><br></div><div>Juanjo</div></div><br>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://juanjose.garciaripoll.googlepages.com" target="_blank">http://juanjose.garciaripoll.googlepages.com</a><br>