Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental solution for step through interpreting the full flow issue #16351 #17308

Draft
wants to merge 26 commits into
base: Pharo13
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1c93efa
Using unknownBytecode to improve the step through implementation
tesonep Oct 12, 2024
03b5a96
Fixing critics
tesonep Oct 12, 2024
6b05d8d
SDL2: Ignore repeated events
iglosiggio Oct 18, 2024
b39e71b
Instead of removing all repeat events just try to match with and with…
iglosiggio Oct 18, 2024
73d4ec0
Rename the argument to KeyboardEvent>>#isRepeat:
iglosiggio Oct 19, 2024
10a2336
isRepeat is `false` by default for KeyboardEvent-s
iglosiggio Oct 21, 2024
596aa40
Merge 73d4ec066d4db585d246331a66ab4b8f2391116f
iglosiggio Oct 21, 2024
b27b2a4
Improvements in undo/redo
guillep Oct 21, 2024
32472c6
Add a test for the new behavior of the dispatcher
iglosiggio Oct 21, 2024
4644c40
Temporarily creating tests for stepping through using the EnhancedDeb…
carolahp Oct 21, 2024
238aaf5
Merge pull request #17305 from guillep/undo-fixes
Ducasse Oct 22, 2024
9b55ea4
Merge pull request #17301 from iglosiggio/fixup-repeat-events
Ducasse Oct 22, 2024
4de0deb
Major update of the Keymap Descriptions to a first version of a Short…
hernanmd Oct 23, 2024
2beea03
Update KMDescriptionPresenter.class.st
hernanmd Oct 23, 2024
3fc240c
Do not use method extensions for Commander activations
Oct 25, 2024
98c493a
Updated dependencies
hernanmd Oct 25, 2024
742a8bb
Fix typo in "heigh"
koendehondt Oct 25, 2024
005f866
Merge pull request #17317 from koendehondt/gh17229
MarcusDenker Oct 25, 2024
ca55b77
Merge pull request #17311 from hernanmd/p13-enh-shortcuts-editor
jecisc Oct 26, 2024
e4a87e7
Merge 4644c40ec9adc14176e5fe48adbf40509eddc754
tesonep Oct 31, 2024
5b99683
Adding more tests to the EnhancedDebugSession
tesonep Oct 31, 2024
679822c
- Adding more tests
tesonep Nov 8, 2024
3422804
The Bytecode interpreter should do the same that the VM, it should no…
tesonep Nov 12, 2024
cd6d853
Adding a test using a block in another process
tesonep Nov 15, 2024
5d96818
Adding implementation with HaltingBlock
tesonep Nov 15, 2024
450b838
Halting only if we are stepping
tesonep Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/Commander-Activators-Shortcut/CmdShortcutActivation.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ CmdShortcutActivation class >> settingInputWidgetForNode: aShortcutSetting [
^ theme newRow: {catcherMorph}
]

