diff --git a/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st b/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st index ffae299..ff75ec2 100644 --- a/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st +++ b/DebuggingSpy-Tests/DSSTONFileLoggerTest.class.st @@ -39,7 +39,7 @@ DSSTONFileLoggerTest >> testDefaultLoggingDirectoryName [ { #category : 'tests - file handling' } DSSTONFileLoggerTest >> testDefaultLoggingFileName [ - self assert: logger defaultLoggingFileName equals: SessionManager default currentSession id asString + self assert: logger defaultLoggingFileName equals: DSSpy id asString ] { #category : 'tests - file handling' } @@ -66,7 +66,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 id asString). self assert: logger loggingFileName equals: logger loggingFileReference basename. self assert: logger loggingFileReference exists ] @@ -79,7 +79,7 @@ DSSTONFileLoggerTest >> testForceRunningTask [ self assert: logger loggingFileName equals: - task title , '-' , SessionManager default currentSession id asString + task title , '-' , DSSpy id asString ] { #category : 'tests - file handling' } diff --git a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st index ba2e330..c7b7679 100644 --- a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st +++ b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st @@ -2,15 +2,12 @@ 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', @@ -38,14 +35,7 @@ DSSpyInstrumenterTest >> assertHaltHitRecordingMethod: method conditional: isHal 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. @@ -65,13 +55,8 @@ DSSpyInstrumenterTest >> assertInstrumentDebuggerCommandNamed: debuggerCommandNa { #category : 'assertions' } DSSpyInstrumenterTest >> assertInstrumentSindarinDebuggerCommandNamed: debuggerCommandName [ - | modifiedMethod cmds cmd | - modifiedClass := StDebugger class. - modifiedMethod := modifiedClass>>#buildSindarinExtentionCommandsGroupWith:forRoot:. - modifiedMethodSource := [ modifiedMethod sourceCode ] - on: Error - do: [ nil ]. - instrumenter instrumentSindarinDebuggerCommands. + | cmds cmd | + debugger := self debuggerOnRecursiveContextForTesting. self setDummyWindowForPresenter: debugger. @@ -123,6 +108,15 @@ DSSpyInstrumenterTest >> assertStepActionRecordForCommandNamed: debuggerCommandN self assert: record receiverClass equals: debugger currentContext receiver class name ] +{ #category : 'running' } +DSSpyInstrumenterTest >> closeOpenedWindows [ + + | currentWindows windowsToClose | + currentWindows := self currentWorld windowsSatisfying: [ :window | window isInWorld ]. + windowsToClose := currentWindows reject: [ :window | intialWindows includes: window ]. + windowsToClose collect: [ :window | window close ] +] + { #category : 'helpers' } DSSpyInstrumenterTest >> clyTextEditor [ @@ -155,6 +149,22 @@ 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 [ @@ -295,7 +305,7 @@ DSSpyInstrumenterTest >> registry [ ] { #category : 'helpers' } -DSSpyInstrumenterTest >> rubTextEditor [ +DSSpyInstrumenterTest >> rubSmalltalkEditor [ | editor textArea | editor := RubSmalltalkEditor forTextArea: @@ -358,10 +368,11 @@ DSSpyInstrumenterTest >> setDummyWindowPresenter: windowPresenter forPresenter: DSSpyInstrumenterTest >> setUp [ super setUp. - instrumenter := DSSpyInstrumenter new. + DSSpyInstrumenter instrumentSystem. recordSourceCode := DSSpy recordSourceCode. DSSpy recordSourceCode: true. - DSRecordRegistry current reset + DSRecordRegistry current reset. + intialWindows := self currentWorld windowsSatisfying: [ :window | window isInWorld ] ] { #category : 'helpers' } @@ -413,232 +424,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 ]. + self closeOpenedWindows. - methodsToRemove ifNotNil: [ - methodsToRemove do: [ :m | m removeFromSystem ] ]. - DSSpy recordSourceCode: recordSourceCode. - DSRecordRegistry current reset. - + + DSSpyInstrumenter stopInstrumentation. + 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 | + 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 [ +DSSpyInstrumenterTest >> testInstrumentClyTextEditorDoIt [ | clyEditor | - modifiedClass := ClyTextEditor. - modifiedMethodSource := (ClyTextEditor >> #printIt) sourceCode. - instrumenter instrumentClyTextEditorPrintIt. clyEditor := self clyTextEditor. - clyEditor printIt. + clyEditor doIt. self assert: self registry size equals: 1. record := self registry first. - self assert: record class identicalTo: DSPrintItRecord. + 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 | + + 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 | + + 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 + 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 initializeWindow: debugger window. + debugger open. - 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 - -] - -{ #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 first. + self assert: record class identicalTo: DSHaltHitRecord. - record := self registry third. - selectedItem := debugger stackTable items second. - self assert: record class identicalTo: DSBrowseContextRecord. + record := self registry second. + self assert: record class identicalTo: DSWindowOpenedRecord. 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: 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 + ] { #category : 'tests - halts' } DSSpyInstrumenterTest >> testInstrumentHaltHits [ - instrumenter instrumentHaltHits. - methodsToRemove := { - (Halt class >> #signal:). - (Halt class >> #signalIn:). - (Halt class >> #signal) }. [ self executeHalt ] on: Halt do: [ ]. @@ -665,8 +540,8 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ [ 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 @@ -676,8 +551,8 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ [ 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 @@ -687,8 +562,8 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ [ 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 @@ -699,11 +574,6 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ { #category : 'tests - halts' } DSSpyInstrumenterTest >> testInstrumentHaltHitsInBlock [ |executedMethod| - instrumenter instrumentHaltHits. - methodsToRemove := { - (Halt class >> #signal:). - (Halt class >> #signalIn:). - (Halt class >> #signal) }. executedMethod := self class >> #executeHaltInBloc. [ self executeHaltInBloc ] @@ -721,225 +591,30 @@ DSSpyInstrumenterTest >> testInstrumentHaltHitsInBlock [ 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 | 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 | 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' } @@ -964,14 +639,11 @@ DSSpyInstrumenterTest >> testInstrumentReturn [ DSSpyInstrumenterTest >> testInstrumentRubEditorCopySelection [ | rubEditor registerClipboardText | - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #copySelection) sourceCode. - instrumenter instrumentRubSmalltalkEditorCopySelection. registerClipboardText := DSSpy recordClipboardContent. DSSpy recordClipboardContent: true. [ - rubEditor := self rubTextEditor. + rubEditor := self rubSmalltalkEditor. rubEditor selectAll. rubEditor copySelection. @@ -992,12 +664,8 @@ DSSpyInstrumenterTest >> testInstrumentRubEditorCopySelection [ DSSpyInstrumenterTest >> testInstrumentRubEditorDebugIt [ | rubEditor | - self skip. - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #debug:) sourceCode. - instrumenter instrumentRubEditorDebugIt. - rubEditor := self rubTextEditor. + rubEditor := self rubSmalltalkEditor. rubEditor selectAll. self runWithoutOpeningDebugger: [rubEditor debugIt]. @@ -1012,11 +680,8 @@ DSSpyInstrumenterTest >> testInstrumentRubEditorDebugIt [ DSSpyInstrumenterTest >> testInstrumentRubEditorDoIt [ | rubEditor | - modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #doIt) sourceCode. - instrumenter instrumentRubEditorDoIt. - rubEditor := self rubTextEditor. + rubEditor := self rubSmalltalkEditor. rubEditor selectAll. rubEditor doIt. @@ -1027,80 +692,56 @@ DSSpyInstrumenterTest >> testInstrumentRubEditorDoIt [ self assert: record selectedString equals: '41+1'printString ] +{ #category : 'tests - interactions' } +DSSpyInstrumenterTest >> testInstrumentRubEditorInspectIt [ + + | rubEditor | + + 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. 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. + 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 ] + 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 := 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 selectedString equals: '''41+1''' ] { #category : 'tests - debugger' } @@ -1109,76 +750,44 @@ DSSpyInstrumenterTest >> testInstrumentRunTo [ self assertInstrumentDebuggerCommandNamed: 'Run to' ] -{ #category : 'tests - mouse events' } -DSSpyInstrumenterTest >> testInstrumentScrollingByDraggingSlider [ - - |slider| - modifiedClass := SliderMorph. - modifiedMethodSource := (SliderMorph >> #dragging:) sourceCode. - instrumenter instrumentScrollingByDraggingSlider. - - slider := SliderMorph new. - slider privateOwner: SystemWindow new. +{ #category : 'tests - browsers' } +DSSpyInstrumenterTest >> testInstrumentSendersAction [ - 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. + | rubEditor | + rubEditor := self rubSmalltalkEditor. + rubEditor sendersOf: #testInstrumentHaltHits. - 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. -] + self assert: self registry size equals: 2. -{ #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. 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 | + + 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 := self codePresenterFrom: self playgroundPagePresenter. debugItCommand := SpCodeDebugItCommand new. @@ -1196,9 +805,6 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDebugIt [ DSSpyInstrumenterTest >> testInstrumentSpCodeDoIt [ | codePresenter printItCommand | - modifiedClass := SpCodeDoItCommand. - modifiedMethodSource := (SpCodeDoItCommand >> #execute) sourceCode. - instrumenter instrumentSpCodeDoIt. codePresenter := self codePresenterFrom: self playgroundPagePresenter. @@ -1218,9 +824,6 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoIt [ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForInspector [ | presenter | - modifiedClass := StObjectContextPresenter. - modifiedMethodSource := (StObjectContextPresenter >> #doEvaluateAndGo) sourceCode. - instrumenter instrumentSpCodeDoItAndGoForInspector. presenter := StObjectContextPresenter basicNew. presenter setModelBeforeInitialization: self stObjectContextModelMock. @@ -1241,9 +844,6 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForInspector [ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForPlayground [ | presenter | - modifiedClass := StPlaygroundPagePresenter. - modifiedMethodSource := (StPlaygroundPagePresenter >> #doEvaluateAndGo) sourceCode. - instrumenter instrumentSpCodeDoItAndGoForPlayground. presenter := StPlaygroundPagePresenter basicNew. presenter forceDisableLoading. @@ -1262,13 +862,50 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForPlayground [ self assert: record selectedString equals: '4+2' ] +{ #category : 'tests - browsers' } +DSSpyInstrumenterTest >> testInstrumentSpCodeImplementors [ + + | codePresenter browseCommand | + 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 >> testInstrumentSpCodeInspectIt [ + + | codePresenter inspectItCommand | + + 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 | - modifiedClass := SpCodePrintItCommand. - modifiedMethodSource := (SpCodePrintItCommand >> #execute) sourceCode. - instrumenter instrumentSpCodePrintIt. codePresenter := self codePresenterFrom: self playgroundPagePresenter. printItCommand := SpCodePrintItCommand new. @@ -1282,22 +919,25 @@ 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 | + 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' } @@ -1365,10 +1005,6 @@ DSSpyInstrumenterTest >> testLoggingInteractionsWithNoSourceCode [ DSSpyInstrumenterTest >> testRecordDNU [ |capturedDNU| - modifiedClass := Exception. - modifiedMethodSource := (Exception >> #raiseUnhandledError) sourceCode. - instrumenter instrumentExceptionSignalling. - [self methodWithDNU] on: MessageNotUnderstood do:[:dnu| capturedDNU := dnu. [dnu raiseUnhandledError] on: UnhandledError do:[] ]. record := self registry first. @@ -1383,10 +1019,6 @@ DSSpyInstrumenterTest >> testRecordDNU [ { #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:[] ]. diff --git a/DebuggingSpy-Tests/DSSpyTest.class.st b/DebuggingSpy-Tests/DSSpyTest.class.st index 0b0ab63..fda6247 100644 --- a/DebuggingSpy-Tests/DSSpyTest.class.st +++ b/DebuggingSpy-Tests/DSSpyTest.class.st @@ -202,38 +202,38 @@ DSSpyTest >> 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 +323,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 +362,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,12 +389,9 @@ 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 ] @@ -813,9 +783,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' } @@ -838,7 +806,7 @@ DSSpyTest >> testSerialize [ { #category : 'tests - task management' } DSSpyTest >> testStartTask [ - + DSSpy startTask: task. self assert: self registry size equals: 1. record := self registry first. @@ -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..bbbbc6a 100644 --- a/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st +++ b/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st @@ -1,3 +1,6 @@ +" +I am an abstract class representing a record of a debugPoint's target. +" Class { #name : 'DSAbstractDebugPointTargetRecord', #superclass : 'Object', diff --git a/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st b/DebuggingSpy/DSAbstractDebuggerActionRecord.class.st similarity index 52% rename from DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st rename to DebuggingSpy/DSAbstractDebuggerActionRecord.class.st index 11d9018..c3866cd 100644 --- a/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st +++ b/DebuggingSpy/DSAbstractDebuggerActionRecord.class.st @@ -1,6 +1,6 @@ Class { - #name : 'DSDebugPointCheckBehaviorRecord', - #superclass : 'Object', + #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/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/DSDebugPointClassTargetRecord.class.st b/DebuggingSpy/DSDebugPointClassTargetRecord.class.st index 730e81b..d530475 100644 --- a/DebuggingSpy/DSDebugPointClassTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointClassTargetRecord.class.st @@ -1,3 +1,6 @@ +" +I am a class which represents a class target record for debugPoint. +" Class { #name : 'DSDebugPointClassTargetRecord', #superclass : 'DSAbstractDebugPointTargetRecord', diff --git a/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st b/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st index 1e84d2a..9658896 100644 --- a/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st @@ -1,3 +1,6 @@ +" +I am a class that reprensent instance variable target record for debugPoint. +" Class { #name : 'DSDebugPointInstanceVariableTargetRecord', #superclass : 'DSDebugPointClassTargetRecord', 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..0e2cb13 100644 --- a/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st @@ -1,3 +1,6 @@ +" +I am a class that reprensent node target record for debugPoint. +" Class { #name : 'DSDebugPointNodeTargetRecord', #superclass : 'DSDebugPointClassTargetRecord', diff --git a/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st b/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st index b052f4b..cf68f3a 100644 --- a/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st +++ b/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st @@ -1,3 +1,6 @@ +" +I am a class that reprensent object target record for debugPoint. +" Class { #name : 'DSDebugPointObjectTargetRecord', #superclass : 'DSAbstractDebugPointTargetRecord', 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/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/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/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/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/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/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..b969084 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 ] @@ -502,33 +488,25 @@ DSRecordHistory >> numberOfSteps [ ^ (self allRecordsOfKind: DSStepActionRecord) size ] -{ #category : 'API-history' } -DSRecordHistory >> openedDebuggers [ - - ^ (self allRecordsOfKind: DSDebuggerOpeningRecord) 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 +534,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 +572,7 @@ DSRecordHistory >> startTime [ ^ records first dateTime asTime ] -{ #category : 'as yet unclassified' } +{ #category : 'accessing' } DSRecordHistory >> stopTime [ ^records last dateTime asTime ] @@ -711,40 +688,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/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/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/DSSTONFileLogger.class.st b/DebuggingSpy/DSSTONFileLogger.class.st index 7eec78e..a291eb9 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', @@ -25,7 +25,7 @@ DSSTONFileLogger >> defaultLoggingDirectoryName [ { #category : 'accessing' } DSSTONFileLogger >> defaultLoggingFileName [ - ^ SessionManager default currentSession id asString + ^ DSSpy id asString ] { #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/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/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 deleted file mode 100644 index 0f363ac..0000000 --- a/DebuggingSpy/DSSindarinStepToNextInstanceCreation.class.st +++ /dev/null @@ -1,21 +0,0 @@ -" -I specialize SindarinStepToNextInstanceCreation with debugging spy record creation. - I am meant to replace SindarinStepToNextInstanceCreation commands in the debugger in order to provide such instrumentation. -" -Class { - #name : 'DSSindarinStepToNextInstanceCreation', - #superclass : 'SindarinStepToNextInstanceCreation', - #traits : 'DSTCommandForTests', - #classTraits : 'DSTCommandForTests classTrait', - #category : 'DebuggingSpy-Commands', - #package : 'DebuggingSpy', - #tag : 'Commands' -} - -{ #category : 'executing' } -DSSindarinStepToNextInstanceCreation >> execute [ - - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_INSTANCE_CREATION]. - self forTests ifTrue: [ ^ self ]. - ^ super execute -] 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/DSSpy.class.st b/DebuggingSpy/DSSpy.class.st index 8959e6f..ba7532d 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. +" Class { #name : 'DSSpy', #superclass : 'Object', @@ -12,7 +15,9 @@ Class { 'packagesMonitoredForSourceCodeChanges', 'recordSourceCode', 'recordClipboardContent', - 'scopeSourceCodeChangesRecording' + 'scopeSourceCodeChangesRecording', + 'recordingSession', + 'id' ], #category : 'DebuggingSpy-Instrumentation', #package : 'DebuggingSpy', @@ -63,6 +68,12 @@ DSSpy class >> handlingError: anObject [ ^ HandlingError := anObject ] +{ #category : 'logging' } +DSSpy class >> id [ + + ^ id ifNil: [ id := UUID new ] +] + { #category : 'events - debugpoints' } DSSpy class >> indexesOfHaltNodesIn: aMethod [ @@ -105,9 +116,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 +133,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 +227,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 +280,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,6 +311,19 @@ 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 [ diff --git a/DebuggingSpy/DSSpyInstrumenter.class.st b/DebuggingSpy/DSSpyInstrumenter.class.st index c8e5a06..63aa0f6 100644 --- a/DebuggingSpy/DSSpyInstrumenter.class.st +++ b/DebuggingSpy/DSSpyInstrumenter.class.st @@ -16,650 +16,176 @@ 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. - - self withSyntaxHighlight. - self withSmartCharacters. - self showLineNumbers. - self subscribeToSettingsChangesAnnouncements. + "Stop listening to events for recording" + SystemAnnouncer uniqueInstance unsubscribe: DSSpy. + DebugPoint codeSupportAnnouncer unsubscribe: DSSpy. + self currentWorld announcer unsubscribe: DSSpy. - 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 ] ]' + "Uninstall MetaLinks used by the instrumenter" + DSMetaLink uninstallAll "TO CHANGE : just uninstall targeted MetaLinks" ] -{ #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: DSStepActionRecord link toAST: (StProceedCommand >> #execute) ast. + StRestartCommand link: DSStepActionRecord link toAST: (StRestartCommand >> #execute) ast. + StReturnValueCommand link: DSStepActionRecord link toAST: (StReturnValueCommand >> #execute) ast. + StRunToSelectionCommand link: DSStepActionRecord link toAST: (StRunToSelectionCommand >> #execute) ast. + StStepIntoCommand link: DSStepActionRecord link toAST: (StStepIntoCommand >> #execute) ast. + StStepOverCommand link: DSStepActionRecord link toAST: (StStepOverCommand >> #execute) ast. + StStepThroughCommand link: DSStepActionRecord 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 -