From a55b5e8cc7e07a1b94516e6bcf27f54c6bac9213 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Thu, 7 Dec 2023 22:21:02 +0100 Subject: [PATCH 01/49] Window types, window activity periods, window opening source events (difficult to interpret) --- DebuggingSpy/DSAbstractEventRecord.class.st | 5 + DebuggingSpy/DSDebuggerOpeningRecord.class.st | 10 ++ DebuggingSpy/DSInspectObjectRecord.class.st | 11 ++ .../DSMouseEnterTableItemRecord.class.st | 5 + .../DSMouseEnterTextEditorRecord.class.st | 10 ++ DebuggingSpy/DSRecordHistory.class.st | 24 ++- DebuggingSpy/DSSurveyRecord.class.st | 10 ++ DebuggingSpy/DSWindowActivityRecord.class.st | 56 ++++++ DebuggingSpy/DSWindowEventRecord.class.st | 11 ++ DebuggingSpy/DSWindowRecord.class.st | 163 ++++++++++++++++++ 10 files changed, 301 insertions(+), 4 deletions(-) create mode 100644 DebuggingSpy/DSWindowActivityRecord.class.st create mode 100644 DebuggingSpy/DSWindowRecord.class.st diff --git a/DebuggingSpy/DSAbstractEventRecord.class.st b/DebuggingSpy/DSAbstractEventRecord.class.st index 2d77d3e..63c08b5 100644 --- a/DebuggingSpy/DSAbstractEventRecord.class.st +++ b/DebuggingSpy/DSAbstractEventRecord.class.st @@ -108,3 +108,8 @@ DSAbstractEventRecord >> windowId: anObject [ windowId := anObject ] + +{ #category : #'as yet unclassified' } +DSAbstractEventRecord >> windowType [ + ^windowId +] diff --git a/DebuggingSpy/DSDebuggerOpeningRecord.class.st b/DebuggingSpy/DSDebuggerOpeningRecord.class.st index 66b9a83..7bbb638 100644 --- a/DebuggingSpy/DSDebuggerOpeningRecord.class.st +++ b/DebuggingSpy/DSDebuggerOpeningRecord.class.st @@ -32,3 +32,13 @@ DSDebuggerOpeningRecord >> record: aDebugger [ debuggerId := aDebugger identityHash. super record: { aDebugger currentContext. aDebugger window window } ] + +{ #category : #accessing } +DSDebuggerOpeningRecord >> windowName [ + ^contextName +] + +{ #category : #'as yet unclassified' } +DSDebuggerOpeningRecord >> windowType [ + ^'Debugger' +] diff --git a/DebuggingSpy/DSInspectObjectRecord.class.st b/DebuggingSpy/DSInspectObjectRecord.class.st index 0d8cb18..c1e6bf0 100644 --- a/DebuggingSpy/DSInspectObjectRecord.class.st +++ b/DebuggingSpy/DSInspectObjectRecord.class.st @@ -11,3 +11,14 @@ Class { DSInspectObjectRecord >> eventName [ ^'Inspect object' ] + +{ #category : #accessing } +DSInspectObjectRecord >> windowName [ + + ^ inspectedObject +] + +{ #category : #'as yet unclassified' } +DSInspectObjectRecord >> windowType [ + ^'Inspector' +] diff --git a/DebuggingSpy/DSMouseEnterTableItemRecord.class.st b/DebuggingSpy/DSMouseEnterTableItemRecord.class.st index 93490e9..a86cc30 100644 --- a/DebuggingSpy/DSMouseEnterTableItemRecord.class.st +++ b/DebuggingSpy/DSMouseEnterTableItemRecord.class.st @@ -11,3 +11,8 @@ Class { DSMouseEnterTableItemRecord >> eventName [ ^'Mouse on table item' ] + +{ #category : #accessing } +DSMouseEnterTableItemRecord >> windowName [ + ^windowId +] diff --git a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st b/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st index fc99457..bf8a0f1 100644 --- a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st +++ b/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st @@ -11,3 +11,13 @@ Class { DSMouseEnterTextEditorRecord >> eventName [ ^'Mouse on text editor' ] + +{ #category : #accessing } +DSMouseEnterTextEditorRecord >> windowName [ + ^ windowId +] + +{ #category : #'as yet unclassified' } +DSMouseEnterTextEditorRecord >> windowType [ + ^windowId +] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 2453fab..9e49483 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -10,7 +10,8 @@ Class { 'records', 'windowsHistory', 'tag', - 'windowNames' + 'windowNames', + 'windows' ], #category : #'DebuggingSpy-Records' } @@ -74,6 +75,19 @@ DSRecordHistory >> buildWindowHistory [ self fixWindowRecordKeysNames ] +{ #category : #'as yet unclassified' } +DSRecordHistory >> buildWindows [ + + windows := OrderedCollection new. + windowsHistory valuesDo: [ :events | + windows add: (DSWindowRecord for: events) ]. + windows do: [ :w | + | sourceEventIndex | + sourceEventIndex := (records indexOf: w events first) - 1. + sourceEventIndex > 0 ifTrue: [ + w sourceEvent: (records at: sourceEventIndex) ] ] +] + { #category : #'API-history' } DSRecordHistory >> callStackBrowing [ @@ -244,9 +258,11 @@ DSRecordHistory >> openedDebuggers [ { #category : #initialization } DSRecordHistory >> processRecords: array [ - self records: array. - (self records first isKindOf: DSStartTaskRecord) ifTrue: [ - self taskName: self records first taskName ] + self records: (array reject:[:e| e windowId = 0]). + (self records first isKindOf: DSStartTaskRecord) ifTrue: [ + self taskName: self records first taskName ]. + self buildWindowHistory. + self buildWindows ] { #category : #accessing } diff --git a/DebuggingSpy/DSSurveyRecord.class.st b/DebuggingSpy/DSSurveyRecord.class.st index f151152..b3e9b59 100644 --- a/DebuggingSpy/DSSurveyRecord.class.st +++ b/DebuggingSpy/DSSurveyRecord.class.st @@ -46,3 +46,13 @@ DSSurveyRecord >> record: aSurvey [ DSSurveyRecord >> survey [ ^survey ] + +{ #category : #accessing } +DSSurveyRecord >> windowName [ + ^survey title +] + +{ #category : #'as yet unclassified' } +DSSurveyRecord >> windowType [ + ^'Survey' +] diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st new file mode 100644 index 0000000..74fa3d6 --- /dev/null +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -0,0 +1,56 @@ +Class { + #name : #DSWindowActivityRecord, + #superclass : #DSMouseEventRecord, + #instVars : [ + 'start', + 'stop', + 'events' + ], + #category : #'DebuggingSpy-Records' +} + +{ #category : #'as yet unclassified' } +DSWindowActivityRecord class >> start: aDSMouseEnterWindowRecord stop: aDSMouseLeaveWindowRecord events: aCollection [ + + ^ self new + start: aDSMouseEnterWindowRecord; + stop: aDSMouseLeaveWindowRecord; + events: aCollection; + yourself +] + +{ #category : #accessing } +DSWindowActivityRecord >> events [ + + ^ events +] + +{ #category : #accessing } +DSWindowActivityRecord >> events: anObject [ + + events := anObject +] + +{ #category : #accessing } +DSWindowActivityRecord >> start [ + + ^ start +] + +{ #category : #accessing } +DSWindowActivityRecord >> start: anObject [ + + start := anObject +] + +{ #category : #accessing } +DSWindowActivityRecord >> stop [ + + ^ stop +] + +{ #category : #accessing } +DSWindowActivityRecord >> stop: anObject [ + + stop := anObject +] diff --git a/DebuggingSpy/DSWindowEventRecord.class.st b/DebuggingSpy/DSWindowEventRecord.class.st index 300f71b..3d0bf6d 100644 --- a/DebuggingSpy/DSWindowEventRecord.class.st +++ b/DebuggingSpy/DSWindowEventRecord.class.st @@ -50,3 +50,14 @@ DSWindowEventRecord >> windowName: anObject [ windowName := anObject ] + +{ #category : #'as yet unclassified' } +DSWindowEventRecord >> windowType [ + + | rs type | + rs := windowName readStream. + type := rs upTo: Character space. + type size = 1 ifTrue: [ type := rs upTo: $( ]. + + ^ type +] diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st new file mode 100644 index 0000000..a09ea91 --- /dev/null +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -0,0 +1,163 @@ +Class { + #name : #DSWindowRecord, + #superclass : #Object, + #instVars : [ + 'type', + 'name', + 'events', + 'activePeriods', + 'sourceEvent' + ], + #category : #'DebuggingSpy-Records' +} + +{ #category : #'instance creation' } +DSWindowRecord class >> for: events [ + ^self new buildEvents: events +] + +{ #category : #accessing } +DSWindowRecord >> activePeriods [ + + ^ activePeriods +] + +{ #category : #accessing } +DSWindowRecord >> activePeriods: anObject [ + + activePeriods := anObject +] + +{ #category : #'as yet unclassified' } +DSWindowRecord >> buildEvents: aCollectionOfEvents [ + + events := aCollectionOfEvents. + activePeriods := self computeActivePeriods. + + type := self windowTypeFor: events first. + type = 'ClyQueryBrowserMorph' ifTrue: [ + (events + detect: [ :e | e class == DSQueryBrowseRecord ] + ifNone: [ nil ]) ifNotNil: [ :e | + type := e queryName readStream upTo: Character space. + name := (e queryName splitOn: Character space) last ] ]. + + + type = 'ClyFullBrowserMorph' ifTrue: [ + type := 'Browser'. + (events + detect: [ :e | e class == DSFullBrowseRecord ] + ifNone: [ nil ]) ifNotNil: [ :e | + name := String streamContents: [ :ws | + (#( nil '' ) includes: e classBrowsed) ifFalse: [ + ws << e classBrowsed ]. + (#( nil '' ) includes: e methodBrowsed) ifFalse: [ + ws << '>>'. + ws << e methodBrowsed ] ] ] ]. + + + name ifNotNil: [ ^ self ]. + name := self windowNameFor: events first +] + +{ #category : #'as yet unclassified' } +DSWindowRecord >> computeActivePeriods [ + + | activityStartStopEvents start stop | + activePeriods := OrderedCollection new. + activityStartStopEvents := events select: [ :e | + { + DSMouseEnterWindowRecord. + DSMouseLeaveWindowRecord } includes: + e class ]. + [ activityStartStopEvents isEmpty ] whileFalse: [ + | next | + next := activityStartStopEvents removeFirst. + next class = DSMouseEnterWindowRecord ifTrue: [ start := next ]. + next class = DSMouseLeaveWindowRecord ifTrue: [ + | startIndex stopIndex | + stop := next. + startIndex := events indexOf: start. + stopIndex := events indexOf: stop. + startIndex > 0 ifTrue: [ + activePeriods add: (DSWindowActivityRecord + start: start + stop: stop + events: (events copyFrom: startIndex to: stopIndex)) ] ] ] +] + +{ #category : #accessing } +DSWindowRecord >> events [ + + ^ events +] + +{ #category : #accessing } +DSWindowRecord >> events: anObject [ + + events := anObject +] + +{ #category : #accessing } +DSWindowRecord >> name [ + + ^ name +] + +{ #category : #accessing } +DSWindowRecord >> name: anObject [ + + name := anObject +] + +{ #category : #printing } +DSWindowRecord >> printOn: ws [ + ws << '['. + ws << type. + ws << ']'. + ws space. + ws << name +] + +{ #category : #accessing } +DSWindowRecord >> sourceEvent [ + + ^ sourceEvent +] + +{ #category : #accessing } +DSWindowRecord >> sourceEvent: anObject [ + + sourceEvent := anObject +] + +{ #category : #accessing } +DSWindowRecord >> type [ + + ^ type +] + +{ #category : #accessing } +DSWindowRecord >> type: anObject [ + + type := anObject +] + +{ #category : #accessing } +DSWindowRecord >> windowId [ + ^events first windowId +] + +{ #category : #'as yet unclassified' } +DSWindowRecord >> windowNameFor: aDSDebuggerOpeningRecord [ + + ^ [ aDSDebuggerOpeningRecord windowName ] + on: Error + do: [ aDSDebuggerOpeningRecord windowId ] +] + +{ #category : #'as yet unclassified' } +DSWindowRecord >> windowTypeFor: aDSDebuggerOpeningRecord [ + + ^aDSDebuggerOpeningRecord windowType +] From eeaf83fee66383746b284093406a3310d8ce0fa6 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Thu, 7 Dec 2023 22:24:10 +0100 Subject: [PATCH 02/49] window jumps --- DebuggingSpy/DSRecordHistory.class.st | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 9e49483..820da50 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -11,7 +11,8 @@ Class { 'windowsHistory', 'tag', 'windowNames', - 'windows' + 'windows', + 'windowJumps' ], #category : #'DebuggingSpy-Records' } @@ -75,6 +76,17 @@ DSRecordHistory >> buildWindowHistory [ self fixWindowRecordKeysNames ] +{ #category : #initialization } +DSRecordHistory >> buildWindowJumps [ + + | currentWindow | + windowJumps := OrderedCollection new. + (self allRecordsOfKind: DSMouseEnterWindowRecord) do: [ :e | + currentWindow = e windowId ifFalse: [ + currentWindow := e windowId. + windowJumps add: currentWindow ] ] +] + { #category : #'as yet unclassified' } DSRecordHistory >> buildWindows [ @@ -262,7 +274,8 @@ DSRecordHistory >> processRecords: array [ (self records first isKindOf: DSStartTaskRecord) ifTrue: [ self taskName: self records first taskName ]. self buildWindowHistory. - self buildWindows + self buildWindows. + self buildWindowJumps ] { #category : #accessing } From f22d5b786a5c565ddd23c9e73257430ca7799a19 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:11:58 +0100 Subject: [PATCH 03/49] model improvements --- DebuggingSpy/DSWindowActivityRecord.class.st | 26 +++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st index 74fa3d6..f5d7f0b 100644 --- a/DebuggingSpy/DSWindowActivityRecord.class.st +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'start', 'stop', - 'events' + 'events', + 'window' ], #category : #'DebuggingSpy-Records' } @@ -19,6 +20,17 @@ DSWindowActivityRecord class >> start: aDSMouseEnterWindowRecord stop: aDSMouseL yourself ] +{ #category : #accessing } +DSWindowActivityRecord >> eventName [ + + ^ String streamContents: [ :ws | + window printTypeOn: ws. + ws << ':'. + ws space. + ws << (events last dateTime - events first dateTime) + humanReadablePrintString ] +] + { #category : #accessing } DSWindowActivityRecord >> events [ @@ -54,3 +66,15 @@ DSWindowActivityRecord >> stop: anObject [ stop := anObject ] + +{ #category : #accessing } +DSWindowActivityRecord >> window [ + + ^ window +] + +{ #category : #accessing } +DSWindowActivityRecord >> window: anObject [ + + window := anObject +] From 39718108d20478cf60396b2f5fbb1b1bcd092886 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:13:02 +0100 Subject: [PATCH 04/49] active periods and windows timeline --- DebuggingSpy/DSRecordHistory.class.st | 15 +++++++---- DebuggingSpy/DSWindowActivityRecord.class.st | 11 ++++++++ DebuggingSpy/DSWindowRecord.class.st | 27 ++++++++++++++++---- 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 820da50..91c635b 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -79,12 +79,17 @@ DSRecordHistory >> buildWindowHistory [ { #category : #initialization } DSRecordHistory >> buildWindowJumps [ - | currentWindow | + | jumps currentWindow | windowJumps := OrderedCollection new. - (self allRecordsOfKind: DSMouseEnterWindowRecord) do: [ :e | - currentWindow = e windowId ifFalse: [ - currentWindow := e windowId. - windowJumps add: currentWindow ] ] + jumps := self allRecordsOfKind: DSMouseEnterWindowRecord. + + jumps do: [ :jumpEvent | + (windows + detect: [ :w | w windowId = jumpEvent windowId ] + ifNone: [ nil ]) ifNotNil: [ :w | + (w activePeriods + detect: [ :period | period start == jumpEvent ] + ifNone: [ nil ]) ifNotNil: [ :period | windowJumps add: period ] ] ] ] { #category : #'as yet unclassified' } diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st index f5d7f0b..164fffe 100644 --- a/DebuggingSpy/DSWindowActivityRecord.class.st +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -20,6 +20,17 @@ DSWindowActivityRecord class >> start: aDSMouseEnterWindowRecord stop: aDSMouseL yourself ] +{ #category : #'as yet unclassified' } +DSWindowActivityRecord class >> start: aDSMouseEnterWindowRecord stop: aDSMouseLeaveWindowRecord events: aCollection window: aDSWindowRecord [ + + ^ (self + start: aDSMouseEnterWindowRecord + stop: aDSMouseLeaveWindowRecord + events: aCollection) + window: aDSWindowRecord; + yourself +] + { #category : #accessing } DSWindowActivityRecord >> eventName [ diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index a09ea91..284d8e4 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -32,7 +32,7 @@ DSWindowRecord >> activePeriods: anObject [ DSWindowRecord >> buildEvents: aCollectionOfEvents [ events := aCollectionOfEvents. - activePeriods := self computeActivePeriods. + self computeActivePeriods. type := self windowTypeFor: events first. type = 'ClyQueryBrowserMorph' ifTrue: [ @@ -63,17 +63,23 @@ DSWindowRecord >> buildEvents: aCollectionOfEvents [ { #category : #'as yet unclassified' } DSWindowRecord >> computeActivePeriods [ - | activityStartStopEvents start stop | + | activityStartStopEvents start stop previous | activePeriods := OrderedCollection new. activityStartStopEvents := events select: [ :e | { DSMouseEnterWindowRecord. DSMouseLeaveWindowRecord } includes: e class ]. + (activityStartStopEvents notEmpty and: [ + activityStartStopEvents first class == DSMouseLeaveWindowRecord ]) + ifTrue: [ activityStartStopEvents removeFirst ]. + [ activityStartStopEvents isEmpty ] whileFalse: [ | next | next := activityStartStopEvents removeFirst. - next class = DSMouseEnterWindowRecord ifTrue: [ start := next ]. + next class = DSMouseEnterWindowRecord ifTrue: [ + previous class = next class ifFalse: [ start := next ] ]. + next class = DSMouseLeaveWindowRecord ifTrue: [ | startIndex stopIndex | stop := next. @@ -83,7 +89,9 @@ DSWindowRecord >> computeActivePeriods [ activePeriods add: (DSWindowActivityRecord start: start stop: stop - events: (events copyFrom: startIndex to: stopIndex)) ] ] ] + events: (events copyFrom: startIndex to: stopIndex) + window: self) ] ]. + previous := next ] ] { #category : #accessing } @@ -113,12 +121,21 @@ DSWindowRecord >> name: anObject [ { #category : #printing } DSWindowRecord >> printOn: ws [ ws << '['. - ws << type. + self printTypeOn: ws. ws << ']'. ws space. ws << name ] +{ #category : #printing } +DSWindowRecord >> printTypeOn: aStream [ + + type isString ifTrue: [ + aStream << type. + ^ self ]. + aStream << 'External Window' +] + { #category : #accessing } DSWindowRecord >> sourceEvent [ From 52510b9fb2bb1de4456663d2645af61746ddd639 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:31:50 +0100 Subject: [PATCH 05/49] Lost changes --- DebuggingSpy/DSRecordHistory.class.st | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 91c635b..d2f317b 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -12,7 +12,8 @@ Class { 'tag', 'windowNames', 'windows', - 'windowJumps' + 'windowJumps', + 'filteredWindowJumps' ], #category : #'DebuggingSpy-Records' } @@ -22,6 +23,11 @@ DSRecordHistory class >> on: anArray [ ^self new processRecords: anArray ] +{ #category : #'instance creation' } +DSRecordHistory class >> readTrace: aStringOrFilename [ + ^self on: (STON fromString: aStringOrFilename asFileReference contents) +] + { #category : #'API-history' } DSRecordHistory >> addWindowRecord: aDSRecord [ @@ -79,7 +85,7 @@ DSRecordHistory >> buildWindowHistory [ { #category : #initialization } DSRecordHistory >> buildWindowJumps [ - | jumps currentWindow | + | jumps | windowJumps := OrderedCollection new. jumps := self allRecordsOfKind: DSMouseEnterWindowRecord. @@ -89,10 +95,15 @@ DSRecordHistory >> buildWindowJumps [ ifNone: [ nil ]) ifNotNil: [ :w | (w activePeriods detect: [ :period | period start == jumpEvent ] - ifNone: [ nil ]) ifNotNil: [ :period | windowJumps add: period ] ] ] + ifNone: [ nil ]) ifNotNil: [ :period | windowJumps add: period ] ] ]. + + filteredWindowJumps := windowJumps reject: [ :e | + e events size <= 3 or: [ + e stop dateTime - e start dateTime + < 500 milliSeconds ] ] ] -{ #category : #'as yet unclassified' } +{ #category : #'private - history' } DSRecordHistory >> buildWindows [ windows := OrderedCollection new. @@ -152,12 +163,12 @@ DSRecordHistory >> detectTimeDiscrepancies [ ] -{ #category : #'as yet unclassified' } +{ #category : #'API-history' } DSRecordHistory >> eventsAfter: aDateAndTime [ ^records select:[:e| e dateTime > aDateAndTime] ] -{ #category : #'as yet unclassified' } +{ #category : #'API-history' } DSRecordHistory >> eventsBefore: aDateAndTime [ self shouldBeImplemented. ] From 82dd79d6202ea8c38ac1f1188d1694bd7143af74 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:32:03 +0100 Subject: [PATCH 06/49] removing deprecated undeclared --- DebuggingSpy/DSRecordHistory.class.st | 7 ------- 1 file changed, 7 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index d2f317b..43fd557 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -264,13 +264,6 @@ DSRecordHistory >> name [ ^ self user, ': ', self taskName, '(', tag, ')' ] -{ #category : #testing } -DSRecordHistory >> numberOfSeekerActions [ - - ^ (self records select: [ :r | - DSSeekerActionRecord withAllSubclasses includes: r class ]) size -] - { #category : #'API-history' } DSRecordHistory >> numberOfSteps [ From 4ea523d79d27d73f882ce42658c1a82138b83d14 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 31 Jan 2024 12:56:49 +0100 Subject: [PATCH 07/49] navgation between window events --- DebuggingSpy/DSRecordHistory.class.st | 17 +++++++++--- DebuggingSpy/DSWindowActivityRecord.class.st | 28 +++++++++++++++++++- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 43fd557..5acf2f4 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -82,13 +82,14 @@ DSRecordHistory >> buildWindowHistory [ self fixWindowRecordKeysNames ] -{ #category : #initialization } +{ #category : #'private - history' } DSRecordHistory >> buildWindowJumps [ - | jumps | + | jumps previousWindowActivity nextWindowActivity | windowJumps := OrderedCollection new. jumps := self allRecordsOfKind: DSMouseEnterWindowRecord. + jumps do: [ :jumpEvent | (windows detect: [ :w | w windowId = jumpEvent windowId ] @@ -100,7 +101,17 @@ DSRecordHistory >> buildWindowJumps [ filteredWindowJumps := windowJumps reject: [ :e | e events size <= 3 or: [ e stop dateTime - e start dateTime - < 500 milliSeconds ] ] + < 500 milliSeconds ] ]. + + previousWindowActivity := nil. + filteredWindowJumps do: [ :period | + period previous: previousWindowActivity. + previousWindowActivity := period ]. + + nextWindowActivity := nil. + filteredWindowJumps reverseDo: [ :period | + period next: nextWindowActivity. + nextWindowActivity := period ] ] { #category : #'private - history' } diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st index 164fffe..ca769e4 100644 --- a/DebuggingSpy/DSWindowActivityRecord.class.st +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -5,7 +5,9 @@ Class { 'start', 'stop', 'events', - 'window' + 'window', + 'previous', + 'next' ], #category : #'DebuggingSpy-Records' } @@ -54,6 +56,30 @@ DSWindowActivityRecord >> events: anObject [ events := anObject ] +{ #category : #accessing } +DSWindowActivityRecord >> next [ + + ^ next +] + +{ #category : #accessing } +DSWindowActivityRecord >> next: anObject [ + + next := anObject +] + +{ #category : #accessing } +DSWindowActivityRecord >> previous [ + + ^ previous +] + +{ #category : #accessing } +DSWindowActivityRecord >> previous: anObject [ + + previous := anObject +] + { #category : #accessing } DSWindowActivityRecord >> start [ From ae4766fffa83a092e21d5a24c99070d0e5f4d945 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:12:38 +0100 Subject: [PATCH 08/49] Heuristic to calculate the source event of a debugger opening --- .../DSAbstractBreakpointEventRecord.class.st | 5 ++ DebuggingSpy/DSAbstractEventRecord.class.st | 13 ++- .../DSAbstractExtendedRecord.class.st | 39 +++++++++ DebuggingSpy/DSDebuggerOpeningRecord.class.st | 18 +++++ .../DSMouseEnterTableItemRecord.class.st | 14 +++- DebuggingSpy/DSRecordHistory.class.st | 79 +++++++++++++++++-- DebuggingSpy/DSRunTestRecord.class.st | 14 ++++ DebuggingSpy/DSWindowRecord.class.st | 7 ++ 8 files changed, 181 insertions(+), 8 deletions(-) create mode 100644 DebuggingSpy/DSAbstractExtendedRecord.class.st create mode 100644 DebuggingSpy/DSRunTestRecord.class.st diff --git a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st b/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st index 6c0ff8a..405a1ee 100644 --- a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st +++ b/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st @@ -14,6 +14,11 @@ Class { #category : #'DebuggingSpy-Records' } +{ #category : #testing } +DSAbstractBreakpointEventRecord >> canOpenDebuggers [ + ^eventName = 'BreakpointHit' +] + { #category : #accessing } DSAbstractBreakpointEventRecord >> eventName [ ^eventName diff --git a/DebuggingSpy/DSAbstractEventRecord.class.st b/DebuggingSpy/DSAbstractEventRecord.class.st index 63c08b5..3ec52af 100644 --- a/DebuggingSpy/DSAbstractEventRecord.class.st +++ b/DebuggingSpy/DSAbstractEventRecord.class.st @@ -53,6 +53,12 @@ DSAbstractEventRecord >> >= aDSAbstractRecord [ ^self dateTime >= aDSAbstractRecord dateTime ] +{ #category : #testing } +DSAbstractEventRecord >> canOpenDebuggers [ + + ^ true +] + { #category : #accessing } DSAbstractEventRecord >> dateTime [ @@ -81,6 +87,11 @@ DSAbstractEventRecord >> printOn: aStream [ aStream << self eventName ] +{ #category : #accessing } +DSAbstractEventRecord >> realRecord [ + ^self +] + { #category : #'actions api' } DSAbstractEventRecord >> record: aWindow [ windowId := aWindow identityHash @@ -109,7 +120,7 @@ DSAbstractEventRecord >> windowId: anObject [ windowId := anObject ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSAbstractEventRecord >> windowType [ ^windowId ] diff --git a/DebuggingSpy/DSAbstractExtendedRecord.class.st b/DebuggingSpy/DSAbstractExtendedRecord.class.st new file mode 100644 index 0000000..c16b0e5 --- /dev/null +++ b/DebuggingSpy/DSAbstractExtendedRecord.class.st @@ -0,0 +1,39 @@ +Class { + #name : #DSAbstractExtendedRecord, + #superclass : #DSAbstractEventRecord, + #instVars : [ + 'sourceRecord' + ], + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #'instance creation' } +DSAbstractExtendedRecord class >> for: anObject [ + + ^ self new + record: anObject; + yourself +] + +{ #category : #'actions api' } +DSAbstractExtendedRecord >> dateTime [ + + ^ sourceRecord dateTime +] + +{ #category : #accessing } +DSAbstractExtendedRecord >> realRecord [ + + ^ sourceRecord +] + +{ #category : #'actions api' } +DSAbstractExtendedRecord >> record: aSourceRecord [ + sourceRecord := aSourceRecord +] + +{ #category : #'actions api' } +DSAbstractExtendedRecord >> windowId [ + + ^ sourceRecord windowId +] diff --git a/DebuggingSpy/DSDebuggerOpeningRecord.class.st b/DebuggingSpy/DSDebuggerOpeningRecord.class.st index 7bbb638..950c0c2 100644 --- a/DebuggingSpy/DSDebuggerOpeningRecord.class.st +++ b/DebuggingSpy/DSDebuggerOpeningRecord.class.st @@ -27,12 +27,30 @@ DSDebuggerOpeningRecord >> eventName [ ^'Debugger open' ] +{ #category : #'as yet unclassified' } +DSDebuggerOpeningRecord >> primarySourcesOfWindowOpenings [ + + ^ ({ + DSAbstractBreakpointEventRecord. + DSHaltHitRecord } collect: [ :c | c withAllSubclasses ]) + flattened +] + { #category : #'actions api' } DSDebuggerOpeningRecord >> record: aDebugger [ debuggerId := aDebugger identityHash. super record: { aDebugger currentContext. aDebugger window window } ] +{ #category : #'as yet unclassified' } +DSDebuggerOpeningRecord >> secondarySourcesOfWindowOpenings [ + + ^ ({ + DSCodeActionRecord. + DSStepActionRecord } collect: [ :c | c withAllSubclasses ]) + flattened +] + { #category : #accessing } DSDebuggerOpeningRecord >> windowName [ ^contextName diff --git a/DebuggingSpy/DSMouseEnterTableItemRecord.class.st b/DebuggingSpy/DSMouseEnterTableItemRecord.class.st index a86cc30..162bf64 100644 --- a/DebuggingSpy/DSMouseEnterTableItemRecord.class.st +++ b/DebuggingSpy/DSMouseEnterTableItemRecord.class.st @@ -9,7 +9,19 @@ Class { { #category : #accessing } DSMouseEnterTableItemRecord >> eventName [ - ^'Mouse on table item' + + ^ 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 } diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 5acf2f4..b93c37a 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -116,15 +116,11 @@ DSRecordHistory >> buildWindowJumps [ { #category : #'private - history' } DSRecordHistory >> buildWindows [ - + windows := OrderedCollection new. windowsHistory valuesDo: [ :events | windows add: (DSWindowRecord for: events) ]. - windows do: [ :w | - | sourceEventIndex | - sourceEventIndex := (records indexOf: w events first) - 1. - sourceEventIndex > 0 ifTrue: [ - w sourceEvent: (records at: sourceEventIndex) ] ] + self reconstructSourcesOfDebuggerOpenings ] { #category : #'API-history' } @@ -174,6 +170,46 @@ DSRecordHistory >> detectTimeDiscrepancies [ ] +{ #category : #'private - history' } +DSRecordHistory >> estimateSourceEventOf: aDSDebuggerOpeningRecord from: aRecordList [ + + | eventIndex previousRecord | + eventIndex := aRecordList indexOf: aDSDebuggerOpeningRecord. + + eventIndex = 1 ifTrue: [ ^ nil ]. + + + (self + 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 + 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...'. + ^ aRecordList at: eventIndex - 1 +] + { #category : #'API-history' } DSRecordHistory >> eventsAfter: aDateAndTime [ ^records select:[:e| e dateTime > aDateAndTime] @@ -190,6 +226,20 @@ DSRecordHistory >> executedCode [ ^ (self allRecordsOfKind: DSCodeActionRecord) size ] +{ #category : #'private - history' } +DSRecordHistory >> findSourceEventLike: possibleSourceEvents forRecord: aRecord in: aRecordList [ + + | eventIndex | + eventIndex := aRecordList indexOf: aRecord. + eventIndex - 1 to: 1 by: -1 do: [ :i | + | previousRecord | + previousRecord := aRecordList at: i. + previousRecord class = aRecord class ifTrue: [ ^ nil ]. + ((possibleSourceEvents includes: previousRecord class) and:[previousRecord canOpenDebuggers]) + ifTrue: [ ^ previousRecord ] ]. + ^ nil +] + { #category : #'private - history' } DSRecordHistory >> findWindowRecordKeyForID: id [ @@ -298,6 +348,23 @@ DSRecordHistory >> processRecords: array [ self buildWindowJumps ] +{ #category : #'as yet unclassified' } +DSRecordHistory >> reconstructSourcesOfDebuggerOpenings [ + + | sortedDebuggerWindows recordsCopy | + sortedDebuggerWindows := (windows select: [ :w | w isDebugger ]) + sort: [ :d1 :d2 | d1 events first dateTime < d2 events first dateTime ]. + + recordsCopy := records copy. + + sortedDebuggerWindows do: [ :w | + |sourceEvent| + sourceEvent := (self estimateSourceEventOf: w events first from: recordsCopy). + recordsCopy remove: w events first. + recordsCopy remove: sourceEvent realRecord ifAbsent:[]. + w sourceEvent: sourceEvent ] +] + { #category : #accessing } DSRecordHistory >> records [ diff --git a/DebuggingSpy/DSRunTestRecord.class.st b/DebuggingSpy/DSRunTestRecord.class.st new file mode 100644 index 0000000..2ba1166 --- /dev/null +++ b/DebuggingSpy/DSRunTestRecord.class.st @@ -0,0 +1,14 @@ +Class { + #name : #DSRunTestRecord, + #superclass : #DSAbstractExtendedRecord, + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #accessing } +DSRunTestRecord >> eventName [ + + ^ String streamContents: [ :str | + str << 'Running test:'. + str space. + str << sourceRecord itemElement ] +] diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index 284d8e4..c5c377d 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -106,6 +106,13 @@ DSWindowRecord >> events: anObject [ events := anObject ] +{ #category : #testing } +DSWindowRecord >> isDebugger [ + + events ifEmpty: [ ^ false ]. + ^ events first class == DSDebuggerOpeningRecord +] + { #category : #accessing } DSWindowRecord >> name [ From 5ed2ff252e4a0eee1f3a7cb0ac5151771c21a707 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:31:03 +0100 Subject: [PATCH 09/49] moving extended model used for analysis under correct tag --- DebuggingSpy/DSRecordHistoryWindowKey.class.st | 2 +- DebuggingSpy/DSWindowRecord.class.st | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DebuggingSpy/DSRecordHistoryWindowKey.class.st b/DebuggingSpy/DSRecordHistoryWindowKey.class.st index 8bffa45..ace7c39 100644 --- a/DebuggingSpy/DSRecordHistoryWindowKey.class.st +++ b/DebuggingSpy/DSRecordHistoryWindowKey.class.st @@ -8,7 +8,7 @@ Class { 'windowName', 'windowId' ], - #category : #'DebuggingSpy-Records' + #category : #'DebuggingSpy-Records-Extensions' } { #category : #printing } diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index c5c377d..5760bfd 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -8,7 +8,7 @@ Class { 'activePeriods', 'sourceEvent' ], - #category : #'DebuggingSpy-Records' + #category : #'DebuggingSpy-Records-Extensions' } { #category : #'instance creation' } From 3ca7a3a7f10cadfaef761665f87b842b516da3e3 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:31:17 +0100 Subject: [PATCH 10/49] window id for window activity records --- DebuggingSpy/DSWindowActivityRecord.class.st | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st index ca769e4..b401e98 100644 --- a/DebuggingSpy/DSWindowActivityRecord.class.st +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -9,7 +9,7 @@ Class { 'previous', 'next' ], - #category : #'DebuggingSpy-Records' + #category : #'DebuggingSpy-Records-Extensions' } { #category : #'as yet unclassified' } @@ -115,3 +115,9 @@ DSWindowActivityRecord >> window: anObject [ window := anObject ] + +{ #category : #accessing } +DSWindowActivityRecord >> windowId [ + + ^ windowId ifNil: [ windowId := window windowId ] +] From cb9c36acd4e60e03b95036e5b95d13a6590a0804 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:06:45 +0100 Subject: [PATCH 11/49] filtered window jump accessor --- DebuggingSpy/DSRecordHistory.class.st | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index b93c37a..c596f3c 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -226,6 +226,12 @@ DSRecordHistory >> executedCode [ ^ (self allRecordsOfKind: DSCodeActionRecord) size ] +{ #category : #accessing } +DSRecordHistory >> filteredWindowJumps [ + + ^ filteredWindowJumps +] + { #category : #'private - history' } DSRecordHistory >> findSourceEventLike: possibleSourceEvents forRecord: aRecord in: aRecordList [ From 533dd0ab6cbe255d757d33029421cc8e0870264a Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:18:33 +0100 Subject: [PATCH 12/49] Improving the window type to detect application windows --- DebuggingSpy/DSWindowEventRecord.class.st | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DebuggingSpy/DSWindowEventRecord.class.st b/DebuggingSpy/DSWindowEventRecord.class.st index 3d0bf6d..9ce384b 100644 --- a/DebuggingSpy/DSWindowEventRecord.class.st +++ b/DebuggingSpy/DSWindowEventRecord.class.st @@ -58,6 +58,7 @@ DSWindowEventRecord >> windowType [ rs := windowName readStream. type := rs upTo: Character space. type size = 1 ifTrue: [ type := rs upTo: $( ]. - - ^ type + (#('Spotter' 'implementors' 'Inspector' 'Debugger' 'Implementors' 'Breakpoint' 'Transcript' 'Browser' 'ClyQueryBrowserMorph' 'ClyFullBrowserMorph') includes: type) ifTrue:[^type]. + type isNumber ifTrue:[^'X']. + ^ 'Application' ] From a59b3344b664fb3051f0146527945a899de364cd Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:19:40 +0100 Subject: [PATCH 13/49] Adding filtered windows to remove framework-related windows --- DebuggingSpy/DSRecordHistory.class.st | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index c596f3c..dd5e55f 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -13,7 +13,8 @@ Class { 'windowNames', 'windows', 'windowJumps', - 'filteredWindowJumps' + 'filteredWindowJumps', + 'filteredWindows' ], #category : #'DebuggingSpy-Records' } @@ -116,11 +117,18 @@ DSRecordHistory >> buildWindowJumps [ { #category : #'private - history' } DSRecordHistory >> buildWindows [ - + windows := OrderedCollection new. windowsHistory valuesDo: [ :events | windows add: (DSWindowRecord for: events) ]. - self reconstructSourcesOfDebuggerOpenings + self reconstructSourcesOfDebuggerOpenings. + + filteredWindows := windows reject: [ :w | + (w totalTime < 0.5 seconds or: [ + (w respondsTo: #type) and: [ + #( 'Finish' 'Post-task' 'Survey' ) includes: + w type ] ]) or: [ w windowId = -1 ] ]. + self halt ] { #category : #'API-history' } From 166a82ea2b0cb97ada016f524d28145d291ca324 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:20:36 +0100 Subject: [PATCH 14/49] Improving printing of window records --- DebuggingSpy/DSWindowRecord.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index 5760bfd..b4032cb 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -131,7 +131,7 @@ DSWindowRecord >> printOn: ws [ self printTypeOn: ws. ws << ']'. ws space. - ws << name + ws << (name isString ifTrue:[name] ifFalse:[name printString]) ] { #category : #printing } From ca1e4bb0ccb60594bf21ca13f18c4a45d957afd7 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:20:55 +0100 Subject: [PATCH 15/49] Added total time accessor on window records --- DebuggingSpy/DSWindowRecord.class.st | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index b4032cb..b74fa67 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -155,6 +155,14 @@ DSWindowRecord >> sourceEvent: anObject [ sourceEvent := anObject ] +{ #category : #accessing } +DSWindowRecord >> totalTime [ + + ^ (activePeriods + inject: 0 + into: [ :sum :next | sum + next duration asSeconds ]) seconds +] + { #category : #accessing } DSWindowRecord >> type [ From 8ef1351a4c36b1b02e6c4ee5a04fb1dc0efd4d2c Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:21:32 +0100 Subject: [PATCH 16/49] Better printing of window activity records and duration accessor --- DebuggingSpy/DSWindowActivityRecord.class.st | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st index b401e98..d2187bf 100644 --- a/DebuggingSpy/DSWindowActivityRecord.class.st +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -1,6 +1,6 @@ Class { #name : #DSWindowActivityRecord, - #superclass : #DSMouseEventRecord, + #superclass : #DSAbstractEventRecord, #instVars : [ 'start', 'stop', @@ -33,6 +33,12 @@ DSWindowActivityRecord class >> start: aDSMouseEnterWindowRecord stop: aDSMouseL yourself ] +{ #category : #accessing } +DSWindowActivityRecord >> duration [ + + ^ events last dateTime - events first dateTime +] + { #category : #accessing } DSWindowActivityRecord >> eventName [ @@ -40,8 +46,7 @@ DSWindowActivityRecord >> eventName [ window printTypeOn: ws. ws << ':'. ws space. - ws << (events last dateTime - events first dateTime) - humanReadablePrintString ] + ws << self duration humanReadablePrintString ] ] { #category : #accessing } From 7323f4a67a884e27b9290c469b50efc9dab30d9a Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:21:49 +0100 Subject: [PATCH 17/49] Recategorizing method --- DebuggingSpy/DSRecordHistory.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index dd5e55f..3bfeaaa 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -362,7 +362,7 @@ DSRecordHistory >> processRecords: array [ self buildWindowJumps ] -{ #category : #'as yet unclassified' } +{ #category : #'private - history' } DSRecordHistory >> reconstructSourcesOfDebuggerOpenings [ | sortedDebuggerWindows recordsCopy | From 3d0d3fa242f30172607f7b261b4cd59f8e985332 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:22:51 +0100 Subject: [PATCH 18/49] Recomputing window id for logs without id or with erroneous id, better filter of noise logs, comments and renamings. --- DebuggingSpy/DSRecordHistory.class.st | 62 +++++++++++++++------------ 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 3bfeaaa..6b2b201 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -78,7 +78,7 @@ DSRecordHistory >> breakpointRemove [ DSRecordHistory >> buildWindowHistory [ self windowsHistory removeAll. - self fixMissingWindowIds. + self fixMissingWindowNames. self records do: [ :r | r recordWindowHistoryOn: self ]. self fixWindowRecordKeysNames ] @@ -266,34 +266,39 @@ DSRecordHistory >> findWindowRecordKeyForID: id [ ] { #category : #'private - history' } -DSRecordHistory >> fixMissingWindowIds [ +DSRecordHistory >> fixMissingWindowNames [ - | openedWindowStack | - openedWindowStack := Stack new. windowNames := Dictionary new. + (records reject: [ :e | e windowId isNil ]) do: [ :r | + (r respondsTo: #windowName) ifTrue: [ + windowNames + at: (r windowId ifNil: [ self halt ]) + ifAbsentPut: [ r windowName ifNil: [ self halt ] ] ] ] +] - records do: [ :r | - r windowId ifNotNil: [ - ({ - DSWindowClosedRecord. - DSMouseLeaveWindowRecord } includes: r class) ifTrue: [ - openedWindowStack removeAllSuchThat: [ :id | r windowId = id ] ]. - - ({ - DSWindowActivatedRecord. - DSMouseEnterWindowRecord. - DSWindowOpenedRecord } includes: r class) ifTrue: [ - openedWindowStack push: r windowId ]. - - ({ - DSWindowActivatedRecord. - DSWindowOpenedRecord } includes: r class) ifTrue: [ - (#( nil '' ) includes: r windowName) ifFalse: [ - windowNames at: r windowId put: r windowName ] ] ]. - r windowId ifNil: [ - openedWindowStack isEmpty - ifTrue: [ r windowId: -1 ] - ifFalse: [ r windowId: openedWindowStack top ] ] ] +{ #category : #'as yet unclassified' } +DSRecordHistory >> fixWindowIdsOf: aCollection [ + + | windowlessRecords currentWindowId | + windowlessRecords := aCollection select: [ :e | e windowId isNil ]. + + currentWindowId := aCollection select: [ :e | + { + DSWindowClosedRecord. + DSMouseLeaveWindowRecord } includes: e class ]. + + windowlessRecords removeAllSuchThat: [ :e | + e dateTime < currentWindowId first dateTime ]. + windowlessRecords removeAllSuchThat: [ :e | + e dateTime > currentWindowId last dateTime ]. + + [ currentWindowId isEmpty ] whileFalse: [ + | firstEvent | + firstEvent := currentWindowId removeFirst. + (windowlessRecords select: [ :e | e dateTime < firstEvent dateTime ]) + do: [ :e | e windowId: firstEvent windowId ]. + windowlessRecords removeAllSuchThat: [ :e | + (#( nil 0 ) includes: e windowId) not ] ] ] { #category : #'private - history' } @@ -354,7 +359,10 @@ DSRecordHistory >> openedDebuggers [ { #category : #initialization } DSRecordHistory >> processRecords: array [ - self records: (array reject:[:e| e windowId = 0]). + 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 | #( nil 0 ) includes: e windowId ]). (self records first isKindOf: DSStartTaskRecord) ifTrue: [ self taskName: self records first taskName ]. self buildWindowHistory. From 1313862aa8da4bd8b3f25a1e93a5594d07bc5bed Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:14:22 +0100 Subject: [PATCH 19/49] helpers --- DebuggingSpy/DSRecordHistory.class.st | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 6b2b201..c042504 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -29,6 +29,20 @@ DSRecordHistory class >> readTrace: aStringOrFilename [ ^self on: (STON fromString: aStringOrFilename asFileReference contents) ] +{ #category : #'as yet unclassified' } +DSRecordHistory class >> windowActivationEventTypes [ + + "Return a list of types that correspond to the user activating or entering a window." + ^{DSMouseEnterWindowRecord } +] + +{ #category : #'as yet unclassified' } +DSRecordHistory class >> windowLeaveEventTypes [ + + "Return a list of types that correspond to the user activating or entering a window." + ^{DSMouseLeaveWindowRecord. DSWindowClosedRecord } +] + { #category : #'API-history' } DSRecordHistory >> addWindowRecord: aDSRecord [ From 0fe09489938db857377d41f14874e65ab7f90920 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:14:28 +0100 Subject: [PATCH 20/49] Fixing log --- DebuggingSpy/DSSpyInstrumenter.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggingSpy/DSSpyInstrumenter.class.st b/DebuggingSpy/DSSpyInstrumenter.class.st index 306e1de..7f1109d 100644 --- a/DebuggingSpy/DSSpyInstrumenter.class.st +++ b/DebuggingSpy/DSSpyInstrumenter.class.st @@ -41,7 +41,7 @@ DSSpyInstrumenter >> instrumentClyQueryBrowser [ ifFalse: [title := ''Loading: '', title ]. self systemScope isCurrentImage ifFalse: [ title := title , '' in '', self systemScope description ]. - [DSQueryBrowseRecord for: self] on: Error do: [DSSpy log: #ERROR key: #BROWSE]. + [DSQueryBrowseRecord for: self] on: Error do: [DSSpy log: #ERROR key: #QUERY]. ^title' ] From 1b8b56ecd0ebc88cab7916a6e1fb60e943a063dd Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:14:47 +0100 Subject: [PATCH 21/49] Added window logs sequences validation --- DebuggingSpy/DSRecordHistory.class.st | 46 ++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index c042504..3d138b6 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -381,7 +381,8 @@ DSRecordHistory >> processRecords: array [ self taskName: self records first taskName ]. self buildWindowHistory. self buildWindows. - self buildWindowJumps + self buildWindowJumps. + self validateWindows ] { #category : #'private - history' } @@ -460,6 +461,49 @@ DSRecordHistory >> user: anObject [ user := anObject ] +{ #category : #'private - history' } +DSRecordHistory >> validateWindows [ + "Validates that each windows starts by a window entering or opening event, finishes by a window closing or leaving event, and that every event contained in the window happened between the opening event timestamp and the closing even timestamp" + + | 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 >= firstEvent dateTime and: [ + e dateTime <= lastEvent dateTime ]) ifFalse: [ + (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) + add: #timestamp -> e ] ] ]. + + 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.' ]) ] +] + { #category : #accessing } DSRecordHistory >> windowsHistory [ ^windowsHistory ifNil:[windowsHistory := IdentityDictionary new] From bef912d43dd5e3253945da774b8dfea5c3730c8b Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:15:07 +0100 Subject: [PATCH 22/49] removing halts --- DebuggingSpy/DSRecordHistory.class.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 3d138b6..d8d18aa 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -116,7 +116,7 @@ DSRecordHistory >> buildWindowJumps [ filteredWindowJumps := windowJumps reject: [ :e | e events size <= 3 or: [ e stop dateTime - e start dateTime - < 500 milliSeconds ] ]. + < 500 milliSeconds "or: [ ""self halt."" ""e type = 'Finish'"" true] "] ]. previousWindowActivity := nil. filteredWindowJumps do: [ :period | @@ -141,8 +141,7 @@ DSRecordHistory >> buildWindows [ (w totalTime < 0.5 seconds or: [ (w respondsTo: #type) and: [ #( 'Finish' 'Post-task' 'Survey' ) includes: - w type ] ]) or: [ w windowId = -1 ] ]. - self halt + w type ] ]) or: [ w windowId = -1 ] ] ] { #category : #'API-history' } From 1ae506bec8b52388c406098d8c485309a4ebe2b2 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:15:23 +0100 Subject: [PATCH 23/49] More precision in window id fixing heuristic --- DebuggingSpy/DSRecordHistory.class.st | 48 ++++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index d8d18aa..b9a081c 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -289,29 +289,37 @@ DSRecordHistory >> fixMissingWindowNames [ ifAbsentPut: [ r windowName ifNil: [ self halt ] ] ] ] ] -{ #category : #'as yet unclassified' } +{ #category : #'private - history' } DSRecordHistory >> fixWindowIdsOf: aCollection [ - | windowlessRecords currentWindowId | - windowlessRecords := aCollection select: [ :e | e windowId isNil ]. + | windowlessRecords validEvents enterAndLeaveSequences currentWindowId currentSequence | - currentWindowId := aCollection select: [ :e | - { - DSWindowClosedRecord. - DSMouseLeaveWindowRecord } includes: e class ]. - - windowlessRecords removeAllSuchThat: [ :e | - e dateTime < currentWindowId first dateTime ]. - windowlessRecords removeAllSuchThat: [ :e | - e dateTime > currentWindowId last dateTime ]. - - [ currentWindowId isEmpty ] whileFalse: [ - | firstEvent | - firstEvent := currentWindowId removeFirst. - (windowlessRecords select: [ :e | e dateTime < firstEvent dateTime ]) - do: [ :e | e windowId: firstEvent windowId ]. - windowlessRecords removeAllSuchThat: [ :e | - (#( nil 0 ) includes: e windowId) not ] ] + windowlessRecords := aCollection select: [ :e | e windowId isNil ]. + validEvents := aCollection select:[ :e | (#( nil 0 ) includes: e windowId) not ]. + + "First we sort all events in sequences happening in the same window" + enterAndLeaveSequences := OrderedCollection new. + currentWindowId := validEvents first windowId. + currentSequence := OrderedCollection new. + validEvents do: [:e | + + (e windowId ~= currentWindowId or: [(self class windowLeaveEventTypes includes: e class)]) + ifTrue: [ + (self class windowLeaveEventTypes includes: e class) ifTrue:[currentSequence add: e]. + enterAndLeaveSequences add: currentSequence. + currentSequence := OrderedCollection new. + currentSequence add: e. + currentWindowId := e windowId ] + ifFalse: [ currentSequence add: e ] ]. + + "Then for each sequence, we try to find events without window id happening between the start and the end of that sequence" + enterAndLeaveSequences do: [ :sequence | + | enter leave | + enter := sequence first. + leave := sequence last. + (windowlessRecords select: [ :e | + e dateTime > enter dateTime and: [ e dateTime < leave dateTime ] ]) + do: [ :e | e windowId: enter windowId ] ] ] { #category : #'private - history' } From 903996034a90f1105aa371f11eb13c9ff4b5c27d Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:22:13 +0100 Subject: [PATCH 24/49] Adding explicit unknown window to window types. --- DebuggingSpy/DSAbstractEventRecord.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggingSpy/DSAbstractEventRecord.class.st b/DebuggingSpy/DSAbstractEventRecord.class.st index 3ec52af..97a6462 100644 --- a/DebuggingSpy/DSAbstractEventRecord.class.st +++ b/DebuggingSpy/DSAbstractEventRecord.class.st @@ -122,5 +122,5 @@ DSAbstractEventRecord >> windowId: anObject [ { #category : #accessing } DSAbstractEventRecord >> windowType [ - ^windowId + ^'Unknown Window' ] From df711c0372719a2ceaeddfb64b71cf2f5ef34968 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:28:12 +0100 Subject: [PATCH 25/49] Computing window jumps based on filtered windows instead of windows --- DebuggingSpy/DSRecordHistory.class.st | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index b9a081c..5ab6fe4 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -104,9 +104,8 @@ DSRecordHistory >> buildWindowJumps [ windowJumps := OrderedCollection new. jumps := self allRecordsOfKind: DSMouseEnterWindowRecord. - jumps do: [ :jumpEvent | - (windows + (filteredWindows detect: [ :w | w windowId = jumpEvent windowId ] ifNone: [ nil ]) ifNotNil: [ :w | (w activePeriods @@ -116,7 +115,7 @@ DSRecordHistory >> buildWindowJumps [ filteredWindowJumps := windowJumps reject: [ :e | e events size <= 3 or: [ e stop dateTime - e start dateTime - < 500 milliSeconds "or: [ ""self halt."" ""e type = 'Finish'"" true] "] ]. + < 500 milliSeconds "or: [ ""self halt."" ""e type = 'Finish'"" true] " ] ]. previousWindowActivity := nil. filteredWindowJumps do: [ :period | From 3ca57e57e4760b4994a8a8d194019b37bbf82288 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 14 Feb 2024 14:29:58 +0100 Subject: [PATCH 26/49] missing accessors --- DebuggingSpy/DSRecordHistory.class.st | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 5ab6fe4..6fab9cb 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -252,6 +252,12 @@ DSRecordHistory >> filteredWindowJumps [ ^ filteredWindowJumps ] +{ #category : #accessing } +DSRecordHistory >> filteredWindows [ + + ^ filteredWindows +] + { #category : #'private - history' } DSRecordHistory >> findSourceEventLike: possibleSourceEvents forRecord: aRecord in: aRecordList [ @@ -510,6 +516,12 @@ DSRecordHistory >> validateWindows [ 'potential sequence problem found in windows. This is just an information, you can proceed.' ]) ] ] +{ #category : #accessing } +DSRecordHistory >> windowJumps [ + + ^ windowJumps +] + { #category : #accessing } DSRecordHistory >> windowsHistory [ ^windowsHistory ifNil:[windowsHistory := IdentityDictionary new] From 931a3448cc405a5a5d0e02441c1adc91a12e9566 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Mon, 19 Feb 2024 16:27:25 +0100 Subject: [PATCH 27/49] Stepping record for analysis --- DebuggingSpy/DSDebuggerActionRecord.class.st | 10 +++ DebuggingSpy/DSIntoRecord.class.st | 5 ++ DebuggingSpy/DSOverRecord.class.st | 5 ++ DebuggingSpy/DSProceedRecord.class.st | 5 ++ DebuggingSpy/DSRestartRecord.class.st | 5 ++ DebuggingSpy/DSReturnRecord.class.st | 5 ++ DebuggingSpy/DSRunToRecord.class.st | 5 ++ DebuggingSpy/DSStepRecord.class.st | 67 ++++++++++++++++++++ DebuggingSpy/DSThroughRecord.class.st | 5 ++ 9 files changed, 112 insertions(+) create mode 100644 DebuggingSpy/DSIntoRecord.class.st create mode 100644 DebuggingSpy/DSOverRecord.class.st create mode 100644 DebuggingSpy/DSProceedRecord.class.st create mode 100644 DebuggingSpy/DSRestartRecord.class.st create mode 100644 DebuggingSpy/DSReturnRecord.class.st create mode 100644 DebuggingSpy/DSRunToRecord.class.st create mode 100644 DebuggingSpy/DSStepRecord.class.st create mode 100644 DebuggingSpy/DSThroughRecord.class.st diff --git a/DebuggingSpy/DSDebuggerActionRecord.class.st b/DebuggingSpy/DSDebuggerActionRecord.class.st index 8733cca..89d87c6 100644 --- a/DebuggingSpy/DSDebuggerActionRecord.class.st +++ b/DebuggingSpy/DSDebuggerActionRecord.class.st @@ -67,6 +67,16 @@ DSDebuggerActionRecord class >> through: aContext [ yourself ] +{ #category : #converting } +DSDebuggerActionRecord >> asStepRecord [ + + ^ DSStepRecord + perform: + (eventName asLowercase copyReplaceAll: ' ' with: '') asSymbol + asMutator + with: { self } +] + { #category : #accessing } DSDebuggerActionRecord >> eventName [ ^eventName diff --git a/DebuggingSpy/DSIntoRecord.class.st b/DebuggingSpy/DSIntoRecord.class.st new file mode 100644 index 0000000..2a6133c --- /dev/null +++ b/DebuggingSpy/DSIntoRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSIntoRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSOverRecord.class.st b/DebuggingSpy/DSOverRecord.class.st new file mode 100644 index 0000000..aa6cdd7 --- /dev/null +++ b/DebuggingSpy/DSOverRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSOverRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSProceedRecord.class.st b/DebuggingSpy/DSProceedRecord.class.st new file mode 100644 index 0000000..077c090 --- /dev/null +++ b/DebuggingSpy/DSProceedRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSProceedRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSRestartRecord.class.st b/DebuggingSpy/DSRestartRecord.class.st new file mode 100644 index 0000000..b6d3434 --- /dev/null +++ b/DebuggingSpy/DSRestartRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSRestartRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSReturnRecord.class.st b/DebuggingSpy/DSReturnRecord.class.st new file mode 100644 index 0000000..9b34fcc --- /dev/null +++ b/DebuggingSpy/DSReturnRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSReturnRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSRunToRecord.class.st b/DebuggingSpy/DSRunToRecord.class.st new file mode 100644 index 0000000..5ae2667 --- /dev/null +++ b/DebuggingSpy/DSRunToRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSRunToRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSStepRecord.class.st b/DebuggingSpy/DSStepRecord.class.st new file mode 100644 index 0000000..a91add9 --- /dev/null +++ b/DebuggingSpy/DSStepRecord.class.st @@ -0,0 +1,67 @@ +Class { + #name : #DSStepRecord, + #superclass : #DSAbstractExtendedRecord, + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #'as yet unclassified' } +DSStepRecord class >> into: aDSDebuggerActionRecord [ + + ^ DSIntoRecord for: aDSDebuggerActionRecord +] + +{ #category : #'as yet unclassified' } +DSStepRecord class >> over: aDSDebuggerActionRecord [ + + ^ DSOverRecord for: aDSDebuggerActionRecord +] + +{ #category : #'as yet unclassified' } +DSStepRecord class >> proceed: aDSDebuggerActionRecord [ + + ^ DSProceedRecord for: aDSDebuggerActionRecord +] + +{ #category : #'as yet unclassified' } +DSStepRecord class >> restart: aDSDebuggerActionRecord [ + + ^ DSRestartRecord for: aDSDebuggerActionRecord +] + +{ #category : #'as yet unclassified' } +DSStepRecord class >> return: aDSDebuggerActionRecord [ + + ^ DSReturnRecord for: aDSDebuggerActionRecord +] + +{ #category : #'as yet unclassified' } +DSStepRecord class >> runto: aDSDebuggerActionRecord [ + + ^ DSRunToRecord for: aDSDebuggerActionRecord +] + +{ #category : #'as yet unclassified' } +DSStepRecord class >> through: aDSDebuggerActionRecord [ + + ^ DSThroughRecord for: aDSDebuggerActionRecord +] + +{ #category : #accessing } +DSStepRecord >> contextName [ + ^sourceRecord contextName +] + +{ #category : #accessing } +DSStepRecord >> eventName [ + ^ sourceRecord eventName +] + +{ #category : #accessing } +DSStepRecord >> sourceNodeClass [ + ^sourceRecord sourceNodeClass +] + +{ #category : #accessing } +DSStepRecord >> sourceNodeCode [ + ^sourceRecord sourceNodeCode +] diff --git a/DebuggingSpy/DSThroughRecord.class.st b/DebuggingSpy/DSThroughRecord.class.st new file mode 100644 index 0000000..544e93d --- /dev/null +++ b/DebuggingSpy/DSThroughRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSThroughRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} From 8842f68e495cc2a273aaf36df66b9c79404d7ad3 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:48:38 +0100 Subject: [PATCH 28/49] removing halt --- DebuggingSpy/DSRecordHistory.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 6fab9cb..b7adaee 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -226,7 +226,7 @@ DSRecordHistory >> estimateSourceEventOf: aDSDebuggerOpeningRecord from: aRecord windowId: (aRecordList at: eventIndex - 1) windowId; yourself ]. - self halt: 'If we get there we forgot a case...'. + "self halt: 'If we get there we forgot a case...'." ^ aRecordList at: eventIndex - 1 ] From 31d4ae5c391084f6aa19b22dd4b2b9dd3c70cac6 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:49:00 +0100 Subject: [PATCH 29/49] class error --- DebuggingSpy/DSDebuggerActionRecord.class.st | 10 ---------- DebuggingSpy/DSStepActionRecord.class.st | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DebuggingSpy/DSDebuggerActionRecord.class.st b/DebuggingSpy/DSDebuggerActionRecord.class.st index 89d87c6..8733cca 100644 --- a/DebuggingSpy/DSDebuggerActionRecord.class.st +++ b/DebuggingSpy/DSDebuggerActionRecord.class.st @@ -67,16 +67,6 @@ DSDebuggerActionRecord class >> through: aContext [ yourself ] -{ #category : #converting } -DSDebuggerActionRecord >> asStepRecord [ - - ^ DSStepRecord - perform: - (eventName asLowercase copyReplaceAll: ' ' with: '') asSymbol - asMutator - with: { self } -] - { #category : #accessing } DSDebuggerActionRecord >> eventName [ ^eventName diff --git a/DebuggingSpy/DSStepActionRecord.class.st b/DebuggingSpy/DSStepActionRecord.class.st index be88dcf..7c08c6f 100644 --- a/DebuggingSpy/DSStepActionRecord.class.st +++ b/DebuggingSpy/DSStepActionRecord.class.st @@ -16,6 +16,16 @@ Class { #category : #'DebuggingSpy-Records' } +{ #category : #converting } +DSStepActionRecord >> asStepRecord [ + + ^ DSStepRecord + perform: + (eventName asLowercase copyReplaceAll: ' ' with: '') asSymbol + asMutator + with: self +] + { #category : #accessing } DSStepActionRecord >> context [ From c0fc7d50fbbd3478b1d288388b3f607e3e6a1ee3 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:49:11 +0100 Subject: [PATCH 30/49] class error --- DebuggingSpy/DSStepRecord.class.st | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/DebuggingSpy/DSStepRecord.class.st b/DebuggingSpy/DSStepRecord.class.st index a91add9..3d0db12 100644 --- a/DebuggingSpy/DSStepRecord.class.st +++ b/DebuggingSpy/DSStepRecord.class.st @@ -46,22 +46,7 @@ DSStepRecord class >> through: aDSDebuggerActionRecord [ ^ DSThroughRecord for: aDSDebuggerActionRecord ] -{ #category : #accessing } -DSStepRecord >> contextName [ - ^sourceRecord contextName -] - { #category : #accessing } DSStepRecord >> eventName [ ^ sourceRecord eventName ] - -{ #category : #accessing } -DSStepRecord >> sourceNodeClass [ - ^sourceRecord sourceNodeClass -] - -{ #category : #accessing } -DSStepRecord >> sourceNodeCode [ - ^sourceRecord sourceNodeCode -] From 3133f87f1592e777d0ce64edd0281cea33619868 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:49:25 +0100 Subject: [PATCH 31/49] delegation to original event --- DebuggingSpy/DSStepRecord.class.st | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/DebuggingSpy/DSStepRecord.class.st b/DebuggingSpy/DSStepRecord.class.st index 3d0db12..a3ab1a7 100644 --- a/DebuggingSpy/DSStepRecord.class.st +++ b/DebuggingSpy/DSStepRecord.class.st @@ -46,7 +46,27 @@ DSStepRecord class >> through: aDSDebuggerActionRecord [ ^ DSThroughRecord for: aDSDebuggerActionRecord ] +{ #category : #accessing } +DSStepRecord >> context [ + ^sourceRecord context +] + { #category : #accessing } DSStepRecord >> eventName [ ^ sourceRecord eventName ] + +{ #category : #accessing } +DSStepRecord >> node [ + ^sourceRecord node +] + +{ #category : #accessing } +DSStepRecord >> receiver [ + ^sourceRecord receiver +] + +{ #category : #accessing } +DSStepRecord >> receiverClass [ + ^sourceRecord receiverClass +] From dfbaa19a25ef6464d82788f68b1d32d5f2469c66 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:49:53 +0100 Subject: [PATCH 32/49] replacing all generic steps by hierarchical step structure --- DebuggingSpy/DSRecordHistory.class.st | 9 +++++++++ DebuggingSpy/DSStepRecord.class.st | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index b7adaee..291bf70 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -389,11 +389,20 @@ DSRecordHistory >> processRecords: 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 | #( nil 0 ) includes: e windowId ]). + + "Transform raw events to model events" + (self allRecordsOfKind: DSStepActionRecord) do: #asStepRecord. + + "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. + + "Check data consistency (raises a warning that can be proceeded)" self validateWindows ] diff --git a/DebuggingSpy/DSStepRecord.class.st b/DebuggingSpy/DSStepRecord.class.st index a3ab1a7..2e2e117 100644 --- a/DebuggingSpy/DSStepRecord.class.st +++ b/DebuggingSpy/DSStepRecord.class.st @@ -4,6 +4,16 @@ Class { #category : #'DebuggingSpy-Records-Extensions' } +{ #category : #'as yet unclassified' } +DSStepRecord class >> for: anEvent [ + + | step | + step := self new. + step become: anEvent. + anEvent record: step. + ^ anEvent +] + { #category : #'as yet unclassified' } DSStepRecord class >> into: aDSDebuggerActionRecord [ From 963805a5b8bd488c4187fc280b9491d43b07715b Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 11:38:20 +0100 Subject: [PATCH 33/49] Breakpoint hierarchy evenet model --- .../DSAbstractBreakpointEventRecord.class.st | 14 +++++ DebuggingSpy/DSBreakpointAdd.class.st | 5 ++ DebuggingSpy/DSBreakpointEventRecord.class.st | 6 ++ DebuggingSpy/DSBreakpointHit.class.st | 5 ++ DebuggingSpy/DSBreakpointRecord.class.st | 35 ++++++++++++ DebuggingSpy/DSBreakpointRemoved.class.st | 5 ++ .../DSMethodBreakpointRecord.class.st | 54 ++++++++++++++++++ DebuggingSpy/DSRecordHistory.class.st | 1 + DebuggingSpy/DSVariableBreakpointAdd.class.st | 5 ++ .../DSVariableBreakpointEventRecord.class.st | 6 ++ DebuggingSpy/DSVariableBreakpointHit.class.st | 5 ++ .../DSVariableBreakpointRecord.class.st | 56 +++++++++++++++++++ .../DSVariableBreakpointRemoved.class.st | 5 ++ 13 files changed, 202 insertions(+) create mode 100644 DebuggingSpy/DSBreakpointAdd.class.st create mode 100644 DebuggingSpy/DSBreakpointHit.class.st create mode 100644 DebuggingSpy/DSBreakpointRecord.class.st create mode 100644 DebuggingSpy/DSBreakpointRemoved.class.st create mode 100644 DebuggingSpy/DSMethodBreakpointRecord.class.st create mode 100644 DebuggingSpy/DSVariableBreakpointAdd.class.st create mode 100644 DebuggingSpy/DSVariableBreakpointHit.class.st create mode 100644 DebuggingSpy/DSVariableBreakpointRecord.class.st create mode 100644 DebuggingSpy/DSVariableBreakpointRemoved.class.st diff --git a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st b/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st index 405a1ee..304a662 100644 --- a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st +++ b/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st @@ -14,6 +14,14 @@ Class { #category : #'DebuggingSpy-Records' } +{ #category : #converting } +DSAbstractBreakpointEventRecord >> asBreakpointRecord [ + + ^ self modelClass + perform: eventName asLowercase asSymbol asMutator + with: self +] + { #category : #testing } DSAbstractBreakpointEventRecord >> canOpenDebuggers [ ^eventName = 'BreakpointHit' @@ -24,6 +32,12 @@ DSAbstractBreakpointEventRecord >> eventName [ ^eventName ] +{ #category : #converting } +DSAbstractBreakpointEventRecord >> modelClass [ + + ^ self subclassResponsibility +] + { #category : #accessing } DSAbstractBreakpointEventRecord >> objectCentric [ diff --git a/DebuggingSpy/DSBreakpointAdd.class.st b/DebuggingSpy/DSBreakpointAdd.class.st new file mode 100644 index 0000000..452b1ad --- /dev/null +++ b/DebuggingSpy/DSBreakpointAdd.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSBreakpointAdd, + #superclass : #DSMethodBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSBreakpointEventRecord.class.st b/DebuggingSpy/DSBreakpointEventRecord.class.st index a5b6444..62ba559 100644 --- a/DebuggingSpy/DSBreakpointEventRecord.class.st +++ b/DebuggingSpy/DSBreakpointEventRecord.class.st @@ -17,6 +17,12 @@ DSBreakpointEventRecord >> method [ ^ method ] +{ #category : #converting } +DSBreakpointEventRecord >> modelClass [ + + ^ DSMethodBreakpointRecord +] + { #category : #accessing } DSBreakpointEventRecord >> node [ diff --git a/DebuggingSpy/DSBreakpointHit.class.st b/DebuggingSpy/DSBreakpointHit.class.st new file mode 100644 index 0000000..c40af9b --- /dev/null +++ b/DebuggingSpy/DSBreakpointHit.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSBreakpointHit, + #superclass : #DSMethodBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSBreakpointRecord.class.st b/DebuggingSpy/DSBreakpointRecord.class.st new file mode 100644 index 0000000..8c50185 --- /dev/null +++ b/DebuggingSpy/DSBreakpointRecord.class.st @@ -0,0 +1,35 @@ +Class { + #name : #DSBreakpointRecord, + #superclass : #DSAbstractExtendedRecord, + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> canOpenDebuggers [ + ^sourceRecord canOpenDebuggers +] + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> eventName [ + ^sourceRecord eventName +] + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> objectCentric [ + ^sourceRecord objectCentric +] + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> once [ + ^sourceRecord once +] + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> printTargetInstance: anObject [ + ^sourceRecord printTargetInstance: anObject +] + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> target [ + ^sourceRecord target +] diff --git a/DebuggingSpy/DSBreakpointRemoved.class.st b/DebuggingSpy/DSBreakpointRemoved.class.st new file mode 100644 index 0000000..396a022 --- /dev/null +++ b/DebuggingSpy/DSBreakpointRemoved.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSBreakpointRemoved, + #superclass : #DSMethodBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSMethodBreakpointRecord.class.st b/DebuggingSpy/DSMethodBreakpointRecord.class.st new file mode 100644 index 0000000..56bda70 --- /dev/null +++ b/DebuggingSpy/DSMethodBreakpointRecord.class.st @@ -0,0 +1,54 @@ +Class { + #name : #DSMethodBreakpointRecord, + #superclass : #DSBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord class >> breakpointadded: event [ + + ^DSBreakpointAdd for: event + +] + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord class >> breakpointhit: event [ + + ^DSBreakpointHit for: event + +] + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord class >> breakpointremoved: event [ + + ^DSBreakpointRemoved for: event + +] + +{ #category : #'instance creation' } +DSMethodBreakpointRecord class >> for: anEvent [ + + | breakpoint | + breakpoint := self new. + breakpoint become: anEvent. + anEvent record: breakpoint. + ^ anEvent +] + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord >> eventName [ + + ^ String streamContents: [ :s | + s << 'Method'. + s << super eventName ] +] + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord >> method [ + ^sourceRecord method +] + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord >> node [ + ^sourceRecord node +] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 291bf70..3719585 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -392,6 +392,7 @@ DSRecordHistory >> processRecords: array [ "Transform raw events to model events" (self allRecordsOfKind: DSStepActionRecord) do: #asStepRecord. + (self allRecordsOfKind: DSAbstractBreakpointEventRecord) do: #asBreakpointRecord. "Detect if we're in a specific task" (self records first isKindOf: DSStartTaskRecord) ifTrue: [ diff --git a/DebuggingSpy/DSVariableBreakpointAdd.class.st b/DebuggingSpy/DSVariableBreakpointAdd.class.st new file mode 100644 index 0000000..4409629 --- /dev/null +++ b/DebuggingSpy/DSVariableBreakpointAdd.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSVariableBreakpointAdd, + #superclass : #DSVariableBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSVariableBreakpointEventRecord.class.st b/DebuggingSpy/DSVariableBreakpointEventRecord.class.st index 31a2487..d391fdf 100644 --- a/DebuggingSpy/DSVariableBreakpointEventRecord.class.st +++ b/DebuggingSpy/DSVariableBreakpointEventRecord.class.st @@ -18,6 +18,12 @@ DSVariableBreakpointEventRecord >> accessStrategy [ ^ accessStrategy ] +{ #category : #converting } +DSVariableBreakpointEventRecord >> modelClass [ + + ^ DSVariableBreakpointRecord +] + { #category : #'actions api' } DSVariableBreakpointEventRecord >> record: aBreakpointEvent [ super record: aBreakpointEvent. diff --git a/DebuggingSpy/DSVariableBreakpointHit.class.st b/DebuggingSpy/DSVariableBreakpointHit.class.st new file mode 100644 index 0000000..e2c92ad --- /dev/null +++ b/DebuggingSpy/DSVariableBreakpointHit.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSVariableBreakpointHit, + #superclass : #DSVariableBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSVariableBreakpointRecord.class.st b/DebuggingSpy/DSVariableBreakpointRecord.class.st new file mode 100644 index 0000000..568ac02 --- /dev/null +++ b/DebuggingSpy/DSVariableBreakpointRecord.class.st @@ -0,0 +1,56 @@ +Class { + #name : #DSVariableBreakpointRecord, + #superclass : #DSBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRecord class >> breakpointadded: event [ + + ^DSVariableBreakpointAdd for: event +] + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRecord class >> breakpointhit: event [ + + ^DSVariableBreakpointHit for: event +] + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRecord class >> breakpointremoved: event [ + + ^DSVariableBreakpointRemoved for: event +] + +{ #category : #'instance creation' } +DSVariableBreakpointRecord class >> for: anEvent [ + + | breakpoint | + breakpoint := self new. + breakpoint become: anEvent. + anEvent record: breakpoint. + ^ anEvent +] + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRecord >> accessStrategy [ + ^sourceRecord accessStrategy +] + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRecord >> eventName [ + + ^ String streamContents: [ :s | + s << 'Variable'. + s << super eventName ] +] + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRecord >> targetClassOrMethod [ + ^sourceRecord targetClassOrMethod +] + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRecord >> targetVariables [ + ^sourceRecord targetVariables +] diff --git a/DebuggingSpy/DSVariableBreakpointRemoved.class.st b/DebuggingSpy/DSVariableBreakpointRemoved.class.st new file mode 100644 index 0000000..fe137ef --- /dev/null +++ b/DebuggingSpy/DSVariableBreakpointRemoved.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSVariableBreakpointRemoved, + #superclass : #DSVariableBreakpointRecord, + #category : #'DebuggingSpy-Records-Extensions' +} From a3f9b7ef5c9da789fda07aebd96c3a196a868b6b Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 11:41:15 +0100 Subject: [PATCH 34/49] fixing log event name for clarity --- DebuggingSpy/DSSelectInspectorPageRecord.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggingSpy/DSSelectInspectorPageRecord.class.st b/DebuggingSpy/DSSelectInspectorPageRecord.class.st index 1750b70..ba0cc02 100644 --- a/DebuggingSpy/DSSelectInspectorPageRecord.class.st +++ b/DebuggingSpy/DSSelectInspectorPageRecord.class.st @@ -12,7 +12,7 @@ Class { { #category : #accessing } DSSelectInspectorPageRecord >> eventName [ - ^'Selecting inspector page' + ^'Selecting inspector tab' ] { #category : #accessing } From 5ced0b7c63f1e3cde2dc616ac57637034092d1c5 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:20:44 +0100 Subject: [PATCH 35/49] Merging contiguous window jumps --- .../DSMergedWindowActivityRecord.class.st | 60 +++++++++++++++++++ DebuggingSpy/DSRecordHistory.class.st | 50 +++++++++++++++- DebuggingSpy/DSWindowActivityRecord.class.st | 10 ++++ 3 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 DebuggingSpy/DSMergedWindowActivityRecord.class.st diff --git a/DebuggingSpy/DSMergedWindowActivityRecord.class.st b/DebuggingSpy/DSMergedWindowActivityRecord.class.st new file mode 100644 index 0000000..fae856b --- /dev/null +++ b/DebuggingSpy/DSMergedWindowActivityRecord.class.st @@ -0,0 +1,60 @@ +Class { + #name : #DSMergedWindowActivityRecord, + #superclass : #DSWindowActivityRecord, + #instVars : [ + 'activities' + ], + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #accessing } +DSMergedWindowActivityRecord >> activities [ + + ^ activities ifNil: [ activities := OrderedCollection new ] +] + +{ #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/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 3719585..473c1c4 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -14,7 +14,8 @@ Class { 'windows', 'windowJumps', 'filteredWindowJumps', - 'filteredWindows' + 'filteredWindows', + 'mergedWindowJumps' ], #category : #'DebuggingSpy-Records' } @@ -125,7 +126,10 @@ DSRecordHistory >> buildWindowJumps [ nextWindowActivity := nil. filteredWindowJumps reverseDo: [ :period | period next: nextWindowActivity. - nextWindowActivity := period ] + nextWindowActivity := period ]. + + self mergeFilteredJumps + ] { #category : #'private - history' } @@ -340,6 +344,28 @@ DSRecordHistory >> initialize [ self flag: 'I am not tested! Please do it!' ] +{ #category : #'private - history' } +DSRecordHistory >> mergeFilteredJumps [ + + | currentJump | + mergedWindowJumps := OrderedCollection new. + currentJump := filteredWindowJumps first. + + [ currentJump notNil ] whileTrue: [ + currentJump next ifNil: [ + mergedWindowJumps add: currentJump. + ^ self ]. + currentJump windowId = currentJump next windowId + ifTrue: [ currentJump merge: currentJump next ] + ifFalse: [ + mergedWindowJumps ifNotEmpty: [ + currentJump previous: mergedWindowJumps last ]. + mergedWindowJumps add: currentJump. + currentJump := currentJump next ] ]. + + self validateMergedJumps +] + { #category : #'API-history' } DSRecordHistory >> methodsAdded [ @@ -483,6 +509,26 @@ DSRecordHistory >> user: anObject [ user := anObject ] +{ #category : #'private - history' } +DSRecordHistory >> validateMergedJumps [ + + 1 to: mergedWindowJumps size do:[:i| + |current next| + current := mergedWindowJumps at: i. + current = mergedWindowJumps last ifFalse:[ + |w wId| + next := mergedWindowJumps at: i + 1. + self assert: next previous == current. + self assert: current next == next. + w := current window. + wId := current windowId. + + self assert: (current events allSatisfy: [:e| e windowId = w and:[e window == w]]). + self assert: (current events allSatisfy: [:e| e dateTime < next start dateTime]) + ] + ] +] + { #category : #'private - history' } DSRecordHistory >> validateWindows [ "Validates that each windows starts by a window entering or opening event, finishes by a window closing or leaving event, and that every event contained in the window happened between the opening event timestamp and the closing even timestamp" diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st index d2187bf..6163b6c 100644 --- a/DebuggingSpy/DSWindowActivityRecord.class.st +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -61,6 +61,16 @@ DSWindowActivityRecord >> events: anObject [ events := anObject ] +{ #category : #merging } +DSWindowActivityRecord >> merge: aDSWindowActivityRecord [ + |merge become| + merge := DSMergedWindowActivityRecord new. + become := self. + merge become: self. + become mergeWith: merge. + become mergeWith: aDSWindowActivityRecord +] + { #category : #accessing } DSWindowActivityRecord >> next [ From 8261a398c05f8d9162169fd1c61bb9040f0ddcb3 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:34:57 +0100 Subject: [PATCH 36/49] Renaming and accessor for merged window jumps --- DebuggingSpy/DSRecordHistory.class.st | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 473c1c4..598f24b 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -128,7 +128,7 @@ DSRecordHistory >> buildWindowJumps [ period next: nextWindowActivity. nextWindowActivity := period ]. - self mergeFilteredJumps + self mergeFilteredWindowJumps ] @@ -345,7 +345,7 @@ DSRecordHistory >> initialize [ ] { #category : #'private - history' } -DSRecordHistory >> mergeFilteredJumps [ +DSRecordHistory >> mergeFilteredWindowJumps [ | currentJump | mergedWindowJumps := OrderedCollection new. @@ -366,6 +366,12 @@ DSRecordHistory >> mergeFilteredJumps [ self validateMergedJumps ] +{ #category : #accessing } +DSRecordHistory >> mergedWindowJumps [ + + ^ mergedWindowJumps +] + { #category : #'API-history' } DSRecordHistory >> methodsAdded [ From 64640a0c4fe6a5ab254809169786fb027a591221 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:27:14 +0100 Subject: [PATCH 37/49] Breakpoint reporting --- DebuggingSpy/DSBreakpointRecord.class.st | 10 +++ DebuggingSpy/DSBreakpointReport.class.st | 70 +++++++++++++++++++ .../DSMethodBreakpointRecord.class.st | 12 ++++ DebuggingSpy/DSRecordHistory.class.st | 13 ++++ .../DSVariableBreakpointRecord.class.st | 14 ++-- 5 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 DebuggingSpy/DSBreakpointReport.class.st diff --git a/DebuggingSpy/DSBreakpointRecord.class.st b/DebuggingSpy/DSBreakpointRecord.class.st index 8c50185..9ffe1e7 100644 --- a/DebuggingSpy/DSBreakpointRecord.class.st +++ b/DebuggingSpy/DSBreakpointRecord.class.st @@ -29,7 +29,17 @@ DSBreakpointRecord >> printTargetInstance: anObject [ ^sourceRecord printTargetInstance: anObject ] +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> submethodTargets [ + ^self subclassResponsibility +] + { #category : #'as yet unclassified' } DSBreakpointRecord >> target [ ^sourceRecord target ] + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> targetClassOrMethod [ + ^self subclassResponsibility +] diff --git a/DebuggingSpy/DSBreakpointReport.class.st b/DebuggingSpy/DSBreakpointReport.class.st new file mode 100644 index 0000000..e875782 --- /dev/null +++ b/DebuggingSpy/DSBreakpointReport.class.st @@ -0,0 +1,70 @@ +Class { + #name : #DSBreakpointReport, + #superclass : #Object, + #instVars : [ + 'records', + 'method', + 'targets' + ], + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #adding } +DSBreakpointReport >> add: aBreakpointRecord [ + + self records add: aBreakpointRecord. + aBreakpointRecord submethodTargets do: [ :target | + (self targets at: target ifAbsentPut: [ OrderedCollection new ]) add: + aBreakpointRecord ] +] + +{ #category : #accessing } +DSBreakpointReport >> method [ + + ^ method +] + +{ #category : #accessing } +DSBreakpointReport >> method: anObject [ + + method := anObject +] + +{ #category : #printing } +DSBreakpointReport >> printOn: aStream [ + + aStream << method. + aStream << ':'. + aStream space. + aStream << records size asString. + aStream space. + aStream << 'breakpoints on'. + aStream space. + aStream << targets size asString. + aStream space. + aStream << 'submethod targets' +] + +{ #category : #accessing } +DSBreakpointReport >> records [ + + ^ records ifNil: [ records := OrderedCollection new ] +] + +{ #category : #accessing } +DSBreakpointReport >> records: anObject [ + + records := anObject +] + +{ #category : #accessing } +DSBreakpointReport >> targets [ + + ^ targets ifNil: [ targets := Dictionary new ] +] + +{ #category : #accessing } +DSBreakpointReport >> targets: anObject [ + + targets := anObject +] diff --git a/DebuggingSpy/DSMethodBreakpointRecord.class.st b/DebuggingSpy/DSMethodBreakpointRecord.class.st index 56bda70..55e7c4d 100644 --- a/DebuggingSpy/DSMethodBreakpointRecord.class.st +++ b/DebuggingSpy/DSMethodBreakpointRecord.class.st @@ -52,3 +52,15 @@ DSMethodBreakpointRecord >> method [ DSMethodBreakpointRecord >> node [ ^sourceRecord node ] + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord >> submethodTargets [ + + ^ {self node} +] + +{ #category : #'as yet unclassified' } +DSMethodBreakpointRecord >> targetClassOrMethod [ + + ^ self method +] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 598f24b..2263e8a 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -64,6 +64,19 @@ DSRecordHistory >> breakpointAdds [ ^ (self breakpointEvents: BreakpointAdded name) size ] +{ #category : #'API-history' } +DSRecordHistory >> breakpointAnalysisMap [ + + | report | + report := Dictionary new. + (self allRecordsOfKind: DSBreakpointRecord) do: [ :bp | + (report at: bp targetClassOrMethod ifAbsentPut: [ + DSBreakpointReport new + method: bp targetClassOrMethod; + yourself ]) add: bp ]. + ^ report +] + { #category : #'private - history' } DSRecordHistory >> breakpointEvents [ diff --git a/DebuggingSpy/DSVariableBreakpointRecord.class.st b/DebuggingSpy/DSVariableBreakpointRecord.class.st index 568ac02..65bc1e2 100644 --- a/DebuggingSpy/DSVariableBreakpointRecord.class.st +++ b/DebuggingSpy/DSVariableBreakpointRecord.class.st @@ -32,12 +32,12 @@ DSVariableBreakpointRecord class >> for: anEvent [ ^ anEvent ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSVariableBreakpointRecord >> accessStrategy [ ^sourceRecord accessStrategy ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSVariableBreakpointRecord >> eventName [ ^ String streamContents: [ :s | @@ -45,12 +45,18 @@ DSVariableBreakpointRecord >> eventName [ s << super eventName ] ] -{ #category : #'as yet unclassified' } +{ #category : #'accessing - analysis' } +DSVariableBreakpointRecord >> submethodTargets [ + + ^ self targetVariables +] + +{ #category : #accessing } DSVariableBreakpointRecord >> targetClassOrMethod [ ^sourceRecord targetClassOrMethod ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSVariableBreakpointRecord >> targetVariables [ ^sourceRecord targetVariables ] From e0016f1a8b1aaa96c6cff9c21cd0d91084bb2219 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 21:27:44 +0100 Subject: [PATCH 38/49] Abstraction for breakpoint report --- DebuggingSpy/DSBreakpointReport.class.st | 35 ++--------------- DebuggingSpy/DSExceptionReport.class.st | 48 ++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 32 deletions(-) create mode 100644 DebuggingSpy/DSExceptionReport.class.st diff --git a/DebuggingSpy/DSBreakpointReport.class.st b/DebuggingSpy/DSBreakpointReport.class.st index e875782..d24600d 100644 --- a/DebuggingSpy/DSBreakpointReport.class.st +++ b/DebuggingSpy/DSBreakpointReport.class.st @@ -1,9 +1,7 @@ Class { #name : #DSBreakpointReport, - #superclass : #Object, + #superclass : #DSExceptionReport, #instVars : [ - 'records', - 'method', 'targets' ], #category : #'DebuggingSpy-Records-Extensions' @@ -12,31 +10,16 @@ Class { { #category : #adding } DSBreakpointReport >> add: aBreakpointRecord [ - self records add: aBreakpointRecord. + super add: aBreakpointRecord. aBreakpointRecord submethodTargets do: [ :target | (self targets at: target ifAbsentPut: [ OrderedCollection new ]) add: aBreakpointRecord ] ] -{ #category : #accessing } -DSBreakpointReport >> method [ - - ^ method -] - -{ #category : #accessing } -DSBreakpointReport >> method: anObject [ - - method := anObject -] - { #category : #printing } DSBreakpointReport >> printOn: aStream [ - aStream << method. - aStream << ':'. - aStream space. - aStream << records size asString. + super printOn: aStream. aStream space. aStream << 'breakpoints on'. aStream space. @@ -45,18 +28,6 @@ DSBreakpointReport >> printOn: aStream [ aStream << 'submethod targets' ] -{ #category : #accessing } -DSBreakpointReport >> records [ - - ^ records ifNil: [ records := OrderedCollection new ] -] - -{ #category : #accessing } -DSBreakpointReport >> records: anObject [ - - records := anObject -] - { #category : #accessing } DSBreakpointReport >> targets [ diff --git a/DebuggingSpy/DSExceptionReport.class.st b/DebuggingSpy/DSExceptionReport.class.st new file mode 100644 index 0000000..a27a131 --- /dev/null +++ b/DebuggingSpy/DSExceptionReport.class.st @@ -0,0 +1,48 @@ +Class { + #name : #DSExceptionReport, + #superclass : #Object, + #instVars : [ + 'records', + 'method' + ], + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #adding } +DSExceptionReport >> add: aBreakpointRecord [ + + self records add: aBreakpointRecord +] + +{ #category : #accessing } +DSExceptionReport >> method [ + + ^ method +] + +{ #category : #accessing } +DSExceptionReport >> method: anObject [ + + method := anObject +] + +{ #category : #printing } +DSExceptionReport >> printOn: aStream [ + + aStream << method. + aStream << ':'. + aStream space. + aStream << records size asString +] + +{ #category : #accessing } +DSExceptionReport >> records [ + + ^ records ifNil: [ records := OrderedCollection new ] +] + +{ #category : #accessing } +DSExceptionReport >> records: anObject [ + + records := anObject +] From 8c267ac5282ba330da08e6606a4f5fb158da9542 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 20 Feb 2024 21:27:49 +0100 Subject: [PATCH 39/49] Halt report --- DebuggingSpy/DSHaltChangeRecord.class.st | 2 +- DebuggingSpy/DSHaltHitRecord.class.st | 2 +- DebuggingSpy/DSHaltReport.class.st | 13 +++++++++++++ DebuggingSpy/DSRecordHistory.class.st | 13 +++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 DebuggingSpy/DSHaltReport.class.st diff --git a/DebuggingSpy/DSHaltChangeRecord.class.st b/DebuggingSpy/DSHaltChangeRecord.class.st index ca64943..a264a2b 100644 --- a/DebuggingSpy/DSHaltChangeRecord.class.st +++ b/DebuggingSpy/DSHaltChangeRecord.class.st @@ -28,7 +28,7 @@ DSHaltChangeRecord class >> remove [ { #category : #accessing } DSHaltChangeRecord >> eventName [ - ^'Halt change' + ^haltChange, ' (', method, ')' ] { #category : #accessing } diff --git a/DebuggingSpy/DSHaltHitRecord.class.st b/DebuggingSpy/DSHaltHitRecord.class.st index d3640d1..a6f88e0 100644 --- a/DebuggingSpy/DSHaltHitRecord.class.st +++ b/DebuggingSpy/DSHaltHitRecord.class.st @@ -20,7 +20,7 @@ DSHaltHitRecord >> conditional [ { #category : #accessing } DSHaltHitRecord >> eventName [ - ^'Halt hit' + ^'HALT_HIT (', method, ')' ] { #category : #accessing } diff --git a/DebuggingSpy/DSHaltReport.class.st b/DebuggingSpy/DSHaltReport.class.st new file mode 100644 index 0000000..d1d1a08 --- /dev/null +++ b/DebuggingSpy/DSHaltReport.class.st @@ -0,0 +1,13 @@ +Class { + #name : #DSHaltReport, + #superclass : #DSExceptionReport, + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #printing } +DSHaltReport >> printOn: aStream [ + + super printOn: aStream. + aStream space. + aStream << 'halts' +] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 2263e8a..9d1a316 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -351,6 +351,19 @@ DSRecordHistory >> fixWindowRecordKeysNames [ (self findWindowRecordKeyForID: id) windowName: name ] ] +{ #category : #'API-history' } +DSRecordHistory >> haltAnalysisMap [ + + | report | + report := Dictionary new. + (self allRecordsOfKind: DSAbstractHaltRecord) do: [ :bp | + (report at: bp method ifAbsentPut: [ + DSHaltReport new + method: bp method; + yourself ]) add: bp ]. + ^ report +] + { #category : #initialization } DSRecordHistory >> initialize [ super initialize. From 6257183f1fd87551d76136f043ead18547957fcb Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:32:01 +0100 Subject: [PATCH 40/49] Test for 1 halt --- DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st index b0c384b..db8b62d 100644 --- a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st +++ b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st @@ -188,6 +188,11 @@ DSSpyInstrumenterTest >> debuggerWithRunnableContext [ initialize ] +{ #category : #helpers } +DSSpyInstrumenterTest >> execute1Halt [ + 1 halt +] + { #category : #helpers } DSSpyInstrumenterTest >> executeHalt [ @@ -649,6 +654,14 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ record := self registry fourth. self assert: record selector equals: #now:. self assertHaltHitRecordingMethod: (self class >> #executeHaltWithMessage) conditional: false once: false. + + [ self execute1Halt ] + on: Halt + do: [ ]. + self assert: self registry size equals: 5. + record := self registry fifth. + self assert: record selector equals: #halt. + self assertHaltHitRecordingMethod: (self class >> #execute1Halt) conditional: false once: false. ] { #category : #'tests - halts' } From 0509c3c3bdeff5d62be251011faf341f90cb952f Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:32:24 +0100 Subject: [PATCH 41/49] We need to keep the nil windows, for example halts and breakpoints have no windows --- DebuggingSpy/DSRecordHistory.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 9d1a316..cba8107 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -446,7 +446,7 @@ DSRecordHistory >> processRecords: 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 | #( nil 0 ) includes: e windowId ]). + (array reject: [ :e | #( 0 ) includes: e windowId ]). "Transform raw events to model events" (self allRecordsOfKind: DSStepActionRecord) do: #asStepRecord. From d783af101485e7688717635e7dc7a42a2fbfc107 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:32:39 +0100 Subject: [PATCH 42/49] The breakpoints have changed --- DebuggingSpy/DSDebuggerOpeningRecord.class.st | 1 + 1 file changed, 1 insertion(+) diff --git a/DebuggingSpy/DSDebuggerOpeningRecord.class.st b/DebuggingSpy/DSDebuggerOpeningRecord.class.st index 950c0c2..ed231cf 100644 --- a/DebuggingSpy/DSDebuggerOpeningRecord.class.st +++ b/DebuggingSpy/DSDebuggerOpeningRecord.class.st @@ -31,6 +31,7 @@ DSDebuggerOpeningRecord >> eventName [ DSDebuggerOpeningRecord >> primarySourcesOfWindowOpenings [ ^ ({ + DSBreakpointRecord. DSAbstractBreakpointEventRecord. DSHaltHitRecord } collect: [ :c | c withAllSubclasses ]) flattened From d39f2b3d7c3497b62061826c8aabb4cc6bc9030f Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:46:44 +0100 Subject: [PATCH 43/49] Recording breakpoints hash to know which is which in the logs --- DebuggingSpy-Tests/DSSpyTest.class.st | 17 ++++++++++++----- .../DSAbstractBreakpointEventRecord.class.st | 11 +++++++++-- DebuggingSpy/DSBreakpointRecord.class.st | 6 ++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/DebuggingSpy-Tests/DSSpyTest.class.st b/DebuggingSpy-Tests/DSSpyTest.class.st index d36052d..6d7a3c7 100644 --- a/DebuggingSpy-Tests/DSSpyTest.class.st +++ b/DebuggingSpy-Tests/DSSpyTest.class.st @@ -10,7 +10,8 @@ Class { 'breakpoint', 'task', 'survey', - 'recordSourceCode' + 'recordSourceCode', + 'breakpointHash' ], #category : #'DebuggingSpy-Tests' } @@ -25,7 +26,8 @@ DSSpyTest >> assertBreakpointRecordedAs: aDSRecordClass forBreakpointEvent: aBre ifNotNil: [self assert: record objectCentric]. self deny: record once. self assert: record method equals: self breakpointedMethod name. - self assert: record node equals: self breakpointedMethod ast printString + self assert: record node equals: self breakpointedMethod ast printString. + self assert: record breakpointHash equals: breakpointHash ] { #category : #assertions } @@ -67,7 +69,8 @@ DSSpyTest >> assertVariableBreakpointRecordedAs: aDSRecordClass forBreakpointEve self deny: record once. self assert: record targetClassOrMethod equals: self breakpointedMethod name. self assert: record targetVariables first equals: #value. - self assert: record accessStrategy equals: #all + self assert: record accessStrategy equals: #all. + self assert: record breakpointHash equals: breakpointHash ] { #category : #assertions } @@ -113,7 +116,8 @@ DSSpyTest >> compileTestMethod [ DSSpyTest >> installBreakpoint [ breakpoint := Breakpoint new node: self breakpointedMethod ast. - breakpoint install + breakpoint install. + breakpointHash := breakpoint hash ] { #category : #helpers } @@ -121,7 +125,8 @@ DSSpyTest >> installVariableBreakpoint [ breakpoint := VariableBreakpoint watchVariable: #value - inClass: self breakpointedMethod + inClass: self breakpointedMethod. + breakpointHash := breakpoint hash ] { #category : #helpers } @@ -530,6 +535,7 @@ DSSpyTest >> testObjectCentricBreakpointRecord [ instrumenter listenToBreakpointChanges. breakpoint := target haltOnCallTo: #breakpointMethod. + breakpointHash := breakpoint hash. self assert: self registry size equals: 1. record := self registry first. self @@ -565,6 +571,7 @@ DSSpyTest >> testObjectCentricVariableBreakpointRecord [ breakpoint := (self breakpointedMethod newBreakpointForVariable: #value) scopeTo: target; install. + breakpointHash := breakpoint hash. self assert: self registry size equals: 1. record := self registry first. diff --git a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st b/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st index 304a662..42103da 100644 --- a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st +++ b/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st @@ -9,7 +9,8 @@ Class { 'target', 'objectCentric', 'eventName', - 'once' + 'once', + 'breakpointHash' ], #category : #'DebuggingSpy-Records' } @@ -22,6 +23,11 @@ DSAbstractBreakpointEventRecord >> asBreakpointRecord [ with: self ] +{ #category : #accessing } +DSAbstractBreakpointEventRecord >> breakpointHash [ + ^breakpointHash +] + { #category : #testing } DSAbstractBreakpointEventRecord >> canOpenDebuggers [ ^eventName = 'BreakpointHit' @@ -72,7 +78,8 @@ DSAbstractBreakpointEventRecord >> record: aBreakpointEvent [ self printTargetInstance: aBreakpointEvent breakpoint targetInstance ] ifFalse: [ nil ]. - once := aBreakpointEvent breakpoint once + once := aBreakpointEvent breakpoint once. + breakpointHash := aBreakpointEvent breakpoint hash ] { #category : #accessing } diff --git a/DebuggingSpy/DSBreakpointRecord.class.st b/DebuggingSpy/DSBreakpointRecord.class.st index 9ffe1e7..a03e14d 100644 --- a/DebuggingSpy/DSBreakpointRecord.class.st +++ b/DebuggingSpy/DSBreakpointRecord.class.st @@ -4,6 +4,12 @@ Class { #category : #'DebuggingSpy-Records-Extensions' } +{ #category : #accessing } +DSBreakpointRecord >> breakpointHash [ + + ^ sourceRecord breakpointHash +] + { #category : #'as yet unclassified' } DSBreakpointRecord >> canOpenDebuggers [ ^sourceRecord canOpenDebuggers From 3541e8df42d9d34dba63d78f3140fd1ea82c86c6 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:46:53 +0100 Subject: [PATCH 44/49] Reclassification --- DebuggingSpy/DSBreakpointRecord.class.st | 16 ++++++++-------- DebuggingSpy/DSMethodBreakpointRecord.class.st | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/DebuggingSpy/DSBreakpointRecord.class.st b/DebuggingSpy/DSBreakpointRecord.class.st index a03e14d..a02d6c7 100644 --- a/DebuggingSpy/DSBreakpointRecord.class.st +++ b/DebuggingSpy/DSBreakpointRecord.class.st @@ -10,42 +10,42 @@ DSBreakpointRecord >> breakpointHash [ ^ sourceRecord breakpointHash ] -{ #category : #'as yet unclassified' } +{ #category : #testing } DSBreakpointRecord >> canOpenDebuggers [ ^sourceRecord canOpenDebuggers ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSBreakpointRecord >> eventName [ ^sourceRecord eventName ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSBreakpointRecord >> objectCentric [ ^sourceRecord objectCentric ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSBreakpointRecord >> once [ ^sourceRecord once ] -{ #category : #'as yet unclassified' } +{ #category : #printing } DSBreakpointRecord >> printTargetInstance: anObject [ ^sourceRecord printTargetInstance: anObject ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSBreakpointRecord >> submethodTargets [ ^self subclassResponsibility ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSBreakpointRecord >> target [ ^sourceRecord target ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSBreakpointRecord >> targetClassOrMethod [ ^self subclassResponsibility ] diff --git a/DebuggingSpy/DSMethodBreakpointRecord.class.st b/DebuggingSpy/DSMethodBreakpointRecord.class.st index 55e7c4d..9fe1234 100644 --- a/DebuggingSpy/DSMethodBreakpointRecord.class.st +++ b/DebuggingSpy/DSMethodBreakpointRecord.class.st @@ -35,7 +35,7 @@ DSMethodBreakpointRecord class >> for: anEvent [ ^ anEvent ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSMethodBreakpointRecord >> eventName [ ^ String streamContents: [ :s | @@ -43,23 +43,23 @@ DSMethodBreakpointRecord >> eventName [ s << super eventName ] ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSMethodBreakpointRecord >> method [ ^sourceRecord method ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSMethodBreakpointRecord >> node [ ^sourceRecord node ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSMethodBreakpointRecord >> submethodTargets [ ^ {self node} ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } DSMethodBreakpointRecord >> targetClassOrMethod [ ^ self method From 8e43cf03a6a0afa1e303eae2190ce963375b7462 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Wed, 28 Feb 2024 22:32:35 +0100 Subject: [PATCH 45/49] Capturing exceptions + tests --- .../DSSpyInstrumenterTest.class.st | 51 +++++++++++++++ DebuggingSpy/DSSpyInstrumenter.class.st | 10 +++ .../DSUnhandledExceptionRecord.class.st | 62 +++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 DebuggingSpy/DSUnhandledExceptionRecord.class.st diff --git a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st index db8b62d..e817096 100644 --- a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st +++ b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st @@ -231,6 +231,18 @@ DSSpyInstrumenterTest >> metaPaneClassesItems: listName FromInspector: aMetaPane ^ (aMetaPane class slotNamed: listName) read: aMetaPane ] +{ #category : #helpers } +DSSpyInstrumenterTest >> methodWithDNU [ + + self unknownMessage +] + +{ #category : #helpers } +DSSpyInstrumenterTest >> methodWithException [ + + Exception new signal +] + { #category : #helpers } DSSpyInstrumenterTest >> newInspectorOn: anObject [ @@ -1301,3 +1313,42 @@ DSSpyInstrumenterTest >> testLoggingInteractionsWithNoSourceCode [ assert: record selectedString equals: DSSpy recordSourceCodeDisabledErrorMessage ] ] + +{ #category : #'tests - exceptions' } +DSSpyInstrumenterTest >> testRecordDNU [ + |capturedDNU| + + modifiedClass := Exception. + modifiedMethodSource := (Exception >> #raiseUnhandledError) sourceCode. + instrumenter instrumentExceptionSignalling. + + [self methodWithDNU] on: MessageNotUnderstood do:[:dnu| capturedDNU := dnu. [dnu raiseUnhandledError] on: UnhandledError do:[] ]. + + record := self registry first. + self assert: record class equals: DSUnhandledExceptionRecord. + self assert: record exceptionClass equals: MessageNotUnderstood name. + self assert: record errorString equals: capturedDNU description. + self assert: record receiver equals: self class name. + self assert: record node equals: (self class>>#methodWithDNU) ast children first sourceCode. + self assert: record method equals: (self class>>#methodWithDNU) selector +] + +{ #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:[] ]. + + self assert: self registry size equals: 1. + record := self registry first. + self assert: record class equals: DSUnhandledExceptionRecord. + self assert: record exceptionClass equals: Exception name. + self assert: record errorString equals: capturedException description. + self assert: record receiver equals: self class name. + self assert: record node equals: (self class>>#methodWithException) ast children first sourceCode. + self assert: record method equals: (self class>>#methodWithException) selector +] diff --git a/DebuggingSpy/DSSpyInstrumenter.class.st b/DebuggingSpy/DSSpyInstrumenter.class.st index 7f1109d..a714776 100644 --- a/DebuggingSpy/DSSpyInstrumenter.class.st +++ b/DebuggingSpy/DSSpyInstrumenter.class.st @@ -168,6 +168,16 @@ DSSpyInstrumenter >> instrumentDebuggerStack [ asSpecGroup)' ] +{ #category : #breakpoints } +DSSpyInstrumenter >> instrumentExceptionSignalling [ + Exception compile: 'raiseUnhandledError + + self class = Halt ifFalse:[[ DSUnhandledExceptionRecord for: self] + on: Error + do:[:err| DSSpy log: #ERROR key: self class name asSymbol ]]. + ^ UnhandledError signalForException: self'. +] + { #category : #inspector } DSSpyInstrumenter >> instrumentExpandAttribute [ diff --git a/DebuggingSpy/DSUnhandledExceptionRecord.class.st b/DebuggingSpy/DSUnhandledExceptionRecord.class.st new file mode 100644 index 0000000..5445eee --- /dev/null +++ b/DebuggingSpy/DSUnhandledExceptionRecord.class.st @@ -0,0 +1,62 @@ +" +I record unhandled exceptions with their context information +" +Class { + #name : #DSUnhandledExceptionRecord, + #superclass : #DSAbstractEventRecord, + #instVars : [ + 'exceptionClass', + 'errorString', + 'receiver', + 'node', + 'method' + ], + #category : #'DebuggingSpy-Records' +} + +{ #category : #accessing } +DSUnhandledExceptionRecord >> errorString [ + ^ errorString +] + +{ #category : #accessing } +DSUnhandledExceptionRecord >> eventName [ + ^exceptionClass +] + +{ #category : #accessing } +DSUnhandledExceptionRecord >> exceptionClass [ + ^ exceptionClass +] + +{ #category : #accessing } +DSUnhandledExceptionRecord >> method [ + ^ method +] + +{ #category : #accessing } +DSUnhandledExceptionRecord >> node [ + ^ node +] + +{ #category : #accessing } +DSUnhandledExceptionRecord >> receiver [ + ^ receiver +] + +{ #category : #'actions api' } +DSUnhandledExceptionRecord >> record: anException [ + + |signalerContext context| + signalerContext := anException signalerContext. + receiver := signalerContext receiver class name. + + context := signalerContext. + [ context method pragmas anySatisfy: [ :p| p selector = #debuggerCompleteToSender ] ] + whileTrue:[context := signalerContext sender.]. + node := (context method sourceNodeForPC: context pc) sourceCode. + method := context method selector. + + exceptionClass := anException class name. + errorString := anException description +] From 463f4802b80d15b0d69266498c33ffa27fbb90ed Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:49:55 +0100 Subject: [PATCH 46/49] Fixing namings in windows --- DebuggingSpy/DSWindowEventRecord.class.st | 6 ++++-- DebuggingSpy/DSWindowRecord.class.st | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DebuggingSpy/DSWindowEventRecord.class.st b/DebuggingSpy/DSWindowEventRecord.class.st index 3d0bf6d..5c213dc 100644 --- a/DebuggingSpy/DSWindowEventRecord.class.st +++ b/DebuggingSpy/DSWindowEventRecord.class.st @@ -55,9 +55,11 @@ DSWindowEventRecord >> windowName: anObject [ DSWindowEventRecord >> windowType [ | rs type | + ((windowName splitOn: Character space) includes: 'senders') ifTrue:[^'Senders']. + ((windowName splitOn: Character space) includes: 'implementors') ifTrue:[^'Implementors']. + rs := windowName readStream. - type := rs upTo: Character space. + type := rs upTo: Character space. type size = 1 ifTrue: [ type := rs upTo: $( ]. - ^ type ] diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index 284d8e4..2b4cf69 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -39,7 +39,7 @@ DSWindowRecord >> buildEvents: aCollectionOfEvents [ (events detect: [ :e | e class == DSQueryBrowseRecord ] ifNone: [ nil ]) ifNotNil: [ :e | - type := e queryName readStream upTo: Character space. + type := (e queryName readStream upTo: Character space) capitalized. name := (e queryName splitOn: Character space) last ] ]. @@ -54,8 +54,7 @@ DSWindowRecord >> buildEvents: aCollectionOfEvents [ (#( nil '' ) includes: e methodBrowsed) ifFalse: [ ws << '>>'. ws << e methodBrowsed ] ] ] ]. - - + name ifNotNil: [ ^ self ]. name := self windowNameFor: events first ] From 19678b393a479f2247e83d083b9bbd27bcc12161 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 5 Mar 2024 14:08:54 +0100 Subject: [PATCH 47/49] Improvments and bug fixes --- .../DSMouseEnterTextEditorRecord.class.st | 3 ++- DebuggingSpy/DSRecordHistory.class.st | 14 ++++++++++++-- DebuggingSpy/DSSindarinStepRecord.class.st | 5 +++++ DebuggingSpy/DSStepActionRecord.class.st | 5 ++++- DebuggingSpy/DSStepRecord.class.st | 6 ++++++ DebuggingSpy/DSWindowEventRecord.class.st | 10 +++++++--- DebuggingSpy/DSWindowRecord.class.st | 16 +++++++++++++++- 7 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 DebuggingSpy/DSSindarinStepRecord.class.st diff --git a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st b/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st index bf8a0f1..0867b79 100644 --- a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st +++ b/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st @@ -19,5 +19,6 @@ DSMouseEnterTextEditorRecord >> windowName [ { #category : #'as yet unclassified' } DSMouseEnterTextEditorRecord >> windowType [ - ^windowId +" self halt." + ^"windowId" 'External Window' ] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index cba8107..96186a8 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -494,6 +494,11 @@ DSRecordHistory >> records: anObject [ records := anObject ] +{ #category : #initialization } +DSRecordHistory >> reprocessRecords [ + self processRecords: records asOrderedCollection +] + { #category : #accessing } DSRecordHistory >> tag [ @@ -595,13 +600,13 @@ DSRecordHistory >> validateWindows [ (erroneousWindows at: w ifAbsentPut: [ OrderedCollection new ]) add: #timestamp -> e ] ] ]. - erroneousWindows ifNotEmpty: [ + "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.' ]) ] + 'potential sequence problem found in windows. This is just an information, you can proceed.' ]) ]" ] { #category : #accessing } @@ -610,6 +615,11 @@ DSRecordHistory >> windowJumps [ ^ windowJumps ] +{ #category : #accessing } +DSRecordHistory >> windows [ + ^ windows +] + { #category : #accessing } DSRecordHistory >> windowsHistory [ ^windowsHistory ifNil:[windowsHistory := IdentityDictionary new] diff --git a/DebuggingSpy/DSSindarinStepRecord.class.st b/DebuggingSpy/DSSindarinStepRecord.class.st new file mode 100644 index 0000000..a98b1ce --- /dev/null +++ b/DebuggingSpy/DSSindarinStepRecord.class.st @@ -0,0 +1,5 @@ +Class { + #name : #DSSindarinStepRecord, + #superclass : #DSStepRecord, + #category : #'DebuggingSpy-Records-Extensions' +} diff --git a/DebuggingSpy/DSStepActionRecord.class.st b/DebuggingSpy/DSStepActionRecord.class.st index 7c08c6f..ba557c7 100644 --- a/DebuggingSpy/DSStepActionRecord.class.st +++ b/DebuggingSpy/DSStepActionRecord.class.st @@ -19,11 +19,14 @@ Class { { #category : #converting } DSStepActionRecord >> asStepRecord [ + ((SindarinCommand allSubclasses collect: #defaultName) includes: + eventName) ifTrue: [ ^ DSStepRecord sindarinStep: self ]. + ^ DSStepRecord perform: (eventName asLowercase copyReplaceAll: ' ' with: '') asSymbol asMutator - with: self + with: self ] { #category : #accessing } diff --git a/DebuggingSpy/DSStepRecord.class.st b/DebuggingSpy/DSStepRecord.class.st index 2e2e117..f598c0c 100644 --- a/DebuggingSpy/DSStepRecord.class.st +++ b/DebuggingSpy/DSStepRecord.class.st @@ -50,6 +50,12 @@ DSStepRecord class >> runto: aDSDebuggerActionRecord [ ^ DSRunToRecord for: aDSDebuggerActionRecord ] +{ #category : #'as yet unclassified' } +DSStepRecord class >> sindarinStep: aDSDebuggerActionRecord [ + + ^ DSSindarinStepRecord for: aDSDebuggerActionRecord +] + { #category : #'as yet unclassified' } DSStepRecord class >> through: aDSDebuggerActionRecord [ diff --git a/DebuggingSpy/DSWindowEventRecord.class.st b/DebuggingSpy/DSWindowEventRecord.class.st index 5c213dc..0d14b49 100644 --- a/DebuggingSpy/DSWindowEventRecord.class.st +++ b/DebuggingSpy/DSWindowEventRecord.class.st @@ -56,10 +56,14 @@ DSWindowEventRecord >> windowType [ | rs type | ((windowName splitOn: Character space) includes: 'senders') ifTrue:[^'Senders']. + ((windowName splitOn: Character space) includes: 'Senders') ifTrue:[^'Senders']. ((windowName splitOn: Character space) includes: 'implementors') ifTrue:[^'Implementors']. - + ((windowName splitOn: Character space) includes: 'Implementors') ifTrue:[^'Implementors']. + rs := windowName readStream. - type := rs upTo: Character space. + type := rs upTo: Character space. type size = 1 ifTrue: [ type := rs upTo: $( ]. - ^ type + (#('Spotter' 'implementors' 'Inspector' 'Debugger' 'Implementors' 'Breakpoint' 'Transcript' 'Browser' 'ClyQueryBrowserMorph' 'ClyFullBrowserMorph') includes: type) ifTrue:[^type]. + type isNumber ifTrue:[^'X']. + ^ 'Application' ] diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index 8f9b49f..2124683 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -6,7 +6,8 @@ Class { 'name', 'events', 'activePeriods', - 'sourceEvent' + 'sourceEvent', + 'idleTime' ], #category : #'DebuggingSpy-Records-Extensions' } @@ -28,6 +29,14 @@ DSWindowRecord >> activePeriods: anObject [ activePeriods := anObject ] +{ #category : #adding } +DSWindowRecord >> addIdleTime: aDuration [ + idleTime ifNil: [ + idleTime := aDuration. + ^ self ]. + idleTime := idleTime + aDuration +] + { #category : #'as yet unclassified' } DSWindowRecord >> buildEvents: aCollectionOfEvents [ @@ -105,6 +114,11 @@ DSWindowRecord >> events: anObject [ events := anObject ] +{ #category : #accessing } +DSWindowRecord >> idleTime [ + ^ idleTime ifNil:[idleTime := 0 seconds] +] + { #category : #testing } DSWindowRecord >> isDebugger [ From e97f761ab859b7ddb3c2bd4b7a3eb02960187125 Mon Sep 17 00:00:00 2001 From: Steven Costiou <26929529+StevenCostiou@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:50:38 +0200 Subject: [PATCH 48/49] Debugging code and missing details --- DebuggingSpy/DSRecordHistory.class.st | 22 ++++++++++++++-------- DebuggingSpy/DSSurveyRecord.class.st | 6 ++++++ DebuggingSpy/DSWindowRecord.class.st | 21 +++++++++++++++++++-- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 96186a8..4955347 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -80,7 +80,9 @@ DSRecordHistory >> breakpointAnalysisMap [ { #category : #'private - history' } DSRecordHistory >> breakpointEvents [ - ^ self records select: [ :r | r isKindOf: DSAbstractBreakpointEventRecord ] + ^ self records select: [ :r | + (r isKindOf: DSAbstractBreakpointEventRecord) or: [ + r isKindOf: DSBreakpointRecord ] ] ] { #category : #'private - history' } @@ -169,26 +171,30 @@ DSRecordHistory >> callStackBrowing [ { #category : #'private - history' } DSRecordHistory >> collectTimeDiscrepancies [ - | time currentRecord disc | - disc := 0. + | time currentRecord deltas | time := 0. + deltas := OrderedCollection new. currentRecord := records first. - records do: [ :r | + records do: [ :r | | delta | delta := r dateTime asSeconds - currentRecord dateTime asSeconds. time := time + (r dateTime asSeconds - currentRecord dateTime asSeconds). - delta > 300 ifTrue: [ disc := disc + delta ]. + delta > 30 ifTrue: [ + deltas add: { + r. + currentRecord. + records } -> delta asSeconds ]. currentRecord := r ]. - ^ disc + ^ deltas ] { #category : #'API-history' } DSRecordHistory >> countDebugActions [ - ^ self breakpointAdds + self breakpointHit + self breakpointRemove + ^ self breakpointAdds "+ self breakpointHit" + self breakpointRemove + self executedCode + self methodsAdded + self methodsModified - + self methodsRemoved + self numberOfSteps + self openedDebuggers + + self methodsRemoved + self numberOfSteps "+ self openedDebuggers" + self callStackBrowing ] diff --git a/DebuggingSpy/DSSurveyRecord.class.st b/DebuggingSpy/DSSurveyRecord.class.st index b3e9b59..61a06fc 100644 --- a/DebuggingSpy/DSSurveyRecord.class.st +++ b/DebuggingSpy/DSSurveyRecord.class.st @@ -16,6 +16,12 @@ DSSurveyRecord >> answer [ ^survey answer ] +{ #category : #'as yet unclassified' } +DSSurveyRecord >> collectAnswersFromQuestions [ + + ^ survey collectAnswersFromQuestions +] + { #category : #accessing } DSSurveyRecord >> description [ diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index 2124683..0ed200d 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -7,7 +7,8 @@ Class { 'events', 'activePeriods', 'sourceEvent', - 'idleTime' + 'idleTime', + 'trueIdleTime' ], #category : #'DebuggingSpy-Records-Extensions' } @@ -33,8 +34,12 @@ DSWindowRecord >> activePeriods: anObject [ DSWindowRecord >> addIdleTime: aDuration [ idleTime ifNil: [ idleTime := aDuration. + idleTime asSeconds = 40562 ifTrue: [ self halt ]. + idleTime asSeconds = 3800 ifTrue: [ self halt ]. ^ self ]. - idleTime := idleTime + aDuration + idleTime := idleTime + aDuration. + idleTime asSeconds = 40562 ifTrue: [ self halt ]. + idleTime asSeconds = 3800 ifTrue: [ self halt ]. ] { #category : #'as yet unclassified' } @@ -176,6 +181,18 @@ DSWindowRecord >> totalTime [ into: [ :sum :next | sum + next duration asSeconds ]) seconds ] +{ #category : #accessing } +DSWindowRecord >> trueIdleTime [ + + ^ trueIdleTime ifNil:[trueIdleTime := 0 asSeconds] +] + +{ #category : #accessing } +DSWindowRecord >> trueIdleTime: anObject [ + + trueIdleTime := anObject +] + { #category : #accessing } DSWindowRecord >> type [ From 2b5a3f09ed278d5a01fc84afc6c99990adde39b7 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 27 Sep 2024 18:18:46 +0200 Subject: [PATCH 49/49] Add annotation to the model --- DebuggingSpy/DSBreakpointAdd.class.st | 5 ++ DebuggingSpy/DSBreakpointHit.class.st | 5 ++ DebuggingSpy/DSBreakpointRecord.class.st | 38 ++++++++++++--- DebuggingSpy/DSBreakpointRemoved.class.st | 5 ++ DebuggingSpy/DSBreakpointReport.class.st | 2 +- DebuggingSpy/DSExceptionReport.class.st | 4 +- .../DSMergedWindowActivityRecord.class.st | 4 +- .../DSMouseEnterTextEditorRecord.class.st | 7 +-- DebuggingSpy/DSOverRecord.class.st | 5 ++ DebuggingSpy/DSProceedRecord.class.st | 5 ++ DebuggingSpy/DSRecordHistory.class.st | 27 ++++------- DebuggingSpy/DSRecordRegistry.class.st | 10 ++-- DebuggingSpy/DSRestartRecord.class.st | 5 ++ DebuggingSpy/DSReturnRecord.class.st | 5 ++ DebuggingSpy/DSRunToRecord.class.st | 5 ++ DebuggingSpy/DSSTONFileLogger.class.st | 32 ++++++++----- DebuggingSpy/DSSindarinStepRecord.class.st | 5 ++ DebuggingSpy/DSSpy.class.st | 35 +++++++++----- DebuggingSpy/DSStepActionRecord.class.st | 22 +++++++-- DebuggingSpy/DSStepRecord.class.st | 10 ++++ DebuggingSpy/DSTCommandForTests.trait.st | 5 +- DebuggingSpy/DSTaskSuccessRecord.class.st | 9 +--- DebuggingSpy/DSThroughRecord.class.st | 5 ++ DebuggingSpy/DSVariableBreakpointAdd.class.st | 5 ++ DebuggingSpy/DSVariableBreakpointHit.class.st | 5 ++ .../DSVariableBreakpointRemoved.class.st | 5 ++ DebuggingSpy/DSWindowActivityRecord.class.st | 26 ++++++++++- DebuggingSpy/DSWindowAnnotation.class.st | 39 ++++++++++++++++ ...SWindowElementAnnotationPresenter.class.st | 46 +++++++++++++++++++ DebuggingSpy/DSWindowEventRecord.class.st | 8 +--- DebuggingSpy/DSWindowRecord.class.st | 7 ++- 31 files changed, 308 insertions(+), 88 deletions(-) create mode 100644 DebuggingSpy/DSWindowAnnotation.class.st create mode 100644 DebuggingSpy/DSWindowElementAnnotationPresenter.class.st diff --git a/DebuggingSpy/DSBreakpointAdd.class.st b/DebuggingSpy/DSBreakpointAdd.class.st index 452b1ad..648ee71 100644 --- a/DebuggingSpy/DSBreakpointAdd.class.st +++ b/DebuggingSpy/DSBreakpointAdd.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSMethodBreakpointRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSBreakpointAdd >> eventSymbol [ + ^'+b' +] diff --git a/DebuggingSpy/DSBreakpointHit.class.st b/DebuggingSpy/DSBreakpointHit.class.st index c40af9b..ceda09f 100644 --- a/DebuggingSpy/DSBreakpointHit.class.st +++ b/DebuggingSpy/DSBreakpointHit.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSMethodBreakpointRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSBreakpointHit >> eventSymbol [ + ^'*b' +] diff --git a/DebuggingSpy/DSBreakpointRecord.class.st b/DebuggingSpy/DSBreakpointRecord.class.st index a02d6c7..83288ab 100644 --- a/DebuggingSpy/DSBreakpointRecord.class.st +++ b/DebuggingSpy/DSBreakpointRecord.class.st @@ -12,22 +12,43 @@ DSBreakpointRecord >> breakpointHash [ { #category : #testing } DSBreakpointRecord >> canOpenDebuggers [ - ^sourceRecord canOpenDebuggers + + ^ sourceRecord canOpenDebuggers ] { #category : #accessing } DSBreakpointRecord >> eventName [ - ^sourceRecord eventName + + ^ sourceRecord eventName +] + +{ #category : #'as yet unclassified' } +DSBreakpointRecord >> eventSymbol [ + ^self subclassResponsibility ] { #category : #accessing } DSBreakpointRecord >> objectCentric [ - ^sourceRecord objectCentric + + ^ sourceRecord objectCentric ] { #category : #accessing } DSBreakpointRecord >> once [ - ^sourceRecord once + + ^ sourceRecord once +] + +{ #category : #printing } +DSBreakpointRecord >> printContextAndNode [ + + ^ String streamContents: [ :s | + | nodeStream peek | + s << '['. + s << self eventName. + s << ']'. + s space. + s << self method] ] { #category : #printing } @@ -37,15 +58,18 @@ DSBreakpointRecord >> printTargetInstance: anObject [ { #category : #accessing } DSBreakpointRecord >> submethodTargets [ - ^self subclassResponsibility + + ^ self subclassResponsibility ] { #category : #accessing } DSBreakpointRecord >> target [ - ^sourceRecord target + + ^ sourceRecord target ] { #category : #accessing } DSBreakpointRecord >> targetClassOrMethod [ - ^self subclassResponsibility + + ^ self subclassResponsibility ] diff --git a/DebuggingSpy/DSBreakpointRemoved.class.st b/DebuggingSpy/DSBreakpointRemoved.class.st index 396a022..4a68e24 100644 --- a/DebuggingSpy/DSBreakpointRemoved.class.st +++ b/DebuggingSpy/DSBreakpointRemoved.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSMethodBreakpointRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSBreakpointRemoved >> eventSymbol [ + ^'-b' +] diff --git a/DebuggingSpy/DSBreakpointReport.class.st b/DebuggingSpy/DSBreakpointReport.class.st index d24600d..51ed992 100644 --- a/DebuggingSpy/DSBreakpointReport.class.st +++ b/DebuggingSpy/DSBreakpointReport.class.st @@ -31,7 +31,7 @@ DSBreakpointReport >> printOn: aStream [ { #category : #accessing } DSBreakpointReport >> targets [ - ^ targets ifNil: [ targets := Dictionary new ] + ^ targets ifNil: [ targets := Dictionary new ] ifNotNil: [ targets ] ] { #category : #accessing } diff --git a/DebuggingSpy/DSExceptionReport.class.st b/DebuggingSpy/DSExceptionReport.class.st index a27a131..89bfb40 100644 --- a/DebuggingSpy/DSExceptionReport.class.st +++ b/DebuggingSpy/DSExceptionReport.class.st @@ -38,7 +38,9 @@ DSExceptionReport >> printOn: aStream [ { #category : #accessing } DSExceptionReport >> records [ - ^ records ifNil: [ records := OrderedCollection new ] + ^ records + ifNil: [ records := OrderedCollection new ] + ifNotNil: [ records ] ] { #category : #accessing } diff --git a/DebuggingSpy/DSMergedWindowActivityRecord.class.st b/DebuggingSpy/DSMergedWindowActivityRecord.class.st index fae856b..715042c 100644 --- a/DebuggingSpy/DSMergedWindowActivityRecord.class.st +++ b/DebuggingSpy/DSMergedWindowActivityRecord.class.st @@ -10,7 +10,9 @@ Class { { #category : #accessing } DSMergedWindowActivityRecord >> activities [ - ^ activities ifNil: [ activities := OrderedCollection new ] + ^ activities + ifNil: [ activities := OrderedCollection new ] + ifNotNil: [ activities ] ] { #category : #accessing } diff --git a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st b/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st index 0867b79..9d9a9e9 100644 --- a/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st +++ b/DebuggingSpy/DSMouseEnterTextEditorRecord.class.st @@ -1,6 +1,3 @@ -" -This record is generated when the mouse enters an item in a text editor. -" Class { #name : #DSMouseEnterTextEditorRecord, #superclass : #DSMouseEventRecord, @@ -19,6 +16,6 @@ DSMouseEnterTextEditorRecord >> windowName [ { #category : #'as yet unclassified' } DSMouseEnterTextEditorRecord >> windowType [ -" self halt." - ^"windowId" 'External Window' + + ^ 'External Window' ] diff --git a/DebuggingSpy/DSOverRecord.class.st b/DebuggingSpy/DSOverRecord.class.st index aa6cdd7..06f53e4 100644 --- a/DebuggingSpy/DSOverRecord.class.st +++ b/DebuggingSpy/DSOverRecord.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSStepRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSOverRecord >> eventSymbol [ + ^'>' +] diff --git a/DebuggingSpy/DSProceedRecord.class.st b/DebuggingSpy/DSProceedRecord.class.st index 077c090..d21b96f 100644 --- a/DebuggingSpy/DSProceedRecord.class.st +++ b/DebuggingSpy/DSProceedRecord.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSStepRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSProceedRecord >> eventSymbol [ + ^'P' +] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 4955347..3bd13d6 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -1,6 +1,3 @@ -" -I represent a user experiment record and expose an API to extract data from this record. -" Class { #name : #DSRecordHistory, #superclass : #Object, @@ -128,10 +125,10 @@ DSRecordHistory >> buildWindowJumps [ detect: [ :period | period start == jumpEvent ] ifNone: [ nil ]) ifNotNil: [ :period | windowJumps add: period ] ] ]. - filteredWindowJumps := windowJumps reject: [ :e | + filteredWindowJumps := windowJumps "reject: [ :e | e events size <= 3 or: [ e stop dateTime - e start dateTime - < 500 milliSeconds "or: [ ""self halt."" ""e type = 'Finish'"" true] " ] ]. + < 500 milliSeconds" "or: [ ""self halt."" ""e type = 'Finish'"" true] "" ] ]". previousWindowActivity := nil. filteredWindowJumps do: [ :period | @@ -192,10 +189,9 @@ DSRecordHistory >> collectTimeDiscrepancies [ { #category : #'API-history' } DSRecordHistory >> countDebugActions [ - ^ self breakpointAdds "+ self breakpointHit" + self breakpointRemove - + self executedCode + self methodsAdded + self methodsModified - + self methodsRemoved + self numberOfSteps "+ self openedDebuggers" - + self callStackBrowing + ^ self breakpointAdds + self breakpointRemove + self executedCode + + self methodsAdded + self methodsModified + self methodsRemoved + + self numberOfSteps + self callStackBrowing ] { #category : #'private - history' } @@ -478,7 +474,7 @@ DSRecordHistory >> reconstructSourcesOfDebuggerOpenings [ sortedDebuggerWindows := (windows select: [ :w | w isDebugger ]) sort: [ :d1 :d2 | d1 events first dateTime < d2 events first dateTime ]. - recordsCopy := records copy. + recordsCopy := records copy asOrderedCollection. sortedDebuggerWindows do: [ :w | |sourceEvent| @@ -615,12 +611,6 @@ DSRecordHistory >> validateWindows [ 'potential sequence problem found in windows. This is just an information, you can proceed.' ]) ]" ] -{ #category : #accessing } -DSRecordHistory >> windowJumps [ - - ^ windowJumps -] - { #category : #accessing } DSRecordHistory >> windows [ ^ windows @@ -628,7 +618,10 @@ DSRecordHistory >> windows [ { #category : #accessing } DSRecordHistory >> windowsHistory [ - ^windowsHistory ifNil:[windowsHistory := IdentityDictionary new] + + ^ windowsHistory + ifNil: [ windowsHistory := IdentityDictionary new ] + ifNotNil: [ windowsHistory ] ] { #category : #accessing } diff --git a/DebuggingSpy/DSRecordRegistry.class.st b/DebuggingSpy/DSRecordRegistry.class.st index a1a1e8e..2077f24 100644 --- a/DebuggingSpy/DSRecordRegistry.class.st +++ b/DebuggingSpy/DSRecordRegistry.class.st @@ -1,6 +1,3 @@ -" -For now I am a dumb registry to simply record all events in an ordered collection -" Class { #name : #DSRecordRegistry, #superclass : #Object, @@ -19,7 +16,9 @@ Class { { #category : #accessing } DSRecordRegistry class >> autoSerialize [ - ^ autoSerialize ifNil: [ autoSerialize := false ] + ^ autoSerialize + ifNil: [ autoSerialize := false ] + ifNotNil: [ autoSerialize ] ] { #category : #accessing } @@ -30,7 +29,8 @@ DSRecordRegistry class >> autoSerialize: anObject [ { #category : #accessing } DSRecordRegistry class >> current [ - ^Current ifNil:[Current := self new] + + ^ Current ifNil: [ Current := self new ] ifNotNil: [ Current ] ] { #category : #private } diff --git a/DebuggingSpy/DSRestartRecord.class.st b/DebuggingSpy/DSRestartRecord.class.st index b6d3434..8224746 100644 --- a/DebuggingSpy/DSRestartRecord.class.st +++ b/DebuggingSpy/DSRestartRecord.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSStepRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSRestartRecord >> eventSymbol [ + ^'R' +] diff --git a/DebuggingSpy/DSReturnRecord.class.st b/DebuggingSpy/DSReturnRecord.class.st index 9b34fcc..3a5246c 100644 --- a/DebuggingSpy/DSReturnRecord.class.st +++ b/DebuggingSpy/DSReturnRecord.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSStepRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSReturnRecord >> eventSymbol [ + ^'r' +] diff --git a/DebuggingSpy/DSRunToRecord.class.st b/DebuggingSpy/DSRunToRecord.class.st index 5ae2667..4ab3978 100644 --- a/DebuggingSpy/DSRunToRecord.class.st +++ b/DebuggingSpy/DSRunToRecord.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSStepRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSRunToRecord >> eventSymbol [ + ^'rT' +] diff --git a/DebuggingSpy/DSSTONFileLogger.class.st b/DebuggingSpy/DSSTONFileLogger.class.st index b538041..c56296e 100644 --- a/DebuggingSpy/DSSTONFileLogger.class.st +++ b/DebuggingSpy/DSSTONFileLogger.class.st @@ -1,6 +1,3 @@ -" -I log DSRecords as STON into files. -" Class { #name : #DSSTONFileLogger, #superclass : #Object, @@ -55,7 +52,12 @@ DSSTONFileLogger >> log: aDSEventRecord [ { #category : #accessing } DSSTONFileLogger >> loggingDirectory [ - ^loggingDirectory ifNil:[loggingDirectory := self defaultLoggingDirectoryName asFileReference] + + ^ loggingDirectory + ifNil: [ + loggingDirectory := self defaultLoggingDirectoryName + asFileReference ] + ifNotNil: [ loggingDirectory ] ] { #category : #logging } @@ -67,13 +69,19 @@ DSSTONFileLogger >> loggingDirectory: aStringOrFileReference [ { #category : #accessing } DSSTONFileLogger >> loggingFileName [ - ^loggingFilename ifNil:[loggingFilename := self defaultLoggingFileName] + + ^ loggingFilename + ifNil: [ loggingFilename := self defaultLoggingFileName ] + ifNotNil: [ loggingFilename ] ] { #category : #accessing } DSSTONFileLogger >> loggingFileReference [ - ^loggingFileReference ifNil:[loggingFileReference := self ensureCreateLoggingFileReference] + ^ loggingFileReference + ifNil: [ + loggingFileReference := self ensureCreateLoggingFileReference ] + ifNotNil: [ loggingFileReference ] ] { #category : #initialization } @@ -97,16 +105,16 @@ DSSTONFileLogger >> restoreCurrentConfiguration [ DSSTONFileLogger >> saveCurrentConfiguration [ self savedConfiguration - at: #currentLoggingFilename - put: loggingFilename. - self savedConfiguration - at: #currentLoggingFileReference - put: loggingFileReference + at: #currentLoggingFilename put: loggingFilename; + at: #currentLoggingFileReference put: loggingFileReference ] { #category : #accessing } DSSTONFileLogger >> savedConfiguration [ - ^savedConfiguration ifNil:[savedConfiguration := Dictionary new] + + ^ savedConfiguration + ifNil: [ savedConfiguration := Dictionary new ] + ifNotNil: [ savedConfiguration ] ] { #category : #setup } diff --git a/DebuggingSpy/DSSindarinStepRecord.class.st b/DebuggingSpy/DSSindarinStepRecord.class.st index a98b1ce..29a8e10 100644 --- a/DebuggingSpy/DSSindarinStepRecord.class.st +++ b/DebuggingSpy/DSSindarinStepRecord.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSStepRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSSindarinStepRecord >> eventSymbol [ + ^'sV' +] diff --git a/DebuggingSpy/DSSpy.class.st b/DebuggingSpy/DSSpy.class.st index 741c54c..cd98df2 100644 --- a/DebuggingSpy/DSSpy.class.st +++ b/DebuggingSpy/DSSpy.class.st @@ -1,6 +1,3 @@ -" -I collect spy informations -" Class { #name : #DSSpy, #superclass : #Object, @@ -94,7 +91,9 @@ DSSpy class >> log: elements key: key [ { #category : #accessing } DSSpy class >> logOnlyWhenTaskStarted [ - ^ logOnlyWhenTaskStarted ifNil:[logOnlyWhenTaskStarted := false] + ^ logOnlyWhenTaskStarted + ifNil: [ logOnlyWhenTaskStarted := false ] + ifNotNil: [ logOnlyWhenTaskStarted ] ] { #category : #accessing } @@ -135,7 +134,9 @@ DSSpy class >> logWindowOpened: anEvent [ { #category : #accessing } DSSpy class >> logger [ - ^ logger ifNil:[logger := self defaultLoggerClass new] + ^ logger + ifNil: [ logger := self defaultLoggerClass new ] + ifNotNil: [ logger ] ] { #category : #accessing } @@ -197,7 +198,8 @@ DSSpy class >> methodRemoved: evt [ { #category : #accessing } DSSpy class >> monitor [ - ^monitor ifNil:[monitor := Monitor new] + + ^ monitor ifNil: [ monitor := Monitor new ] ifNotNil: [ monitor ] ] { #category : #'events - methods' } @@ -208,8 +210,9 @@ DSSpy class >> monitorPackageForSourceCodeChanges: aString [ { #category : #'events - methods' } DSSpy class >> packagesMonitoredForSourceCodeChanges [ - ^ packagesMonitoredForSourceCodeChanges ifNil: [ - packagesMonitoredForSourceCodeChanges := Set new ] + ^ packagesMonitoredForSourceCodeChanges + ifNil: [ packagesMonitoredForSourceCodeChanges := Set new ] + ifNotNil: [ packagesMonitoredForSourceCodeChanges ] ] { #category : #accessing } @@ -226,7 +229,9 @@ DSSpy class >> recordBreakpointEvent: aBreakpointEvent [ { #category : #accessing } DSSpy class >> recordClipboardContent [ - ^ recordClipboardContent ifNil: [ recordClipboardContent := false ] + ^ recordClipboardContent + ifNil: [ recordClipboardContent := false ] + ifNotNil: [ recordClipboardContent ] ] { #category : #accessing } @@ -272,7 +277,9 @@ DSSpy class >> recordHaltInRemovedMethod: oldMethod [ { #category : #accessing } DSSpy class >> recordSourceCode [ - ^ recordSourceCode ifNil: [ recordSourceCode := false ] + ^ recordSourceCode + ifNil: [ recordSourceCode := false ] + ifNotNil: [ recordSourceCode ] ] { #category : #accessing } @@ -312,7 +319,9 @@ DSSpy class >> resetSpy [ { #category : #accessing } DSSpy class >> scopeSourceCodeChangesRecording [ - ^ scopeSourceCodeChangesRecording ifNil: [ scopeSourceCodeChangesRecording := false ] + ^ scopeSourceCodeChangesRecording + ifNil: [ scopeSourceCodeChangesRecording := false ] + ifNotNil: [ scopeSourceCodeChangesRecording ] ] { #category : #accessing } @@ -338,5 +347,7 @@ DSSpy class >> startTask: aTask [ { #category : #accessing } DSSpy class >> taskStarted [ - ^ taskStarted ifNil: [ taskStarted := false ] + ^ taskStarted + ifNil: [ taskStarted := false ] + ifNotNil: [ taskStarted ] ] diff --git a/DebuggingSpy/DSStepActionRecord.class.st b/DebuggingSpy/DSStepActionRecord.class.st index ba557c7..7e13aea 100644 --- a/DebuggingSpy/DSStepActionRecord.class.st +++ b/DebuggingSpy/DSStepActionRecord.class.st @@ -1,8 +1,3 @@ -" -I record a debugging action from an opened debugger. -In addition to the debugger window id, I also record the signature of the context I am performing the action as well as the current node of that context. -In confidentiality mode, this signature and node should be replaced by the current pc instead. -" Class { #name : #DSStepActionRecord, #superclass : #DSAbstractEventRecord, @@ -46,6 +41,23 @@ DSStepActionRecord >> node [ ^ node ] +{ #category : #printing } +DSStepActionRecord >> printContextAndNode [ + + ^ String streamContents: [ :s | + | nodeStream peek | + s << '['. + s << context. + s << ']'. + s space. + nodeStream := node readStream. + peek := nodeStream upTo: $(. + + s << (nodeStream atEnd + ifTrue: [ peek ] + ifFalse: [ nodeStream upTo: $) ]) ] +] + { #category : #accessing } DSStepActionRecord >> receiver [ diff --git a/DebuggingSpy/DSStepRecord.class.st b/DebuggingSpy/DSStepRecord.class.st index f598c0c..13c0ef7 100644 --- a/DebuggingSpy/DSStepRecord.class.st +++ b/DebuggingSpy/DSStepRecord.class.st @@ -72,11 +72,21 @@ DSStepRecord >> eventName [ ^ sourceRecord eventName ] +{ #category : #'as yet unclassified' } +DSStepRecord >> eventSymbol [ + ^'V' +] + { #category : #accessing } DSStepRecord >> node [ ^sourceRecord node ] +{ #category : #printing } +DSStepRecord >> printContextAndNode [ + ^sourceRecord printContextAndNode +] + { #category : #accessing } DSStepRecord >> receiver [ ^sourceRecord receiver diff --git a/DebuggingSpy/DSTCommandForTests.trait.st b/DebuggingSpy/DSTCommandForTests.trait.st index 8ca7f6b..fa7bbf9 100644 --- a/DebuggingSpy/DSTCommandForTests.trait.st +++ b/DebuggingSpy/DSTCommandForTests.trait.st @@ -1,6 +1,3 @@ -" -I provide an accessor to tell that a debugging command is used within a test, in order to avoid executing too much debugging code (and for example to make the execution loop indefinitely when we proceed an infinite recursion). -" Trait { #name : #DSTCommandForTests, #instVars : [ @@ -12,7 +9,7 @@ Trait { { #category : #accessing } DSTCommandForTests >> forTests [ - ^ forTests ifNil:[forTests := false] + ^ forTests ifNil: [ forTests := false ] ifNotNil: [ forTests ] ] { #category : #accessing } diff --git a/DebuggingSpy/DSTaskSuccessRecord.class.st b/DebuggingSpy/DSTaskSuccessRecord.class.st index b1571b1..dee1c93 100644 --- a/DebuggingSpy/DSTaskSuccessRecord.class.st +++ b/DebuggingSpy/DSTaskSuccessRecord.class.st @@ -1,9 +1,3 @@ -" -I represent the result of an automatic evaluation of a task success. -true = success. -false = failure. -This boolean is stored into the success inst var. -" Class { #name : #DSTaskSuccessRecord, #superclass : #DSAbstractTaskRecord, @@ -26,5 +20,6 @@ DSTaskSuccessRecord >> record: anArray [ { #category : #accessing } DSTaskSuccessRecord >> success [ - ^success ifNil:[success := false] + + ^ success ifNil: [ success := false ] ifNotNil: [ success ] ] diff --git a/DebuggingSpy/DSThroughRecord.class.st b/DebuggingSpy/DSThroughRecord.class.st index 544e93d..de3cbbb 100644 --- a/DebuggingSpy/DSThroughRecord.class.st +++ b/DebuggingSpy/DSThroughRecord.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSStepRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSThroughRecord >> eventSymbol [ + ^'T' +] diff --git a/DebuggingSpy/DSVariableBreakpointAdd.class.st b/DebuggingSpy/DSVariableBreakpointAdd.class.st index 4409629..ab787f2 100644 --- a/DebuggingSpy/DSVariableBreakpointAdd.class.st +++ b/DebuggingSpy/DSVariableBreakpointAdd.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSVariableBreakpointRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSVariableBreakpointAdd >> eventSymbol [ + ^'+vb' +] diff --git a/DebuggingSpy/DSVariableBreakpointHit.class.st b/DebuggingSpy/DSVariableBreakpointHit.class.st index e2c92ad..14b9548 100644 --- a/DebuggingSpy/DSVariableBreakpointHit.class.st +++ b/DebuggingSpy/DSVariableBreakpointHit.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSVariableBreakpointRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSVariableBreakpointHit >> eventSymbol [ + ^'*vb' +] diff --git a/DebuggingSpy/DSVariableBreakpointRemoved.class.st b/DebuggingSpy/DSVariableBreakpointRemoved.class.st index fe137ef..bc47825 100644 --- a/DebuggingSpy/DSVariableBreakpointRemoved.class.st +++ b/DebuggingSpy/DSVariableBreakpointRemoved.class.st @@ -3,3 +3,8 @@ Class { #superclass : #DSVariableBreakpointRecord, #category : #'DebuggingSpy-Records-Extensions' } + +{ #category : #'as yet unclassified' } +DSVariableBreakpointRemoved >> eventSymbol [ + ^'-vb' +] diff --git a/DebuggingSpy/DSWindowActivityRecord.class.st b/DebuggingSpy/DSWindowActivityRecord.class.st index 6163b6c..ee54974 100644 --- a/DebuggingSpy/DSWindowActivityRecord.class.st +++ b/DebuggingSpy/DSWindowActivityRecord.class.st @@ -7,7 +7,8 @@ Class { 'events', 'window', 'previous', - 'next' + 'next', + 'annotation' ], #category : #'DebuggingSpy-Records-Extensions' } @@ -33,6 +34,18 @@ DSWindowActivityRecord class >> start: aDSMouseEnterWindowRecord stop: aDSMouseL yourself ] +{ #category : #accessing } +DSWindowActivityRecord >> annotation [ + + ^ annotation ifNil:[annotation := DSWindowAnnotation new] +] + +{ #category : #accessing } +DSWindowActivityRecord >> annotation: anObject [ + + annotation := anObject +] + { #category : #accessing } DSWindowActivityRecord >> duration [ @@ -61,6 +74,13 @@ DSWindowActivityRecord >> events: anObject [ events := anObject ] +{ #category : #inspections } +DSWindowActivityRecord >> inspectionAnnotation [ + + + ^ DSWindowElementAnnotationPresenter on: self +] + { #category : #merging } DSWindowActivityRecord >> merge: aDSWindowActivityRecord [ |merge become| @@ -134,5 +154,7 @@ DSWindowActivityRecord >> window: anObject [ { #category : #accessing } DSWindowActivityRecord >> windowId [ - ^ windowId ifNil: [ windowId := window windowId ] + ^ windowId + ifNil: [ windowId := window windowId ] + ifNotNil: [ windowId ] ] diff --git a/DebuggingSpy/DSWindowAnnotation.class.st b/DebuggingSpy/DSWindowAnnotation.class.st new file mode 100644 index 0000000..e61c4aa --- /dev/null +++ b/DebuggingSpy/DSWindowAnnotation.class.st @@ -0,0 +1,39 @@ +Class { + #name : #DSWindowAnnotation, + #superclass : #Object, + #instVars : [ + 'index', + 'annotation' + ], + #category : #'DebuggingSpy-Records-Extensions' +} + +{ #category : #accessing } +DSWindowAnnotation >> annotation [ + + ^ annotation ifNil:[annotation := ''] +] + +{ #category : #accessing } +DSWindowAnnotation >> annotation: anObject [ + + annotation := anObject +] + +{ #category : #accessing } +DSWindowAnnotation >> index [ + + ^ index ifNil:[index := 0] +] + +{ #category : #accessing } +DSWindowAnnotation >> index: anObject [ + + index := anObject +] + +{ #category : #'as yet unclassified' } +DSWindowAnnotation >> intialize [ + annotation := String new. + index := 0 +] diff --git a/DebuggingSpy/DSWindowElementAnnotationPresenter.class.st b/DebuggingSpy/DSWindowElementAnnotationPresenter.class.st new file mode 100644 index 0000000..184eb5d --- /dev/null +++ b/DebuggingSpy/DSWindowElementAnnotationPresenter.class.st @@ -0,0 +1,46 @@ +Class { + #name : #DSWindowElementAnnotationPresenter, + #superclass : #StInspection, + #instVars : [ + 'windowElement', + 'indexField', + 'annotationText' + ], + #category : #'DebuggingSpy-Presenters' +} + +{ #category : #layout } +DSWindowElementAnnotationPresenter >> defaultLayout [ + + ^ SpBoxLayout newTopToBottom + add: (SpPanedLayout newLeftToRight + positionOfSlider: 35 percent; + add: (self newLabel label: 'Index'; yourself); + add: indexField; + yourself) expand: false fill: false padding: 0; + add: (self newLabel label:'Annotation'; yourself) expand: false fill: false padding: 0; + add: annotationText; + yourself +] + +{ #category : #initialization } +DSWindowElementAnnotationPresenter >> initializePresenters [ + super initializePresenters. + + indexField := self newNumberInput. + indexField number: windowElement annotation index. + + annotationText := self newText. + annotationText text: windowElement annotation annotation. + + indexField whenTextChangedDo: [ windowElement annotation index: indexField number ]. + annotationText whenTextChangedDo: [ windowElement annotation annotation: annotationText text ] + + +] + +{ #category : #'accessing - model' } +DSWindowElementAnnotationPresenter >> setModelBeforeInitialization: aDSWindowOrWindowActivity [ + + windowElement := aDSWindowOrWindowActivity +] diff --git a/DebuggingSpy/DSWindowEventRecord.class.st b/DebuggingSpy/DSWindowEventRecord.class.st index 0d14b49..3f45c54 100644 --- a/DebuggingSpy/DSWindowEventRecord.class.st +++ b/DebuggingSpy/DSWindowEventRecord.class.st @@ -1,9 +1,3 @@ -" -I represent an abstract window event record, typically an opening, closing, resizing, or activation of a window. -I hold a unique window ID that corresponds to the original window object's identity hash. This ID should be used to group together all events related to that particular window. - -I should be used from my class-side interface, called on my subclasses to match particular window events. -" Class { #name : #DSWindowEventRecord, #superclass : #DSAbstractEventRecord, @@ -63,7 +57,7 @@ DSWindowEventRecord >> windowType [ rs := windowName readStream. type := rs upTo: Character space. type size = 1 ifTrue: [ type := rs upTo: $( ]. - (#('Spotter' 'implementors' 'Inspector' 'Debugger' 'Implementors' 'Breakpoint' 'Transcript' 'Browser' 'ClyQueryBrowserMorph' 'ClyFullBrowserMorph') includes: type) ifTrue:[^type]. + (#('Spotter' 'implementors' 'Inspector' 'Debugger' 'Implementors' 'Breakpoint' 'Transcript' 'Browser' 'ClyQueryBrowserMorph' 'ClyFullBrowserMorph' 'CORMAS - ECECModel') includes: type) ifTrue:[^type]. type isNumber ifTrue:[^'X']. ^ 'Application' ] diff --git a/DebuggingSpy/DSWindowRecord.class.st b/DebuggingSpy/DSWindowRecord.class.st index 0ed200d..889a805 100644 --- a/DebuggingSpy/DSWindowRecord.class.st +++ b/DebuggingSpy/DSWindowRecord.class.st @@ -121,7 +121,8 @@ DSWindowRecord >> events: anObject [ { #category : #accessing } DSWindowRecord >> idleTime [ - ^ idleTime ifNil:[idleTime := 0 seconds] + + ^ idleTime ifNil: [ idleTime := 0 seconds ] ifNotNil: [ idleTime ] ] { #category : #testing } @@ -184,7 +185,9 @@ DSWindowRecord >> totalTime [ { #category : #accessing } DSWindowRecord >> trueIdleTime [ - ^ trueIdleTime ifNil:[trueIdleTime := 0 asSeconds] + ^ trueIdleTime + ifNil: [ trueIdleTime := 0 asSeconds ] + ifNotNil: [ trueIdleTime ] ] { #category : #accessing }