From 5f698746dcd4a39d4fcc2c7712e6611fc81907cf Mon Sep 17 00:00:00 2001 From: Jules Boulet Date: Mon, 27 Oct 2025 14:56:49 +0100 Subject: [PATCH 01/34] Delete TDSLogger class, change trait to TLogger from ExperimentModel and so add ExperimentModel to the baseline --- .../BaselineOfDebuggingSpy.class.st | 16 ++++++--- BaselineOfDebuggingSpy/package.st | 2 +- DebuggingSpy/DSSTONFileLogger.class.st | 4 +-- DebuggingSpy/TDSLogger.trait.st | 34 ------------------- 4 files changed, 14 insertions(+), 42 deletions(-) delete mode 100644 DebuggingSpy/TDSLogger.trait.st diff --git a/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st b/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st index be9625e..7d92234 100644 --- a/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st +++ b/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st @@ -1,20 +1,26 @@ Class { - #name : #BaselineOfDebuggingSpy, - #superclass : #BaselineOf, - #category : #BaselineOfDebuggingSpy + #name : 'BaselineOfDebuggingSpy', + #superclass : 'BaselineOf', + #category : 'BaselineOfDebuggingSpy', + #package : 'BaselineOfDebuggingSpy' } -{ #category : #baselines } +{ #category : 'baselines' } BaselineOfDebuggingSpy >> baseline: spec [ + + spec baseline: 'ExperimentModel' with: [ + spec repository: + 'github://Pharo-XP-Tools/ExperimentModel:main' ]. + spec for: #common do: [ spec postLoadDoIt: #postloadAction. spec package: 'DebuggingSpy'. spec package: 'DebuggingSpy-Tests' ] ] -{ #category : #baselines } +{ #category : 'baselines' } BaselineOfDebuggingSpy >> postloadAction [ DSSpy handlingError: false ] diff --git a/BaselineOfDebuggingSpy/package.st b/BaselineOfDebuggingSpy/package.st index c9aadfb..240981a 100644 --- a/BaselineOfDebuggingSpy/package.st +++ b/BaselineOfDebuggingSpy/package.st @@ -1 +1 @@ -Package { #name : #BaselineOfDebuggingSpy } +Package { #name : 'BaselineOfDebuggingSpy' } diff --git a/DebuggingSpy/DSSTONFileLogger.class.st b/DebuggingSpy/DSSTONFileLogger.class.st index ec4067a..7eec78e 100644 --- a/DebuggingSpy/DSSTONFileLogger.class.st +++ b/DebuggingSpy/DSSTONFileLogger.class.st @@ -4,8 +4,8 @@ I log DSRecords as STON into files. Class { #name : 'DSSTONFileLogger', #superclass : 'Object', - #traits : 'TDSLogger', - #classTraits : 'TDSLogger classTrait', + #traits : 'TLogger', + #classTraits : 'TLogger classTrait', #instVars : [ 'loggingDirectory', 'loggingFilename', diff --git a/DebuggingSpy/TDSLogger.trait.st b/DebuggingSpy/TDSLogger.trait.st deleted file mode 100644 index 0425470..0000000 --- a/DebuggingSpy/TDSLogger.trait.st +++ /dev/null @@ -1,34 +0,0 @@ -" -Common API for DSSpy surveys -" -Trait { - #name : 'TDSLogger', - #category : 'DebuggingSpy-Loggers', - #package : 'DebuggingSpy', - #tag : 'Loggers' -} - -{ #category : 'logging' } -TDSLogger >> log: aDSEventRecord [ - self explicitRequirement -] - -{ #category : 'initialization' } -TDSLogger >> reset [ - self explicitRequirement -] - -{ #category : 'setup' } -TDSLogger >> setupLoggerAfterSurvey: aSurvey [ - self explicitRequirement -] - -{ #category : 'setup' } -TDSLogger >> setupLoggerBeforeSurvey: aSurvey [ - self explicitRequirement "self forceLoggingFileNameFor: aTask." -] - -{ #category : 'setup' } -TDSLogger >> setupLoggerForTask: aTask [ - self explicitRequirement -] From 99a82c797882b07b90801a0b9914c19f8176f05c Mon Sep 17 00:00:00 2001 From: Jules Boulet Date: Tue, 4 Nov 2025 10:44:47 +0100 Subject: [PATCH 02/34] fix(DebuggingSpy-Tests): disable useless tests and fix tests to correctly delete instrumentation after launch --- DebuggingSpy-Tests/DSSpyBrowserTest.class.st | 12 ++++-------- DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/DebuggingSpy-Tests/DSSpyBrowserTest.class.st b/DebuggingSpy-Tests/DSSpyBrowserTest.class.st index f60a2dd..256e25b 100644 --- a/DebuggingSpy-Tests/DSSpyBrowserTest.class.st +++ b/DebuggingSpy-Tests/DSSpyBrowserTest.class.st @@ -6,15 +6,9 @@ Class { #tag : 'Tests - Scenarios' } -{ #category : 'running' } -DSSpyBrowserTest >> setUp [ - super setUp. - - -] - { #category : 'tests - browser' } DSSpyBrowserTest >> testBrowserRUN1 [ + " |log history openedPlaygrounds playgroundsAction openedBrowser browserEntering| log := DSTestingScenariosFileLocator browserScenario001. history := DSRecordHistory fromSTON: log. @@ -26,7 +20,9 @@ DSSpyBrowserTest >> testBrowserRUN1 [ self assert: openedPlaygrounds size equals: 1. self assert: playgroundsAction notEmpty. self assert: history mergedWindowJumps first type equals: 'Playground'. - self assert: history mergedWindowJumps last type equals: 'Browser'. + self assert: history mergedWindowJumps last type equals: 'Browser'. " + + self flag: #TODO ] diff --git a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st index 23db7f7..8fea668 100644 --- a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st +++ b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st @@ -950,7 +950,7 @@ DSSpyInstrumenterTest >> testInstrumentRubEditorCopySelection [ | rubEditor registerClipboardText | modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #doIt) sourceCode. + modifiedMethodSource := (RubSmalltalkEditor >> #copySelection) sourceCode. instrumenter instrumentRubSmalltalkEditorCopySelection. registerClipboardText := DSSpy recordClipboardContent. @@ -1017,7 +1017,7 @@ DSSpyInstrumenterTest >> testInstrumentRubEditorPaste [ | rubEditor registerClipboardText | modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #doIt) sourceCode. + modifiedMethodSource := (RubSmalltalkEditor >> #paste) sourceCode. instrumenter instrumentRubSmalltalkEditorPaste. registerClipboardText := DSSpy recordClipboardContent. DSSpy recordClipboardContent: true. From 1534d4a927436ceca46fe54fd83c510bca06c355 Mon Sep 17 00:00:00 2001 From: Jules Boulet Date: Tue, 4 Nov 2025 11:28:43 +0100 Subject: [PATCH 03/34] fix(DebuggingSpy-Tests): fix tesInstrumentStPlayground by closing it after test --- DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st index 8fea668..95ae6e6 100644 --- a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st +++ b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st @@ -1269,17 +1269,20 @@ DSSpyInstrumenterTest >> testInstrumentSpCodePrintIt [ { #category : 'tests - playground' } DSSpyInstrumenterTest >> testInstrumentStPlayground [ - |playground| + + | playground | modifiedClass := StPlaygroundPresenter class. - modifiedMethodSource := (StPlaygroundPresenter class >> #open) sourceCode. + modifiedMethodSource := (StPlaygroundPresenter class >> #open) + sourceCode. instrumenter instrumentPlaygroundCode. playground := StPlaygroundPresenter open. - + "On opening, the playground generates an opening record" self assert: self registry size equals: 1. - record := self registry first. + record := self registry first. self assert: record class identicalTo: DSPlaygroundOpenedRecord. - self assert: record windowId equals: playground window window hash + self assert: record windowId equals: playground window window hash. + playground close. ] { #category : 'tests - debugger' } From fc5228341c3db180d0ff8086fe5e5153f4e18903 Mon Sep 17 00:00:00 2001 From: Jules Boulet Date: Tue, 4 Nov 2025 16:46:16 +0100 Subject: [PATCH 04/34] fix(DebuggingSpy-Tests): fix DSSpyTest by adding new reccorded events --- DebuggingSpy-Tests/DSSpyTest.class.st | 37 +++++++++++++++++++-------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/DebuggingSpy-Tests/DSSpyTest.class.st b/DebuggingSpy-Tests/DSSpyTest.class.st index d8076af..a1e5d83 100644 --- a/DebuggingSpy-Tests/DSSpyTest.class.st +++ b/DebuggingSpy-Tests/DSSpyTest.class.st @@ -374,11 +374,15 @@ DSSpyTest >> testLogOnlyWhenTaskStarted [ { #category : 'tests - window events' } DSSpyTest >> testLogWindowActivated [ + DSSpy logWindowActivated: self windowEvent. - - self assert: self registry size equals: 1. - - record := self registry first. + + self assert: self registry size equals: 2. + + record := self registry first. + self assert: record class identicalTo: DSToolWindowActivatedEventRecord. + + record := self registry second. self assertWindowEventRecordedAs: DSWindowActivatedRecord ] @@ -397,10 +401,13 @@ DSSpyTest >> testLogWindowClosed [ DSSpyTest >> testLogWindowOpened [ DSSpy logWindowOpened: self windowEvent. - - self assert: self registry size equals: 1. - - record := self registry first. + + self assert: self registry size equals: 2. + + record := self registry first. + self assert: record class identicalTo: DSToolWindowOpenedEventRecord. + + record := self registry second. self assertWindowEventRecordedAs: DSWindowOpenedRecord ] @@ -926,15 +933,23 @@ DSSpyTest >> testWindowOpenedListensToWindowActivatedAndClosedEvents [ self windowEvent window announce: (WindowClosed new window: self windowEvent window; yourself). - self assert: self registry size equals: 3. + self assert: self registry size equals: 5. record := self registry first. - self assert: record class identicalTo: DSWindowOpenedRecord. + self assert: record class identicalTo: DSToolWindowOpenedEventRecord. record := self registry second. + self assert: record class identicalTo: DSWindowOpenedRecord. + + record := self registry third. + self + assert: record class + identicalTo: DSToolWindowActivatedEventRecord. + + record := self registry at: 4. self assert: record class identicalTo: DSWindowActivatedRecord. - record := self registry third. + record := self registry at: 5. self assert: record class identicalTo: DSWindowClosedRecord ] From bae9abc78dbf6ef23f4a34d2cd30877c3c95ad00 Mon Sep 17 00:00:00 2001 From: Jules Boulet Date: Thu, 6 Nov 2025 11:54:50 +0100 Subject: [PATCH 05/34] Change instrumentation --- DebuggingSpy/DSSpyInstrumenter.class.st | 40 ++++++++++++++----------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/DebuggingSpy/DSSpyInstrumenter.class.st b/DebuggingSpy/DSSpyInstrumenter.class.st index 8383c38..eee5c0d 100644 --- a/DebuggingSpy/DSSpyInstrumenter.class.st +++ b/DebuggingSpy/DSSpyInstrumenter.class.st @@ -87,6 +87,7 @@ DSSpyInstrumenter >> instrumentCodePresenter [ self withSyntaxHighlight. self withSmartCharacters. self withLineNumbers. + self subscribeToSettingsChangesAnnouncements. self registerEventsForStyling. self clearInteractionModel. @@ -119,10 +120,10 @@ DSSpyInstrumenter >> instrumentDebuggerOpening [ super initializeWindow: aWindowPresenter. aWindowPresenter - title: self debuggerActionModel statusStringForContext; - initialExtent: self initialExtent; + initialPosition: self settings lastKnownPosition; whenClosedDo: [ self clear ]. + self settings initializeWindow: aWindowPresenter. self initializeShortcuts: aWindowPresenter. [DSDebuggerOpeningRecord for: self ] on: Error do:[:err| DSSpy log: err key: #DEBUGGER_STACK ] ' @@ -143,7 +144,7 @@ stackTable := self newList. stackTable selection isEmpty ifFalse: [ self updateInspectorFromContext: context. self updateCodeFromContext: context. - self updateExtensionsFrom: self session. + self updateExtensionsFromSession: self session. self expandStackIfLastItemIsSelected. self updateWindowTitle. [DSBrowseContextRecord for: { context . [self window window] on: Error do:[0] } ] on: Error do:[:err| DSSpy log: #ERROR key: #DEBUGGER_STACK ] ] ]. @@ -153,12 +154,14 @@ stackTable := self newList. { #category : 'breakpoints' } DSSpyInstrumenter >> instrumentExceptionSignalling [ + Exception compile: 'raiseUnhandledError + "No one has handled this error, but now give them a chance to decide how to debug it. If none handle this either then open debugger (see UnhandedError>>#defaultAction)" self class = Halt ifFalse:[[ DSUnhandledExceptionRecord for: self] on: Error do:[:err| DSSpy log: #ERROR key: self class name asSymbol ]]. - ^ UnhandledError signalForException: self'. + ^ UnhandledError signalForException: self' ] { #category : 'inspector' } @@ -304,9 +307,7 @@ DSSpyInstrumenter >> instrumentNavigateAttribute [ StRawInspectionPresenter compile: 'setAttributeTable - attributeTable - roots: self inspectorNodes; - children: [ :node | node children ]. + attributeTable children: [ :node | node children ]. self outputSelectionPort transmitDo: [ :val | val ifNotNil: [ @@ -321,7 +322,7 @@ DSSpyInstrumenter >> instrumentPlaygroundCode [ StPlaygroundPresenter class compile: 'open