From 25c7687ca030675ddd159e6f37f3a688f990dd79 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:44:37 +0100 Subject: [PATCH 1/7] Lazy accessor instead of nil check --- src/NewTools-Debugger/StDebuggerActionModel.class.st | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index 2a68da953..e1579bad6 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -306,6 +306,12 @@ StDebuggerActionModel >> predicateFor: aContext postMortem: isContextPostMortem yourself ] +{ #category : 'accessing' } +StDebuggerActionModel >> preventUpdate [ + + ^ preventUpdate ifNil: [ preventUpdate := false ] +] + { #category : 'updating' } StDebuggerActionModel >> preventUpdatesDuring: aBlock [ @@ -591,8 +597,7 @@ StDebuggerActionModel >> updateIfAble [ { #category : 'accessing' } StDebuggerActionModel >> updateIfAble: anAnnouncement [ - preventUpdate ifNil: [ ^ self ]. - preventUpdate ifFalse: [ self update: anAnnouncement ] + self preventUpdate ifFalse: [ self update: anAnnouncement ] ] { #category : 'announcement' } From 4a1abb43e459f5a49adfaf23627c515a0a258606 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:16:42 +0100 Subject: [PATCH 2/7] Improving event model of debugger actions --- .../StDebuggerActionModel.class.st | 28 ++++++++----- ...buggerActionModelStepAnnouncement.class.st | 42 +++++++++++++++++++ 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index e1579bad6..de24ab39f 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -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. @@ -556,7 +550,7 @@ StDebuggerActionModel >> updateAfterMethodAdded [ self) ] -{ #category : 'instance creation' } +{ #category : 'updating' } StDebuggerActionModel >> updateContextChanged [ self updateIfAble: @@ -608,18 +602,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' } diff --git a/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st index 6f1a8cce5..85a096f31 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st @@ -1,7 +1,49 @@ 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 : 'actions' } +StDebuggerActionModelStepAnnouncement >> stepInto [ + step := 'into' +] + +{ #category : 'actions' } +StDebuggerActionModelStepAnnouncement >> stepOver [ + step := 'over' +] + +{ #category : 'actions' } +StDebuggerActionModelStepAnnouncement >> stepThrough [ + step := 'through' +] From 2416606c6f24bb9696ccc36e5fd3a65d4c12ebeb Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:17:27 +0100 Subject: [PATCH 3/7] Plugging the debugger events register to new stepping events updates --- src/NewTools-Debugger/StDebuggerActionModel.class.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index de24ab39f..8836a1a14 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -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 ] ] From c52ac3735a95cf1703dd7db06366586304f5815a Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:05:36 +0100 Subject: [PATCH 4/7] More information about debug actions --- src/NewTools-Debugger/StDebuggerActionModel.class.st | 5 +++++ .../StDebuggerActionModelAnnouncement.class.st | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index 8836a1a14..731d606ab 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -453,6 +453,11 @@ StDebuggerActionModel >> shouldFilterStack [ ^ self filterStack and: [ self class shouldFilterStack ] ] +{ #category : 'actions' } +StDebuggerActionModel >> sourceNodeExecuted [ + ^self referenceContext sourceNodeExecuted +] + { #category : 'accessing - variables' } StDebuggerActionModel >> stack [ ^ self session stack diff --git a/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st index a4ef8adfa..d6f4de474 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st @@ -2,7 +2,8 @@ Class { #name : 'StDebuggerActionModelAnnouncement', #superclass : 'Announcement', #instVars : [ - 'debuggerActionModel' + 'debuggerActionModel', + 'node' ], #category : 'NewTools-Debugger-Model', #package : 'NewTools-Debugger', @@ -26,3 +27,10 @@ StDebuggerActionModelAnnouncement >> debuggerActionModel: aDebuggerActionModel [ debuggerActionModel := aDebuggerActionModel ] + +{ #category : 'accessing' } +StDebuggerActionModelAnnouncement >> on: aDebuggerActionModel [ + + self debuggerActionModel: aDebuggerActionModel. + node := aDebuggerActionModel sourceNodeExecuted +] From c1cf1d9188ea5e04be8bf755618484b2213a117f Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:21:50 +0100 Subject: [PATCH 5/7] Debug action event accessors, safe context access, with the node upon which the action was done. --- src/NewTools-Debugger/StDebuggerActionModel.class.st | 3 ++- .../StDebuggerActionModelAnnouncement.class.st | 10 ++++++++-- .../StDebuggerActionModelClearAnnouncement.class.st | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index 731d606ab..b1e6ada7f 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -455,7 +455,8 @@ StDebuggerActionModel >> shouldFilterStack [ { #category : 'actions' } StDebuggerActionModel >> sourceNodeExecuted [ - ^self referenceContext sourceNodeExecuted + + ^self referenceContext ifNotNil:[:ctx| ctx sourceNodeExecuted] ] { #category : 'accessing - variables' } diff --git a/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st index d6f4de474..67ec44633 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st @@ -13,7 +13,7 @@ Class { { #category : 'instance creation' } StDebuggerActionModelAnnouncement class >> debuggerActionModel: aDebuggerActionModel [ - ^ self new debuggerActionModel: aDebuggerActionModel + ^ self new on: aDebuggerActionModel ] { #category : 'accessing' } @@ -29,8 +29,14 @@ StDebuggerActionModelAnnouncement >> debuggerActionModel: aDebuggerActionModel [ ] { #category : 'accessing' } +StDebuggerActionModelAnnouncement >> node [ + + ^ node +] + +{ #category : 'initialize' } StDebuggerActionModelAnnouncement >> on: aDebuggerActionModel [ self debuggerActionModel: aDebuggerActionModel. - node := aDebuggerActionModel sourceNodeExecuted + node := aDebuggerActionModel sourceNodeExecuted ] diff --git a/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st index 2a652509b..a47b984ee 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st @@ -5,3 +5,9 @@ Class { #package : 'NewTools-Debugger', #tag : 'Model' } + +{ #category : 'initialize' } +StDebuggerActionModelClearAnnouncement >> on: aDebuggerActionModel [ + + self debuggerActionModel: aDebuggerActionModel. +] From f14ac51870342bb492e00a979d8d14ea42d4e25b Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:24:29 +0100 Subject: [PATCH 6/7] Cleaner instantiation code over the debug action hierarchy --- .../StDebuggerActionModelAnnouncement.class.st | 3 +-- .../StDebuggerActionModelClearAnnouncement.class.st | 6 ------ ...tDebuggerActionModelContextChangedAnnouncement.class.st | 7 +++++++ .../StDebuggerActionModelRestartAnnouncement.class.st | 7 +++++++ .../StDebuggerActionModelStepAnnouncement.class.st | 7 +++++++ 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st index 67ec44633..5cbdf05b3 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelAnnouncement.class.st @@ -37,6 +37,5 @@ StDebuggerActionModelAnnouncement >> node [ { #category : 'initialize' } StDebuggerActionModelAnnouncement >> on: aDebuggerActionModel [ - self debuggerActionModel: aDebuggerActionModel. - node := aDebuggerActionModel sourceNodeExecuted + self debuggerActionModel: aDebuggerActionModel ] diff --git a/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st index a47b984ee..2a652509b 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelClearAnnouncement.class.st @@ -5,9 +5,3 @@ Class { #package : 'NewTools-Debugger', #tag : 'Model' } - -{ #category : 'initialize' } -StDebuggerActionModelClearAnnouncement >> on: aDebuggerActionModel [ - - self debuggerActionModel: aDebuggerActionModel. -] diff --git a/src/NewTools-Debugger/StDebuggerActionModelContextChangedAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelContextChangedAnnouncement.class.st index 4d01145ec..30094fb01 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelContextChangedAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelContextChangedAnnouncement.class.st @@ -5,3 +5,10 @@ Class { #package : 'NewTools-Debugger', #tag : 'Model' } + +{ #category : 'initialize' } +StDebuggerActionModelContextChangedAnnouncement >> on: aDebuggerActionModel [ + + super on: aDebuggerActionModel. + node := aDebuggerActionModel sourceNodeExecuted methodNode +] diff --git a/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st index 8706433a2..304b0ed3e 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st @@ -5,3 +5,10 @@ Class { #package : 'NewTools-Debugger', #tag : 'Model' } + +{ #category : 'initialize' } +StDebuggerActionModelRestartAnnouncement >> on: aDebuggerActionModel [ + + super on: aDebuggerActionModel. + node := aDebuggerActionModel sourceNodeExecuted methodNode +] diff --git a/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st index 85a096f31..4bf0fe359 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st @@ -33,6 +33,13 @@ StDebuggerActionModelStepAnnouncement class >> stepThrough: aDebuggerActionModel yourself ] +{ #category : 'initialize' } +StDebuggerActionModelStepAnnouncement >> on: aDebuggerActionModel [ + + super on: aDebuggerActionModel. + node := aDebuggerActionModel sourceNodeExecuted +] + { #category : 'actions' } StDebuggerActionModelStepAnnouncement >> stepInto [ step := 'into' From 58496e66f30c433134218d023240c3976a98226b Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:28:00 +0100 Subject: [PATCH 7/7] better debug action event printing --- .../StDebuggerActionModelRestartAnnouncement.class.st | 5 +++++ .../StDebuggerActionModelStepAnnouncement.class.st | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st index 304b0ed3e..f514099a1 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelRestartAnnouncement.class.st @@ -12,3 +12,8 @@ StDebuggerActionModelRestartAnnouncement >> on: aDebuggerActionModel [ super on: aDebuggerActionModel. node := aDebuggerActionModel sourceNodeExecuted methodNode ] + +{ #category : 'printing' } +StDebuggerActionModelRestartAnnouncement >> printOn: aStream [ + aStream << 'Restart context' +] diff --git a/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st b/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st index 4bf0fe359..8eec659ec 100644 --- a/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModelStepAnnouncement.class.st @@ -40,6 +40,13 @@ StDebuggerActionModelStepAnnouncement >> on: aDebuggerActionModel [ node := aDebuggerActionModel sourceNodeExecuted ] +{ #category : 'printing' } +StDebuggerActionModelStepAnnouncement >> printOn: aStream [ + aStream << 'Step'. + aStream space. + aStream << step +] + { #category : 'actions' } StDebuggerActionModelStepAnnouncement >> stepInto [ step := 'into'