[squeak-dev] Re: Debugger: PLEASE READ [was Re: Request for feedback: mirrors]

David T. Lewis lewis at mail.msen.com
Wed May 23 21:13:22 UTC 2012


On Wed, May 23, 2012 at 12:30:48PM -0700, Eliot Miranda wrote:
> On Wed, May 23, 2012 at 12:04 PM, Andreas Raab <andreas.raab at gmx.de> wrote:
> 
> > On 5/23/2012 20:51, Eliot Miranda wrote:
> >
> >> So given that the Interpreter VM now supports the mirror primitives,
> >> does anyone object if I add the debugger changes to trunk that use the
> >> mirror primitives and hence make accurate debugging of proxies possible?
> >> The downside of doing this is that the debugger will be broken on
> >> older VMs.
> >>
> >
> > It should be possible to write the mirror prims relatively safely, e.g.:
> >
> > object: anObject instVarAt: anIndex
> >        "Primitive. Answer a fixed variable in an object. The numbering of
> > the
> >        variables corresponds to the named instance variables. Fail if the
> > index
> >        is not an Integer or is not the index of a fixed variable.
> > Essential for the
> >        debugger. See  Object documentation whatIsAPrimitive."
> >
> >        <primitive: 73>
> >        anIndex <= (self objectClass: anObject) instSize
> >                ifTrue:["Assume mirror primitives are missing"
> >                        ^anObject instVarAt: index]
> >                ifFalse:["Access beyond fixed variables."
> >                        ^self object: anObject basicAt: anIndex - (self
> > objectClass: anObject) instSize].
> >
> 
> That's a good idea.  Alas it doesn't work because the primitives won't fail
> on the older VMs.  Note that the same primitive is used for instVarAt: and
> object:instVarAt: (and likewise for object:instVarAt:put: & objectClass:
> etc).  The difference is that in the older VM the prims assume a fixed
> argument count and only pop that many objects from the stack.  Hence there
> is the potential of stack overflow in the older VMs.  In any case things
> are likely to limp along rather than fail catastrophically.  I'm not sure
> that that's a good thing or not ;)

Would it be possible to perform one test at image startup time to determine
if mirror primitive support is present, and handle things accordingly from
then on?

Dave



More information about the Squeak-dev mailing list