"Through" button in Debugger

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

"Through" button in Debugger

Denis Kudriashov
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



Reply | Threaded
Open this post in threaded view
|

Re: "Through" button in Debugger

Jason Johnson-5
Did you make a mantis report, tests and that stuff?  If so maybe it
can make it in 3.10, which would be nice.  It sucks to have long
standing bugs in major system components.

On 9/3/07, Denis Kudriashov <[hidden email]> wrote:

> 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
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: "Through" button in Debugger

Denis Kudriashov


2007/9/3, Jason Johnson <[hidden email]>:
Did you make a mantis report, tests and that stuff?  If so maybe it
can make it in 3.10, which would be nice.  It sucks to have long
standing bugs in major system components.


Yes, I make mantis report about this problem