diff --git a/.github/workflows/dsspy.yaml b/.github/workflows/dsspy.yaml index a1c9712..63dd847 100644 --- a/.github/workflows/dsspy.yaml +++ b/.github/workflows/dsspy.yaml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v5 - uses: hpi-swa/setup-smalltalkCI@v1 with: - smalltalk-version: Pharo64-14 + smalltalk-image: Pharo64-14 - run: smalltalkci -s Pharo64-14 shell: bash timeout-minutes: 15 diff --git a/DebuggingSpy-Tests/DSRecordRegistryTest.class.st b/DebuggingSpy-Tests/DSRecordRegistryTest.class.st index 12847a8..e22bbbb 100644 --- a/DebuggingSpy-Tests/DSRecordRegistryTest.class.st +++ b/DebuggingSpy-Tests/DSRecordRegistryTest.class.st @@ -9,22 +9,35 @@ Class { #tag : 'Tests - model' } +{ #category : 'running' } +DSRecordRegistryTest >> setUp [ + + super setUp. + + DSSpy testingSession: true +] + { #category : 'running' } DSRecordRegistryTest >> tearDown [ + DSSpy logger loggingDirectory ensureDeleteAll. + DSSpy resetSpy. DSRecordRegistry autoSerialize: nil. + + 'tests' asFileReference ensureDeleteAll. super tearDown ] { #category : 'tests' } DSRecordRegistryTest >> testAutoSerialize [ - self deny: DSRecordRegistry autoSerialize + + self deny: DSRecordRegistry autoSerialize ] { #category : 'tests' } DSRecordRegistryTest >> testAutoSerializeRecord [ - |materializedRecord| - DSSpy logger loggingFileReference ensureDelete. + + | materializedRecord | DSRecordRegistry autoSerialize: true. record := DSLoggingErrorRecord for: #TEST. materializedRecord := (DSSpy materialize: DSSpy logger loggingFileReference) first. diff --git a/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st b/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st index ffae299..0856cba 100644 --- a/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st +++ b/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st @@ -2,10 +2,9 @@ Class { #name : 'DSSTONFileLoggerTest', #superclass : 'TestCase', #instVars : [ - 'logger', 'survey', 'task', - 'oldLogger' + 'logger' ], #category : 'DebuggingSpy-Tests-Tests - model', #package : 'DebuggingSpy-Tests', @@ -15,9 +14,8 @@ Class { { #category : 'running' } DSSTONFileLoggerTest >> setUp [ super setUp. - oldLogger := DSSpy logger. - logger := DSSTONFileLogger new. - DSSpy logger: logger. + DSSpy testingSession: true. + logger := DSSpy logger. survey := DSTestSurvey new. task := DSTestTask new ] @@ -25,21 +23,26 @@ DSSTONFileLoggerTest >> setUp [ { #category : 'running' } DSSTONFileLoggerTest >> tearDown [ - DSSpy logger: oldLogger. + DSSpy resetSpy. + DSRecordRegistry current reset. + + 'tests' asFileReference ensureDeleteAll. super tearDown ] { #category : 'tests - file handling' } DSSTONFileLoggerTest >> testDefaultLoggingDirectoryName [ - self - assert: logger defaultLoggingDirectoryName - equals: 'ds-spy' + self assert: logger defaultLoggingDirectoryName equals: 'tests'. + + DSSpy testingSession: false. + + self assert: logger defaultLoggingDirectoryName equals: 'ds-spy' ] { #category : 'tests - file handling' } DSSTONFileLoggerTest >> testDefaultLoggingFileName [ - self assert: logger defaultLoggingFileName equals: SessionManager default currentSession id asString + self assert: logger defaultLoggingFileName equals: DSSpy getRecordFileName ] { #category : 'tests - file handling' } @@ -47,9 +50,8 @@ DSSTONFileLoggerTest >> testEnsureCreateLoggingFileReference [ | fileReference | fileReference := logger loggingDirectory / logger loggingFileName. - fileReference ensureDelete. self deny: fileReference exists. - logger ensureCreateLoggingFileReference. + fileReference := logger ensureCreateLoggingFileReference. self assert: fileReference exists ] @@ -66,7 +68,7 @@ DSSTONFileLoggerTest >> testFilenameForSurvey [ DSSTONFileLoggerTest >> testForceLoggingFileNameFor [ logger reset. logger forceLoggingFileNameFor: task. - self assert: logger loggingFileName equals: (task title, '-', SessionManager default currentSession id asString). + self assert: logger loggingFileName equals: (task title, '-', DSSpy getRecordFileName). self assert: logger loggingFileName equals: logger loggingFileReference basename. self assert: logger loggingFileReference exists ] @@ -74,12 +76,8 @@ DSSTONFileLoggerTest >> testForceLoggingFileNameFor [ { #category : 'tests - task management' } DSSTONFileLoggerTest >> testForceRunningTask [ - DSSpy resetSpy. DSSpy forceRunningTask: task. - self - assert: logger loggingFileName - equals: - task title , '-' , SessionManager default currentSession id asString + self assert: logger loggingFileName equals: task title , '-' , DSSpy getRecordFileName ] { #category : 'tests - file handling' } diff --git a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st index ba2e330..3747ab7 100644 --- a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st +++ b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st @@ -2,15 +2,8 @@ Class { #name : 'DSSpyInstrumenterTest', #superclass : 'TestCase', #instVars : [ - 'modifiedClass', - 'modifiedMethodSource', - 'instrumenter', - 'record', - 'debugger', - 'browser', - 'methodToRemove', - 'methodsToRemove', - 'recordSourceCode' + 'recordSourceCode', + 'intialWindows' ], #category : 'DebuggingSpy-Tests-Tests - model', #package : 'DebuggingSpy-Tests', @@ -18,109 +11,29 @@ Class { } { #category : 'assertions' } -DSSpyInstrumenterTest >> assertHaltHitRecordingMethod: method [ +DSSpyInstrumenterTest >> assertHaltHitRecordingMethod: method conditional: isHaltIf once: isOnce forRecord: aRecord [ - self assert: record class equals: DSHaltHitRecord. - self assert: record method equals: method name. - self assert: record sourceCodeInterval first equals: method ast statements first start. - self assert: record sourceCodeInterval last equals: method ast statements first stop -] - -{ #category : 'assertions' } -DSSpyInstrumenterTest >> assertHaltHitRecordingMethod: method conditional: isHaltIf once: isOnce [ - - self assert: record conditional equals: isHaltIf. - self assert: record once equals: isOnce. - self assertHaltHitRecordingMethod: method -] - -{ #category : 'assertions' } -DSSpyInstrumenterTest >> assertInstrumentDebuggerCommandNamed: debuggerCommandName [ - - | cmds cmd | - modifiedClass := StDebugger class. - modifiedMethodSource := [ - (StDebugger class - >> #instrumentCommandsWith:forRoot:) - sourceCode ] - on: Error - do: [ nil ]. - instrumenter instrumentDebuggerCommands. - debugger := self debuggerOnRecursiveContextForTesting. - - cmds := debugger rootCommandsGroup. - cmd := StDebugger - specCommandNamed: debuggerCommandName - inGroup: (StDebugger executionCommandGroupIn: cmds) entries. - (#('Return' 'Proceed') includes: debuggerCommandName) - ifTrue:[cmd decoratedCommand forTests: true]. - - self setDummyWindowForPresenter: debugger. - - cmd execute. - - self assertStepActionRecordForCommandNamed: debuggerCommandName + self assert: aRecord conditional equals: isHaltIf. + self assert: aRecord once equals: isOnce. + self assertHaltHitRecordingMethod: method forRecord: aRecord ] { #category : 'assertions' } -DSSpyInstrumenterTest >> assertInstrumentSindarinDebuggerCommandNamed: debuggerCommandName [ +DSSpyInstrumenterTest >> assertHaltHitRecordingMethod: method forRecord: aRecord [ - | modifiedMethod cmds cmd | - modifiedClass := StDebugger class. - modifiedMethod := modifiedClass>>#buildSindarinExtentionCommandsGroupWith:forRoot:. - modifiedMethodSource := [ modifiedMethod sourceCode ] - on: Error - do: [ nil ]. - instrumenter instrumentSindarinDebuggerCommands. - debugger := self debuggerOnRecursiveContextForTesting. - - self setDummyWindowForPresenter: debugger. - - "Commands from toolbar" - cmds := debugger rootCommandsGroup - / StDebuggerToolbarCommandTreeBuilder groupName - / 'Advanced'. - cmd := StDebugger - specCommandNamed: debuggerCommandName - inGroup: cmds entries. - - cmd decoratedCommand forTests: true. - cmd execute. - - self assertStepActionRecordForCommandNamed: debuggerCommandName. - - DSRecordRegistry current reset. - - "Commands from code menu" - cmds := debugger rootCommandsGroup - / StDebuggerCodeCommandTreeBuilder groupName - / StDebuggerCodeCommandTreeBuilder new codeDebugCommandsGroupName. - cmd := StDebugger - specCommandNamed: debuggerCommandName - inGroup: cmds entries. - cmd decoratedCommand forTests: true. - cmd execute. - - self assertStepActionRecordForCommandNamed: debuggerCommandName. + self assert: aRecord class equals: DSHaltHitRecord. + self assert: aRecord method equals: method name. + self assert: aRecord sourceCodeInterval first equals: method ast statements first start. + self assert: aRecord sourceCodeInterval last equals: method ast statements first stop ] -{ #category : 'assertions' } -DSSpyInstrumenterTest >> assertStepActionRecordForCommandNamed: debuggerCommandName [ - - self assert: self registry size equals: 1. +{ #category : 'running' } +DSSpyInstrumenterTest >> closeOpenedWindows [ - record := self registry first. - self assert: record class identicalTo: DSStepActionRecord. - self assert: record eventName equals: debuggerCommandName. - self assert: record windowId equals: debugger window window identityHash. - self - assert: record context - equals: debugger currentContext printString. - self - assert: record node - equals: debugger currentContext sourceNodeExecuted printString. - self assert: record receiver equals: debugger currentContext receiver printString. - self assert: record receiverClass equals: debugger currentContext receiver class name + | currentWindows windowsToClose | + currentWindows := self currentWorld windowsSatisfying: [ :window | window isInWorld ]. + windowsToClose := currentWindows reject: [ :window | intialWindows includes: window ]. + windowsToClose collect: [ :window | window close ] ] { #category : 'helpers' } @@ -155,9 +68,26 @@ DSSpyInstrumenterTest >> codePresenterFrom: aPlaygroundPagePresenter [ ^ codePresenter ] +{ #category : 'helpers' } +DSSpyInstrumenterTest >> codePresenterFrom: aPlaygroundPagePresenter withText: aText [ + + | codePresenter adapter | + codePresenter := (aPlaygroundPagePresenter class slotNamed: #text) + read: aPlaygroundPagePresenter. + self setDummyWindowPresenter: aPlaygroundPagePresenter window forPresenter: codePresenter. + codePresenter text: aText. + + adapter := SpMorphicCodeAdapter new. + adapter adapt: codePresenter. + codePresenter adapter: adapter. + codePresenter adapter buildWidget. + ^ codePresenter +] + { #category : 'helpers' } DSSpyInstrumenterTest >> debuggerForTesting [ + | debugger | debugger := StTestDebuggerProvider new debuggerWithObjectHalting. debugger application: StDebugger currentApplication. debugger initialize. @@ -167,6 +97,7 @@ DSSpyInstrumenterTest >> debuggerForTesting [ { #category : 'helpers' } DSSpyInstrumenterTest >> debuggerForTestingWithWindow [ + | debugger | debugger := StTestDebuggerProvider new debuggerWithObjectHalting. self setDummyWindowForPresenter: debugger. debugger application: StDebugger currentApplication. @@ -227,6 +158,19 @@ DSSpyInstrumenterTest >> executeHaltWithMessage [ self halt: 'message' ] +{ #category : 'helpers' } +DSSpyInstrumenterTest >> getSindarinDebuggerForTesting [ + + | sindarinDebugger dummyActionModel | + sindarinDebugger := SindarinTestCommandDebugger new. + dummyActionModel := (StTestDebuggerProvider new debuggerWithContext: + [ SindarinTestObjectToVisit new createInstanceWithNew ] asContext) debuggerClientModel. + sindarinDebugger session: dummyActionModel session. + dummyActionModel clear. + + ^ sindarinDebugger +] + { #category : 'helpers' } DSSpyInstrumenterTest >> metaPaneClassesItems: listName FromInspector: aMetaPane [ @@ -295,7 +239,7 @@ DSSpyInstrumenterTest >> registry [ ] { #category : 'helpers' } -DSSpyInstrumenterTest >> rubTextEditor [ +DSSpyInstrumenterTest >> rubSmalltalkEditor [ | editor textArea | editor := RubSmalltalkEditor forTextArea: @@ -356,12 +300,16 @@ DSSpyInstrumenterTest >> setDummyWindowPresenter: windowPresenter forPresenter: { #category : 'running' } DSSpyInstrumenterTest >> setUp [ + super setUp. - - instrumenter := DSSpyInstrumenter new. - recordSourceCode := DSSpy recordSourceCode. + + DSSpy testingSession: true. DSSpy recordSourceCode: true. - DSRecordRegistry current reset + recordSourceCode := DSSpy recordSourceCode. + + intialWindows := self currentWorld windowsSatisfying: [ :window | window isInWorld ]. + + DSSpyInstrumenter instrumentSystem ] { #category : 'helpers' } @@ -413,232 +361,96 @@ DSSpyInstrumenterTest >> tableItemsListFromInspector: anInspector [ { #category : 'running' } DSSpyInstrumenterTest >> tearDown [ - (modifiedClass notNil and: [ - (#( nil '' ) includes: modifiedMethodSource) not ]) ifTrue: [ - modifiedClass compile: modifiedMethodSource. - modifiedClass := nil. - modifiedMethodSource := nil ]. - - methodToRemove ifNotNil: [ - methodToRemove removeFromSystem. - methodToRemove := nil ]. - - methodsToRemove ifNotNil: [ - methodsToRemove do: [ :m | m removeFromSystem ] ]. + DSSpyInstrumenter stopInstrumentation. DSSpy recordSourceCode: recordSourceCode. - DSRecordRegistry current reset. + DSSpy resetSpy. + self closeOpenedWindows. + + 'tests' asFileReference ensureDeleteAll. super tearDown ] -{ #category : 'tests - browsers' } -DSSpyInstrumenterTest >> testInstrumentClyFullBrowser [ - - modifiedClass := ClyFullBrowserMorph. - modifiedMethodSource := (ClyFullBrowserMorph >> #newWindowTitle) sourceCode. - instrumenter instrumentClyFullBrowser. - browser := ClyFullBrowserMorph on: ClyNavigationEnvironment currentImage. - browser prepareInitialStateBy: [ :b |b selectMethod: (Object>>#yourself)]. - self setDummyWindowForMorph: browser. - browser newWindowTitle. - - self assert: self registry size equals: 1. - - record := self registry first. - self assert: record class identicalTo: DSFullBrowseRecord. - self assert: record windowId equals: browser window hash. - self assert: record classBrowsed equals: Object name. - self assert: record packageBrowsed equals: Object package name. - self assert: record methodBrowsed equals: (Object>>#yourself) name -] +{ #category : 'tests - interactions' } +DSSpyInstrumenterTest >> testInstrumentClyTextEditorDebugIt [ -{ #category : 'tests - browsers' } -DSSpyInstrumenterTest >> testInstrumentClyQueryBrowser [ - - modifiedClass := ClyQueryBrowserMorph. - modifiedMethodSource := (ClyQueryBrowserMorph >> #newWindowTitle) sourceCode. - instrumenter instrumentClyQueryBrowser. - browser := ClyQueryBrowserMorph on: ClyNavigationEnvironment currentImage. - browser showResultOf: (ClyMessageImplementorsQuery of: #instrumentClyQueryBrowser). - self setDummyWindowForMorph: browser. - browser newWindowTitle. + | clyEditor record| + self runWithoutOpeningDebugger: [clyEditor := self clyTextEditor. clyEditor debugIt]. + self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSQueryBrowseRecord. - self assert: record windowId equals: browser window hash. - self assert: record queryName equals: browser systemQuery description + + self assert: record class identicalTo: DSDebugItRecord. + self assert: record selectedString equals: '41+1' ] { #category : 'tests - interactions' } -DSSpyInstrumenterTest >> testInstrumentClyTextEditorPrintIt [ - - | clyEditor | - modifiedClass := ClyTextEditor. - modifiedMethodSource := (ClyTextEditor >> #printIt) sourceCode. - instrumenter instrumentClyTextEditorPrintIt. +DSSpyInstrumenterTest >> testInstrumentClyTextEditorDoIt [ + | clyEditor record | clyEditor := self clyTextEditor. - clyEditor printIt. + clyEditor doIt. self assert: self registry size equals: 1. - record := self registry first. - - self assert: record class identicalTo: DSPrintItRecord. + record := self registry first. + + self assert: record class identicalTo: DSDoItRecord. self assert: record selectedString equals: '41+1' ] -{ #category : 'tests - playground' } -DSSpyInstrumenterTest >> testInstrumentCodePresenter [ - |playground code| - modifiedClass := SpCodePresenter. - modifiedMethodSource := [(SpCodePresenter >> #initialize) sourceCode] on: Error do:[nil]. - instrumenter instrumentCodePresenter. - playground := self playgroundPagePresenter. - self setDummyWindowForPresenter: playground. - code := self codePresenterFrom: playground. - - "When typing code, the playground generates an writing record" - self press: $t in: code. - self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSPlaygroundWriteRecord. - self assert: record windowId equals: playground window window hash. - - "When the mouse enters the playground, if the playground has focus, generates a reading event" - code adapter sendMouseEnterEvent. +{ #category : 'tests - interactions' } +DSSpyInstrumenterTest >> testInstrumentClyTextEditorInspectIt [ + + | clyEditor record | + clyEditor := self clyTextEditor. + clyEditor inspectIt. + self assert: self registry size equals: 2. - record := self registry second. - self assert: record class identicalTo: DSPlaygroundReadRecord. - self assert: record windowId equals: playground window window hash - + record := self registry first. + + self assert: record class identicalTo: DSInspectItRecord. + self assert: record selectedString equals: '41+1' ] -{ #category : 'tests - debugger' } -DSSpyInstrumenterTest >> testInstrumentDebuggerCode [ - |code adapter| - modifiedClass := SpCodePresenter. - modifiedMethodSource := [(SpCodePresenter >> #initialize) sourceCode] on: Error do:[nil]. - instrumenter instrumentCodePresenter. - - debugger := self debuggerForTesting. - code := debugger code. - self setDummyWindowForPresenter: code. - adapter := SpMorphicCodeAdapter new. - adapter adapt: code. - code adapter: adapter. - code adapter buildWidget. +{ #category : 'tests - interactions' } +DSSpyInstrumenterTest >> testInstrumentClyTextEditorPrintIt [ + + | clyEditor record | + clyEditor := self clyTextEditor. + clyEditor printIt. - "When typing code, the playground code a writing record" - self press: $t in: code. self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSPlaygroundWriteRecord. - self assert: record windowId equals: code window window hash. - - "When the mouse enters the playground, if the playground has focus, generates a reading event" - code adapter sendMouseEnterEvent. - self assert: self registry size equals: 2. - record := self registry second. - self assert: record class identicalTo: DSPlaygroundReadRecord. - self assert: record windowId equals: code window window hash + record := self registry first. + + self assert: record class identicalTo: DSPrintItRecord. + self assert: record selectedString equals: '41+1' ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentDebuggerOpening [ - modifiedClass := StDebugger. - modifiedMethodSource := [(StDebugger >> #initializeWindow:) sourceCode] on: Error do:[nil]. - - debugger := self debuggerForTestingWithWindow. - instrumenter instrumentDebuggerOpening. + + | debugger record | + debugger := self debuggerForTestingWithWindow. debugger initializeWindow: debugger window. - - self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSDebuggerOpeningRecord. - self assert: record windowId equals: debugger window window hash. - self assert: record debuggerId equals: debugger hash. - self assert: record contextName equals: debugger currentContext method printString. - self assert: record sourceNodeClass equals: debugger currentContext sourceNodeExecuted class name. - self assert: record sourceNodeCode equals: debugger currentContext sourceNodeExecuted sourceCode - -] + debugger open. -{ #category : 'tests - debugger' } -DSSpyInstrumenterTest >> testInstrumentDebuggerStack [ - |selectedItem| - modifiedClass := StDebugger. - modifiedMethodSource := (StDebugger >> #initializeStack) sourceCode. - instrumenter instrumentDebuggerStack. - - debugger := self debuggerForTestingWithWindow. self assert: self registry size equals: 2. - - "No idea why: the stack seems to be refreshed 3 times at opening. - This generates three identical events:" - self assert: self registry first windowId equals: self registry second windowId. - self assert: self registry first receiver equals: self registry second receiver. - self assert: self registry first selector equals: self registry second selector. - self assert: self registry first contextName equals: self registry second contextName. - self assert: self registry first sourceNodeClass equals: self registry second sourceNodeClass. - self assert: self registry first sourceNodeCode equals: self registry second sourceNodeCode. - "self assert: self registry first windowId equals: self registry third windowId. - self assert: self registry first receiver equals: self registry third receiver. - self assert: self registry first selector equals: self registry third selector. - self assert: self registry first contextName equals: self registry third contextName. - self assert: self registry first sourceNodeClass equals: self registry third sourceNodeClass. - self assert: self registry first sourceNodeCode equals: self registry third sourceNodeCode." - - debugger stackTable selectItem: debugger stackTable items second. - self assert: self registry size equals: 3. - - record := self registry third. - selectedItem := debugger stackTable items second. - self assert: record class identicalTo: DSBrowseContextRecord. - self assert: record windowId equals: debugger window window hash. - self assert: record contextName equals: selectedItem method printString. - self assert: record sourceNodeClass equals: selectedItem sourceNodeExecuted class name. - self assert: record sourceNodeCode equals: selectedItem sourceNodeExecuted sourceCode. - self assert: record receiver equals: selectedItem receiver printString. - self assert: record selector equals: selectedItem selector -] - -{ #category : 'tests - inspector' } -DSSpyInstrumenterTest >> testInstrumentExpandAttribute [ - - | inspector object items | - modifiedClass := FTBasicItem. - modifiedMethodSource := (FTBasicItem >> #expandAndRefresh) sourceCode. - instrumenter instrumentExpandAttribute. - - object := OrderedCollection new. - inspector := StInspectorPresenter onObject: object. - items := self tableItemsListFromInspector: inspector. - items first expandAndRefresh. - self assert: self registry size equals: 1. record := self registry first. + self assert: record class identicalTo: DSHaltHitRecord. - self assert: record class identicalTo: DSExpandAttributeRecord. - self - assert: record windowId - equals: inspector window window identityHash. - self assert: record attributeName equals: 'self'. - self assert: record attributeHash equals: object identityHash. - self assert: record attributeValue equals: object displayString + record := self registry second. + self assert: record class identicalTo: DSWindowOpenedRecord. + self assert: record windowId equals: debugger window window hash ] { #category : 'tests - halts' } DSSpyInstrumenterTest >> testInstrumentHaltHits [ - instrumenter instrumentHaltHits. - methodsToRemove := { - (Halt class >> #signal:). - (Halt class >> #signalIn:). - (Halt class >> #signal) }. + | record | [ self executeHalt ] on: Halt do: [ ]. @@ -648,7 +460,8 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ self assertHaltHitRecordingMethod: self class >> #executeHalt conditional: false - once: false. + once: false + forRecord: record. [ self executeHaltIf ] on: Halt @@ -659,531 +472,289 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ self assertHaltHitRecordingMethod: self class >> #executeHaltIf conditional: true - once: false. + once: false + forRecord: record. self recompileExecuteHaltOnce. [ self executeHaltOnce ] on: Halt do: [ ]. - self assert: self registry size equals: 3. - record := self registry third. + self assert: self registry size equals: 5. + record := self registry at: 5. self assert: record selector equals: #once:. self assertHaltHitRecordingMethod: self class >> #executeHaltOnce conditional: false - once: true. + once: true + forRecord: record. [ self executeHaltWithMessage ] on: Halt do: [ ]. - self assert: self registry size equals: 4. - record := self registry fourth. + self assert: self registry size equals: 6. + record := self registry at: 6. self assert: record selector equals: #now:. self assertHaltHitRecordingMethod: self class >> #executeHaltWithMessage conditional: false - once: false. + once: false + forRecord: record. [ self execute1Halt ] on: Halt do: [ ]. - self assert: self registry size equals: 5. - record := self registry fifth. + self assert: self registry size equals: 7. + record := self registry at: 7. self assert: record selector equals: #halt. self assertHaltHitRecordingMethod: self class >> #execute1Halt conditional: false once: false + forRecord: record ] { #category : 'tests - halts' } DSSpyInstrumenterTest >> testInstrumentHaltHitsInBlock [ - |executedMethod| - instrumenter instrumentHaltHits. - methodsToRemove := { - (Halt class >> #signal:). - (Halt class >> #signalIn:). - (Halt class >> #signal) }. - + + | executedMethod record | executedMethod := self class >> #executeHaltInBloc. - [ self executeHaltInBloc ] + [ self executeHaltInBloc ] on: Halt - do: [ ]. - + do: [ ]. + self assert: self registry size equals: 1. - record := self registry first. - + record := self registry first. + self assert: record conditional equals: false. self assert: record once equals: false. self assert: record class equals: DSHaltHitRecord. - self assert: record method equals: executedMethod name. + self assert: record method equals: executedMethod name. self assert: record sourceCodeInterval first equals: executedMethod ast statements first receiver statements first start. self assert: record sourceCodeInterval last equals: executedMethod ast statements first receiver statements first stop ] -{ #category : 'tests - inspector' } -DSSpyInstrumenterTest >> testInstrumentInspectMethodsOfClass [ - - | metaPane object classes | - modifiedClass := StMetaBrowserPresenter. - modifiedMethodSource := (StMetaBrowserPresenter >> #methodsOf:) - sourceCode. - instrumenter instrumentInspectMethodsOfClass. - - object := OrderedCollection new. - metaPane := StMetaBrowserPresenter basicNew. - self setDummyWindowForPresenter: metaPane. - metaPane application: StPharoApplication current. - metaPane setModelBeforeInitialization: object. - - metaPane initialize. - - classes := self - metaPaneClassesItems: #classes - FromInspector: metaPane. - classes selectPath: - (Array new: OrderedCollection allSuperclasses size + 1 withAll: 1). - - self assert: self registry size equals: 1. - record := self registry first. - - self assert: record class identicalTo: DSInspectMethodsRecord. - self assert: record windowId equals: metaPane window window hash. - self assert: record selectedClass equals: object class name. - self assert: record inspectedObject equals: object printString. - - classes clickAtPath: { 1. 1. 1. 1 }. - record := self registry second. - self - assert: record selectedClass - equals: object class superclass name -] - -{ #category : 'tests - inspector' } -DSSpyInstrumenterTest >> testInstrumentInspectSourceOfMethod [ - - | metaPane object methods classes | - modifiedClass := StMetaBrowserPresenter. - modifiedMethodSource := (StMetaBrowserPresenter >> #updateSourceWith:) - sourceCode. - instrumenter instrumentInspectSourceOfMethod. - - object := OrderedCollection new. - metaPane := StMetaBrowserPresenter on: object. - methods := self - metaPaneClassesItems: #methods - FromInspector: metaPane. - classes := self - metaPaneClassesItems: #classes - FromInspector: metaPane. - - self setDummyWindowForPresenter: metaPane. - - classes selectPath: - (Array new: OrderedCollection allSuperclasses size + 1 withAll: 1). - - methods selectItem: methods items first. - record := self registry first. - - self assert: record class identicalTo: DSInspectMethodSourceRecord. - self - assert: record selectedMethod - equals: metaPane selectedMethod name. - - self assert: record windowId equals: metaPane window window hash. - self assert: record selectedClass equals: object class name. - self assert: record inspectedObject equals: object printString -] - -{ #category : 'tests - inspector' } -DSSpyInstrumenterTest >> testInstrumentInspectorOnObject [ - |inspector object| - modifiedClass := StInspectorPresenter. - modifiedMethodSource := (StInspectorPresenter >> #initializePresenters) sourceCode. - instrumenter instrumentInspectorOnObject. - - object := OrderedCollection new. - inspector := self newInspectorOn: object. - - self assert: self registry size equals: 1. - record := self registry first. - - - self assert: record class identicalTo: DSInspectObjectRecord. - self assert: record windowId equals: inspector window window identityHash. - self assert: record inspectedObject equals: object printString. - self assert: record inspectedObjectHash equals: object identityHash -] - -{ #category : 'tests - inspector' } -DSSpyInstrumenterTest >> testInstrumentInspectorPageSelection [ - - | inspector object objectInspector pagesView | - modifiedClass := StObjectInspectorPresenter. - modifiedMethodSource := (StObjectInspectorPresenter - >> #initializePresenters) sourceCode. - instrumenter instrumentInspectorPageSelection. - - object := OrderedCollection new. - inspector := self newInspectorOn: object. - objectInspector := inspector firstPage. - pagesView := (objectInspector class slotNamed: #views) read: - objectInspector. - - self assert: self registry size equals: 1. - record := self registry first. - - self assert: record class identicalTo: DSSelectInspectorPageRecord. - self - assert: record windowId - equals: inspector window window identityHash. - self assert: record pageTitle equals: pagesView pages first title. - self assert: record inspectedObjectHash equals: object identityHash. - self assert: record inspectedObject equals: object printString. - - pagesView selectPage: pagesView pages second. - self assert: self registry size equals: 2. - record := self registry second. - self assert: record pageTitle equals: pagesView pages second title -] - -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentMouseDownFTSelectableMorph [ - - |morph| - self should: [FTSelectableMorph >> #mouseDown: ] raise: KeyNotFound. - instrumenter instrumentMouseDownFTSelectableMorph. - methodToRemove := (FTSelectableMorph >> #mouseDown:). - - morph := FTSelectableMorph new. - morph privateOwner: SystemWindow new. - morph mouseDown: nil. - - self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSMouseDownTableItemRecord. - self assert: record windowId equals: morph window hash. - self assert: record itemElement equals: (DSMouseEventRecord printStringMorphs: {morph}) -] - -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentMouseEnterFTSelectableMorph [ - - |morph| - modifiedClass := FTSelectableMorph. - modifiedMethodSource := (FTSelectableMorph >> #mouseEnter:) sourceCode. - instrumenter instrumentMouseEnterFTSelectableMorph. - - morph := FTSelectableMorph new. - morph privateOwner: SystemWindow new. - morph mouseEnter: nil. - - self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSMouseEnterTableItemRecord. - self assert: record windowId equals: morph window hash. - self assert: record itemElement equals: (DSMouseEventRecord printStringMorphs: {morph}) -] - { #category : 'tests - mouse events' } DSSpyInstrumenterTest >> testInstrumentMouseEnterWindow [ - - |window| - self should: [SystemWindow >> #handleMouseEnter: ] raise: KeyNotFound. - instrumenter instrumentMouseEnterWindow. - methodToRemove := (SystemWindow >> #handleMouseEnter:). - + + | window record | window := SystemWindow new. window handleMouseEnter: (self simulatedMouseEventFor: window). - - self assert: self registry size equals: 1. + + self assert: self registry size equals: 1. record := self registry first. self assert: record class identicalTo: DSMouseEnterWindowRecord. - self assert: record windowId equals: window hash. - self assert: record itemElement equals: (DSMouseEventRecord printStringMorphs: {window}) + self assert: record windowId equals: window hash ] { #category : 'tests - mouse events' } DSSpyInstrumenterTest >> testInstrumentMouseLeaveWindow [ - - |window| - self should: [SystemWindow >> #handleMouseLeave: ] raise: KeyNotFound. - instrumenter instrumentMouseLeaveWindow. - methodToRemove := (SystemWindow >> #handleMouseLeave:). - + + | window record | window := SystemWindow new. window handleMouseLeave: (self simulatedMouseEventFor: window). - - self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSMouseLeaveWindowRecord. - self assert: record windowId equals: window hash. - self assert: record itemElement equals: (DSMouseEventRecord printStringMorphs: {window}) -] - -{ #category : 'tests - inspector' } -DSSpyInstrumenterTest >> testInstrumentNavigateAttribute [ - |raw object| - modifiedClass := StRawInspectionPresenter. - modifiedMethodSource := (StRawInspectionPresenter >> #setAttributeTable) sourceCode. - instrumenter instrumentNavigateAttribute. - - object := OrderedCollection new. - raw := StRawInspectionPresenter on: object. - self setDummyWindowForPresenter: raw. - raw selectPath: #(2). self assert: self registry size equals: 1. - record := self registry first. - - self assert: record class identicalTo: DSNavigateAttributeRecord. - self assert: record windowId equals: raw window window identityHash. - self assert: record inspectedObject equals: object printString. - self assert: record inspectedObjectHash equals: object identityHash + record := self registry first. + self assert: record class identicalTo: DSMouseLeaveWindowRecord. + self assert: record windowId equals: window hash ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentProceed [ - self assertInstrumentDebuggerCommandNamed: 'Proceed' + | debugger command record | + debugger := StDummyDebuggerPresenter new. + command := StProceedCommand forContext: debugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSProceedRecord ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentRestart [ - self assertInstrumentDebuggerCommandNamed: 'Restart' + | debugger command record | + debugger := StDummyDebuggerPresenter new. + command := StRestartCommand forContext: debugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSRestartRecord ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentReturn [ - self assertInstrumentDebuggerCommandNamed: 'Return' + | debugger command record | + debugger := StDummyDebuggerPresenter new. + command := StReturnValueCommand forContext: debugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSReturnValue ] { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentRubEditorCopySelection [ - | rubEditor registerClipboardText | - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #copySelection) sourceCode. - instrumenter instrumentRubSmalltalkEditorCopySelection. - + | rubEditor registerClipboardText record | registerClipboardText := DSSpy recordClipboardContent. DSSpy recordClipboardContent: true. - [ - rubEditor := self rubTextEditor. - rubEditor selectAll. - rubEditor copySelection. + [ + rubEditor := self rubSmalltalkEditor. + rubEditor selectAll. + rubEditor copySelection. - self - assert: - (self registry select: [ :r | r class = DSClipboardCopyRecord ]) - size - equals: 1. - record := (self registry select: [ :r | - r class = DSClipboardCopyRecord ]) first. + self assert: (self registry select: [ :r | r class = DSClipboardCopyRecord ]) size equals: 1. + record := (self registry select: [ :r | r class = DSClipboardCopyRecord ]) first. - self assert: record class identicalTo: DSClipboardCopyRecord. - self assert: record clipboardText asString equals: Clipboard clipboardText asString] - ensure: [ DSSpy recordClipboardContent: registerClipboardText ] + self assert: record class identicalTo: DSClipboardCopyRecord. + self assert: record clipboardText asString equals: Clipboard clipboardText asString ] ensure: [ + DSSpy recordClipboardContent: registerClipboardText ] ] { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentRubEditorDebugIt [ - | rubEditor | - self skip. - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #debug:) sourceCode. - instrumenter instrumentRubEditorDebugIt. - - rubEditor := self rubTextEditor. + | rubEditor record | + rubEditor := self rubSmalltalkEditor. rubEditor selectAll. - self runWithoutOpeningDebugger: [rubEditor debugIt]. + self runWithoutOpeningDebugger: [ rubEditor debugIt ]. self assert: self registry size equals: 1. - record := self registry first. - - self assert: record class identicalTo: DSDebugItRecord. + record := self registry first. + + self assert: record class identicalTo: DSDebugItRecord. self assert: record selectedString equals: '41+1' printString ] { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentRubEditorDoIt [ - | rubEditor | - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #doIt) sourceCode. - instrumenter instrumentRubEditorDoIt. - - rubEditor := self rubTextEditor. + | rubEditor record | + rubEditor := self rubSmalltalkEditor. rubEditor selectAll. rubEditor doIt. self assert: self registry size equals: 1. - record := self registry first. - - self assert: record class identicalTo: DSDoItRecord. - self assert: record selectedString equals: '41+1'printString + record := self registry first. + + self assert: record class identicalTo: DSDoItRecord. + self assert: record selectedString equals: '41+1' printString +] + +{ #category : 'tests - interactions' } +DSSpyInstrumenterTest >> testInstrumentRubEditorInspectIt [ + + | rubEditor record | + rubEditor := self rubSmalltalkEditor. + rubEditor selectAll. + rubEditor inspectIt. + + self assert: self registry size equals: 2. + record := self registry first. + + self assert: record class identicalTo: DSInspectItRecord. + self assert: record selectedString equals: '41+1' printString ] { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentRubEditorPaste [ - | rubEditor registerClipboardText | - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #paste) sourceCode. - instrumenter instrumentRubSmalltalkEditorPaste. + | rubEditor registerClipboardText record | registerClipboardText := DSSpy recordClipboardContent. DSSpy recordClipboardContent: true. - [ - rubEditor := self rubTextEditor. - rubEditor textArea beForSmalltalkCode. + [ + rubEditor := self rubSmalltalkEditor. + rubEditor textArea beForSmalltalkCode. - Clipboard clipboardText: 'copiedText'. - rubEditor selectAll. - rubEditor paste. - "Added the select to be able to run the test in an instrumented image" - self - assert: - (self registry select: [ :r | r class = DSClipboardPasteRecord ]) - size - equals: 1. - record := (self registry select: [ :r | - r class = DSClipboardPasteRecord ]) first. - - self assert: record class identicalTo: DSClipboardPasteRecord. - self assert: record clipboardText equals: 'copiedText' ] ensure: [ - DSSpy recordClipboardContent: registerClipboardText ] + Clipboard clipboardText: 'copiedText'. + rubEditor selectAll. + rubEditor paste. "Added the select to be able to run the test in an instrumented image" + self assert: (self registry select: [ :r | r class = DSClipboardPasteRecord ]) size equals: 1. + record := (self registry select: [ :r | r class = DSClipboardPasteRecord ]) first. + + self assert: record class identicalTo: DSClipboardPasteRecord. + self assert: record clipboardText equals: 'copiedText' ] ensure: [ DSSpy recordClipboardContent: registerClipboardText ] ] { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentRubEditorPrintIt [ - | rubEditor | - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #printIt) sourceCode. - instrumenter instrumentRubEditorPrintIt. - - rubEditor := self rubTextEditor. + | rubEditor record | + rubEditor := self rubSmalltalkEditor. rubEditor printIt. self assert: self registry size equals: 1. - record := self registry first. - - self assert: record class identicalTo: DSPrintItRecord. - self assert: record selectedString equals: '41+1' -] - -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentRubScrollTextMorphHandleMouseOver [ - - self should: [RubScrolledTextMorph >> #handlesMouseOver: ] raise: KeyNotFound. - instrumenter instrumentRubScrollTextMorphHandleMouseOver. - methodToRemove := (RubScrolledTextMorph >> #handlesMouseOver:). - - self assert: (RubScrolledTextMorph new handlesMouseOver: nil) -] - -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentRubScrollTextMorphMouseEnter [ - |morph| - - modifiedClass := RubScrolledTextMorph. - instrumenter instrumentRubScrollTextMorphMouseEnter. - methodToRemove := (RubScrolledTextMorph >> #mouseEnter:). - morph := RubScrolledTextMorph new. - morph mouseEnter: nil. - - self assert: self registry size equals: 1. record := self registry first. - self assert: record class identicalTo: DSMouseEnterTextEditorRecord. - self assert: record windowId equals: morph window hash. - self assert: record itemElement equals: (DSMouseEventRecord printStringMorphs: {morph}) + + self assert: record class identicalTo: DSPrintItRecord. + self assert: record selectedString equals: '''41+1''' ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentRunTo [ - self assertInstrumentDebuggerCommandNamed: 'Run to' -] + | debugger command record | + debugger := StDummyDebuggerPresenter new. + command := StRunToSelectionCommand forContext: debugger. + command execute. -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentScrollingByDraggingSlider [ - - |slider| - modifiedClass := SliderMorph. - modifiedMethodSource := (SliderMorph >> #dragging:) sourceCode. - instrumenter instrumentScrollingByDraggingSlider. - - slider := SliderMorph new. - slider privateOwner: SystemWindow new. - - slider dragging: true. - self assert: self registry size equals: 1. - record := self registry first. - self assert: record class identicalTo: DSStartScrollingEventRecord. - self assert: record windowId equals: slider window hash. + self assert: self registry size equals: 1. - slider dragging: false. - self assert: self registry size equals: 2. - record := self registry second. - self assert: record class identicalTo: DSStopScrollingEventRecord. - self assert: record windowId equals: slider window hash. + record := self registry first. + self assert: record class identicalTo: DSRunToSelectionRecord ] -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentScrollingInScrollPanesEvents [ - - |pane| - modifiedClass := GeneralScrollPaneMorph. - modifiedMethodSource := (GeneralScrollPaneMorph >> #mouseWheel:) sourceCode. - instrumenter instrumentScrollingInScrollPanesEvents. - - pane := GeneralScrollPaneMorph new. - pane privateOwner: SystemWindow new. - - pane mouseWheel: MouseWheelEvent new. - self assert: self registry size equals: 1. +{ #category : 'tests - browsers' } +DSSpyInstrumenterTest >> testInstrumentSendersAction [ + + | rubEditor record | + rubEditor := self rubSmalltalkEditor. + rubEditor sendersOf: #testInstrumentHaltHits. + + self assert: self registry size equals: 2. + record := self registry first. - self assert: record class identicalTo: DSScrollEventRecord. - self assert: record windowId equals: pane window hash + self assert: record class identicalTo: DSImplementorsRecord. + self assert: record windowId equals: nil ] -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentScrollingInTablesEvents [ - - |table| - modifiedClass := FTTableMorph. - modifiedMethodSource := (FTTableMorph >> #mouseWheel:) sourceCode. - instrumenter instrumentScrollingInTablesEvents. - - table := FTTableMorph new. - table privateOwner: SystemWindow new. - - table mouseWheel: MouseWheelEvent new. - self assert: self registry size equals: 1. +{ #category : 'tests - browsers' } +DSSpyInstrumenterTest >> testInstrumentSpCodeBrowse [ + + | codePresenter browseCommand record | + codePresenter := self codePresenterFrom: self playgroundPagePresenter. + + browseCommand := SpBrowseClassCommand new. + browseCommand context: codePresenter. + codePresenter rawSelection: (1 to: 4). + browseCommand execute. + + self assert: self registry size equals: 2. record := self registry first. - self assert: record class identicalTo: DSScrollEventRecord. - self assert: record windowId equals: table window hash + + self assert: record class identicalTo: DSBrowseRecord. + self assert: record windowId equals: codePresenter window identityHash ] { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentSpCodeDebugIt [ - | codePresenter debugItCommand | - self skip. - self flag: 'This test seems to make the CI crash because of a debugger opening?'. - modifiedClass := SpCodeDebugItCommand. - modifiedMethodSource := (SpCodeDebugItCommand >> #execute) sourceCode. - instrumenter instrumentSpCodeDebugIt. - + | codePresenter debugItCommand record | codePresenter := self codePresenterFrom: self playgroundPagePresenter. debugItCommand := SpCodeDebugItCommand new. debugItCommand context: codePresenter. - self runWithoutOpeningDebugger: [ debugItCommand execute]. + self runWithoutOpeningDebugger: [ debugItCommand execute ]. self assert: self registry size equals: 1. record := self registry first. @@ -1195,10 +766,7 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDebugIt [ { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentSpCodeDoIt [ - | codePresenter printItCommand | - modifiedClass := SpCodeDoItCommand. - modifiedMethodSource := (SpCodeDoItCommand >> #execute) sourceCode. - instrumenter instrumentSpCodeDoIt. + | codePresenter printItCommand record | codePresenter := self codePresenterFrom: self playgroundPagePresenter. @@ -1217,19 +785,17 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoIt [ { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForInspector [ - | presenter | - modifiedClass := StObjectContextPresenter. - modifiedMethodSource := (StObjectContextPresenter >> #doEvaluateAndGo) sourceCode. - instrumenter instrumentSpCodeDoItAndGoForInspector. - + | presenter record | presenter := StObjectContextPresenter basicNew. presenter setModelBeforeInitialization: self stObjectContextModelMock. - [presenter intializePresentersWithEvaluator] on: Error do:["we just pass layout initialization errors as we do not care"]. + [ presenter intializePresentersWithEvaluator ] + on: Error + do: [ "we just pass layout initialization errors as we do not care" ]. presenter evaluator text: '4+2'. - presenter evaluator selectionInterval: (1 to: 3). - - presenter doEvaluateAndGo. - + presenter evaluator selectionInterval: (1 to: 3). + + presenter doEvaluateAndGo. + self assert: self registry size equals: 1. record := self registry first. @@ -1240,11 +806,7 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForInspector [ { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForPlayground [ - | presenter | - modifiedClass := StPlaygroundPagePresenter. - modifiedMethodSource := (StPlaygroundPagePresenter >> #doEvaluateAndGo) sourceCode. - instrumenter instrumentSpCodeDoItAndGoForPlayground. - + | presenter record | presenter := StPlaygroundPagePresenter basicNew. presenter forceDisableLoading. presenter application: StPharoApplication new. @@ -1253,8 +815,8 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForPlayground [ presenter text text: '4+2'. presenter text selectionInterval: (1 to: 3). - presenter doEvaluateAndGo. - + presenter doEvaluateAndGo. + self assert: self registry size equals: 1. record := self registry first. @@ -1262,14 +824,49 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForPlayground [ self assert: record selectedString equals: '4+2' ] +{ #category : 'tests - browsers' } +DSSpyInstrumenterTest >> testInstrumentSpCodeImplementors [ + + | codePresenter browseCommand record | + codePresenter := self codePresenterFrom: self playgroundPagePresenter withText: 'execute'. + + browseCommand := SpBrowseImplementorsCommand new. + browseCommand context: codePresenter. + codePresenter selectionInterval: (1 to: 7). + browseCommand execute. + + self assert: self registry size equals: 2. + + record := self registry first. + self assert: record class identicalTo: DSImplementorsRecord. + self assert: record windowId equals: codePresenter window identityHash. + + record := self registry second. + self assert: record class identicalTo: DSWindowOpenedRecord +] + { #category : 'tests - interactions' } -DSSpyInstrumenterTest >> testInstrumentSpCodePrintIt [ +DSSpyInstrumenterTest >> testInstrumentSpCodeInspectIt [ - | codePresenter printItCommand | - modifiedClass := SpCodePrintItCommand. - modifiedMethodSource := (SpCodePrintItCommand >> #execute) sourceCode. - instrumenter instrumentSpCodePrintIt. + | codePresenter inspectItCommand record | + codePresenter := self codePresenterFrom: self playgroundPagePresenter. + inspectItCommand := SpCodeInspectItCommand new. + inspectItCommand context: codePresenter. + codePresenter rawSelection: (1 to: 4). + inspectItCommand execute. + + self assert: self registry size equals: 2. + record := self registry first. + + self assert: record class identicalTo: DSInspectItRecord. + self assert: record selectedString equals: '41+1' +] + +{ #category : 'tests - interactions' } +DSSpyInstrumenterTest >> testInstrumentSpCodePrintIt [ + + | codePresenter printItCommand record | codePresenter := self codePresenterFrom: self playgroundPagePresenter. printItCommand := SpCodePrintItCommand new. printItCommand context: codePresenter. @@ -1282,113 +879,184 @@ DSSpyInstrumenterTest >> testInstrumentSpCodePrintIt [ self assert: record selectedString equals: '41+1' ] -{ #category : 'tests - playground' } -DSSpyInstrumenterTest >> testInstrumentStPlayground [ +{ #category : 'tests - browsers' } +DSSpyInstrumenterTest >> testInstrumentSpCodeSenders [ - | playground | - modifiedClass := StPlaygroundPresenter class. - modifiedMethodSource := (StPlaygroundPresenter class >> #open) - sourceCode. - instrumenter instrumentPlaygroundCode. - playground := StPlaygroundPresenter open. + | codePresenter browseCommand record | + codePresenter := self codePresenterFrom: self playgroundPagePresenter withText: 'execute'. + + browseCommand := SpBrowseSendersCommand new. + browseCommand context: codePresenter. + codePresenter selectionInterval: (1 to: 7). + browseCommand execute. + + self assert: self registry size equals: 2. - "On opening, the playground generates an opening record" - self assert: self registry size equals: 1. record := self registry first. - self assert: record class identicalTo: DSPlaygroundOpenedRecord. - self assert: record windowId equals: playground window window hash. - playground close. + self assert: record class identicalTo: DSSendersRecord. + self assert: record windowId equals: codePresenter window identityHash. + + record := self registry second. + self assert: record class identicalTo: DSWindowOpenedRecord ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepInto [ - self assertInstrumentDebuggerCommandNamed: 'Into' + | debugger command record | + debugger := StDummyDebuggerPresenter new. + command := StStepIntoCommand forContext: debugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSStepIntoRecord ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepOver [ - self assertInstrumentDebuggerCommandNamed: 'Over' + | debugger command record | + debugger := StDummyDebuggerPresenter new. + command := StStepOverCommand forContext: debugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSStepOverRecord ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepThrough [ - self assertInstrumentDebuggerCommandNamed: 'Through' + | debugger command record | + debugger := StDummyDebuggerPresenter new. + command := StStepThroughCommand forContext: debugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSStepThroughRecord ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepToMethodEntry [ - self assertInstrumentSindarinDebuggerCommandNamed: 'To method entry' + | sindarinDebugger command record | + sindarinDebugger := self getSindarinDebuggerForTesting. + command := SindarinStepToMethodEntryCommand forContext: sindarinDebugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSSindarinStepToMethodEntry ] { #category : 'tests - debugger' } -DSSpyInstrumenterTest >> testInstrumentStepToNextCallInClass [ +DSSpyInstrumenterTest >> testInstrumentStepToNextExecutionInClass [ - self assertInstrumentSindarinDebuggerCommandNamed: 'To next execution in class' + | sindarinDebugger command record | + sindarinDebugger := self getSindarinDebuggerForTesting. + command := SindarinStepToNextExecutionInClassCommand forContext: sindarinDebugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSSindarinStepToNextExecution ] { #category : 'tests - debugger' } -DSSpyInstrumenterTest >> testInstrumentStepToNextCallInObject [ +DSSpyInstrumenterTest >> testInstrumentStepToNextExecutionInObject [ + + | sindarinDebugger command record | + sindarinDebugger := self getSindarinDebuggerForTesting. + command := SindarinStepToNextExecutionInObjectCommand forContext: sindarinDebugger. + command execute. + + self assert: self registry size equals: 1. - self assertInstrumentSindarinDebuggerCommandNamed: 'To next execution in receiver' + record := self registry first. + self assert: record class identicalTo: DSSindarinStepToNextExecution ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepToNextInstanceCreation [ - self assertInstrumentSindarinDebuggerCommandNamed: 'Next instance creation' + | sindarinDebugger command record | + sindarinDebugger := self getSindarinDebuggerForTesting. + command := SindarinStepToNextInstanceCreation forContext: sindarinDebugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSSindarinStepToNextInstanceCreation ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepToReturnCommand [ - self assertInstrumentSindarinDebuggerCommandNamed: 'To return' + | sindarinDebugger command record | + sindarinDebugger := self getSindarinDebuggerForTesting. + command := SindarinStepToReturnCommand forContext: sindarinDebugger. + command execute. + + self assert: self registry size equals: 1. + + record := self registry first. + self assert: record class identicalTo: DSSindarinStepToReturn ] { #category : 'tests - interactions' } DSSpyInstrumenterTest >> testLoggingInteractionsWithNoSourceCode [ + DSSpy recordSourceCode: false. - { + { DSDebugItRecord. DSDoItRecord. - DSPrintItRecord } do: [ :recordClass | - record := recordClass new record: 'test'. - self - assert: record selectedString - equals: DSSpy recordSourceCodeDisabledErrorMessage ] + DSPrintItRecord } do: [ :recordClass | + | record | + record := recordClass new record: 'test'. + self assert: record selectedString equals: DSSpy recordSourceCodeDisabledErrorMessage ] ] { #category : 'tests - exceptions' } DSSpyInstrumenterTest >> testRecordDNU [ - |capturedDNU| - - modifiedClass := Exception. - modifiedMethodSource := (Exception >> #raiseUnhandledError) sourceCode. - instrumenter instrumentExceptionSignalling. - - [self methodWithDNU] on: MessageNotUnderstood do:[:dnu| capturedDNU := dnu. [dnu raiseUnhandledError] on: UnhandledError do:[] ]. - + + | capturedDNU record | + [ self methodWithDNU ] + on: MessageNotUnderstood + do: [ :dnu | + capturedDNU := dnu. + [ dnu raiseUnhandledError ] + on: UnhandledError + do: [ ] ]. + record := self registry first. self assert: record class equals: DSUnhandledExceptionRecord. self assert: record exceptionClass equals: MessageNotUnderstood name. self assert: record errorString equals: capturedDNU description. self assert: record receiver equals: self class name. - self assert: record node equals: (self class>>#methodWithDNU) ast children first sourceCode. - self assert: record method equals: (self class>>#methodWithDNU) selector + self assert: record node equals: (self class >> #methodWithDNU) ast children first sourceCode. + self assert: record method equals: (self class >> #methodWithDNU) selector ] { #category : 'tests - exceptions' } DSSpyInstrumenterTest >> testRecordException [ - |capturedException| - - modifiedClass := Exception. - modifiedMethodSource := (Exception >> #raiseUnhandledError) sourceCode. - instrumenter instrumentExceptionSignalling. - - [self methodWithException] on: Exception do:[:e| capturedException := e copy. [e raiseUnhandledError] on: UnhandledError do:[] ]. + + | capturedException record | + [ self methodWithException ] + on: Exception + do: [ :e | + capturedException := e copy. + [ e raiseUnhandledError ] + on: UnhandledError + do: [ ] ]. self assert: self registry size equals: 1. record := self registry first. @@ -1396,6 +1064,6 @@ DSSpyInstrumenterTest >> testRecordException [ self assert: record exceptionClass equals: Exception name. self assert: record errorString equals: capturedException description. self assert: record receiver equals: self class name. - self assert: record node equals: (self class>>#methodWithException) ast children first sourceCode. - self assert: record method equals: (self class>>#methodWithException) selector + self assert: record node equals: (self class >> #methodWithException) ast children first sourceCode. + self assert: record method equals: (self class >> #methodWithException) selector ] diff --git a/DebuggingSpy-Tests/DSSpyTest.class.st b/DebuggingSpy-Tests/DSSpyTest.class.st index 0b0ab63..a44e02d 100644 --- a/DebuggingSpy-Tests/DSSpyTest.class.st +++ b/DebuggingSpy-Tests/DSSpyTest.class.st @@ -184,11 +184,13 @@ DSSpyTest >> setUp [ DSSpy packagesMonitoredForSourceCodeChanges: nil. recordSourceCode := DSSpy recordSourceCode. DSSpy recordSourceCode: false. - DSSpy scopeSourceCodeChangesRecording: true + DSSpy scopeSourceCodeChangesRecording: true. + DSSpy testingSession: true ] { #category : 'running' } DSSpyTest >> tearDown [ + DSRecordRegistry autoSerialize: false. instrumenter unsubscribeFromSystemAnnouncer. debugpoint ifNotNil: [ debugpoint remove ]. @@ -197,43 +199,46 @@ DSSpyTest >> tearDown [ DSRecordRegistry current reset. DSSpy recordSourceCode: recordSourceCode. DSSpy scopeSourceCodeChangesRecording: nil. + DSSpy resetSpy. + + 'tests' asFileReference ensureDeleteAll. super tearDown ] { #category : 'tests - task management' } DSSpyTest >> testCloseSurvey [ - - |taskLoggingFileName recordedSurvey| + + | taskLoggingFileName recordedSurvey | DSSpy logOnlyWhenTaskStarted: true. DSSpy startTask: task. DSRecordRegistry autoSerialize: true. - taskLoggingFileName := task title, '-', DSSpy logger defaultLoggingFileName. - + taskLoggingFileName := task title , '-' , DSSpy logger defaultLoggingFileName. + self assert: self registry size equals: 1. self assert: DSSpy logger loggingFileName equals: taskLoggingFileName. self assert: DSSpy logger loggingFileReference basename equals: taskLoggingFileName. - + DSSpy closeSurvey: survey. self assert: self registry size equals: 2. self assert: DSSpy logger loggingFileName equals: taskLoggingFileName. - self assert: DSSpy logger loggingFileReference basename equals: taskLoggingFileName. - + self assert: DSSpy logger loggingFileReference basename equals: taskLoggingFileName. + record := self registry first. self assert: record class equals: DSStartTaskRecord. self assert: record taskName equals: DSTestTask dsTaskDescription. self assert: record description equals: DSTestTask dsTaskDescription. - + record := self registry last. self assert: record class equals: DSSurveyRecord. self assert: record answer equals: survey answer. self assert: record description equals: DSTestSurvey dsSurveyDescription. - - recordedSurvey := (STON fromString: (DSSpy logger loggingDirectory / (DSSpy logger filenameForSurvey: survey)) readStream contents) first. + + recordedSurvey := (STON fromString: + (DSSpy logger loggingDirectory / (DSSpy logger filenameForSurvey: survey)) readStream contents) first. self assert: recordedSurvey class equals: DSSurveyRecord. self assert: recordedSurvey answer equals: survey answer. self assert: recordedSurvey description equals: DSTestSurvey dsSurveyDescription. (DSSpy logger loggingDirectory / (DSSpy logger filenameForSurvey: survey)) delete - ] { #category : 'tests - debugpoints events' } @@ -323,6 +328,7 @@ DSSpyTest >> testDefaultLogger [ { #category : 'tests - task management' } DSSpyTest >> testEndTask [ + DSSpy endTask: task. self assert: self registry size equals: 1. record := self registry first. @@ -361,42 +367,14 @@ DSSpyTest >> testLogKey [ self assert: record event equals: #TEST ] -{ #category : 'tests - logging' } -DSSpyTest >> testLogOnlyWhenTaskStarted [ - |str dir| - dir := DSSpy logger loggingDirectory. - dir exists ifTrue: [ dir deleteAllChildren]. - DSSpy resetSpy. - self deny: DSSpy logOnlyWhenTaskStarted. - - str := WriteStream on: String new. - str nextPutAll: '[''test'']'. - - DSSpy logOnlyWhenTaskStarted: true. - DSSpy log: 'test'. - self assert: DSSpy logOnlyWhenTaskStarted. - self assert: DSSpy logger loggingFileReference contents isEmpty. - - DSSpy startTask: task. - DSSpy log: 'test'. - self assert: DSSpy logger loggingFileReference contents equals: str contents. - - DSSpy endTask: task. - self assert: DSSpy logOnlyWhenTaskStarted - -] - { #category : 'tests - window events' } DSSpyTest >> testLogWindowActivated [ DSSpy logWindowActivated: self windowEvent. - self assert: self registry size equals: 2. + self assert: self registry size equals: 1. record := self registry first. - self assert: record class identicalTo: DSToolWindowActivatedEventRecord. - - record := self registry second. self assertWindowEventRecordedAs: DSWindowActivatedRecord ] @@ -416,30 +394,26 @@ DSSpyTest >> testLogWindowOpened [ DSSpy logWindowOpened: self windowEvent. - self assert: self registry size equals: 2. + self assert: self registry size equals: 1. record := self registry first. - self assert: record class identicalTo: DSToolWindowOpenedEventRecord. - - record := self registry second. self assertWindowEventRecordedAs: DSWindowOpenedRecord ] { #category : 'tests - serialize/materialize' } DSSpyTest >> testMaterialize [ - |records materializedRecords| - DSSpy logger loggingFileReference ensureDelete. - DSSpy resetSpy. - records := OrderedCollection with: (DSLoggingErrorRecord for: #TEST) with: (DSLoggingErrorRecord for: #TEST). - records do:[:r| DSSpy serialize: r]. + + | records materializedRecords | + records := OrderedCollection with: (DSLoggingErrorRecord for: #TEST) with: (DSLoggingErrorRecord for: #TEST). + records do: [ :r | DSSpy serialize: r ]. materializedRecords := DSSpy materialize: DSSpy logger loggingFileReference. self assert: materializedRecords size equals: 2. - + self assert: materializedRecords first class equals: DSLoggingErrorRecord. self assert: materializedRecords first dateTime equals: records first dateTime. self assert: materializedRecords first eventName equals: records first eventName. self assert: materializedRecords first event equals: records first event. - + self assert: materializedRecords second class equals: DSLoggingErrorRecord. self assert: materializedRecords second dateTime equals: records second dateTime. self assert: materializedRecords second eventName equals: records second eventName. @@ -813,9 +787,7 @@ DSSpyTest >> testResetSpy [ DSSpy startTask: task. DSSpy resetSpy. self deny: DSSpy taskStarted. - self - assert: DSSpy logger loggingFileName - equals: DSSpy logger defaultLoggingFileName + self assert: DSSpy logger loggingFileName equals: DSSpy logger defaultLoggingFileName ] { #category : 'tests - methods events' } @@ -827,8 +799,6 @@ DSSpyTest >> testScopeSourceCodeChangesRecording [ { #category : 'tests - serialize/materialize' } DSSpyTest >> testSerialize [ - DSSpy logger loggingFileReference ensureDelete. - DSSpy resetSpy. record := DSLoggingErrorRecord for: #TEST. DSSpy serialize: record. self @@ -838,7 +808,7 @@ DSSpyTest >> testSerialize [ { #category : 'tests - task management' } DSSpyTest >> testStartTask [ - + DSSpy startTask: task. self assert: self registry size equals: 1. record := self registry first. @@ -851,9 +821,7 @@ DSSpyTest >> testStartTask [ DSSpyTest >> testStartTaskSerialization [ | recordedTask | - DSSpy logger loggingDirectory deleteAllChildren. DSRecordRegistry autoSerialize: true. - DSSpy resetSpy. DSSpy startTask: task. recordedTask := (DSSpy materialize: DSSpy logger loggingFileReference) first. self assert: recordedTask class equals: DSStartTaskRecord. @@ -945,27 +913,19 @@ DSSpyTest >> testWatchDebugPointRemoved [ DSSpyTest >> testWindowOpenedListensToWindowActivatedAndClosedEvents [ DSSpy logWindowOpened: self windowEvent. - self windowEvent window announceActivated. - self windowEvent window announce: (WindowClosed new + DSSpy logWindowActivated: windowEvent window announceActivated. + DSSpy logWindowClosed: (windowEvent window announce: (WindowClosed new window: self windowEvent window; - yourself). - self assert: self registry size equals: 5. + yourself)). + self assert: self registry size equals: 3. record := self registry first. - 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. + record := self registry second. self assert: record class identicalTo: DSWindowActivatedRecord. - record := self registry at: 5. + record := self registry third. self assert: record class identicalTo: DSWindowClosedRecord ] diff --git a/DebuggingSpy/ClyTextEditor.extension.st b/DebuggingSpy/ClyTextEditor.extension.st new file mode 100644 index 0000000..e48eb9c --- /dev/null +++ b/DebuggingSpy/ClyTextEditor.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'ClyTextEditor' } + +{ #category : '*DebuggingSpy' } +ClyTextEditor >> recordSelectedString [ + + ^ self selection string +] diff --git a/DebuggingSpy/DSAbstractBrowserRecord.class.st b/DebuggingSpy/DSAbstractBrowserRecord.class.st new file mode 100644 index 0000000..323bd07 --- /dev/null +++ b/DebuggingSpy/DSAbstractBrowserRecord.class.st @@ -0,0 +1,16 @@ +" +Abstract record for events linked to the browser : browse, senders, implementors, ... +" +Class { + #name : 'DSAbstractBrowserRecord', + #superclass : 'DSAbstractEventRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'actions api' } +DSAbstractBrowserRecord >> record: aCommandObject [ + + self windowId: aCommandObject recordWindow identityHash +] diff --git a/DebuggingSpy/DSAbstractDebugPointEventRecord.class.st b/DebuggingSpy/DSAbstractDebugPointEventRecord.class.st index 2863995..7957707 100644 --- a/DebuggingSpy/DSAbstractDebugPointEventRecord.class.st +++ b/DebuggingSpy/DSAbstractDebugPointEventRecord.class.st @@ -9,7 +9,6 @@ Class { 'target', 'behaviors', 'arguments', - 'link', 'enabled', 'eventName', 'debugPointHash' diff --git a/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st b/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st index 3ea7b30..0e98796 100644 --- a/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st +++ b/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st @@ -1,12 +1,15 @@ +" +I am an abstract class representing a record of a debugPoint's target. +" Class { #name : 'DSAbstractDebugPointTargetRecord', #superclass : 'Object', #instVars : [ 'target' ], - #category : 'DebuggingSpy-Records', + #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', - #tag : 'Records' + #tag : 'Records-Extensions' } { #category : 'instance creation' } diff --git a/DebuggingSpy/DSAbstractDebuggerActionRecord.class.st b/DebuggingSpy/DSAbstractDebuggerActionRecord.class.st new file mode 100644 index 0000000..98d2ade --- /dev/null +++ b/DebuggingSpy/DSAbstractDebuggerActionRecord.class.st @@ -0,0 +1,10 @@ +" +I am recording actions linked to Debugger's commands: step into, over, through, ... +" +Class { + #name : 'DSAbstractDebuggerActionRecord', + #superclass : 'DSAbstractEventRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} diff --git a/DebuggingSpy/DSAbstractEventRecord.class.st b/DebuggingSpy/DSAbstractEventRecord.class.st index 5e6924f..0c7ecf5 100644 --- a/DebuggingSpy/DSAbstractEventRecord.class.st +++ b/DebuggingSpy/DSAbstractEventRecord.class.st @@ -23,16 +23,14 @@ DSAbstractEventRecord class >> for: anObject [ ^ rec ] -{ #category : 'printing' } -DSAbstractEventRecord class >> printStringMorphs: anArrayOfMorphs [ +{ #category : 'accessing' } +DSAbstractEventRecord class >> link [ - | str | - str := WriteStream on: String new. - anArrayOfMorphs do: [ :m | - ((m isKindOf: StringMorph) and: [ m contents ~= '...' ]) ifTrue: [ - str << m contents asString. - m == anArrayOfMorphs last ifFalse: [ str << ' ' ] ] ]. - ^ str contents + ^ DSMetaLink new + metaObject: self; + selector: #for:; + arguments: #( receiver ); + control: #before ] { #category : 'comparing' } @@ -103,10 +101,7 @@ DSAbstractEventRecord >> realRecord [ { #category : 'actions api' } DSAbstractEventRecord >> record: aWindow [ - windowId := aWindow identityHash. -" (aWindow isKindOf: ClyBrowserMorph) ifFalse: [ ^ self ]. - aWindow activeWindow ifNil:[^self]. - windowId := aWindow activeWindow identityHash" + self windowId: aWindow identityHash. ] { #category : 'API-history' } @@ -127,9 +122,9 @@ DSAbstractEventRecord >> windowId [ ] { #category : 'accessing' } -DSAbstractEventRecord >> windowId: anObject [ +DSAbstractEventRecord >> windowId: aWindowId [ - windowId := anObject + windowId := aWindowId = nil identityHash ifTrue: [ nil ] ifFalse: [ aWindowId ] ] { #category : 'accessing' } diff --git a/DebuggingSpy/DSAbstractSindarinActionRecord.class.st b/DebuggingSpy/DSAbstractSindarinActionRecord.class.st new file mode 100644 index 0000000..63bda5e --- /dev/null +++ b/DebuggingSpy/DSAbstractSindarinActionRecord.class.st @@ -0,0 +1,10 @@ +" +I am an abstract class for records linked to the Sindarin debugger. +" +Class { + #name : 'DSAbstractSindarinActionRecord', + #superclass : 'DSAbstractEventRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} diff --git a/DebuggingSpy/DSBreakpointReport.class.st b/DebuggingSpy/DSBreakpointReport.class.st index 8311136..080fa55 100644 --- a/DebuggingSpy/DSBreakpointReport.class.st +++ b/DebuggingSpy/DSBreakpointReport.class.st @@ -4,9 +4,9 @@ Class { #instVars : [ 'targets' ], - #category : 'DebuggingSpy-Records-Extensions', + #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', - #tag : 'Records-Extensions' + #tag : 'Records' } { #category : 'adding' } diff --git a/DebuggingSpy/DSBrowseContextRecord.class.st b/DebuggingSpy/DSBrowseContextRecord.class.st deleted file mode 100644 index e3c9fe5..0000000 --- a/DebuggingSpy/DSBrowseContextRecord.class.st +++ /dev/null @@ -1,70 +0,0 @@ -" -I record printed representation of browsed contexts in the debugger: -- the receiver -- the selector -" -Class { - #name : 'DSBrowseContextRecord', - #superclass : 'DSDebuggerRecord', - #instVars : [ - 'receiver', - 'selector' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSBrowseContextRecord >> context [ - ^'Browsing' -] - -{ #category : 'accessing' } -DSBrowseContextRecord >> eventName [ - ^'Browse context' -] - -{ #category : 'accessing - structure variables' } -DSBrowseContextRecord >> glyph [ - ^'Br' -] - -{ #category : 'accessing - structure variables' } -DSBrowseContextRecord >> glyphColor [ - - ^ Color orange -] - -{ #category : 'accessing' } -DSBrowseContextRecord >> receiver [ - - ^ receiver -] - -{ #category : 'accessing' } -DSBrowseContextRecord >> receiver: anObject [ - - receiver := anObject -] - -{ #category : 'actions api' } -DSBrowseContextRecord >> record: aContextAndWindow [ - |ctx| - super record: aContextAndWindow. - ctx := aContextAndWindow first. - receiver := ctx receiver printString. - selector := ctx selector -] - -{ #category : 'accessing' } -DSBrowseContextRecord >> selector [ - - ^ selector -] - -{ #category : 'accessing' } -DSBrowseContextRecord >> selector: anObject [ - - selector := anObject -] diff --git a/DebuggingSpy/DSBrowseRecord.class.st b/DebuggingSpy/DSBrowseRecord.class.st new file mode 100644 index 0000000..27ef8a7 --- /dev/null +++ b/DebuggingSpy/DSBrowseRecord.class.st @@ -0,0 +1,20 @@ +" +Record when a user is doing a ""Browse"" on a class, method, ... +" +Class { + #name : 'DSBrowseRecord', + #superclass : 'DSAbstractBrowserRecord', + #instVars : [ + 'packageBrowsed', + 'classBrowsed', + 'methodBrowsed' + ], + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSBrowseRecord >> eventName [ + ^ 'Browse' +] diff --git a/DebuggingSpy/DSClipboardActionRecord.class.st b/DebuggingSpy/DSClipboardActionRecord.class.st index 6b3f0fb..e7c0fab 100644 --- a/DebuggingSpy/DSClipboardActionRecord.class.st +++ b/DebuggingSpy/DSClipboardActionRecord.class.st @@ -40,8 +40,8 @@ DSClipboardActionRecord >> editorClassName: anObject [ ] { #category : 'actions api' } -DSClipboardActionRecord >> record: recordInfo [ - clipboardText := DSSpy recordClipboardContent ifTrue: [ recordInfo first] ifFalse: ['RecordClipboarContent disabled']. - windowId := recordInfo second. - editorClassName := recordInfo third +DSClipboardActionRecord >> record: anEditor [ + + self windowId: anEditor textArea window hash. + editorClassName := anEditor class name ] diff --git a/DebuggingSpy/DSClipboardCopyRecord.class.st b/DebuggingSpy/DSClipboardCopyRecord.class.st index 4196313..a68009f 100644 --- a/DebuggingSpy/DSClipboardCopyRecord.class.st +++ b/DebuggingSpy/DSClipboardCopyRecord.class.st @@ -1,3 +1,6 @@ +" +I record when a user is doing a copy to clipboard action. +" Class { #name : 'DSClipboardCopyRecord', #superclass : 'DSClipboardActionRecord', @@ -11,3 +14,13 @@ DSClipboardCopyRecord >> eventName [ ^ 'Clipboard Copy' ] + +{ #category : 'actions api' } +DSClipboardCopyRecord >> record: anEditor [ + + clipboardText := DSSpy recordClipboardContent + ifTrue: [ anEditor selection asString ] + ifFalse: [ 'RecordClipboarContent disabled' ]. + + super record: anEditor +] diff --git a/DebuggingSpy/DSClipboardPasteRecord.class.st b/DebuggingSpy/DSClipboardPasteRecord.class.st index 8a53497..2ac388b 100644 --- a/DebuggingSpy/DSClipboardPasteRecord.class.st +++ b/DebuggingSpy/DSClipboardPasteRecord.class.st @@ -1,3 +1,6 @@ +" +I record when a user is doing a paste from clipboard action. +" Class { #name : 'DSClipboardPasteRecord', #superclass : 'DSClipboardActionRecord', @@ -11,3 +14,13 @@ DSClipboardPasteRecord >> eventName [ ^ 'Clipboard Paste' ] + +{ #category : 'actions api' } +DSClipboardPasteRecord >> record: anEditor [ + + clipboardText := DSSpy recordClipboardContent + ifTrue: [ Clipboard clipboardText ] + ifFalse: [ 'RecordClipboarContent disabled' ]. + + super record: anEditor +] diff --git a/DebuggingSpy/DSCodeActionRecord.class.st b/DebuggingSpy/DSCodeActionRecord.class.st index 56a4ef7..bc029a3 100644 --- a/DebuggingSpy/DSCodeActionRecord.class.st +++ b/DebuggingSpy/DSCodeActionRecord.class.st @@ -14,10 +14,10 @@ Class { } { #category : 'actions api' } -DSCodeActionRecord >> record: aCodeString [ +DSCodeActionRecord >> record: anEditor [ selectedString := DSSpy recordSourceCode - ifTrue: [ aCodeString ] + ifTrue: [ anEditor recordSelectedString ] ifFalse: [ DSSpy recordSourceCodeDisabledErrorMessage ] ] diff --git a/DebuggingSpy/DSCompositeEventRecord.class.st b/DebuggingSpy/DSCompositeEventRecord.class.st deleted file mode 100644 index d808f31..0000000 --- a/DebuggingSpy/DSCompositeEventRecord.class.st +++ /dev/null @@ -1,63 +0,0 @@ -Class { - #name : 'DSCompositeEventRecord', - #superclass : 'DSAbstractEventRecord', - #instVars : [ - 'subEvents' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'adding' } -DSCompositeEventRecord >> addSubEvent: aDSEvent [ - - self subEvents add: aDSEvent -] - -{ #category : 'API' } -DSCompositeEventRecord >> canOpenDebuggers [ - - ^ self subEvents first canOpenDebuggers -] - -{ #category : 'accessing' } -DSCompositeEventRecord >> dateTime [ - - ^ self subEvents first dateTime -] - -{ #category : 'API' } -DSCompositeEventRecord >> duration [ - - ^ subEvents last dateTime - subEvents first dateTime -] - -{ #category : 'accessing' } -DSCompositeEventRecord >> eventName [ - ^subEvents first eventName -] - -{ #category : 'accessing' } -DSCompositeEventRecord >> subEvents [ - - ^ subEvents ifNil: [ subEvents := OrderedCollection new ] -] - -{ #category : 'accessing' } -DSCompositeEventRecord >> subEvents: anObject [ - - subEvents := anObject -] - -{ #category : 'API' } -DSCompositeEventRecord >> windowId [ - - ^ self subEvents first windowId -] - -{ #category : 'API' } -DSCompositeEventRecord >> windowType [ - - ^ self subEvents first windowType -] diff --git a/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st b/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st deleted file mode 100644 index 11d9018..0000000 --- a/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st +++ /dev/null @@ -1,7 +0,0 @@ -Class { - #name : 'DSDebugPointCheckBehaviorRecord', - #superclass : 'Object', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} diff --git a/DebuggingSpy/DSDebugPointClassTargetRecord.class.st b/DebuggingSpy/DSDebugPointClassTargetRecord.class.st index 730e81b..8c6256c 100644 --- a/DebuggingSpy/DSDebugPointClassTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointClassTargetRecord.class.st @@ -1,7 +1,10 @@ +" +I am a class which represents a class target record for debugPoint. +" Class { #name : 'DSDebugPointClassTargetRecord', #superclass : 'DSAbstractDebugPointTargetRecord', - #category : 'DebuggingSpy-Records', + #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', - #tag : 'Records' + #tag : 'Records-Extensions' } diff --git a/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st b/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st index 1e84d2a..f7edb51 100644 --- a/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st @@ -1,12 +1,15 @@ +" +I am a class that reprensent instance variable target record for debugPoint. +" Class { #name : 'DSDebugPointInstanceVariableTargetRecord', #superclass : 'DSDebugPointClassTargetRecord', #instVars : [ 'accessStrategy' ], - #category : 'DebuggingSpy-Records', + #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', - #tag : 'Records' + #tag : 'Records-Extensions' } { #category : 'accessing' } diff --git a/DebuggingSpy/DSDebugPointMetaBehaviorRecord.class.st b/DebuggingSpy/DSDebugPointMetaBehaviorRecord.class.st deleted file mode 100644 index 8acef38..0000000 --- a/DebuggingSpy/DSDebugPointMetaBehaviorRecord.class.st +++ /dev/null @@ -1,7 +0,0 @@ -Class { - #name : 'DSDebugPointMetaBehaviorRecord', - #superclass : 'Object', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} diff --git a/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st b/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st index 97e7ff5..a322285 100644 --- a/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st @@ -1,7 +1,10 @@ +" +I am a class that reprensent node target record for debugPoint. +" Class { #name : 'DSDebugPointNodeTargetRecord', #superclass : 'DSDebugPointClassTargetRecord', - #category : 'DebuggingSpy-Records', + #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', - #tag : 'Records' + #tag : 'Records-Extensions' } diff --git a/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st b/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st index b052f4b..efee89f 100644 --- a/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st @@ -1,12 +1,15 @@ +" +I am a class that reprensent object target record for debugPoint. +" Class { #name : 'DSDebugPointObjectTargetRecord', #superclass : 'DSAbstractDebugPointTargetRecord', #instVars : [ 'subTarget' ], - #category : 'DebuggingSpy-Records', + #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', - #tag : 'Records' + #tag : 'Records-Extensions' } { #category : 'actions api' } diff --git a/DebuggingSpy/DSDebugPointRecord.class.st b/DebuggingSpy/DSDebugPointRecord.class.st index 2c5ea5f..ecc792e 100644 --- a/DebuggingSpy/DSDebugPointRecord.class.st +++ b/DebuggingSpy/DSDebugPointRecord.class.st @@ -1,3 +1,6 @@ +" +I represent a debugPoint recorded event. +" Class { #name : 'DSDebugPointRecord', #superclass : 'DSAbstractExtendedRecord', diff --git a/DebuggingSpy/DSDebuggerActionRecord.class.st b/DebuggingSpy/DSDebuggerActionRecord.class.st deleted file mode 100644 index 61da3a8..0000000 --- a/DebuggingSpy/DSDebuggerActionRecord.class.st +++ /dev/null @@ -1,81 +0,0 @@ -" -I record debugger actions such as step, stepOver, etc. -The name of the action is stored in my event name -" -Class { - #name : 'DSDebuggerActionRecord', - #superclass : 'DSDebuggerRecord', - #instVars : [ - 'eventName' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'tests - instance creation' } -DSDebuggerActionRecord class >> into: aContext [ - - ^ (self for: aContext) - eventName: 'Into'; - yourself -] - -{ #category : 'tests - instance creation' } -DSDebuggerActionRecord class >> over: aContext [ - - ^ (self for: aContext) - eventName: 'Over'; - yourself -] - -{ #category : 'tests - instance creation' } -DSDebuggerActionRecord class >> proceed: aContext [ - - ^ (self for: aContext) - eventName: 'Proceed'; - yourself -] - -{ #category : 'tests - instance creation' } -DSDebuggerActionRecord class >> restart: aContext [ - - ^ (self for: aContext) - eventName: 'Restart'; - yourself -] - -{ #category : 'tests - instance creation' } -DSDebuggerActionRecord class >> return: aContext [ - - ^ (self for: aContext) - eventName: 'Return'; - yourself -] - -{ #category : 'tests - instance creation' } -DSDebuggerActionRecord class >> runTo: aContext [ - - ^ (self for: aContext) - eventName: 'Run to'; - yourself -] - -{ #category : 'tests - instance creation' } -DSDebuggerActionRecord class >> through: aContext [ - - ^ (self for: aContext) - eventName: 'Through'; - yourself -] - -{ #category : 'accessing' } -DSDebuggerActionRecord >> eventName [ - ^eventName -] - -{ #category : 'accessing' } -DSDebuggerActionRecord >> eventName: anObject [ - - eventName := anObject -] diff --git a/DebuggingSpy/DSDebuggerOpeningRecord.class.st b/DebuggingSpy/DSDebuggerOpeningRecord.class.st deleted file mode 100644 index a7fc182..0000000 --- a/DebuggingSpy/DSDebuggerOpeningRecord.class.st +++ /dev/null @@ -1,66 +0,0 @@ -" -I am generated when a debugger is opened. -" -Class { - #name : 'DSDebuggerOpeningRecord', - #superclass : 'DSDebuggerRecord', - #instVars : [ - 'debuggerId' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSDebuggerOpeningRecord >> debuggerId [ - - ^ debuggerId -] - -{ #category : 'accessing' } -DSDebuggerOpeningRecord >> debuggerId: anObject [ - - debuggerId := anObject -] - -{ #category : 'accessing' } -DSDebuggerOpeningRecord >> eventName [ - ^'Debugger open' -] - -{ #category : 'actions api' } -DSDebuggerOpeningRecord >> primarySourcesOfWindowOpenings [ - - ^ ({ - DSDebugPointRecord. - DSAbstractDebugPointEventRecord. - DSHaltHitRecord. - DSUnhandledExceptionRecord } collect: [ :c | c withAllSubclasses ]) - flattened -] - -{ #category : 'actions api' } -DSDebuggerOpeningRecord >> record: aDebugger [ - debuggerId := aDebugger identityHash. - super record: { aDebugger currentContext. aDebugger window window } -] - -{ #category : 'actions api' } -DSDebuggerOpeningRecord >> secondarySourcesOfWindowOpenings [ - - ^ ({ - DSCodeActionRecord. - DSStepActionRecord } collect: [ :c | c withAllSubclasses ]) - flattened -] - -{ #category : 'accessing' } -DSDebuggerOpeningRecord >> windowName [ - ^contextName -] - -{ #category : 'accessing' } -DSDebuggerOpeningRecord >> windowType [ - ^'Debugger' -] diff --git a/DebuggingSpy/DSDebuggerRecord.class.st b/DebuggingSpy/DSDebuggerRecord.class.st deleted file mode 100644 index ee6c1d1..0000000 --- a/DebuggingSpy/DSDebuggerRecord.class.st +++ /dev/null @@ -1,64 +0,0 @@ -" -I record debugger events triggered from users' interaction with the debugger. -I store the browsed debugger context: the executed method and the node that is going to be executed next. -" -Class { - #name : 'DSDebuggerRecord', - #superclass : 'DSAbstractEventRecord', - #instVars : [ - 'contextName', - 'sourceNodeClass', - 'sourceNodeCode' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSDebuggerRecord >> contextName [ - - ^ contextName -] - -{ #category : 'accessing' } -DSDebuggerRecord >> contextName: anObject [ - - contextName := anObject -] - -{ #category : 'actions api' } -DSDebuggerRecord >> record: aContextAndWindow [ - |aContext method sourceNode| - super record: aContextAndWindow second. - aContext := aContextAndWindow first. - method := aContext method. - contextName := method isCompiledBlock ifTrue:[method printString] ifFalse:[method name]. - sourceNode := aContext sourceNodeExecuted. - sourceNodeClass := sourceNode class name. - sourceNodeCode := sourceNode sourceCode -] - -{ #category : 'accessing' } -DSDebuggerRecord >> sourceNodeClass [ - - ^ sourceNodeClass -] - -{ #category : 'accessing' } -DSDebuggerRecord >> sourceNodeClass: anObject [ - - sourceNodeClass := anObject -] - -{ #category : 'accessing' } -DSDebuggerRecord >> sourceNodeCode [ - - ^ sourceNodeCode -] - -{ #category : 'accessing' } -DSDebuggerRecord >> sourceNodeCode: anObject [ - - sourceNodeCode := anObject -] diff --git a/DebuggingSpy/DSDoItRecord.class.st b/DebuggingSpy/DSDoItRecord.class.st index 4d2a4b0..f654df5 100644 --- a/DebuggingSpy/DSDoItRecord.class.st +++ b/DebuggingSpy/DSDoItRecord.class.st @@ -1,5 +1,5 @@ " -I record when the user selects code and debugs it. +I record when the user selects code and executes it by a ""Do it"". " Class { #name : 'DSDoItRecord', diff --git a/DebuggingSpy/DSExceptionReport.class.st b/DebuggingSpy/DSExceptionReport.class.st index 38c2388..2052e1c 100644 --- a/DebuggingSpy/DSExceptionReport.class.st +++ b/DebuggingSpy/DSExceptionReport.class.st @@ -5,9 +5,9 @@ Class { 'records', 'method' ], - #category : 'DebuggingSpy-Records-Extensions', + #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', - #tag : 'Records-Extensions' + #tag : 'Records' } { #category : 'adding' } diff --git a/DebuggingSpy/DSExpandAttributeRecord.class.st b/DebuggingSpy/DSExpandAttributeRecord.class.st deleted file mode 100644 index f115b71..0000000 --- a/DebuggingSpy/DSExpandAttributeRecord.class.st +++ /dev/null @@ -1,26 +0,0 @@ -" -I record the inspection of an inspected object's attribute through expanding inspector trees -" -Class { - #name : 'DSExpandAttributeRecord', - #superclass : 'DSInspectAttributeRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing - structure variables' } -DSExpandAttributeRecord >> glyph [ - ^'EA' -] - -{ #category : 'actions api' } -DSExpandAttributeRecord >> record: aFTTableItem [ - |window| - window := aFTTableItem dataSource model window. - (window isKindOf: SpWindowPresenter) ifTrue:[window := window window]. - super record: { - aFTTableItem data. - aFTTableItem data hostObject. - window} -] diff --git a/DebuggingSpy/DSFullBrowseRecord.class.st b/DebuggingSpy/DSFullBrowseRecord.class.st deleted file mode 100644 index 3fbdb8b..0000000 --- a/DebuggingSpy/DSFullBrowseRecord.class.st +++ /dev/null @@ -1,82 +0,0 @@ -" -I record user browsing code action. -I store the browsed package, class and method names, and the window id in which it happened. -Elements are browsed in order `package>class>method`. -If one of them is nil, for instance, `package>class>nil`, it means that the user is browsing the class and possibly looking at its methods, or at the list of classes in the package, or at the packages list. - -I have to register names instead of objects, as there are no guarantees that the image that analyzes the record has these package/class/method. -" -Class { - #name : 'DSFullBrowseRecord', - #superclass : 'DSAbstractEventRecord', - #instVars : [ - 'methodBrowsed', - 'packageBrowsed', - 'classBrowsed' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSFullBrowseRecord >> classBrowsed [ - - ^ classBrowsed -] - -{ #category : 'accessing' } -DSFullBrowseRecord >> classBrowsed: anObject [ - - classBrowsed := anObject -] - -{ #category : 'accessing' } -DSFullBrowseRecord >> eventName [ - ^'Browse' -] - -{ #category : 'accessing' } -DSFullBrowseRecord >> methodBrowsed [ - - ^ methodBrowsed -] - -{ #category : 'accessing' } -DSFullBrowseRecord >> methodBrowsed: anObject [ - - methodBrowsed := anObject -] - -{ #category : 'accessing' } -DSFullBrowseRecord >> packageBrowsed [ - - ^ packageBrowsed -] - -{ #category : 'accessing' } -DSFullBrowseRecord >> packageBrowsed: anObject [ - - packageBrowsed := anObject -] - -{ #category : 'actions api' } -DSFullBrowseRecord >> record: aClyFullBrowser [ - super record: aClyFullBrowser window. - packageBrowsed := aClyFullBrowser packageSelection isEmpty - ifTrue: [ '' ] - ifFalse: [ - aClyFullBrowser packageSelection lastSelectedItem - actualObject name ]. - classBrowsed := aClyFullBrowser classSelection isEmpty - ifTrue: [ '' ] - ifFalse: [ - aClyFullBrowser classSelection lastSelectedItem - actualObject name ]. - methodBrowsed := aClyFullBrowser methodSelection isEmpty - ifTrue: [ '' ] - ifFalse: [ - aClyFullBrowser methodSelection lastSelectedItem - actualObject name ]. - -] diff --git a/DebuggingSpy/DSHaltReport.class.st b/DebuggingSpy/DSHaltReport.class.st index 1cb19e7..af8e329 100644 --- a/DebuggingSpy/DSHaltReport.class.st +++ b/DebuggingSpy/DSHaltReport.class.st @@ -1,9 +1,9 @@ Class { #name : 'DSHaltReport', #superclass : 'DSExceptionReport', - #category : 'DebuggingSpy-Records-Extensions', + #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', - #tag : 'Records-Extensions' + #tag : 'Records' } { #category : 'printing' } diff --git a/DebuggingSpy/DSImplementorsRecord.class.st b/DebuggingSpy/DSImplementorsRecord.class.st new file mode 100644 index 0000000..d4890c1 --- /dev/null +++ b/DebuggingSpy/DSImplementorsRecord.class.st @@ -0,0 +1,15 @@ +" +Record when a user is searching for implementors of a class, method, ... +" +Class { + #name : 'DSImplementorsRecord', + #superclass : 'DSAbstractBrowserRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSImplementorsRecord >> eventName [ + ^ 'Implementors' +] diff --git a/DebuggingSpy/DSInspectAttributeRecord.class.st b/DebuggingSpy/DSInspectAttributeRecord.class.st deleted file mode 100644 index 5b69ead..0000000 --- a/DebuggingSpy/DSInspectAttributeRecord.class.st +++ /dev/null @@ -1,76 +0,0 @@ -" -I record the inspection of an inspected object's attribute -" -Class { - #name : 'DSInspectAttributeRecord', - #superclass : 'DSInspectorRecord', - #instVars : [ - 'attributeName', - 'attributeValue', - 'attributeHash' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSInspectAttributeRecord >> attributeHash [ - - ^ attributeHash -] - -{ #category : 'accessing' } -DSInspectAttributeRecord >> attributeHash: anObject [ - - attributeHash := anObject -] - -{ #category : 'accessing' } -DSInspectAttributeRecord >> attributeName [ - - ^ attributeName -] - -{ #category : 'accessing' } -DSInspectAttributeRecord >> attributeName: anObject [ - - attributeName := anObject -] - -{ #category : 'accessing' } -DSInspectAttributeRecord >> attributeValue [ - - ^ attributeValue -] - -{ #category : 'accessing' } -DSInspectAttributeRecord >> attributeValue: anObject [ - - attributeValue := anObject -] - -{ #category : 'accessing' } -DSInspectAttributeRecord >> eventName [ - ^'Inspect object' -] - -{ #category : 'accessing - structure variables' } -DSInspectAttributeRecord >> glyph [ - ^'InA' -] - -{ #category : 'actions api' } -DSInspectAttributeRecord >> record: inspectorNodeWithInspectedObjectWithWindow [ - - | inspectorNode window | - inspectorNode := inspectorNodeWithInspectedObjectWithWindow first. - inspectedObject := inspectorNodeWithInspectedObjectWithWindow second. - window := inspectorNodeWithInspectedObjectWithWindow third. - super record: { - inspectedObject. - window }. - attributeName := inspectorNode key. - attributeValue := inspectorNode stringValue. - attributeHash := inspectorNode value identityHash -] diff --git a/DebuggingSpy/DSInspectItRecord.class.st b/DebuggingSpy/DSInspectItRecord.class.st new file mode 100644 index 0000000..fdf9948 --- /dev/null +++ b/DebuggingSpy/DSInspectItRecord.class.st @@ -0,0 +1,16 @@ +" +I record when the user selects code and inspects it. +" +Class { + #name : 'DSInspectItRecord', + #superclass : 'DSCodeActionRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSInspectItRecord >> eventName [ + + ^ 'Inspect it' +] diff --git a/DebuggingSpy/DSInspectMethodSourceRecord.class.st b/DebuggingSpy/DSInspectMethodSourceRecord.class.st deleted file mode 100644 index 28b19ec..0000000 --- a/DebuggingSpy/DSInspectMethodSourceRecord.class.st +++ /dev/null @@ -1,40 +0,0 @@ -" -I record inspections of the source of a method in the meta pane of an inspector -" -Class { - #name : 'DSInspectMethodSourceRecord', - #superclass : 'DSInspectMethodsRecord', - #instVars : [ - 'selectedMethod' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing - structure variables' } -DSInspectMethodSourceRecord >> glyph [ - ^'InMS' -] - -{ #category : 'actions api' } -DSInspectMethodSourceRecord >> record: inspectedObjectWithSelectedClassWithSelectedMethodWithWindow [ - - super record: { - inspectedObjectWithSelectedClassWithSelectedMethodWithWindow first. - inspectedObjectWithSelectedClassWithSelectedMethodWithWindow second. - inspectedObjectWithSelectedClassWithSelectedMethodWithWindow last }. - selectedMethod := inspectedObjectWithSelectedClassWithSelectedMethodWithWindow third name -] - -{ #category : 'accessing' } -DSInspectMethodSourceRecord >> selectedMethod [ - - ^ selectedMethod -] - -{ #category : 'accessing' } -DSInspectMethodSourceRecord >> selectedMethod: anObject [ - - selectedMethod := anObject -] diff --git a/DebuggingSpy/DSInspectMethodsRecord.class.st b/DebuggingSpy/DSInspectMethodsRecord.class.st deleted file mode 100644 index f93e975..0000000 --- a/DebuggingSpy/DSInspectMethodsRecord.class.st +++ /dev/null @@ -1,44 +0,0 @@ -" -I record inspections of the methods of a class in the meta pane of an inspector. -" -Class { - #name : 'DSInspectMethodsRecord', - #superclass : 'DSInspectorRecord', - #instVars : [ - 'selectedClass' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSInspectMethodsRecord >> eventName [ - ^'Inspect methods' -] - -{ #category : 'accessing - structure variables' } -DSInspectMethodsRecord >> glyph [ - ^'InM' -] - -{ #category : 'actions api' } -DSInspectMethodsRecord >> record: inspectedObjectWithSelectedClassWithWindow [ - - super record: { - inspectedObjectWithSelectedClassWithWindow first. - inspectedObjectWithSelectedClassWithWindow last }. - selectedClass := inspectedObjectWithSelectedClassWithWindow second name -] - -{ #category : 'accessing' } -DSInspectMethodsRecord >> selectedClass [ - - ^ selectedClass -] - -{ #category : 'accessing' } -DSInspectMethodsRecord >> selectedClass: anObject [ - - selectedClass := anObject -] diff --git a/DebuggingSpy/DSInspectObjectRecord.class.st b/DebuggingSpy/DSInspectObjectRecord.class.st deleted file mode 100644 index 842e657..0000000 --- a/DebuggingSpy/DSInspectObjectRecord.class.st +++ /dev/null @@ -1,31 +0,0 @@ -" -I record the opening of an inspector on an object -" -Class { - #name : 'DSInspectObjectRecord', - #superclass : 'DSInspectorRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSInspectObjectRecord >> eventName [ - ^'Inspect object' -] - -{ #category : 'accessing - structure variables' } -DSInspectObjectRecord >> glyph [ - ^'InO' -] - -{ #category : 'accessing' } -DSInspectObjectRecord >> windowName [ - - ^ inspectedObject -] - -{ #category : 'accessing' } -DSInspectObjectRecord >> windowType [ - ^'Inspector' -] diff --git a/DebuggingSpy/DSInspectorRecord.class.st b/DebuggingSpy/DSInspectorRecord.class.st deleted file mode 100644 index 55a04a7..0000000 --- a/DebuggingSpy/DSInspectorRecord.class.st +++ /dev/null @@ -1,51 +0,0 @@ -" -I represent recorded events from an open inspector (standalone or embedded in another presenter). -" -Class { - #name : 'DSInspectorRecord', - #superclass : 'DSAbstractEventRecord', - #instVars : [ - 'inspectedObject', - 'inspectedObjectHash' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing - structure variables' } -DSInspectorRecord >> glyphColor [ - ^Color green darker -] - -{ #category : 'accessing' } -DSInspectorRecord >> inspectedObject [ - - ^ inspectedObject -] - -{ #category : 'accessing' } -DSInspectorRecord >> inspectedObject: anObject [ - - inspectedObject := anObject -] - -{ #category : 'accessing' } -DSInspectorRecord >> inspectedObjectHash [ - - ^ inspectedObjectHash -] - -{ #category : 'accessing' } -DSInspectorRecord >> inspectedObjectHash: anObject [ - - inspectedObjectHash := anObject -] - -{ #category : 'actions api' } -DSInspectorRecord >> record: inspectedObjectAndWindow [ - - super record: inspectedObjectAndWindow second. - inspectedObject := inspectedObjectAndWindow first printString. - inspectedObjectHash := inspectedObjectAndWindow first identityHash -] diff --git a/DebuggingSpy/DSIntoRecord.class.st b/DebuggingSpy/DSIntoRecord.class.st deleted file mode 100644 index 24bb1dd..0000000 --- a/DebuggingSpy/DSIntoRecord.class.st +++ /dev/null @@ -1,7 +0,0 @@ -Class { - #name : 'DSIntoRecord', - #superclass : 'DSStepRecord', - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} diff --git a/DebuggingSpy/DSMergedWindowActivityRecord.class.st b/DebuggingSpy/DSMergedWindowActivityRecord.class.st deleted file mode 100644 index a0e3bda..0000000 --- a/DebuggingSpy/DSMergedWindowActivityRecord.class.st +++ /dev/null @@ -1,64 +0,0 @@ -Class { - #name : 'DSMergedWindowActivityRecord', - #superclass : 'DSWindowActivityRecord', - #instVars : [ - 'activities' - ], - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} - -{ #category : 'accessing' } -DSMergedWindowActivityRecord >> activities [ - - ^ activities - ifNil: [ activities := OrderedCollection new ] - ifNotNil: [ activities ] -] - -{ #category : 'accessing' } -DSMergedWindowActivityRecord >> activities: anObject [ - - activities := anObject -] - -{ #category : 'accessing' } -DSMergedWindowActivityRecord >> duration [ - - ^ (self activities - inject: 0 - into: [ :sum :n | sum + n duration asSeconds ]) asSeconds -] - -{ #category : 'accessing' } -DSMergedWindowActivityRecord >> eventName [ - - ^ String streamContents: [ :ws | - self window printTypeOn: ws. - ws << ':'. - ws space. - ws << self duration humanReadablePrintString ] -] - -{ #category : 'accessing' } -DSMergedWindowActivityRecord >> events [ - - ^ (self activities collect: #events) flattened -] - -{ #category : 'merging' } -DSMergedWindowActivityRecord >> merge: aDSWindowActivityRecord [ - - self mergeWith: aDSWindowActivityRecord -] - -{ #category : 'merging' } -DSMergedWindowActivityRecord >> mergeWith: anActivityRecord [ - self activities add: anActivityRecord. - windowId ifNil:[windowId := anActivityRecord windowId]. - start ifNil:[start := anActivityRecord start]. - window ifNil:[window := anActivityRecord window]. - next := anActivityRecord next. - stop := anActivityRecord stop. -] diff --git a/DebuggingSpy/DSMetaLink.class.st b/DebuggingSpy/DSMetaLink.class.st new file mode 100644 index 0000000..44f1c63 --- /dev/null +++ b/DebuggingSpy/DSMetaLink.class.st @@ -0,0 +1,17 @@ +" +MetaLinks only used by Debugging Spy for instrumentation purpose. +" +Class { + #name : 'DSMetaLink', + #superclass : 'MetaLink', + #category : 'DebuggingSpy-Instrumentation', + #package : 'DebuggingSpy', + #tag : 'Instrumentation' +} + +{ #category : 'accessing' } +DSMetaLink class >> linkInstaller [ + ^linkInstaller + ifNil: [ linkInstaller := DSMetaLinkInstaller new ] + +] diff --git a/DebuggingSpy/DSMetaLinkInstaller.class.st b/DebuggingSpy/DSMetaLinkInstaller.class.st new file mode 100644 index 0000000..e199106 --- /dev/null +++ b/DebuggingSpy/DSMetaLinkInstaller.class.st @@ -0,0 +1,27 @@ +" +Installer for DSMetaLinks, it allows to uninstall all DSMetaLinks easily +" +Class { + #name : 'DSMetaLinkInstaller', + #superclass : 'MetaLinkInstaller', + #category : 'DebuggingSpy-Instrumentation', + #package : 'DebuggingSpy', + #tag : 'Instrumentation' +} + +{ #category : 'updating' } +DSMetaLinkInstaller >> methodChanged: aMethodChanged [ + + | links dsLink newMethod | + super methodChanged: aMethodChanged. + + links := aMethodChanged oldMethod compiledMethod ast links. + + links ifEmpty: [ ^ self ]. + + dsLink := links detect: [ :link | link class = DSMetaLink ] ifNone: [ ^ self ]. + + newMethod := aMethodChanged newMethod. + + newMethod methodClass link: dsLink toAST: newMethod ast +] diff --git a/DebuggingSpy/DSMethodDebugPointRecord.class.st b/DebuggingSpy/DSMethodDebugPointRecord.class.st index 48efc57..d79380e 100644 --- a/DebuggingSpy/DSMethodDebugPointRecord.class.st +++ b/DebuggingSpy/DSMethodDebugPointRecord.class.st @@ -1,3 +1,6 @@ +" +Abstract class for records on DebugPoint's actions +" Class { #name : 'DSMethodDebugPointRecord', #superclass : 'DSDebugPointRecord', diff --git a/DebuggingSpy/DSMethodEventRecord.class.st b/DebuggingSpy/DSMethodEventRecord.class.st index 1db38c9..3651e2e 100644 --- a/DebuggingSpy/DSMethodEventRecord.class.st +++ b/DebuggingSpy/DSMethodEventRecord.class.st @@ -18,7 +18,6 @@ Class { DSMethodEventRecord class >> added: aMethod [ ^ (self for: aMethod) - eventName: 'Method added'; yourself ] @@ -26,7 +25,6 @@ DSMethodEventRecord class >> added: aMethod [ DSMethodEventRecord class >> modified: aMethod [ ^ (self for: aMethod) - eventName: 'Method modified'; yourself ] @@ -34,7 +32,6 @@ DSMethodEventRecord class >> modified: aMethod [ DSMethodEventRecord class >> removed: aMethod [ ^ (self for: aMethod) - eventName: 'Method removed'; yourself ] diff --git a/DebuggingSpy/DSMouseDownTableItemRecord.class.st b/DebuggingSpy/DSMouseDownTableItemRecord.class.st deleted file mode 100644 index 49676ee..0000000 --- a/DebuggingSpy/DSMouseDownTableItemRecord.class.st +++ /dev/null @@ -1,15 +0,0 @@ -" -This record is generated when the mouse clicks an item in a table. -" -Class { - #name : 'DSMouseDownTableItemRecord', - #superclass : 'DSMouseEventRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSMouseDownTableItemRecord >> eventName [ - ^'Click on table item' -] diff --git a/DebuggingSpy/DSMouseEnterTableItemRecord.class.st b/DebuggingSpy/DSMouseEnterTableItemRecord.class.st deleted file mode 100644 index c3eff48..0000000 --- a/DebuggingSpy/DSMouseEnterTableItemRecord.class.st +++ /dev/null @@ -1,32 +0,0 @@ -" -This record is generated when the mouse enters an item in a table. -" -Class { - #name : 'DSMouseEnterTableItemRecord', - #superclass : 'DSMouseEventRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSMouseEnterTableItemRecord >> eventName [ - - ^ String streamContents: [ :str | - str << 'Mouse on table item:'. - str space. - str << itemElement ] -] - -{ #category : 'testing' } -DSMouseEnterTableItemRecord >> isOverTestCase [ - - ^ itemElement isString and: [ - itemElement size > 4 and: [ - (itemElement copyFrom: 1 to: 4) = 'test' ] ] -] - -{ #category : 'accessing' } -DSMouseEnterTableItemRecord >> windowName [ - ^windowId -] diff --git a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st b/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st deleted file mode 100644 index 95c3bfe..0000000 --- a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st +++ /dev/null @@ -1,26 +0,0 @@ -" -This record is generated when the mouse enters an item in a text editor. -" -Class { - #name : 'DSMouseEnterTextEditorRecord', - #superclass : 'DSMouseEventRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSMouseEnterTextEditorRecord >> eventName [ - ^'Mouse on text editor' -] - -{ #category : 'accessing' } -DSMouseEnterTextEditorRecord >> windowName [ - ^ windowId -] - -{ #category : 'accessing' } -DSMouseEnterTextEditorRecord >> windowType [ - - ^ 'External Window' -] diff --git a/DebuggingSpy/DSMouseEnterWindowRecord.class.st b/DebuggingSpy/DSMouseEnterWindowRecord.class.st index a548653..e44ec43 100644 --- a/DebuggingSpy/DSMouseEnterWindowRecord.class.st +++ b/DebuggingSpy/DSMouseEnterWindowRecord.class.st @@ -4,9 +4,6 @@ This record is generated when the mouse enters a window (with or without focus). Class { #name : 'DSMouseEnterWindowRecord', #superclass : 'DSMouseEventRecord', - #instVars : [ - 'toolInfo' - ], #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', #tag : 'Records' @@ -16,24 +13,3 @@ Class { DSMouseEnterWindowRecord >> eventName [ ^'Enter window' ] - -{ #category : 'actions api' } -DSMouseEnterWindowRecord >> record: morphsAndWindow [ - - | window tool | - super record: morphsAndWindow. - window := morphsAndWindow last. - window ifNil: [ ^ self ]. - tool := DSSpy toolInWindow: window. - tool ifNil: [ ^ self ]. - toolInfo := DSToolInfo - toolNamed: tool class name - id: tool identityHash - windowId: windowId - action: 'enter' -] - -{ #category : 'accessing' } -DSMouseEnterWindowRecord >> toolInfo [ - ^ toolInfo -] diff --git a/DebuggingSpy/DSMouseEventRecord.class.st b/DebuggingSpy/DSMouseEventRecord.class.st index 3f3f67a..5300f4e 100644 --- a/DebuggingSpy/DSMouseEventRecord.class.st +++ b/DebuggingSpy/DSMouseEventRecord.class.st @@ -9,28 +9,26 @@ Class { #name : 'DSMouseEventRecord', #superclass : 'DSAbstractEventRecord', #instVars : [ - 'itemElement' + 'toolInfo' ], #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', #tag : 'Records' } -{ #category : 'accessing' } -DSMouseEventRecord >> itemElement [ +{ #category : 'actions api' } +DSMouseEventRecord >> record: aWindow [ - ^ itemElement -] + | tool | + self windowId: aWindow identityHash. -{ #category : 'accessing' } -DSMouseEventRecord >> itemElement: anObject [ - - itemElement := anObject + tool := DSSpy toolInWindow: aWindow. + tool ifNil: [ ^ self ]. + toolInfo := DSToolInfo toolNamed: tool class name id: tool identityHash windowId: windowId ] -{ #category : 'actions api' } -DSMouseEventRecord >> record: morphsAndWindow [ +{ #category : 'accessing' } +DSMouseEventRecord >> toolInfo [ - itemElement := self class printStringMorphs: morphsAndWindow first. - windowId := morphsAndWindow last identityHash + ^ toolInfo ] diff --git a/DebuggingSpy/DSNavigateAttributeRecord.class.st b/DebuggingSpy/DSNavigateAttributeRecord.class.st deleted file mode 100644 index 766e541..0000000 --- a/DebuggingSpy/DSNavigateAttributeRecord.class.st +++ /dev/null @@ -1,29 +0,0 @@ -" -I record the inspection of an inspected object's attribute through selecting attributes in inspector tables -" -Class { - #name : 'DSNavigateAttributeRecord', - #superclass : 'DSInspectAttributeRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSNavigateAttributeRecord >> context [ - ^'Inspecting attributes' -] - -{ #category : 'accessing - structure variables' } -DSNavigateAttributeRecord >> glyph [ - ^'NA' -] - -{ #category : 'actions api' } -DSNavigateAttributeRecord >> record: attributeWithModelAndWindow [ - - super record: { - attributeWithModelAndWindow first first. - attributeWithModelAndWindow first second. - attributeWithModelAndWindow second } -] diff --git a/DebuggingSpy/DSOverRecord.class.st b/DebuggingSpy/DSOverRecord.class.st deleted file mode 100644 index cedf18e..0000000 --- a/DebuggingSpy/DSOverRecord.class.st +++ /dev/null @@ -1,12 +0,0 @@ -Class { - #name : 'DSOverRecord', - #superclass : 'DSStepRecord', - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} - -{ #category : 'accessing' } -DSOverRecord >> eventSymbol [ - ^'>' -] diff --git a/DebuggingSpy/DSPlaygroundOpenedRecord.class.st b/DebuggingSpy/DSPlaygroundOpenedRecord.class.st deleted file mode 100644 index 3a42b99..0000000 --- a/DebuggingSpy/DSPlaygroundOpenedRecord.class.st +++ /dev/null @@ -1,20 +0,0 @@ -" -I record that a StPlayground opened. -" -Class { - #name : 'DSPlaygroundOpenedRecord', - #superclass : 'DSPlaygroundRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSPlaygroundOpenedRecord >> eventName [ - ^'Playground open' -] - -{ #category : 'accessing - structure variables' } -DSPlaygroundOpenedRecord >> glyph [ - ^'P' -] diff --git a/DebuggingSpy/DSPlaygroundReadRecord.class.st b/DebuggingSpy/DSPlaygroundReadRecord.class.st deleted file mode 100644 index 17e2ab7..0000000 --- a/DebuggingSpy/DSPlaygroundReadRecord.class.st +++ /dev/null @@ -1,26 +0,0 @@ -" -I record that a mouse entered a StPlayground's code, which may indicate that the developer is reading the code. -" -Class { - #name : 'DSPlaygroundReadRecord', - #superclass : 'DSPlaygroundRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSPlaygroundReadRecord >> context [ - ^'Reading code' -] - -{ #category : 'accessing' } -DSPlaygroundReadRecord >> eventName [ - - ^ 'Playground read' -] - -{ #category : 'accessing - structure variables' } -DSPlaygroundReadRecord >> glyph [ - ^'PR' -] diff --git a/DebuggingSpy/DSPlaygroundRecord.class.st b/DebuggingSpy/DSPlaygroundRecord.class.st deleted file mode 100644 index 0f7931f..0000000 --- a/DebuggingSpy/DSPlaygroundRecord.class.st +++ /dev/null @@ -1,21 +0,0 @@ -" -I record events that happens in a StPlayground. -I do not really serve any purpose as an abstract class, but I'm just there to provide quick access to my subclasses' instances. -" -Class { - #name : 'DSPlaygroundRecord', - #superclass : 'DSAbstractEventRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing - structure variables' } -DSPlaygroundRecord >> glyphColor [ - ^Color blue darker -] - -{ #category : 'actions api' } -DSPlaygroundRecord >> record: aPresenter [ - super record: aPresenter window window -] diff --git a/DebuggingSpy/DSPlaygroundWriteRecord.class.st b/DebuggingSpy/DSPlaygroundWriteRecord.class.st deleted file mode 100644 index 2ba6af7..0000000 --- a/DebuggingSpy/DSPlaygroundWriteRecord.class.st +++ /dev/null @@ -1,25 +0,0 @@ -" -I record that the developer is typing in an StPlayground. -" -Class { - #name : 'DSPlaygroundWriteRecord', - #superclass : 'DSPlaygroundRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSPlaygroundWriteRecord >> context [ - ^'Writing code' -] - -{ #category : 'accessing' } -DSPlaygroundWriteRecord >> eventName [ - ^'Playground write' -] - -{ #category : 'accessing - structure variables' } -DSPlaygroundWriteRecord >> glyph [ - ^'PW' -] diff --git a/DebuggingSpy/DSProceedCommand.class.st b/DebuggingSpy/DSProceedCommand.class.st deleted file mode 100644 index 73874e8..0000000 --- a/DebuggingSpy/DSProceedCommand.class.st +++ /dev/null @@ -1,21 +0,0 @@ -" -I specialize StProceedCommand with debugging spy record creation. - I am meant to replace StProceedCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSProceedCommand', - #superclass : 'StProceedCommand', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'hooks' } -DSProceedCommand >> execute [ - - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #PROCEED]. - self forTests ifTrue: [ ^ self ]. - ^ super execute -] diff --git a/DebuggingSpy/DSProceedRecord.class.st b/DebuggingSpy/DSProceedRecord.class.st index af358ff..a068ffc 100644 --- a/DebuggingSpy/DSProceedRecord.class.st +++ b/DebuggingSpy/DSProceedRecord.class.st @@ -1,12 +1,16 @@ +" +I am a record for the 'Proceed' command in the Debugger. +" Class { #name : 'DSProceedRecord', - #superclass : 'DSStepRecord', - #category : 'DebuggingSpy-Records-Extensions', + #superclass : 'DSAbstractDebuggerActionRecord', + #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', - #tag : 'Records-Extensions' + #tag : 'Records' } { #category : 'accessing' } -DSProceedRecord >> eventSymbol [ - ^'P' +DSProceedRecord >> eventName [ + + ^ 'Proceed' ] diff --git a/DebuggingSpy/DSQueryBrowseRecord.class.st b/DebuggingSpy/DSQueryBrowseRecord.class.st deleted file mode 100644 index 1ee8a92..0000000 --- a/DebuggingSpy/DSQueryBrowseRecord.class.st +++ /dev/null @@ -1,37 +0,0 @@ -" -I record user browsing queries results (implementors, selectors...). -I store the name of the query and the id of the window -" -Class { - #name : 'DSQueryBrowseRecord', - #superclass : 'DSAbstractEventRecord', - #instVars : [ - 'queryName' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSQueryBrowseRecord >> eventName [ - ^'Query' -] - -{ #category : 'accessing' } -DSQueryBrowseRecord >> queryName [ - - ^ queryName -] - -{ #category : 'accessing' } -DSQueryBrowseRecord >> queryName: anObject [ - - queryName := anObject -] - -{ #category : 'actions api' } -DSQueryBrowseRecord >> record: aClyQueryBrowser [ - super record: aClyQueryBrowser window. - queryName := aClyQueryBrowser systemQuery description -] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index ab21aaa..749bfeb 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -55,7 +55,7 @@ DSRecordHistory class >> windowLeaveEventTypes [ { #category : 'API-history' } DSRecordHistory >> absoluteTimeTaken [ - "The absoulte time taken to perform the recording of user events, including unmonitoring activities (interruptions or activities outside the IDE)." + "The absolute time taken to perform the recording of user events, including unmonitoring activities (interruptions or activities outside the IDE)." ^ ((records last dateTime asSeconds - records first dateTime asSeconds) / 60) asFloat @@ -75,52 +75,6 @@ DSRecordHistory >> allRecordsOfKind: aClass [ ^ records select: [ :record | record isKindOf: aClass ] ] -{ #category : 'API-history' } -DSRecordHistory >> breakpointAdds [ - - ^ (self breakpointEvents: BreakpointAdded name) size -] - -{ #category : 'API-history' } -DSRecordHistory >> breakpointAnalysisMap [ - - | report | - report := Dictionary new. - (self allRecordsOfKind: DSDebugPointRecord) do: [ :bp | - (report at: bp targetClassOrMethod ifAbsentPut: [ - DSBreakpointReport new - method: bp targetClassOrMethod; - yourself ]) add: bp ]. - ^ report -] - -{ #category : 'private - history' } -DSRecordHistory >> breakpointEvents [ - - ^ self records select: [ :r | - (r isKindOf: DSAbstractDebugPointEventRecord) or: [ - r isKindOf: DSDebugPointRecord ] ] -] - -{ #category : 'private - history' } -DSRecordHistory >> breakpointEvents: aBreakpointEventName [ - - ^ self breakpointEvents select: [ :bpEvent | - bpEvent eventName = aBreakpointEventName ] -] - -{ #category : 'API-history' } -DSRecordHistory >> breakpointHit [ - - ^ (self breakpointEvents: BreakpointHit name) size -] - -{ #category : 'API-history' } -DSRecordHistory >> breakpointRemove [ - - ^ (self breakpointEvents: BreakpointRemoved name) size -] - { #category : 'API-history' } DSRecordHistory >> buildWindowHistory [ @@ -179,12 +133,6 @@ DSRecordHistory >> buildWindows [ w type ] ]) or: [ w windowId = -1 ] ] ] -{ #category : 'API-history' } -DSRecordHistory >> callStackBrowing [ - - ^ (self allRecordsOfKind: DSBrowseContextRecord) size -] - { #category : 'private - history' } DSRecordHistory >> collectTimeDiscrepancies [ @@ -209,9 +157,9 @@ DSRecordHistory >> collectTimeDiscrepancies [ { #category : 'API-history' } DSRecordHistory >> countDebugActions [ - ^ self breakpointAdds + self breakpointRemove + self executedCode + ^ self debugPointAdds + self debugPointRemove + self executedCode + self methodsAdded + self methodsModified + self methodsRemoved - + self numberOfSteps + self callStackBrowing + + self numberOfSteps ] { #category : 'accessing' } @@ -219,6 +167,52 @@ DSRecordHistory >> dateTime [ ^records first dateTime ] +{ #category : 'API-history' } +DSRecordHistory >> debugPointAdds [ + + ^ (self debugPointEvents: DebugPointAdded name) size +] + +{ #category : 'API-history' } +DSRecordHistory >> debugPointAnalysisMap [ + + | report | + report := Dictionary new. + (self allRecordsOfKind: DSDebugPointRecord) do: [ :bp | + (report at: bp targetClassOrMethod ifAbsentPut: [ + DSBreakpointReport new + method: bp targetClassOrMethod; + yourself ]) add: bp ]. + ^ report +] + +{ #category : 'private - history' } +DSRecordHistory >> debugPointEvents [ + + ^ self records select: [ :r | + (r isKindOf: DSAbstractDebugPointEventRecord) or: [ + r isKindOf: DSDebugPointRecord ] ] +] + +{ #category : 'private - history' } +DSRecordHistory >> debugPointEvents: aDebugPointEventName [ + + ^ self debugPointEvents select: [ :bpEvent | + bpEvent eventName = aDebugPointEventName ] +] + +{ #category : 'API-history' } +DSRecordHistory >> debugPointHit [ + + ^ (self debugPointEvents: DebugPointHit name) size +] + +{ #category : 'API-history' } +DSRecordHistory >> debugPointRemove [ + + ^ (self debugPointEvents: DebugPointRemoved name) size +] + { #category : 'private - history' } DSRecordHistory >> detectTimeDiscrepancies [ |time currentRecord totalDelta| @@ -248,33 +242,25 @@ DSRecordHistory >> estimateSourceEventOf: aDSDebuggerOpeningRecord from: aRecord (self - findSourceEventLike: - aDSDebuggerOpeningRecord primarySourcesOfWindowOpenings + findSourceEventLike: aDSDebuggerOpeningRecord primarySourcesOfWindowOpenings forRecord: aDSDebuggerOpeningRecord in: aRecordList) ifNotNil: [ :sourceEvent | ^ sourceEvent ]. previousRecord := aRecordList at: eventIndex - 1. - (previousRecord class == DSMouseEnterTableItemRecord and: [ - previousRecord isOverTestCase ]) ifTrue: [ - ^ DSRunTestRecord for: previousRecord ]. (self - findSourceEventLike: - aDSDebuggerOpeningRecord secondarySourcesOfWindowOpenings + findSourceEventLike: aDSDebuggerOpeningRecord secondarySourcesOfWindowOpenings forRecord: aDSDebuggerOpeningRecord in: aRecordList) ifNotNil: [ :sourceEvent | ^ sourceEvent ]. - aDSDebuggerOpeningRecord contextName = 'CompiledMethod>>#DoIt' - ifTrue: [ - ^DSDebugItRecord new - selectedString: aDSDebuggerOpeningRecord sourceNodeCode; - windowId: (aRecordList at: eventIndex - 1) windowId; - yourself ]. - - "self halt: 'If we get there we forgot a case...'." + aDSDebuggerOpeningRecord contextName = 'CompiledMethod>>#DoIt' ifTrue: [ + ^ DSDebugItRecord new + selectedString: aDSDebuggerOpeningRecord sourceNodeCode; + windowId: (aRecordList at: eventIndex - 1) windowId; + yourself ]. "self halt: 'If we get there we forgot a case...'." ^ aRecordList at: eventIndex - 1 ] @@ -499,36 +485,27 @@ DSRecordHistory >> name [ { #category : 'API-history' } DSRecordHistory >> numberOfSteps [ - ^ (self allRecordsOfKind: DSStepActionRecord) size -] - -{ #category : 'API-history' } -DSRecordHistory >> openedDebuggers [ - - ^ (self allRecordsOfKind: DSDebuggerOpeningRecord) size + ^ (self allRecordsOfKind: DSAbstractDebuggerActionRecord) size ] { #category : 'initialization' } DSRecordHistory >> processRecords: array [ - self fixWindowIdsOf: array. + self fixWindowIdsOf: array. "events with window id equals to 0 are automatic events triggered while opening a spec presenter while the window is not already open -> noise " - self records: - (array reject: [ :e | #( 0 ) includes: e windowId ]). - + self records: (array reject: [ :e | #( 0 ) includes: e windowId ]). + "Transform raw events to model events" - (self allRecordsOfKind: DSStepActionRecord) do: #asStepRecord. - (self allRecordsOfKind: DSAbstractDebugPointEventRecord) do: #asDebugPointRecord. + (self allRecordsOfKind: DSAbstractDebugPointEventRecord) do: #asDebugPointRecord. - "Detect if we're in a specific task" - (self records first isKindOf: DSStartTaskRecord) ifTrue: [ - self taskName: self records first taskName ]. + "Detect if we're in a specific task" + (self records first isKindOf: DSStartTaskRecord) ifTrue: [ self taskName: self records first taskName ]. "Windows" self buildWindowHistory. - self buildWindows. - self buildWindowJumps. - self reconstructWindowsToolInfo. + self buildWindows. + "self buildWindowJumps." + self reconstructWindowsToolInfo. "Check data consistency (raises a warning that can be proceeded)" self validateWindows @@ -556,8 +533,7 @@ DSRecordHistory >> reconstructWindowsToolInfo [ | toolInfos validWindows | toolInfos := (((records select: [ :r | - (r isKindOf: DSToolWindowEvent) or: [ - r class = DSMouseEnterWindowRecord ] ]) collect: + (r class = DSMouseEnterWindowRecord) ]) collect: #toolInfo) reject: #isNil) asOrderedCollection groupedBy: #windowIdentityHash. @@ -595,7 +571,7 @@ DSRecordHistory >> startTime [ ^ records first dateTime asTime ] -{ #category : 'as yet unclassified' } +{ #category : 'accessing' } DSRecordHistory >> stopTime [ ^records last dateTime asTime ] @@ -711,40 +687,31 @@ DSRecordHistory >> validateWindows [ | erroneousWindows | erroneousWindows := Dictionary new. - windows do: [ :w | - | firstEvent lastEvent | - firstEvent := w events first. - lastEvent := w events last. - - ({ - DSWindowOpenedRecord. - DSWindowActivatedRecord. - DSMouseEnterWindowRecord. - DSDebuggerOpeningRecord. - DSBrowseContextRecord. - DSQueryBrowseRecord } includes: firstEvent class) ifFalse: [ - (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) - add: #opening -> firstEvent ]. - - ({ - DSWindowClosedRecord. - DSMouseLeaveWindowRecord } includes: lastEvent class) ifFalse: [ - (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) - add: #closing -> lastEvent ]. - - w events do: [ :e | - (e dateTime between: firstEvent dateTime and: lastEvent dateTime) - ifFalse: [ - (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) - add: #timestamp -> e ] ] ] - - "erroneousWindows ifNotEmpty: [ + windows do: [ :w | "erroneousWindows ifNotEmpty: [ Warning signal: (String streamContents: [ :str | str << erroneousWindows size printString. str space. str << 'potential sequence problem found in windows. This is just an information, you can proceed.' ]) ]" + | firstEvent lastEvent | + firstEvent := w events first. + lastEvent := w events last. + + ({ + DSWindowOpenedRecord. + DSWindowActivatedRecord. + DSMouseEnterWindowRecord } includes: firstEvent class) ifFalse: [ + (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) add: #opening -> firstEvent ]. + + ({ + DSWindowClosedRecord. + DSMouseLeaveWindowRecord } includes: lastEvent class) ifFalse: [ + (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) add: #closing -> lastEvent ]. + + w events do: [ :e | + (e dateTime between: firstEvent dateTime and: lastEvent dateTime) ifFalse: [ + (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) add: #timestamp -> e ] ] ] ] { #category : 'accessing' } diff --git a/DebuggingSpy/DSRecordRegistry.class.st b/DebuggingSpy/DSRecordRegistry.class.st index dda8bc0..b7ede8c 100644 --- a/DebuggingSpy/DSRecordRegistry.class.st +++ b/DebuggingSpy/DSRecordRegistry.class.st @@ -1,3 +1,6 @@ +" +I am a registry containing all records during a recording session. +" Class { #name : 'DSRecordRegistry', #superclass : 'Object', diff --git a/DebuggingSpy/DSRestartCommand.class.st b/DebuggingSpy/DSRestartCommand.class.st deleted file mode 100644 index 3e0501e..0000000 --- a/DebuggingSpy/DSRestartCommand.class.st +++ /dev/null @@ -1,17 +0,0 @@ -" -I specialize StRestartCommand with debugging spy record creation. - I am meant to replace StRestartCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSRestartCommand', - #superclass : 'StRestartCommand', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'hooks' } -DSRestartCommand >> execute [ - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #RESTART]. - ^super execute. -] diff --git a/DebuggingSpy/DSRestartRecord.class.st b/DebuggingSpy/DSRestartRecord.class.st index 0ac59d7..b0b77cf 100644 --- a/DebuggingSpy/DSRestartRecord.class.st +++ b/DebuggingSpy/DSRestartRecord.class.st @@ -1,12 +1,16 @@ +" +I am a record for the 'Restart' command in the Debugger. +" Class { #name : 'DSRestartRecord', - #superclass : 'DSStepRecord', - #category : 'DebuggingSpy-Records-Extensions', + #superclass : 'DSAbstractDebuggerActionRecord', + #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', - #tag : 'Records-Extensions' + #tag : 'Records' } { #category : 'accessing' } -DSRestartRecord >> eventSymbol [ - ^'R' +DSRestartRecord >> eventName [ + + ^ 'Restart' ] diff --git a/DebuggingSpy/DSReturnRecord.class.st b/DebuggingSpy/DSReturnRecord.class.st deleted file mode 100644 index f29541d..0000000 --- a/DebuggingSpy/DSReturnRecord.class.st +++ /dev/null @@ -1,12 +0,0 @@ -Class { - #name : 'DSReturnRecord', - #superclass : 'DSStepRecord', - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} - -{ #category : 'accessing' } -DSReturnRecord >> eventSymbol [ - ^'r' -] diff --git a/DebuggingSpy/DSReturnValue.class.st b/DebuggingSpy/DSReturnValue.class.st new file mode 100644 index 0000000..1ba37a7 --- /dev/null +++ b/DebuggingSpy/DSReturnValue.class.st @@ -0,0 +1,16 @@ +" +I am a record for the 'Return value' command in the Debugger. +" +Class { + #name : 'DSReturnValue', + #superclass : 'DSAbstractDebuggerActionRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSReturnValue >> eventName [ + + ^ 'Return value' +] diff --git a/DebuggingSpy/DSReturnValueCommand.class.st b/DebuggingSpy/DSReturnValueCommand.class.st deleted file mode 100644 index d8cc2ec..0000000 --- a/DebuggingSpy/DSReturnValueCommand.class.st +++ /dev/null @@ -1,20 +0,0 @@ -" -I specialize StReturnValueCommand with debugging spy record creation. - I am meant to replace StReturnValueCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSReturnValueCommand', - #superclass : 'StReturnValueCommand', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'actions' } -DSReturnValueCommand >> execute [ - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #RETURN_VALUE]. - self forTests ifTrue: [ ^ self ]. - ^super execute. -] diff --git a/DebuggingSpy/DSRunTestRecord.class.st b/DebuggingSpy/DSRunTestRecord.class.st deleted file mode 100644 index ec968f2..0000000 --- a/DebuggingSpy/DSRunTestRecord.class.st +++ /dev/null @@ -1,16 +0,0 @@ -Class { - #name : 'DSRunTestRecord', - #superclass : 'DSAbstractExtendedRecord', - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} - -{ #category : 'accessing' } -DSRunTestRecord >> eventName [ - - ^ String streamContents: [ :str | - str << 'Running test:'. - str space. - str << sourceRecord itemElement ] -] diff --git a/DebuggingSpy/DSRunToRecord.class.st b/DebuggingSpy/DSRunToRecord.class.st deleted file mode 100644 index 44b8c98..0000000 --- a/DebuggingSpy/DSRunToRecord.class.st +++ /dev/null @@ -1,12 +0,0 @@ -Class { - #name : 'DSRunToRecord', - #superclass : 'DSStepRecord', - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} - -{ #category : 'accessing' } -DSRunToRecord >> eventSymbol [ - ^'rT' -] diff --git a/DebuggingSpy/DSRunToSelectionCommand.class.st b/DebuggingSpy/DSRunToSelectionCommand.class.st deleted file mode 100644 index 832785c..0000000 --- a/DebuggingSpy/DSRunToSelectionCommand.class.st +++ /dev/null @@ -1,17 +0,0 @@ -" -I specialize StRunToSelectionCommand with debugging spy record creation. - I am meant to replace StRunToSelectionCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSRunToSelectionCommand', - #superclass : 'StRunToSelectionCommand', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'hooks' } -DSRunToSelectionCommand >> execute [ - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #RUN_TO]. - ^super execute. -] diff --git a/DebuggingSpy/DSRunToSelectionRecord.class.st b/DebuggingSpy/DSRunToSelectionRecord.class.st new file mode 100644 index 0000000..3001a82 --- /dev/null +++ b/DebuggingSpy/DSRunToSelectionRecord.class.st @@ -0,0 +1,16 @@ +" +I am a record for the 'Run to selection' command in the Debugger. +" +Class { + #name : 'DSRunToSelectionRecord', + #superclass : 'DSAbstractDebuggerActionRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSRunToSelectionRecord >> eventName [ + + ^ 'Run to selection' +] diff --git a/DebuggingSpy/DSSTONFileLogger.class.st b/DebuggingSpy/DSSTONFileLogger.class.st index 7eec78e..4b780d7 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 : 'TLogger', - #classTraits : 'TLogger classTrait', + #traits : 'TExperimentLogger', + #classTraits : 'TExperimentLogger classTrait', #instVars : [ 'loggingDirectory', 'loggingFilename', @@ -19,13 +19,16 @@ Class { { #category : 'accessing' } DSSTONFileLogger >> defaultLoggingDirectoryName [ - ^'ds-spy' + + ^ DSSpy testingSession + ifTrue: [ 'tests' ] + ifFalse: [ 'ds-spy' ] ] { #category : 'accessing' } DSSTONFileLogger >> defaultLoggingFileName [ - ^ SessionManager default currentSession id asString + ^ DSSpy getRecordFileName ] { #category : 'logging' } diff --git a/DebuggingSpy/DSScrollEventRecord.class.st b/DebuggingSpy/DSScrollEventRecord.class.st deleted file mode 100644 index a839bd2..0000000 --- a/DebuggingSpy/DSScrollEventRecord.class.st +++ /dev/null @@ -1,16 +0,0 @@ -" -I record a scrolling event somewhere in a FTTableMorph or a GeneralScrollPane. -To identify where I am scrolling, use the window id recorded by my superclass. -" -Class { - #name : 'DSScrollEventRecord', - #superclass : 'DSAbstractEventRecord', - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSScrollEventRecord >> eventName [ - ^'Scrolling' -] diff --git a/DebuggingSpy/DSSelectInspectorPageRecord.class.st b/DebuggingSpy/DSSelectInspectorPageRecord.class.st deleted file mode 100644 index 1cb5c63..0000000 --- a/DebuggingSpy/DSSelectInspectorPageRecord.class.st +++ /dev/null @@ -1,49 +0,0 @@ -" -I record the selection of an inspector page when inspecting an object -" -Class { - #name : 'DSSelectInspectorPageRecord', - #superclass : 'DSInspectorRecord', - #instVars : [ - 'pageTitle' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSSelectInspectorPageRecord >> context [ - ^'Inspecting (tab change)' -] - -{ #category : 'accessing' } -DSSelectInspectorPageRecord >> eventName [ - ^'Selecting inspector tab' -] - -{ #category : 'accessing - structure variables' } -DSSelectInspectorPageRecord >> glyph [ - ^'In' -] - -{ #category : 'accessing' } -DSSelectInspectorPageRecord >> pageTitle [ - - ^ pageTitle -] - -{ #category : 'accessing' } -DSSelectInspectorPageRecord >> pageTitle: anObject [ - - pageTitle := anObject -] - -{ #category : 'actions api' } -DSSelectInspectorPageRecord >> record: pageTitleWithInspectedObjectWithWindow [ - - super record: { - pageTitleWithInspectedObjectWithWindow second. - pageTitleWithInspectedObjectWithWindow last }. - pageTitle := pageTitleWithInspectedObjectWithWindow first -] diff --git a/DebuggingSpy/DSSendersRecord.class.st b/DebuggingSpy/DSSendersRecord.class.st new file mode 100644 index 0000000..acda10b --- /dev/null +++ b/DebuggingSpy/DSSendersRecord.class.st @@ -0,0 +1,15 @@ +" +Record when user is searching for senders of a class, method, ... +" +Class { + #name : 'DSSendersRecord', + #superclass : 'DSAbstractBrowserRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSSendersRecord >> eventName [ + ^ 'Senders' +] diff --git a/DebuggingSpy/DSSindarinStepRecord.class.st b/DebuggingSpy/DSSindarinStepRecord.class.st deleted file mode 100644 index 352dc55..0000000 --- a/DebuggingSpy/DSSindarinStepRecord.class.st +++ /dev/null @@ -1,12 +0,0 @@ -Class { - #name : 'DSSindarinStepRecord', - #superclass : 'DSStepRecord', - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} - -{ #category : 'accessing' } -DSSindarinStepRecord >> eventSymbol [ - ^'sV' -] diff --git a/DebuggingSpy/DSSindarinStepToMethodEntry.class.st b/DebuggingSpy/DSSindarinStepToMethodEntry.class.st new file mode 100644 index 0000000..05baefa --- /dev/null +++ b/DebuggingSpy/DSSindarinStepToMethodEntry.class.st @@ -0,0 +1,16 @@ +" +I am a record for the 'Step to method entry' command in the Sindarin debugger. +" +Class { + #name : 'DSSindarinStepToMethodEntry', + #superclass : 'DSAbstractSindarinActionRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSSindarinStepToMethodEntry >> eventName [ + + ^ 'Step to method entry' +] diff --git a/DebuggingSpy/DSSindarinStepToMethodEntryCommand.class.st b/DebuggingSpy/DSSindarinStepToMethodEntryCommand.class.st deleted file mode 100644 index d168651..0000000 --- a/DebuggingSpy/DSSindarinStepToMethodEntryCommand.class.st +++ /dev/null @@ -1,21 +0,0 @@ -" -I specialize SindarinStepToMethodEntryCommand with debugging spy record creation. - I am meant to replace SindarinStepToMethodEntryCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSSindarinStepToMethodEntryCommand', - #superclass : 'SindarinStepToMethodEntryCommand', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'executing' } -DSSindarinStepToMethodEntryCommand >> execute [ - - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_METHOD_ENTRY]. - self forTests ifTrue: [ ^ self ]. - ^ super execute -] diff --git a/DebuggingSpy/DSSindarinStepToNextExecution.class.st b/DebuggingSpy/DSSindarinStepToNextExecution.class.st new file mode 100644 index 0000000..f324907 --- /dev/null +++ b/DebuggingSpy/DSSindarinStepToNextExecution.class.st @@ -0,0 +1,16 @@ +" +I am a record for the 'Step to next execution' commands in the Sindarin debugger. +" +Class { + #name : 'DSSindarinStepToNextExecution', + #superclass : 'DSAbstractSindarinActionRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSSindarinStepToNextExecution >> eventName [ + + ^ 'Step to next execution' +] diff --git a/DebuggingSpy/DSSindarinStepToNextExecutionInClassCommand.class.st b/DebuggingSpy/DSSindarinStepToNextExecutionInClassCommand.class.st deleted file mode 100644 index 82ac5de..0000000 --- a/DebuggingSpy/DSSindarinStepToNextExecutionInClassCommand.class.st +++ /dev/null @@ -1,21 +0,0 @@ -" -I specialize SindarinStepToNextCallInClassCommand with debugging spy record creation. - I am meant to replace SindarinStepToNextCallInClassCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSSindarinStepToNextExecutionInClassCommand', - #superclass : 'SindarinStepToNextExecutionInClassCommand', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'hooks' } -DSSindarinStepToNextExecutionInClassCommand >> execute [ - - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_EXECUTION_IN_CLASS]. - self forTests ifTrue: [ ^ self ]. - ^ super execute -] diff --git a/DebuggingSpy/DSSindarinStepToNextExecutionInObjectCommand.class.st b/DebuggingSpy/DSSindarinStepToNextExecutionInObjectCommand.class.st deleted file mode 100644 index 14ce17b..0000000 --- a/DebuggingSpy/DSSindarinStepToNextExecutionInObjectCommand.class.st +++ /dev/null @@ -1,21 +0,0 @@ -" -I specialize SindarinStepToNextCallInObjectCommand with debugging spy record creation. - I am meant to replace SindarinStepToNextCallInObjectCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSSindarinStepToNextExecutionInObjectCommand', - #superclass : 'SindarinStepToNextExecutionInObjectCommand', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'hooks' } -DSSindarinStepToNextExecutionInObjectCommand >> execute [ - - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_EXECUTION_IN_OBJECT]. - self forTests ifTrue: [ ^ self ]. - ^ super execute -] diff --git a/DebuggingSpy/DSSindarinStepToNextInstanceCreation.class.st b/DebuggingSpy/DSSindarinStepToNextInstanceCreation.class.st index 0f363ac..38ad6e3 100644 --- a/DebuggingSpy/DSSindarinStepToNextInstanceCreation.class.st +++ b/DebuggingSpy/DSSindarinStepToNextInstanceCreation.class.st @@ -1,21 +1,16 @@ " -I specialize SindarinStepToNextInstanceCreation with debugging spy record creation. - I am meant to replace SindarinStepToNextInstanceCreation commands in the debugger in order to provide such instrumentation. +I am a record for the 'Step to next instance creation' command in the Sindarin debugger. " Class { #name : 'DSSindarinStepToNextInstanceCreation', - #superclass : 'SindarinStepToNextInstanceCreation', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', + #superclass : 'DSAbstractSindarinActionRecord', + #category : 'DebuggingSpy-Records', #package : 'DebuggingSpy', - #tag : 'Commands' + #tag : 'Records' } -{ #category : 'executing' } -DSSindarinStepToNextInstanceCreation >> execute [ +{ #category : 'accessing' } +DSSindarinStepToNextInstanceCreation >> eventName [ - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_INSTANCE_CREATION]. - self forTests ifTrue: [ ^ self ]. - ^ super execute + ^ 'Step to next instance creation' ] diff --git a/DebuggingSpy/DSSindarinStepToReturn.class.st b/DebuggingSpy/DSSindarinStepToReturn.class.st new file mode 100644 index 0000000..9cff642 --- /dev/null +++ b/DebuggingSpy/DSSindarinStepToReturn.class.st @@ -0,0 +1,16 @@ +" +I am a record for the 'Step to return' command in the Sindarin debugger. +" +Class { + #name : 'DSSindarinStepToReturn', + #superclass : 'DSAbstractSindarinActionRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSSindarinStepToReturn >> eventName [ + + ^ 'Step to return' +] diff --git a/DebuggingSpy/DSSindarinStepToReturnCommand.class.st b/DebuggingSpy/DSSindarinStepToReturnCommand.class.st deleted file mode 100644 index f666f5e..0000000 --- a/DebuggingSpy/DSSindarinStepToReturnCommand.class.st +++ /dev/null @@ -1,21 +0,0 @@ -" -I specialize SindarinStepToReturnCommand with debugging spy record creation. - I am meant to replace SindarinStepToReturnCommand commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSSindarinStepToReturnCommand', - #superclass : 'SindarinStepToReturnCommand', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'executing' } -DSSindarinStepToReturnCommand >> execute [ - - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_RETURN]. - self forTests ifTrue: [ ^ self ]. - ^ super execute -] diff --git a/DebuggingSpy/DSSourceCodeChangeEventRecord.class.st b/DebuggingSpy/DSSourceCodeChangeEventRecord.class.st index f13a638..6810c98 100644 --- a/DebuggingSpy/DSSourceCodeChangeEventRecord.class.st +++ b/DebuggingSpy/DSSourceCodeChangeEventRecord.class.st @@ -16,30 +16,6 @@ Class { #tag : 'Records' } -{ #category : 'instance creation' } -DSSourceCodeChangeEventRecord class >> added: aMethod [ - - ^ (self for: aMethod) - eventName: 'Method added'; - yourself -] - -{ #category : 'instance creation' } -DSSourceCodeChangeEventRecord class >> modified: aMethod [ - - ^ (self for: aMethod) - eventName: 'Method modified'; - yourself -] - -{ #category : 'instance creation' } -DSSourceCodeChangeEventRecord class >> removed: aMethod [ - - ^ (self for: aMethod) - eventName: 'Method removed'; - yourself -] - { #category : 'accessing' } DSSourceCodeChangeEventRecord >> eventName [ ^'Source code modification' diff --git a/DebuggingSpy/DSSpy.class.st b/DebuggingSpy/DSSpy.class.st index 8959e6f..770364d 100644 --- a/DebuggingSpy/DSSpy.class.st +++ b/DebuggingSpy/DSSpy.class.st @@ -1,3 +1,6 @@ +" +I am defining rules for recording and I am used by most of the DebuggingSpy's classes as an helper. +" Class { #name : 'DSSpy', #superclass : 'Object', @@ -12,7 +15,10 @@ Class { 'packagesMonitoredForSourceCodeChanges', 'recordSourceCode', 'recordClipboardContent', - 'scopeSourceCodeChangesRecording' + 'scopeSourceCodeChangesRecording', + 'recordingSession', + 'recordFileName', + 'testingSession' ], #category : 'DebuggingSpy-Instrumentation', #package : 'DebuggingSpy', @@ -57,6 +63,12 @@ DSSpy class >> forceRunningTask: aTask [ taskStarted := true ] +{ #category : 'logging' } +DSSpy class >> getRecordFileName [ + + ^ recordFileName ifNil: [ recordFileName := DateAndTime now asFileNameCompatibleString copyReplaceAll: '.' with: '_'] +] + { #category : 'accessing' } DSSpy class >> handlingError: anObject [ @@ -105,9 +117,6 @@ DSSpy class >> logOnlyWhenTaskStarted: anObject [ { #category : 'events - windows' } DSSpy class >> logWindowActivated: anEvent [ - [ DSToolWindowActivatedEventRecord for: anEvent window ] - on: Error - do: [ self log: #ERROR key: #WINDOW_TOOL_OPENED ]. [ DSWindowActivatedRecord for: anEvent ] on: Error do: [ self log: #ERROR key: #WINDOW_ACTIVATED ] @@ -125,17 +134,9 @@ DSSpy class >> logWindowOpened: anEvent [ | window | window := anEvent window. - [ DSToolWindowOpenedEventRecord for: window ] - on: Error - do: [ self log: #ERROR key: #WINDOW_TOOL_OPENED ]. [ DSWindowOpenedRecord for: anEvent ] on: Error - do: [ self log: #ERROR key: #WINDOW_OPENED ]. - window announcer - when: WindowActivated - send: #logWindowActivated: - to: self. - window announcer when: WindowClosed send: #logWindowClosed: to: self + do: [ self log: #ERROR key: #WINDOW_OPENED ] ] { #category : 'accessing' } @@ -227,6 +228,7 @@ DSSpy class >> packagesMonitoredForSourceCodeChanges: anObject [ { #category : 'accessing' } DSSpy class >> recordClipboardContent [ + "Indicates if the clipboard content should be recorded or not" ^ recordClipboardContent ifNil: [ recordClipboardContent := false ] ] @@ -279,6 +281,7 @@ DSSpy class >> recordHaltInRemovedMethod: oldMethod [ { #category : 'accessing' } DSSpy class >> recordSourceCode [ + "Indicates if source code should be recorded or not (when doing actions like Print It, Do It, ...)" ^ recordSourceCode ifNil: [ recordSourceCode := false ] ] @@ -309,12 +312,27 @@ DSSpy class >> recordSourceCodeDisabledErrorMessage [ ^ 'Source code recording disabled' ] +{ #category : 'accessing' } +DSSpy class >> recordingSession [ + "Indicates if there is currently a recording session or not" + + ^ recordingSession ifNil: [ recordingSession := false ] +] + +{ #category : 'accessing' } +DSSpy class >> recordingSession: aBoolean [ + + recordingSession := aBoolean +] + { #category : 'initialization' } DSSpy class >> resetSpy [ - logger ifNotNil:[:l| l reset]. + logger ifNotNil: [ :l | l reset ]. taskStarted := false. - logOnlyWhenTaskStarted := false + logOnlyWhenTaskStarted := false. + testingSession := false. + recordFileName := nil ] { #category : 'accessing' } @@ -350,6 +368,19 @@ DSSpy class >> taskStarted [ ^ taskStarted ifNil: [ taskStarted := false ] ] +{ #category : 'accessing' } +DSSpy class >> testingSession [ + "Indicates if we are in a testing session" + + ^ testingSession ifNil: [ recordingSession := false ] +] + +{ #category : 'accessing' } +DSSpy class >> testingSession: aBoolean [ + + testingSession := aBoolean +] + { #category : 'utils' } DSSpy class >> toolInWindow: window [ diff --git a/DebuggingSpy/DSSpyInstrumenter.class.st b/DebuggingSpy/DSSpyInstrumenter.class.st index c8e5a06..14407d3 100644 --- a/DebuggingSpy/DSSpyInstrumenter.class.st +++ b/DebuggingSpy/DSSpyInstrumenter.class.st @@ -16,650 +16,179 @@ DSSpyInstrumenter class >> instrumentSystem [ DSRecordRegistry autoSerialize: true ] -{ #category : 'browsers' } -DSSpyInstrumenter >> instrumentClyFullBrowser [ - - ClyFullBrowserMorph compile: 'newWindowTitle - | newTitle | - - packageView selection isEmpty ifTrue: [ ^self systemScope description]. - - newTitle := self buildTitleFromSelections. - self systemScope isCurrentImage ifFalse: [ - newTitle := newTitle , '' in '', self systemScope description ]. - - [DSFullBrowseRecord for: self] on: Error do: [DSSpy log: #ERROR key: #BROWSE]. - ^newTitle' -] - -{ #category : 'browsers' } -DSSpyInstrumenter >> instrumentClyQueryBrowser [ - - ClyQueryBrowserMorph compile: 'newWindowTitle - | title | - title := systemQuery description. - resultView areItemsLoaded - ifTrue: [title := title capitalized , '' ['' , self itemCount asString, '']''] - ifFalse: [title := ''Loading: '', title ]. - self systemScope isCurrentImage ifFalse: [ - title := title , '' in '', self systemScope description ]. - [DSQueryBrowseRecord for: self] on: Error do: [DSSpy log: #ERROR key: #QUERY]. - ^title' -] - -{ #category : 'interactions' } -DSSpyInstrumenter >> instrumentClyTextEditorPrintIt [ - - ClyTextEditor compile: 'printIt - "Treat the current text selection as an expression; evaluate it. Insert the - description of the result of evaluation after the selection and then make - this description the new text selection." - - | pointerArea | - [DSPrintItRecord for: self selectionString] on: Error do:[:e| DSSpy log: #ERROR key: #ACTION_PRINTIT ]. - self evaluateSelectionAndDo: [ :result | - | popoverPresenter | - pointerArea := textArea cursor boundsInWorld. - - popoverPresenter := SpPopoverPresenter new presenter: - (SpCodePopoverPrintPresenter - newCode: self - object: result). - popoverPresenter relativeTo: (SpPresenter new - layout: SpBoxLayout new; - build; - yourself). - popoverPresenter bePositionRight. - popoverPresenter popupPointingTo: pointerArea. - popoverPresenter takeKeyboardFocus ]' -] - -{ #category : 'debugger' } -DSSpyInstrumenter >> instrumentCodePresenter [ - - SpCodePresenter compile: 'initialize +{ #category : 'system instrumentation' } +DSSpyInstrumenter class >> stopInstrumentation [ + + "Stop the instrumentation of the system" - super initialize. + "Stop the recording session" + DSSpy recordingSession: false. - "Use the default menu" - overrideContextMenu := false. + "Stop listening to events for recording" + SystemAnnouncer uniqueInstance unsubscribe: DSSpy. + DebugPoint codeSupportAnnouncer unsubscribe: DSSpy. + self currentWorld announcer unsubscribe: DSSpy. - self withSyntaxHighlight. - self withSmartCharacters. - self showLineNumbers. - self subscribeToSettingsChangesAnnouncements. + "Uninstall MetaLinks used by the instrumenter" + DSMetaLink uninstallAll. - self registerEventsForStyling. - self clearInteractionModel. - - self eventHandler - whenKeyDownDo: [ :event | - [ DSPlaygroundWriteRecord for: self ] - on: Error - do: [:e| DSSpy log: #ERROR key: #PLAYGROUND_WRITE ] ]; - whenMouseEnterDo: [ :evt | - [ DSPlaygroundReadRecord for: self. ] - on: Error - do: [ DSSpy log: #ERROR key: #PLAYGROUND_READ ] ]' + "Change recording file" + DSSpy resetSpy ] -{ #category : 'debugger' } -DSSpyInstrumenter >> instrumentDebuggerCommands [ - StDebugger class compile: - 'instrumentCommandsWith: stDebuggerInstance forRoot: rootCommandGroup +{ #category : 'system' } +DSSpyInstrumenter >> instrumentBrowseActions [ + "Instruments browse actions" - - self buildInstrumentedCommandsWith: stDebuggerInstance forRoot: rootCommandGroup' - + ClySpawnFullBrowserCommand link: DSBrowseRecord link toAST: (ClySpawnFullBrowserCommand>>#execute) ast. + SpBrowseClassCommand link: DSBrowseRecord link toAST: (SpBrowseClassCommand >> #execute) ast ] -{ #category : 'debugger' } -DSSpyInstrumenter >> instrumentDebuggerOpening [ - - StDebugger compile: 'initializeWindow: aWindowPresenter - - super initializeWindow: aWindowPresenter. - aWindowPresenter - 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 ] ' -] +{ #category : 'system' } +DSSpyInstrumenter >> instrumentCopySelection [ + "Instruments the action of copying to clipboard" -{ #category : 'debugger' } -DSSpyInstrumenter >> instrumentDebuggerStack [ - - StDebugger compile: 'initializeStack -stackTable := self newList. - stackTable - activateOnDoubleClick; - whenActivatedDo: [ :selection | self doBrowseClass ]. - stackTable display:[:selection| StContextPrinter printContext: selection]. - stackTable displayColor:[ :context | self stackColorForContext: context ]. - stackTable displayIcon: [ :context| self stackIconForContext: context ]. - stackTable transmitDo: [ :context | - stackTable selection isEmpty ifFalse: [ - self updateInspectorFromContext: context. - self updateCodeFromContext: context. - 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 ] ] ]. - stackHeader := self instantiate: StHeaderBar. - stackHeader label: ''Stack''' + RubTextEditor link: DSClipboardCopyRecord link toAST: (RubTextEditor >> #copySelection) ast. + RubSmalltalkEditor link: DSClipboardCopyRecord link toAST: (RubSmalltalkEditor >> #copySelection) ast ] -{ #category : 'debugpoints ' } -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)" +{ #category : 'interactions' } +DSSpyInstrumenter >> instrumentDebugIt [ + "Instruments different debugIt methods" - self class = Halt ifFalse:[[ DSUnhandledExceptionRecord for: self] - on: Error - do:[:err| DSSpy log: #ERROR key: self class name asSymbol ]]. - ^ UnhandledError signalForException: self' + RubSmalltalkEditor link: DSDebugItRecord link toAST: (RubSmalltalkEditor >> #debugIt) ast. + SpCodePrintItCommand link: DSDebugItRecord link toAST: (SpCodeDebugItCommand >> #execute) ast ] -{ #category : 'inspector' } -DSSpyInstrumenter >> instrumentExpandAttribute [ +{ #category : 'debugger' } +DSSpyInstrumenter >> instrumentDebuggerCommands [ + "Instruments different debugIt methods" - FTBasicItem compile: 'expandAndRefresh - [DSExpandAttributeRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #INSPECTOR_OBSERVE]. - self dataSource preservingScrollbarPositionDo: [ - self expand. - self refreshTable ]' + StProceedCommand link: DSProceedRecord link toAST: (StProceedCommand >> #execute) ast. + StRestartCommand link: DSRestartRecord link toAST: (StRestartCommand >> #execute) ast. + StReturnValueCommand link: DSReturnValue link toAST: (StReturnValueCommand >> #execute) ast. + StRunToSelectionCommand link: DSRunToSelectionRecord link toAST: (StRunToSelectionCommand >> #execute) ast. + StStepIntoCommand link: DSStepIntoRecord link toAST: (StStepIntoCommand >> #execute) ast. + StStepOverCommand link: DSStepOverRecord link toAST: (StStepOverCommand >> #execute) ast. + StStepThroughCommand link: DSStepThroughRecord link toAST: (StStepThroughCommand >> #execute) ast ] -{ #category : 'debugpoints ' } -DSSpyInstrumenter >> instrumentHaltHits [ - Halt class compile: 'signalIn: ctx - - self = Halt ifTrue:[ - [|sender| - sender := thisContext sender sender sender sender sender sender sender sender sender. - ctx selector = #once: ifFalse:[sender := sender sender]. - DSHaltHitRecord for: {sender sourceNodeExecuted. ctx selector}] - on: Error - do:[ DSSpy log: #ERROR key: #HALT_HIT ]]. - super signalIn: ctx'. - - Halt class compile: 'signal: s - self = Halt ifTrue:[ [|sender| - sender := thisContext sender sender sender sender sender. - DSHaltHitRecord for: {sender sourceNodeExecuted. #now:}] - on: Error - do:[ DSSpy log: #ERROR key: #HALT_HIT ]]. - super signal: s'. - - Halt class compile: 'signal - self = Halt ifTrue:[ [|sender| - sender := thisContext sender sender sender sender sender. - DSHaltHitRecord for: {sender sourceNodeExecuted. #halt}] - on: Error - do:[:err| DSSpy log: #ERROR key: #HALT_HIT ]]. - super signal'. -] - -{ #category : 'inspector' } -DSSpyInstrumenter >> instrumentInspectMethodsOfClass [ - - StMetaBrowserPresenter compile: 'methodsOf: aClass +{ #category : 'interactions' } +DSSpyInstrumenter >> instrumentDoIt [ + "Instruments different 'Do it' actions" - aClass ifNil: [ ^ #() ]. - [DSInspectMethodsRecord for: {self model. self selectedClass. self window window}] on: Error do:[:e| DSSpy log: #ERROR key: #INSPECTOR_META_CLASS]. - ^ aClass methods sorted: #selector ascending -' + RubSmalltalkEditor link: DSDoItRecord link toAST: (RubSmalltalkEditor >> #doIt) ast. + SpCodePrintItCommand link: DSDoItRecord link toAST: (SpCodeDoItCommand >> #execute) ast ] -{ #category : 'inspector' } -DSSpyInstrumenter >> instrumentInspectSourceOfMethod [ - - StMetaBrowserPresenter compile: 'updateSourceWith: method - source userActionDuring: [ - method - ifNotNil: [ - [DSInspectMethodSourceRecord for: {self model. self selectedClass. self selectedMethod. self window window}] on: Error do:[ DSSpy log: #ERROR key: #INSPECTOR_META_METHOD]. - source text: method sourceCode; beForMethod: method ] - ifNil: [ - source text: ''''; clearInteractionModel ] ]' -] +{ #category : 'interactions' } +DSSpyInstrumenter >> instrumentDoItAndGo [ + "Instruments different 'Do it and go' actions" -{ #category : 'inspector' } -DSSpyInstrumenter >> instrumentInspectorOnObject [ - - StInspectorPresenter compile: 'initializePresenters - [ - self class == StPlayground ifFalse: [ - DSInspectObjectRecord for: { - self model inspectedObject. - ([self window window] on: Error do: [ 0 ]) } ] ] - on: Error - do: [ DSSpy log: #ERROR key: #INSPECTOR_INSPECT ]. - millerList := self instantiate: SpMillerPaginatorPresenter. - millerList millerListPresenter - spacing: self spacing; - presenterBlock: [ :aModel | self newInspectorFor: aModel ]; - setRootModel: self model; - whenColumnsWillChangeDo: [ self keepLastPageSelectedTabName ]' + StObjectContextPresenter link: DSDoItAndGoRecord link toAST: (StObjectContextPresenter >> #doEvaluateAndGo) ast. + StPlaygroundPagePresenter link: DSDoItAndGoRecord link toAST: (StPlaygroundPagePresenter >> #doEvaluateAndGo) ast ] -{ #category : 'inspector' } -DSSpyInstrumenter >> instrumentInspectorPageSelection [ +{ #category : 'exceptions' } +DSSpyInstrumenter >> instrumentExceptionSignalling [ + "Instruments exception (except halt)" - StObjectInspectorPresenter compile: 'initializePresenters - views := self newNotebook. - header := self instantiate: StHeaderBar. - - views whenSelectedPageChangedDo: [ :page | - [ - DSSelectInspectorPageRecord for: { - page title. - self model inspectedObject. - [self window window] on: Error do:[0] } ] - on: Error - do: [ :e | DSSpy log: #ERROR key: #INSPECTOR_META_CLASS ] ]' + Exception link: DSUnhandledExceptionRecord link toAST: (Exception >> #raiseUnhandledError) ast. ] -{ #category : 'mouse events' } -DSSpyInstrumenter >> instrumentMouseDownFTSelectableMorph [ +{ #category : 'system' } +DSSpyInstrumenter >> instrumentImplementorsActions [ + "Instruments actions to show implementors of a method" - FTSelectableMorph compile:'mouseDown: evt - [DSMouseDownTableItemRecord for: {self allMorphs. self window}] on: Error do:[:e| DSSpy log: #ERROR key: #CLICK_ON_TABLE_ITEM]. - ^super mouseDown: evt ' + ClyShowMessageImplementorCommand link: DSImplementorsRecord link toAST: (ClyShowMessageImplementorCommand >> #execute) ast. + ClyTextEditor link: DSImplementorsRecord link toAST: (ClyTextEditor>>#implementorsOf:) ast. + RubSmalltalkEditor link: DSImplementorsRecord link toAST: (RubSmalltalkEditor >> #implementorsOf:) ast. + SpBrowseImplementorsCommand link: DSImplementorsRecord link toAST: (SpBrowseImplementorsCommand >> #execute) ast ] -{ #category : 'mouse events' } -DSSpyInstrumenter >> instrumentMouseEnterFTSelectableMorph [ - - FTSelectableMorph compile: 'mouseEnter: evt +{ #category : 'interactions' } +DSSpyInstrumenter >> instrumentInspectIt [ + "Instruments different inspectIt methods" - [DSMouseEnterTableItemRecord for: {self allMorphs. self window}] on: Error do:[:e| DSSpy log: #ERROR key: #ENTER_TABLE_ITEM]. - colorBeforeOver := self color. - self color: (selectionColor isTransparent - ifTrue: [ self mouseOverColor ] - ifFalse: [ self mouseOverColor mixed: 0.5 with: selectionColor ])' + RubSmalltalkEditor link: DSInspectItRecord link toAST: (RubSmalltalkEditor >> #inspectIt) ast. + SpCodePrintItCommand link: DSInspectItRecord link toAST: (SpCodeInspectItCommand >> #execute) ast ] -{ #category : 'mouse events' } +{ #category : 'system' } DSSpyInstrumenter >> instrumentMouseEnterWindow [ - SystemWindow compile: 'handleMouseEnter: anEvent - - [DSMouseEnterWindowRecord for:{{self}. self}] on: Error do:[:e| DSSpy log: #ERROR key: #WINDOW_ENTER ]. - ^super handleMouseEnter: anEvent' + SystemWindow link: DSMouseEnterWindowRecord link toAST: (SystemWindow >> #handleMouseEnter:) ast ] { #category : 'mouse events' } DSSpyInstrumenter >> instrumentMouseLeaveWindow [ - - SystemWindow compile: 'handleMouseLeave: anEvent - - [DSMouseLeaveWindowRecord for:{{self}. self}] on: Error do:[:e| DSSpy log: #ERROR key: #WINDOW_LEAVE ] . - ^super handleMouseLeave: anEvent' -] - -{ #category : 'inspector' } -DSSpyInstrumenter >> instrumentNavigateAttribute [ - - StRawInspectionPresenter compile: 'setAttributeTable - - attributeTable children: [ :node | node children ]. - - self outputSelectionPort transmitDo: [ :val | - val ifNotNil: [ - [ DSNavigateAttributeRecord for: { {val. model}. self window window} ] - on: Error - do: [ :err | DSSpy log: #ERROR key: #INSPECTOR_OBSERVE ] ] ]' -] -{ #category : 'playground' } -DSSpyInstrumenter >> instrumentPlaygroundCode [ - - StPlaygroundPresenter class compile: 'open -