{ #category : 'accessing' }
CmdShortcutActivation >> action [
"Answer a <CompiledMethod> defining the receiver's action"

^ self annotatedClass class lookupSelector: self declarationSelector
]

{ #category : 'settings' }
CmdShortcutActivation >> buildSettingNodeOn: aBuilder [
| nodeBuilder |
Expand All @@ -91,6 +98,15 @@ CmdShortcutActivation >> buildSettingNodeOn: aBuilder [
^nodeBuilder
]

{ #category : 'printing' }
CmdShortcutActivation >> description [
"Answer a <String> describing the receiver. We use the `action` method comments to retrieve the description"

^ self action comment
ifNil: [ String empty ]
ifNotNil: [ : comm | comm ]
]

{ #category : 'accessing' }
CmdShortcutActivation >> keyCombination [
^ keyCombination
Expand All @@ -101,6 +117,12 @@ CmdShortcutActivation >> keyCombination: anObject [
keyCombination := anObject
]

{ #category : 'printing' }
CmdShortcutActivation >> name [

^ self declarationSelector asString
]

{ #category : 'printing' }
CmdShortcutActivation >> printOn: aStream [
super printOn: aStream.
Expand All @@ -109,6 +131,26 @@ CmdShortcutActivation >> printOn: aStream [
aStream nextPut: $)
]

{ #category : 'printing' }
CmdShortcutActivation >> scope [
"The receiver's scope is the package name where is installed"

^ self annotatedClass packageName
]

{ #category : 'printing' }
CmdShortcutActivation >> scopeName [

^ self scope asString
]

{ #category : 'printing' }
CmdShortcutActivation >> shortcut [
"Answer a <String> representation of the receiver's key combination"

^ self keyCombination asString
]

{ #category : 'command execution' }
CmdShortcutActivation >> tryExecuteCommandInContext: aToolContext byEvents: anEventBuffer [

Expand Down
13 changes: 13 additions & 0 deletions src/Debugger-Model-Tests/EnhancedStepThroughTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Class {
#name : 'EnhancedStepThroughTest',
#superclass : 'StepThroughTest',
#category : 'Debugger-Model-Tests-Core',
#package : 'Debugger-Model-Tests',
#tag : 'Core'
}

{ #category : 'utilities' }
EnhancedStepThroughTest >> settingUpSessionAndProcessAndContextForBlock: aBlock [
super settingUpSessionAndProcessAndContextForBlock: aBlock.
session := process newEnhancedDebugSessionNamed: 'test session' startedAt: context
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Class {
#name : 'EnhancedStepThroughWithHaltingBlockTest',
#superclass : 'StepThroughTest',
#category : 'Debugger-Model-Tests-Core',
#package : 'Debugger-Model-Tests',
#tag : 'Core'
}

{ #category : 'utilities' }
EnhancedStepThroughWithHaltingBlockTest >> settingUpSessionAndProcessAndContextForBlock: aBlock [

super settingUpSessionAndProcessAndContextForBlock: aBlock.
session := EnhancedDebugSessionWithHaltingBlock named: 'test session' on: process startedAt: context


]
230 changes: 220 additions & 10 deletions src/Debugger-Model-Tests/StepThroughTest.class.st
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
Class {
#name : 'StepThroughTest',
#superclass : 'DebuggerTest',
#instVars : [
'aBlock',
'failed'
],
#category : 'Debugger-Model-Tests-Core',
#package : 'Debugger-Model-Tests',
#tag : 'Core'
}

{ #category : 'helper' }
StepThroughTest >> evalBlock: aBlockClosure afterLoop: remainingCount [

remainingCount = 1 ifTrue: [ ^ aBlockClosure value ].

^ self evalBlock: aBlockClosure afterLoop: remainingCount - 1.

]

{ #category : 'helper' }
StepThroughTest >> evalBlockThenReturnOne: aBlock [
aBlock value.
Expand Down Expand Up @@ -38,6 +51,77 @@ StepThroughTest >> stepB3 [
^ 43
]

{ #category : 'helper' }
StepThroughTest >> stepC1 [
self evalBlock: [ self stepC2 ] afterLoop: 100
]

{ #category : 'helper' }
StepThroughTest >> stepC2 [

^ 5
]

{ #category : 'helper' }
StepThroughTest >> stepD1 [

aBlock := [ 2 + 3 ].

self stepD2

]

{ #category : 'helper' }
StepThroughTest >> stepD2 [

aBlock value
]

{ #category : 'helper' }
StepThroughTest >> stepE1 [

| tmpBlock |
tmpBlock := [ 2 - 3 ].

self evalBlockThenReturnOne: tmpBlock
]

{ #category : 'helper' }
StepThroughTest >> stepF1 [

| tmpBlock |
tmpBlock := [ 2 - 3 ].

tmpBlock value
]

{ #category : 'helper' }
StepThroughTest >> stepG1 [

| sem |

sem := Semaphore new.

self stepG2: [ 1 + 3 ] sem: sem.

]

{ #category : 'helper' }
StepThroughTest >> stepG2: aTmp sem: sem [

[
sem wait.
[
aTmp value.
failed := false ] on: Exception do: [ failed := true ] ] forkAt:
Processor activePriority + 1.

sem signal.

[ failed isNil ] whileTrue: [ Processor yield ].

]

{ #category : 'tests' }
StepThroughTest >> testStepThrough [
"In a context c, define a block b, send a message to another method to get b evaluated.
Expand All @@ -48,15 +132,15 @@ StepThroughTest >> testStepThrough [
session stepInto.
"Reached node 'self evalBlockThenReturnOne: [self stepA2]' of method stepA1"
"Checking that the execution is indeed at this node"
self assert: (session interruptedContext method) equals: (self class>>#stepA1).
node := self class>>#stepA1 sourceNodeForPC: session interruptedContext pc.
self assert: (session interruptedContext method) equals: (self class lookupSelector: #stepA1).
node := (self class lookupSelector: #stepA1) sourceNodeForPC: session interruptedContext pc.
self assert: node isMessage.
self assert: node receiver isSelfVariable.
self assert: node selector equals: #evalBlockThenReturnOne:.
session stepThrough.

"With fullblocks the method of the suspended context is a compiledBlock, not the method having it"
expectedMethod := (self class >> #stepA1) literalAt: 1 .
expectedMethod := (self class lookupSelector: #stepA1) literalAt: 1 .

"Checking that after the step through, the execution is at the 'self stepA2' node of the stepA1 method"
self assert: (session interruptedContext method) equals: expectedMethod.
Expand All @@ -72,34 +156,160 @@ StepThroughTest >> testStepThroughDoesTheSameThingAsStepOverWhenNoBlockIsInvolve
| node |

self settingUpSessionAndProcessAndContextForBlock: [ self stepB1 ].
[session interruptedContext method == (self class>>#stepB1)]
[session interruptedContext method == (self class lookupSelector: #stepB1)]
whileFalse: [ session stepInto ].

"Reached node 'self stepB2' of method stepB1"
self assert: session interruptedContext method equals: self class>>#stepB1.
self assert: session interruptedContext method equals: (self class lookupSelector:#stepB1).
session stepOver.
self assert: (session interruptedContext method) equals: (self class>>#stepB1).
self assert: (session interruptedContext method) equals: (self class lookupSelector:#stepB1).
"Checking that after the step over, we reached the node 'self stepB3' of method stepB1"
node := self class>>#stepB1 sourceNodeForPC: session interruptedContext pc.
node := (self class lookupSelector:#stepB1) sourceNodeForPC: session interruptedContext pc.
self assert: node isMessage.
self assert: node receiver isSelfVariable.
self assert: node selector equals: #stepB3.

"Set up the debugged execution again"
self settingUpSessionAndProcessAndContextForBlock: [ self stepB1 ].
[session interruptedContext method == (self class>>#stepB1)]
[session interruptedContext method == (self class lookupSelector:#stepB1)]
whileFalse: [ session stepInto ].

"Reached node 'self stepB2' of method stepB1"
self assert: session interruptedContext method equals: self class>>#stepB1.
self assert: session interruptedContext method equals: (self class lookupSelector:#stepB1).
session stepThrough.
"Checking that after the step through, we reached the node 'self stepB3' of method stepB1 (the same node that was reached with the step over"
node := self class>>#stepB1 sourceNodeForPC: session interruptedContext pc.
node := (self class lookupSelector:#stepB1) sourceNodeForPC: session interruptedContext pc.
self assert: node isMessage.
self assert: node receiver isSelfVariable.
self assert: node selector equals: #stepB3
]

{ #category : 'tests' }
StepThroughTest >> testStepThroughInABlockInAInstanceVariable [
"In a context c, define a block b, send a message to another method to get b evaluated.
Testing that a step through on this message send moves the execution to the point where the block b is about to be evaluated."
| node expectedMethod |

self settingUpSessionAndProcessAndContextForBlock: [ self stepD1 ].

session stepInto.
session stepInto.
session stepInto.

"Reached node 'self evalBlock: [ self stepC2 ] afterLoop: 10' of method stepC1"
"Checking that the execution is indeed at this node"
self assert: (session interruptedContext method) equals: (self class lookupSelector: #stepD1).
node := (self class lookupSelector:#stepD1) sourceNodeForPC: session interruptedContext pc.

session stepThrough.

"With fullblocks the method of the suspended context is a compiledBlock, not the method having it"
expectedMethod := (self class lookupSelector: #stepD1) literalAt: 1 .

"Checking that after the step through, the execution is at the 'self stepA2' node of the stepA1 method"
self assert: (session interruptedContext method) equals: expectedMethod.
node := expectedMethod sourceNodeForPC: session interruptedContext pc.
self assert: node isMessage.
self assert: node receiver value equals: 2.
self assert: node selector equals: #+
]

{ #category : 'tests' }
StepThroughTest >> testStepThroughInABlockInATemporary [

| node expectedMethod |

self settingUpSessionAndProcessAndContextForBlock: [ self stepE1 ].

session stepInto.
session stepInto.
session stepInto.

self assert: (session interruptedContext method) equals: (self class lookupSelector: #stepE1).
node := (self class lookupSelector:#stepE1) sourceNodeForPC: session interruptedContext pc.

session stepThrough.

"With fullblocks the method of the suspended context is a compiledBlock, not the method having it"
expectedMethod := (self class lookupSelector: #stepE1) literalAt: 1 .

"Checking that after the step through, the execution is at the 'self stepA2' node of the stepA1 method"
self assert: (session interruptedContext method) equals: expectedMethod.
node := expectedMethod sourceNodeForPC: session interruptedContext pc.
self assert: node isMessage.
self assert: node receiver value equals: 2.
self assert: node selector equals: #-
]

{ #category : 'tests' }
StepThroughTest >> testStepThroughInABlockInATemporaryDirectly [

| node expectedMethod |

self settingUpSessionAndProcessAndContextForBlock: [ self stepF1 ].

session stepInto.
session stepInto.
session stepInto.

self assert: (session interruptedContext method) equals: (self class lookupSelector: #stepF1).
node := (self class lookupSelector:#stepF1) sourceNodeForPC: session interruptedContext pc.

session stepThrough.

"With fullblocks the method of the suspended context is a compiledBlock, not the method having it"
expectedMethod := (self class lookupSelector: #stepF1) literalAt: 1 .

"Checking that after the step through, the execution is at the 'self stepA2' node of the stepA1 method"
self assert: (session interruptedContext method) equals: expectedMethod.
node := expectedMethod sourceNodeForPC: session interruptedContext pc.
self assert: node isMessage.
self assert: node receiver value equals: 2.
self assert: node selector equals: #-
]

{ #category : 'tests' }
StepThroughTest >> testStepThroughInOtherProcess [

self settingUpSessionAndProcessAndContextForBlock: [ self stepG1 ].

session stepInto.

session stepThrough.
session stepThrough.
session stepThrough.
session stepThrough.

self deny: failed.
]

{ #category : 'tests' }
StepThroughTest >> testStepThroughLonger [
"In a context c, define a block b, send a message to another method to get b evaluated.
Testing that a step through on this message send moves the execution to the point where the block b is about to be evaluated."
| node expectedMethod |

self settingUpSessionAndProcessAndContextForBlock: [ self stepC1 ].
session stepInto.
session stepInto.
"Reached node 'self evalBlock: [ self stepC2 ] afterLoop: 10' of method stepC1"
"Checking that the execution is indeed at this node"
self assert: (session interruptedContext method) equals: (self class lookupSelector:#stepC1).
node := (self class lookupSelector:#stepC1) sourceNodeForPC: session interruptedContext pc.

session stepThrough.

"With fullblocks the method of the suspended context is a compiledBlock, not the method having it"
expectedMethod := (self class lookupSelector: #stepC1) literalAt: 1 .

"Checking that after the step through, the execution is at the 'self stepA2' node of the stepA1 method"
self assert: (session interruptedContext method) equals: expectedMethod.
node := expectedMethod sourceNodeForPC: session interruptedContext pc.
self assert: node isMessage.
self assert: node receiver isSelfVariable.
self assert: node selector equals: #stepC2
]

{ #category : 'tests' }
StepThroughTest >> testStepThroughUntilTermination [
"Stepping over a message node brings the execution to the next node in the same method."
Expand Down
Loading