Skip to content

Debug action events small improvements #926

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

Open
wants to merge 7 commits into
base: Pharo13
Choose a base branch
from
48 changes: 33 additions & 15 deletions src/NewTools-Debugger/StDebuggerActionModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,6 @@ StDebuggerActionModel >> isInterruptedContextSubclassResponsibilityException [
^ self contextPredicate isContextSubclassResponsibilityException
]

{ #category : 'instance creation' }
StDebuggerActionModel >> newStepAnnouncement [

^ (StDebuggerActionModelStepAnnouncement debuggerActionModel: self)
]

{ #category : 'debug - execution' }
StDebuggerActionModel >> peelToFirstLike: aContext [
self session peelToFirstLike: aContext.
Expand Down Expand Up @@ -306,6 +300,12 @@ StDebuggerActionModel >> predicateFor: aContext postMortem: isContextPostMortem
yourself
]

{ #category : 'accessing' }
StDebuggerActionModel >> preventUpdate [

^ preventUpdate ifNil: [ preventUpdate := false ]
]

{ #category : 'updating' }
StDebuggerActionModel >> preventUpdatesDuring: aBlock [

Expand Down Expand Up @@ -373,14 +373,13 @@ StDebuggerActionModel >> referenceContext [
{ #category : 'events - handling' }
StDebuggerActionModel >> registerActionsForSession: aSession [

self flag: 'Rewrite it'.
aSession ifNotNil: [
aSession
when: #restart send: #updateRestart to: self;
when: #resume send: #updateResume to: self;
when: #stepInto send: #updateStep to: self;
when: #stepOver send: #updateStep to: self;
when: #stepThrough send: #updateStep to: self;
when: #stepOver send: #updateStepOver to: self;
when: #stepThrough send: #updateStepThrough to: self;
when: #contextChanged send: #updateContextChanged to: self;
when: #clear send: #clear to: self ]
]
Expand Down Expand Up @@ -454,6 +453,12 @@ StDebuggerActionModel >> shouldFilterStack [
^ self filterStack and: [ self class shouldFilterStack ]
]

{ #category : 'actions' }
StDebuggerActionModel >> sourceNodeExecuted [

^self referenceContext ifNotNil:[:ctx| ctx sourceNodeExecuted]
]

{ #category : 'accessing - variables' }
StDebuggerActionModel >> stack [
^ self session stack
Expand Down Expand Up @@ -550,7 +555,7 @@ StDebuggerActionModel >> updateAfterMethodAdded [
self)
]

{ #category : 'instance creation' }
{ #category : 'updating' }
StDebuggerActionModel >> updateContextChanged [

self updateIfAble:
Expand Down Expand Up @@ -591,8 +596,7 @@ StDebuggerActionModel >> updateIfAble [
{ #category : 'accessing' }
StDebuggerActionModel >> updateIfAble: anAnnouncement [

preventUpdate ifNil: [ ^ self ].
preventUpdate ifFalse: [ self update: anAnnouncement ]
self preventUpdate ifFalse: [ self update: anAnnouncement ]
]

{ #category : 'announcement' }
Expand All @@ -603,18 +607,32 @@ StDebuggerActionModel >> updateRestart [
self)
]

{ #category : 'instance creation' }
{ #category : 'updating' }
StDebuggerActionModel >> updateResume [

self updateIfAble:
(StDebuggerActionModelResumeAnnouncement debuggerActionModel: self)
]

{ #category : 'instance creation' }
{ #category : 'updating' }
StDebuggerActionModel >> updateStep [

self updateIfAble:
(StDebuggerActionModelStepAnnouncement debuggerActionModel: self)
(StDebuggerActionModelStepAnnouncement stepInto: self)
]

{ #category : 'updating' }
StDebuggerActionModel >> updateStepOver [

self updateIfAble:
(StDebuggerActionModelStepAnnouncement stepOver: self)
]

{ #category : 'updating' }
StDebuggerActionModel >> updateStepThrough [

self updateIfAble:
(StDebuggerActionModelStepAnnouncement stepThrough: self)
]

{ #category : 'context' }
Expand Down
17 changes: 15 additions & 2 deletions src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Class {
#name : 'StDebuggerActionModelAnnouncement',
#superclass : 'Announcement',
#instVars : [
'debuggerActionModel'
'debuggerActionModel',
'node'
],
#category : 'NewTools-Debugger-Model',
#package : 'NewTools-Debugger',
Expand All @@ -12,7 +13,7 @@ Class {
{ #category : 'instance creation' }
StDebuggerActionModelAnnouncement class >> debuggerActionModel: aDebuggerActionModel [

^ self new debuggerActionModel: aDebuggerActionModel
^ self new on: aDebuggerActionModel
]

{ #category : 'accessing' }
Expand All @@ -26,3 +27,15 @@ StDebuggerActionModelAnnouncement >> debuggerActionModel: aDebuggerActionModel [

debuggerActionModel := aDebuggerActionModel
]

{ #category : 'accessing' }
StDebuggerActionModelAnnouncement >> node [

^ node
]

{ #category : 'initialize' }
StDebuggerActionModelAnnouncement >> on: aDebuggerActionModel [

self debuggerActionModel: aDebuggerActionModel
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ Class {
#package : 'NewTools-Debugger',
#tag : 'Model'
}

{ #category : 'initialize' }
StDebuggerActionModelContextChangedAnnouncement >> on: aDebuggerActionModel [

super on: aDebuggerActionModel.
node := aDebuggerActionModel sourceNodeExecuted methodNode
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ Class {
#package : 'NewTools-Debugger',
#tag : 'Model'
}

{ #category : 'initialize' }
StDebuggerActionModelRestartAnnouncement >> on: aDebuggerActionModel [

super on: aDebuggerActionModel.
node := aDebuggerActionModel sourceNodeExecuted methodNode
]

{ #category : 'printing' }
StDebuggerActionModelRestartAnnouncement >> printOn: aStream [
aStream << 'Restart context'
]
Original file line number Diff line number Diff line change
@@ -1,7 +1,63 @@
Class {
#name : 'StDebuggerActionModelStepAnnouncement',
#superclass : 'StDebuggerActionModelAnnouncement',
#instVars : [
'step'
],
#category : 'NewTools-Debugger-Model',
#package : 'NewTools-Debugger',
#tag : 'Model'
}

{ #category : 'debugging actions' }
StDebuggerActionModelStepAnnouncement class >> stepInto: aDebuggerActionModel [

^ (self debuggerActionModel: aDebuggerActionModel)
stepInto;
yourself
]

{ #category : 'debugging actions' }
StDebuggerActionModelStepAnnouncement class >> stepOver: aDebuggerActionModel [

^ (self debuggerActionModel: aDebuggerActionModel)
stepOver;
yourself
]

{ #category : 'debugging actions' }
StDebuggerActionModelStepAnnouncement class >> stepThrough: aDebuggerActionModel [

^ (self debuggerActionModel: aDebuggerActionModel)
stepThrough;
yourself
]

{ #category : 'initialize' }
StDebuggerActionModelStepAnnouncement >> on: aDebuggerActionModel [

super on: aDebuggerActionModel.
node := aDebuggerActionModel sourceNodeExecuted
]

{ #category : 'printing' }
StDebuggerActionModelStepAnnouncement >> printOn: aStream [
aStream << 'Step'.
aStream space.
aStream << step
]

{ #category : 'actions' }
StDebuggerActionModelStepAnnouncement >> stepInto [
step := 'into'
]

{ #category : 'actions' }
StDebuggerActionModelStepAnnouncement >> stepOver [
step := 'over'
]

{ #category : 'actions' }
StDebuggerActionModelStepAnnouncement >> stepThrough [
step := 'through'
]
Loading