<div dir="ltr">The thought has occurred to me that the coverage tool that Gail Zacharias wrote a number of years back could be extended to a single stepper. It would be a fair amount of work, and would require pretty deep understanding of CCL internals, but it would enable single-stepping of compiled code.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 18, 2018 at 11:17 AM, Ron Garret <span dir="ltr"><<a href="mailto:ron@flownet.com" target="_blank">ron@flownet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Rather than write your own wrapper you should consider using the advice facility built in to CCL:<br>
<br>
<a href="https://ccl.clozure.com/manual/chapter4.3.html#Advising" rel="noreferrer" target="_blank">https://ccl.clozure.com/<wbr>manual/chapter4.3.html#<wbr>Advising</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Jan 18, 2018, at 7:41 AM, 73budden . <<a href="mailto:budden73@gmail.com">budden73@gmail.com</a>> wrote:<br>
<br>
> Hi!<br>
><br>
> I'm trying to build a single stepper for compiled functions in CCL<br>
> (vanilla "Visual Basic" like "debugger").<br>
><br>
> My current idea is to find all function references (subset of<br>
> ccl::lfunloop scope) and<br>
> replace all of them with function wrappers. E.g. I have a function<br>
> which I want to make steppable:<br>
><br>
> (defun f () (print 'list))<br>
><br>
> It references PRINT as a symbol.<br>
> (lfunloop for v in #'f do (print v)) returns:<br>
><br>
> LIST<br>
> PRINT<br>
> F<br>
><br>
> Then I do:<br>
> CCL>(compile (defun my-wrapped-print (&rest args) (break "About to<br>
> call print with ~S" args) (apply #'print args)))<br>
> MY-WRAPPED-PRINT<br>
><br>
> And<br>
> CCL>(%set-nth-immediate #'f 1 'MY-WRAPPED-PRINT)<br>
><br>
> Then, when I run (f), debugger is invoked while trying to call<br>
> "print". In current example #'f is too trivial and it isn't shown on<br>
> the backtrace, but if we make more complex f and put it into the<br>
> source file, I can see its source with SWANK debugger.<br>
><br>
> So the question is: how do I say 'print (which is used as a function)<br>
> from 'list (which is used as mere data). If I treat any symbol<br>
> reference as a function, this would be obviously wrong.<br>
><br>
> As far as I can get it, I have to track how symbols are referenced. I<br>
> found already that #<acode immediate (PRINT)> is created in the<br>
> nx1-call-form, so I think I can extend acode to include the type of<br>
> reference. Also I found how info is extracted. So I can add a<br>
> bit-vector to a functions data which stores "1" if nth-immediate is a<br>
> function and 0 otherwise. But still I'm unable to find where this<br>
> immediate is recorded into the generated code, so I don't know how to<br>
> extend the set. Can anyone please give a hint?<br>
><br>
> Also, if my approach is definitely wrong somehow, please let me know.<br>
> ______________________________<wbr>_________________<br>
> Openmcl-devel mailing list<br>
> <a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
> <a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" rel="noreferrer" target="_blank">https://lists.clozure.com/<wbr>mailman/listinfo/openmcl-devel</a><br>
<br>
______________________________<wbr>_________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
<a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" rel="noreferrer" target="_blank">https://lists.clozure.com/<wbr>mailman/listinfo/openmcl-devel</a><br>
</div></div></blockquote></div><br></div>