"Through" button in Debugger

Denis Kudriashov dionisiydk at gmail.com
Mon Sep 3 09:23:14 UTC 2007


Hi all

"Through" button in Debugger does not work correct for expressions like:

 [:a | a + 2] valueWithArguments: #(4 ).

this block is executed.

But expression:

 [:a | a + 2] value: 4.

works ok - block will start to debug.

I found reason in

ContextPart>>doPrimitive: primitiveIndex method: meth receiver: receiver
args: argument
    "Simulate a primitive method whose index is primitiveIndex.  The
    simulated receiver and arguments are given as arguments to this
message."

    | value |
    <primitive: 19> "Simulation guard"
    "If successful, push result and return resuming context,
        else ^ PrimitiveFailToken"


    (primitiveIndex = 19) ifTrue:[
        ToolSet
            debugContext: self
            label:'Code simulation error'
            contents: nil].

    (primitiveIndex = 80 and: [receiver isKindOf: ContextPart])
        ifTrue: [^self push: ((BlockContext newForMethod: receiver home
method)
                        home: receiver home
                        startpc: pc + 2
                        nargs: (arguments at: 1))].
    (primitiveIndex = 81 and: [receiver isMemberOf: BlockContext])
        ifTrue: [^receiver pushArgs: arguments from: self].
    primitiveIndex = 83 "afr 9/11/1998 19:50"
        ifTrue: [^ self send: arguments first to: receiver
                    with: arguments allButFirst
                    super: false].
    primitiveIndex = 84 "afr 9/11/1998 19:50"
        ifTrue: [^ self send: arguments first to: receiver
                    with: (arguments at: 2)
                    super: false].
    primitiveIndex = 186 ifTrue: [ "closure value"
        | m |
        m _ receiver method.
        arguments size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: arguments
            receiver: receiver
            class: receiver class].
    primitiveIndex = 187 ifTrue: [ "closure valueWithArguments:"
        | m args |
        m _ receiver method.
        args _ arguments first.
        args size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: args
            receiver: receiver
            class: receiver class].
    primitiveIndex = 188 ifTrue: [ "object withArgs:executeMethod:"
        | m args |
        args _ arguments first.
        m _ arguments second.
        args size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: args
            receiver: receiver
            class: receiver class].
    arguments size > 6 ifTrue: [^ PrimitiveFailToken].
    primitiveIndex = 117
        ifTrue:[value _ self tryNamedPrimitiveIn: meth for: receiver
withArgs: arguments]
        ifFalse:[value _ receiver tryPrimitive: primitiveIndex withArgs:
arguments].
    value == PrimitiveFailToken
        ifTrue: [^ PrimitiveFailToken]
        ifFalse: [^ self push: value]

It checks primitive index for method under debug and choose how it must be
performed.
But index 82 (#valueWithArguments primitive) is absent.
I try correct method and add new line:
    (primitiveIndex = 82 and: [receiver isMemberOf: BlockContext])
        ifTrue: [^receiver pushArgs: arguments first from: self].

And now debugging by though button works right for expression  "[:a | a + 2]
valueWithArguments: #(4 )".
But maybe it fix kills other part of system.

I work in last Squeak.3.9.dev...image
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070903/e6a52280/attachment.htm


More information about the Squeak-dev mailing list