[Openmcl-devel] Trying to build a single stepper

Bill St. Clair wws at clozure.com
Thu Jan 18 08:29:53 PST 2018


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.

On Thu, Jan 18, 2018 at 11:17 AM, Ron Garret <ron at flownet.com> wrote:

> Rather than write your own wrapper you should consider using the advice
> facility built in to CCL:
>
> https://ccl.clozure.com/manual/chapter4.3.html#Advising
>
> On Jan 18, 2018, at 7:41 AM, 73budden . <budden73 at gmail.com> wrote:
>
> > Hi!
> >
> > I'm trying to build a single stepper for compiled functions in CCL
> > (vanilla "Visual Basic" like "debugger").
> >
> > My current idea is to find all function references (subset of
> > ccl::lfunloop scope) and
> > replace all of them with function wrappers. E.g. I have a function
> > which I want to make steppable:
> >
> > (defun f () (print 'list))
> >
> > It references PRINT as a symbol.
> > (lfunloop for v in #'f do (print v)) returns:
> >
> > LIST
> > PRINT
> > F
> >
> > Then I do:
> > CCL>(compile (defun my-wrapped-print (&rest args) (break "About to
> > call print with ~S" args) (apply #'print args)))
> > MY-WRAPPED-PRINT
> >
> > And
> > CCL>(%set-nth-immediate #'f 1 'MY-WRAPPED-PRINT)
> >
> > Then, when I run (f), debugger is invoked while trying to call
> > "print". In current example #'f is too trivial and it isn't shown on
> > the backtrace, but if we make more complex f and put it into the
> > source file, I can see its source with SWANK debugger.
> >
> > So the question is: how do I say 'print (which is used as a function)
> > from 'list (which is used as mere data). If I treat any symbol
> > reference as a function, this would be obviously wrong.
> >
> > As far as I can get it, I have to track how symbols are referenced. I
> > found already that #<acode immediate (PRINT)> is created in the
> > nx1-call-form, so I think I can extend acode to include the type of
> > reference. Also I found how info is extracted. So I can add a
> > bit-vector to a functions data which stores "1" if nth-immediate is a
> > function and 0 otherwise. But still I'm unable to find where this
> > immediate is recorded into the generated code, so I don't know how to
> > extend the set. Can anyone please give a hint?
> >
> > Also, if my approach is definitely wrong somehow, please let me know.
> > _______________________________________________
> > Openmcl-devel mailing list
> > Openmcl-devel at clozure.com
> > https://lists.clozure.com/mailman/listinfo/openmcl-devel
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20180118/fd69a360/attachment.htm>


More information about the Openmcl-devel mailing list