diff --git a/Sindarin-Tests/SindarinDebuggerTest.class.st b/Sindarin-Tests/SindarinDebuggerTest.class.st index 841d673..d38a5f0 100644 --- a/Sindarin-Tests/SindarinDebuggerTest.class.st +++ b/Sindarin-Tests/SindarinDebuggerTest.class.st @@ -568,22 +568,7 @@ SindarinDebuggerTest >> testSkip [ self assert: p equals: Point ] -{ #category : #tests } -SindarinDebuggerTest >> testSkipSkipsMessagesByPuttingReceiverOnStack [ - - | a scdbg | - a := 1. - scdbg := SindarinDebugger - debug: [ a := a + 2 ]. - self assert: a equals: 1. - - scdbg skip. - scdbg step. - - self assert: a equals: 1 -] - -{ #category : #tests } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipAssignmentWithStoreIntoBytecodePushesReplacementValueButNotWithPopIntoBytecode [ | a b dbg aFormerValue bFormerValue | @@ -612,6 +597,40 @@ SindarinDebuggerTest >> testSkipAssignmentWithStoreIntoBytecodePushesReplacement self assert: a equals: aFormerValue ] +{ #category : #tests } +SindarinDebuggerTest >> testSkipSkipsMessagesByPuttingReceiverOnStack [ + + | a scdbg | + a := 1. + scdbg := SindarinDebugger + debug: [ a := a + 2 ]. + self assert: a equals: 1. + + scdbg skip. + scdbg step. + + self assert: a equals: 1 +] + +{ #category : #tests } +SindarinDebuggerTest >> testSkipSkipsSuperSendBytecodesCorrectly [ + + | a scdbg oldValueOfA negatedContext | + a := ScaledDecimal newFromNumber: 3 scale: 2. + scdbg := SindarinDebugger debug: [ a := a negated ]. + oldValueOfA := a. + + scdbg + step; + stepOver; + skip. + negatedContext := scdbg context. + scdbg stepUntil: [ scdbg context == negatedContext ]. + scdbg stepOver. + + self assert: a equals: oldValueOfA +] + { #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipThroughNode [ | dbg realExecPC realValueOfA targetExecNode realExecTopStack nodeAfterSkipThrough | diff --git a/Sindarin/SindarinDebugger.class.st b/Sindarin/SindarinDebugger.class.st index e7502de..4d0a5ce 100644 --- a/Sindarin/SindarinDebugger.class.st +++ b/Sindarin/SindarinDebugger.class.st @@ -360,6 +360,13 @@ SindarinDebugger >> method [ ^ self context method ] +{ #category : #'accessing - bytes' } +SindarinDebugger >> nextBytecode [ + + ^ self currentBytecode detect: [ :each | + each offset = self context pc ] +] + { #category : #astAndAstMapping } SindarinDebugger >> node [ "Returns the AST node about to be executed by the top context of the execution" @@ -572,7 +579,7 @@ SindarinDebugger >> skipMessageNode [ self node arguments do: [ :arg | self context pop ]. "Pop the arguments of the message send from the context's value stack" "Increase the pc to go over the message send" - self context pc: self context pc + 1. + self context pc: self context pc + self nextBytecode bytes size. "Execute bytecodes the debugger usually executes without stopping the execution (for example popping the return value of the just executed message send if it is not used afterwards)" self debugSession stepToFirstInterestingBytecodeIn: self debugSession interruptedProcess @@ -587,7 +594,7 @@ SindarinDebugger >> skipMessageNodeWith: replacementValue [ "Push the replacement value on the context's value stack, to simulate that the message send happened and returned nil" self context push: replacementValue. "Increase the pc to go over the message send" - self context pc: self context pc + 1. + self context pc: self context pc + self nextBytecode bytes size. "Execute bytecodes the debugger usually executes without stopping the execution (for example popping the return value of the just executed message send if it is not used afterwards)" self debugSession stepToFirstInterestingBytecodeIn: self debugSession interruptedProcess