diff --git a/.github/workflows/dsspy.yaml b/.github/workflows/dsspy.yaml index 7213dad..817e277 100644 --- a/.github/workflows/dsspy.yaml +++ b/.github/workflows/dsspy.yaml @@ -5,17 +5,11 @@ on: [push, pull_request] jobs: build: runs-on: ubuntu-latest - env: - PROJECT_NAME: ${{ matrix.smalltalk }}-DebuggingSpy - strategy: - matrix: - smalltalk: [ Pharo64-12 ] - name: ${{ matrix.smalltalk }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - uses: hpi-swa/setup-smalltalkCI@v1 with: - smalltalk-version: ${{ matrix.smalltalk }} - - run: smalltalkci -s ${{ matrix.smalltalk }} + smalltalk-version: Pharo64-13 + - run: smalltalkci -s Pharo64-13 shell: bash timeout-minutes: 15 diff --git a/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st b/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st index be9625e..7d92234 100644 --- a/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st +++ b/BaselineOfDebuggingSpy/BaselineOfDebuggingSpy.class.st @@ -1,20 +1,26 @@ Class { - #name : #BaselineOfDebuggingSpy, - #superclass : #BaselineOf, - #category : #BaselineOfDebuggingSpy + #name : 'BaselineOfDebuggingSpy', + #superclass : 'BaselineOf', + #category : 'BaselineOfDebuggingSpy', + #package : 'BaselineOfDebuggingSpy' } -{ #category : #baselines } +{ #category : 'baselines' } BaselineOfDebuggingSpy >> baseline: spec [ + + spec baseline: 'ExperimentModel' with: [ + spec repository: + 'github://Pharo-XP-Tools/ExperimentModel:main' ]. + spec for: #common do: [ spec postLoadDoIt: #postloadAction. spec package: 'DebuggingSpy'. spec package: 'DebuggingSpy-Tests' ] ] -{ #category : #baselines } +{ #category : 'baselines' } BaselineOfDebuggingSpy >> postloadAction [ DSSpy handlingError: false ] diff --git a/BaselineOfDebuggingSpy/package.st b/BaselineOfDebuggingSpy/package.st index c9aadfb..240981a 100644 --- a/BaselineOfDebuggingSpy/package.st +++ b/BaselineOfDebuggingSpy/package.st @@ -1 +1 @@ -Package { #name : #BaselineOfDebuggingSpy } +Package { #name : 'BaselineOfDebuggingSpy' } diff --git a/DebuggingSpy-Tests/DSSpyBrowserTest.class.st b/DebuggingSpy-Tests/DSSpyBrowserTest.class.st index f60a2dd..256e25b 100644 --- a/DebuggingSpy-Tests/DSSpyBrowserTest.class.st +++ b/DebuggingSpy-Tests/DSSpyBrowserTest.class.st @@ -6,15 +6,9 @@ Class { #tag : 'Tests - Scenarios' } -{ #category : 'running' } -DSSpyBrowserTest >> setUp [ - super setUp. - - -] - { #category : 'tests - browser' } DSSpyBrowserTest >> testBrowserRUN1 [ + " |log history openedPlaygrounds playgroundsAction openedBrowser browserEntering| log := DSTestingScenariosFileLocator browserScenario001. history := DSRecordHistory fromSTON: log. @@ -26,7 +20,9 @@ DSSpyBrowserTest >> testBrowserRUN1 [ self assert: openedPlaygrounds size equals: 1. self assert: playgroundsAction notEmpty. self assert: history mergedWindowJumps first type equals: 'Playground'. - self assert: history mergedWindowJumps last type equals: 'Browser'. + self assert: history mergedWindowJumps last type equals: 'Browser'. " + + self flag: #TODO ] diff --git a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st index 23db7f7..ba2e330 100644 --- a/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st +++ b/DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st @@ -79,7 +79,7 @@ DSSpyInstrumenterTest >> assertInstrumentSindarinDebuggerCommandNamed: debuggerC "Commands from toolbar" cmds := debugger rootCommandsGroup / StDebuggerToolbarCommandTreeBuilder groupName - / 'Advanced Step'. + / 'Advanced'. cmd := StDebugger specCommandNamed: debuggerCommandName inGroup: cmds entries. @@ -383,7 +383,7 @@ DSSpyInstrumenterTest >> stObjectContextModelMock [ | model context | model := StInspectorModel on: StInspectorMockObject new. context := StInspectionContext fromPragma: - (StInspectorMockObject >> #inspectionMock1) pragmas first. + (StInspectorMockObject >> #inspectionMock1:) pragmas first. context inspectedObject: model inspectedObject. ^ StObjectContextModel new inspection: model; @@ -635,7 +635,7 @@ DSSpyInstrumenterTest >> testInstrumentExpandAttribute [ DSSpyInstrumenterTest >> testInstrumentHaltHits [ instrumenter instrumentHaltHits. - methodsToRemove := { + methodsToRemove := { (Halt class >> #signal:). (Halt class >> #signalIn:). (Halt class >> #signal) }. @@ -645,40 +645,55 @@ DSSpyInstrumenterTest >> testInstrumentHaltHits [ self assert: self registry size equals: 1. record := self registry first. self assert: record selector equals: #halt. - self assertHaltHitRecordingMethod: (self class >> #executeHalt) conditional: false once: false. - + self + assertHaltHitRecordingMethod: self class >> #executeHalt + conditional: false + once: false. + [ self executeHaltIf ] on: Halt do: [ ]. self assert: self registry size equals: 2. record := self registry second. self assert: record selector equals: #haltIf:. - self assertHaltHitRecordingMethod: (self class >> #executeHaltIf) conditional: true once: false. - + self + assertHaltHitRecordingMethod: self class >> #executeHaltIf + conditional: true + once: false. + self recompileExecuteHaltOnce. [ self executeHaltOnce ] on: Halt - do: [ ]. + do: [ ]. self assert: self registry size equals: 3. record := self registry third. - self assert: record selector equals: #once. - self assertHaltHitRecordingMethod: (self class >> #executeHaltOnce) conditional: false once: true. - - [ self executeHaltWithMessage ] + self assert: record selector equals: #once:. + self + assertHaltHitRecordingMethod: self class >> #executeHaltOnce + conditional: false + once: true. + + [ self executeHaltWithMessage ] on: Halt - do: [ ]. + do: [ ]. self assert: self registry size equals: 4. record := self registry fourth. self assert: record selector equals: #now:. - self assertHaltHitRecordingMethod: (self class >> #executeHaltWithMessage) conditional: false once: false. - - [ self execute1Halt ] + self + assertHaltHitRecordingMethod: self class >> #executeHaltWithMessage + conditional: false + once: false. + + [ self execute1Halt ] on: Halt - do: [ ]. + 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. + self + assertHaltHitRecordingMethod: self class >> #execute1Halt + conditional: false + once: false ] { #category : 'tests - halts' } @@ -950,7 +965,7 @@ DSSpyInstrumenterTest >> testInstrumentRubEditorCopySelection [ | rubEditor registerClipboardText | modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #doIt) sourceCode. + modifiedMethodSource := (RubSmalltalkEditor >> #copySelection) sourceCode. instrumenter instrumentRubSmalltalkEditorCopySelection. registerClipboardText := DSSpy recordClipboardContent. @@ -1017,7 +1032,7 @@ DSSpyInstrumenterTest >> testInstrumentRubEditorPaste [ | rubEditor registerClipboardText | modifiedClass := RubSmalltalkEditor. - modifiedMethodSource := (RubSmalltalkEditor >> #doIt) sourceCode. + modifiedMethodSource := (RubSmalltalkEditor >> #paste) sourceCode. instrumenter instrumentRubSmalltalkEditorPaste. registerClipboardText := DSSpy recordClipboardContent. DSSpy recordClipboardContent: true. @@ -1269,17 +1284,20 @@ DSSpyInstrumenterTest >> testInstrumentSpCodePrintIt [ { #category : 'tests - playground' } DSSpyInstrumenterTest >> testInstrumentStPlayground [ - |playground| + + | playground | modifiedClass := StPlaygroundPresenter class. - modifiedMethodSource := (StPlaygroundPresenter class >> #open) sourceCode. + modifiedMethodSource := (StPlaygroundPresenter class >> #open) + sourceCode. instrumenter instrumentPlaygroundCode. playground := StPlaygroundPresenter open. - + "On opening, the playground generates an opening record" self assert: self registry size equals: 1. - record := self registry first. + record := self registry first. self assert: record class identicalTo: DSPlaygroundOpenedRecord. - self assert: record windowId equals: playground window window hash + self assert: record windowId equals: playground window window hash. + playground close. ] { #category : 'tests - debugger' } @@ -1309,13 +1327,13 @@ DSSpyInstrumenterTest >> testInstrumentStepToMethodEntry [ { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepToNextCallInClass [ - self assertInstrumentSindarinDebuggerCommandNamed: 'Next call in class' + self assertInstrumentSindarinDebuggerCommandNamed: 'To next execution in class' ] { #category : 'tests - debugger' } DSSpyInstrumenterTest >> testInstrumentStepToNextCallInObject [ - self assertInstrumentSindarinDebuggerCommandNamed: 'Next call in receiver' + self assertInstrumentSindarinDebuggerCommandNamed: 'To next execution in receiver' ] { #category : 'tests - debugger' } diff --git a/DebuggingSpy-Tests/DSSpyTest.class.st b/DebuggingSpy-Tests/DSSpyTest.class.st index d8076af..0b0ab63 100644 --- a/DebuggingSpy-Tests/DSSpyTest.class.st +++ b/DebuggingSpy-Tests/DSSpyTest.class.st @@ -7,29 +7,30 @@ Class { 'methodEvent', 'windowEvent', 'instrumenter', - 'breakpoint', + 'debugpoint', 'task', 'survey', 'recordSourceCode', - 'breakpointHash' + 'debugpointHash' ], #category : 'DebuggingSpy-Tests-Tests - model', #package : 'DebuggingSpy-Tests', #tag : 'Tests - model' } +{ #category : 'helpers' } +DSSpyTest >> addOnceBehaviorToDebugPoint [ + + debugpoint addBehavior: (OnceBehavior new priority: 1) +] + { #category : 'assertions' } -DSSpyTest >> assertBreakpointRecordedAs: aDSRecordClass forBreakpointEvent: aBreakpointEventClass target: aTarget [ +DSSpyTest >> assertDebugPointRecordedAs: aDSRecordClass forDebugPointEvent: aBreakpointEventClass target: aTarget [ self assert: record class equals: aDSRecordClass. self assert: record eventName equals: aBreakpointEventClass name. - self assert: record target equals: aTarget. - aTarget ifNil:[ self deny: record objectCentric] - 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 breakpointHash equals: breakpointHash + self assert: record target class equals: aTarget. + self assert: record debugPointHash equals: debugpointHash ] { #category : 'assertions' } @@ -60,21 +61,6 @@ DSSpyTest >> assertMethodSourceCodeRecorded [ equals: (self class >> #methodEvent) sourceCode ] -{ #category : 'assertions' } -DSSpyTest >> assertVariableBreakpointRecordedAs: aDSRecordClass forBreakpointEvent: aBreakpointEventClass target: aTarget [ - - self assert: record class equals: aDSRecordClass. - self assert: record eventName equals: aBreakpointEventClass name. - self assert: record target equals: aTarget. - aTarget ifNil:[ self deny: record objectCentric] - ifNotNil: [self assert: record objectCentric]. - 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 breakpointHash equals: breakpointHash -] - { #category : 'assertions' } DSSpyTest >> assertWindowEventRecordedAs: aClass [ self assert: record class identicalTo: aClass. @@ -115,20 +101,17 @@ DSSpyTest >> compileTestMethod [ ] { #category : 'helpers' } -DSSpyTest >> installBreakpoint [ +DSSpyTest >> installBreakDebugPoint [ - breakpoint := Breakpoint new node: self breakpointedMethod ast. - breakpoint install. - breakpointHash := breakpoint hash + debugpoint := DebugPointManager installNew: BreakDebugPoint on: self breakpointedMethod ast. + debugpointHash := debugpoint hash ] { #category : 'helpers' } -DSSpyTest >> installVariableBreakpoint [ +DSSpyTest >> installWatchDebugPoint [ - breakpoint := VariableBreakpoint - watchVariable: #value - inClass: self breakpointedMethod. - breakpointHash := breakpoint hash + debugpoint := DebugPointManager installNew: WatchDebugPoint inClass: DSTestClassWithInstanceVariables onVariableAccessNamed: #text. + debugpointHash := debugpoint hash ] { #category : 'helpers' } @@ -166,10 +149,10 @@ DSSpyTest >> registry [ ] { #category : 'helpers' } -DSSpyTest >> removeBreakpoint [ +DSSpyTest >> removeDebugPoint [ - breakpoint remove. - breakpoint := nil + debugpoint remove. + debugpoint := nil ] { #category : 'helpers' } @@ -208,7 +191,7 @@ DSSpyTest >> setUp [ DSSpyTest >> tearDown [ DSRecordRegistry autoSerialize: false. instrumenter unsubscribeFromSystemAnnouncer. - breakpoint ifNotNil: [ breakpoint remove ]. + debugpoint ifNotNil: [ debugpoint remove ]. self recoverTestMethod ifNotNil: [ self removeTestMethod ]. self removeNewMethodWithHalt. DSRecordRegistry current reset. @@ -217,54 +200,6 @@ DSSpyTest >> tearDown [ super tearDown ] -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testBreakpointAdded [ - - instrumenter listenToBreakpointChanges. - - self installBreakpoint. - self assert: self registry size equals: 1. - - record := self registry first. - self - assertBreakpointRecordedAs: DSBreakpointEventRecord - forBreakpointEvent: BreakpointAdded - target: nil -] - -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testBreakpointHit [ - - self installBreakpoint. - instrumenter listenToBreakpointChanges. - - [self breakpointMethod] on: Break do:[]. - self assert: self registry size equals: 1. - - record := self registry first. - self - assertBreakpointRecordedAs: DSBreakpointEventRecord - forBreakpointEvent: BreakpointHit - target: nil - -] - -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testBreakpointRemoved [ - - self installBreakpoint. - instrumenter listenToBreakpointChanges. - - self removeBreakpoint. - self assert: self registry size equals: 1. - - record := self registry first. - self - assertBreakpointRecordedAs: DSBreakpointEventRecord - forBreakpointEvent: BreakpointRemoved - target: nil -] - { #category : 'tests - task management' } DSSpyTest >> testCloseSurvey [ @@ -301,6 +236,85 @@ DSSpyTest >> testCloseSurvey [ ] +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testDebugPointAdded [ + + instrumenter listenToDebugPointChanges. + + self installBreakDebugPoint. + self assert: self registry size equals: 1. + + record := self registry first. + self + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointAdded + target: DSDebugPointNodeTargetRecord +] + +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testDebugPointAddedToInstanceVariable [ + + instrumenter listenToDebugPointChanges. + + debugpoint := DebugPointManager installNew: BreakDebugPoint inClass: DSTestClassWithInstanceVariables onVariableAccessNamed: #number. + debugpointHash := debugpoint hash. + + self assert: self registry size equals: 1. + record := self registry first. + + self assert: record target target + equals: '#number => InstanceVariableSlot' +] + +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testDebugPointChanged [ + + self installBreakDebugPoint. + instrumenter listenToDebugPointChanges. + + self addOnceBehaviorToDebugPoint. + self assert: self registry size equals: 1. + + record := self registry first. + self + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointChanged + target: DSDebugPointNodeTargetRecord +] + +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testDebugPointHit [ + + self installBreakDebugPoint. + instrumenter listenToDebugPointChanges. + + [self breakpointMethod] on: Break do:[]. + self assert: self registry size equals: 1. + + record := self registry first. + self + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointHit + target: DSDebugPointNodeTargetRecord + +] + +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testDebugPointRemoved [ + + self installBreakDebugPoint. + instrumenter listenToDebugPointChanges. + + self removeDebugPoint. + self assert: self registry size equals: 1. + + record := self registry first. + self + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointRemoved + target: DSDebugPointNodeTargetRecord +] + { #category : 'tests - logging' } DSSpyTest >> testDefaultLogger [ DSSpy logger: nil. @@ -374,11 +388,15 @@ DSSpyTest >> testLogOnlyWhenTaskStarted [ { #category : 'tests - window events' } DSSpyTest >> testLogWindowActivated [ + DSSpy logWindowActivated: self windowEvent. - - self assert: self registry size equals: 1. - - record := self registry first. + + self assert: self registry size equals: 2. + + record := self registry first. + self assert: record class identicalTo: DSToolWindowActivatedEventRecord. + + record := self registry second. self assertWindowEventRecordedAs: DSWindowActivatedRecord ] @@ -397,10 +415,13 @@ DSSpyTest >> testLogWindowClosed [ DSSpyTest >> testLogWindowOpened [ DSSpy logWindowOpened: self windowEvent. - - self assert: self registry size equals: 1. - - record := self registry first. + + self assert: self registry size equals: 2. + + record := self registry first. + self assert: record class identicalTo: DSToolWindowOpenedEventRecord. + + record := self registry second. self assertWindowEventRecordedAs: DSWindowOpenedRecord ] @@ -529,83 +550,77 @@ DSSpyTest >> testMonitorPackageForSourceCodeChanges [ self assert: (DSSpy packagesMonitoredForSourceCodeChanges includes: self class package name). ] -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testObjectCentricBreakpointRecord [ +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testObjectCentricBreakDebugPointRecord [ - |target| + | target | target := self class basicNew. - instrumenter listenToBreakpointChanges. - - breakpoint := target haltOnCallTo: #breakpointMethod. - breakpointHash := breakpoint hash. - self assert: self registry size equals: 1. + instrumenter listenToDebugPointChanges. + + debugpoint := target breakOnCallTo: #breakpointMethod. + debugpointHash := debugpoint hash. + self assert: self registry size equals: 1. record := self registry first. self - assertBreakpointRecordedAs: DSBreakpointEventRecord - forBreakpointEvent: BreakpointAdded - target: (DSAbstractBreakpointEventRecord basicNew printTargetInstance: target). - - [target breakpointMethod] on: Break do:[]. - self assert: self registry size equals: 2. + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointAdded + target: DSDebugPointObjectTargetRecord. + + [ target breakpointMethod ] + on: Break + do: [ ]. + self assert: self registry size equals: 2. record := self registry second. self - assertBreakpointRecordedAs: DSBreakpointEventRecord - forBreakpointEvent: BreakpointHit - target: (DSAbstractBreakpointEventRecord basicNew printTargetInstance: target). + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointHit + target: DSDebugPointObjectTargetRecord. - self removeBreakpoint. - self assert: self registry size equals: 3. + self removeDebugPoint. + self assert: self registry size equals: 3. record := self registry third. - self - assertBreakpointRecordedAs: DSBreakpointEventRecord - forBreakpointEvent: BreakpointRemoved - target: (DSAbstractBreakpointEventRecord basicNew printTargetInstance: target). + self + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointRemoved + target: DSDebugPointObjectTargetRecord. ] -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testObjectCentricVariableBreakpointRecord [ +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testObjectCentricVariableDebugPointRecord [ | target | - target := self class basicNew. - instrumenter listenToBreakpointChanges. - - breakpoint := (self breakpointedMethod newBreakpointForVariable: #value) - scopeTo: target; - install. - breakpointHash := breakpoint hash. + target := DSTestClassWithInstanceVariables new. + instrumenter listenToDebugPointChanges. + + debugpoint := DebugPointManager installNew: BreakDebugPoint forObject: target onVariableAccessNamed: #text. + debugpointHash := debugpoint hash. self assert: self registry size equals: 1. record := self registry first. self - assertVariableBreakpointRecordedAs: DSVariableBreakpointEventRecord - forBreakpointEvent: BreakpointAdded - target: - (DSAbstractBreakpointEventRecord basicNew printTargetInstance: - target). + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointAdded + target: DSDebugPointObjectTargetRecord. - [ target breakpointMethod ] + [ target text: 'A beautiful text' ] on: Break do: [ ]. self assert: self registry size equals: 2. record := self registry second. self - assertVariableBreakpointRecordedAs: DSVariableBreakpointEventRecord - forBreakpointEvent: BreakpointHit - target: - (DSAbstractBreakpointEventRecord basicNew printTargetInstance: - target). + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: VariableDebugPointHit + target: DSDebugPointObjectTargetRecord. - self removeBreakpoint. + self removeDebugPoint. self assert: self registry size equals: 3. record := self registry third. self - assertVariableBreakpointRecordedAs: DSVariableBreakpointEventRecord - forBreakpointEvent: BreakpointRemoved - target: - (DSAbstractBreakpointEventRecord basicNew printTargetInstance: - target) + assertDebugPointRecordedAs: DSBreakDebugPointEventRecord + forDebugPointEvent: DebugPointRemoved + target: DSDebugPointObjectTargetRecord ] { #category : 'tests - methods events' } @@ -855,67 +870,75 @@ DSSpyTest >> testTaskStarted [ self deny: DSSpy taskStarted ] -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testVariableBreakpointAdded [ - instrumenter listenToBreakpointChanges. +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testWatchDebugPointAdded [ + | history | - self installVariableBreakpoint. - self assert: self registry size equals: 1. + history := OrderedCollection new. + instrumenter listenToDebugPointChanges. + self installWatchDebugPoint. + self assert: self registry size equals: 1. record := self registry first. self - assertVariableBreakpointRecordedAs: DSVariableBreakpointEventRecord - forBreakpointEvent: BreakpointAdded - target: nil + assertDebugPointRecordedAs: DSWatchDebugPointEventRecord + forDebugPointEvent: DebugPointAdded + target: DSDebugPointInstanceVariableTargetRecord ] -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testVariableBreakpointAddedToMultipleVariables [ +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testWatchDebugPointChangedBehavior [ - instrumenter listenToBreakpointChanges. + self installWatchDebugPoint. + instrumenter listenToDebugPointChanges. + + self addOnceBehaviorToDebugPoint. - breakpoint := VariableBreakpoint watchVariablesInClass: - DSTestClassWithInstanceVariables. self assert: self registry size equals: 1. record := self registry first. - self - assertCollection: record targetVariables - equals: - (DSTestClassWithInstanceVariables allSlots collect: [ :s | s name ]) + self assertDebugPointRecordedAs: DSWatchDebugPointEventRecord forDebugPointEvent: DebugPointChanged target: DSDebugPointInstanceVariableTargetRecord ] -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testVariableBreakpointHit [ - - self installVariableBreakpoint. - instrumenter listenToBreakpointChanges. - [ self breakpointMethod ] on: Break do:[]. +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testWatchDebugPointHit [ - self assert: self registry size equals: 1. + self installWatchDebugPoint. + instrumenter listenToDebugPointChanges. + [ DSTestClassWithInstanceVariables new ] + on: Break + do: [ ]. + + self assert: self registry size equals: 2. record := self registry first. self - assertVariableBreakpointRecordedAs: DSVariableBreakpointEventRecord - forBreakpointEvent: BreakpointHit - target: nil + assertDebugPointRecordedAs: DSWatchDebugPointEventRecord + forDebugPointEvent: VariableDebugPointHit + target: DSDebugPointInstanceVariableTargetRecord. + + record := self registry second. + self + assertDebugPointRecordedAs: DSWatchDebugPointEventRecord + forDebugPointEvent: DebugPointChanged + target: DSDebugPointInstanceVariableTargetRecord ] -{ #category : 'tests - breakpoints events' } -DSSpyTest >> testVariableBreakpointRemoved [ +{ #category : 'tests - debugpoints events' } +DSSpyTest >> testWatchDebugPointRemoved [ - self installVariableBreakpoint. - instrumenter listenToBreakpointChanges. - self removeBreakpoint. + self installWatchDebugPoint. + instrumenter listenToDebugPointChanges. + self removeDebugPoint. self assert: self registry size equals: 1. record := self registry first. self - assertVariableBreakpointRecordedAs: DSVariableBreakpointEventRecord - forBreakpointEvent: BreakpointRemoved - target: nil + assertDebugPointRecordedAs: DSWatchDebugPointEventRecord + forDebugPointEvent: DebugPointRemoved + target: DSDebugPointInstanceVariableTargetRecord ] { #category : 'tests - window events' } @@ -926,15 +949,23 @@ DSSpyTest >> testWindowOpenedListensToWindowActivatedAndClosedEvents [ self windowEvent window announce: (WindowClosed new window: self windowEvent window; yourself). - self assert: self registry size equals: 3. + self assert: self registry size equals: 5. record := self registry first. - self assert: record class identicalTo: DSWindowOpenedRecord. + self assert: record class identicalTo: DSToolWindowOpenedEventRecord. record := self registry second. + self assert: record class identicalTo: DSWindowOpenedRecord. + + record := self registry third. + self + assert: record class + identicalTo: DSToolWindowActivatedEventRecord. + + record := self registry at: 4. self assert: record class identicalTo: DSWindowActivatedRecord. - record := self registry third. + record := self registry at: 5. self assert: record class identicalTo: DSWindowClosedRecord ] diff --git a/DebuggingSpy-Tests/DSTestClassWithInstanceVariables.class.st b/DebuggingSpy-Tests/DSTestClassWithInstanceVariables.class.st index 37b4d63..e2b5c09 100644 --- a/DebuggingSpy-Tests/DSTestClassWithInstanceVariables.class.st +++ b/DebuggingSpy-Tests/DSTestClassWithInstanceVariables.class.st @@ -5,60 +5,43 @@ Class { #name : 'DSTestClassWithInstanceVariables', #superclass : 'Object', #instVars : [ - 'a', - 'b', - 'c', - 'd' + 'number', + 'text' ], #category : 'DebuggingSpy-Tests-Utils', #package : 'DebuggingSpy-Tests', #tag : 'Utils' } -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> a [ +{ #category : 'initialization' } +DSTestClassWithInstanceVariables >> initialize [ - ^ a + super initialize. + number := '0'. + text := 'hell0' + ] -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> a: anObject [ +{ #category : 'initialization' } +DSTestClassWithInstanceVariables >> number [ - a := anObject + ^ number ] -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> b [ +{ #category : 'initialization' } +DSTestClassWithInstanceVariables >> number: aNumber [ - ^ b + number := aNumber ] -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> b: anObject [ +{ #category : 'initialization' } +DSTestClassWithInstanceVariables >> text [ - b := anObject + ^ text ] -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> c [ +{ #category : 'initialization' } +DSTestClassWithInstanceVariables >> text: aString [ - ^ c -] - -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> c: anObject [ - - c := anObject -] - -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> d [ - - ^ d -] - -{ #category : 'accessing' } -DSTestClassWithInstanceVariables >> d: anObject [ - - d := anObject + text := aString ] diff --git a/DebuggingSpy/BreakDebugPoint.extension.st b/DebuggingSpy/BreakDebugPoint.extension.st new file mode 100644 index 0000000..877c6cc --- /dev/null +++ b/DebuggingSpy/BreakDebugPoint.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'BreakDebugPoint' } + +{ #category : '*DebuggingSpy' } +BreakDebugPoint >> debugPointRecordFor: aDebugPointEvent [ + + ^ DSBreakDebugPointEventRecord for: aDebugPointEvent +] diff --git a/DebuggingSpy/Breakpoint.extension.st b/DebuggingSpy/Breakpoint.extension.st deleted file mode 100644 index 6d1a33d..0000000 --- a/DebuggingSpy/Breakpoint.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : 'Breakpoint' } - -{ #category : '*DebuggingSpy' } -Breakpoint >> breakpointRecordFor: aBreakpointEvent [ - ^DSBreakpointEventRecord for: aBreakpointEvent -] diff --git a/DebuggingSpy/BreakpointAnnouncement.extension.st b/DebuggingSpy/BreakpointAnnouncement.extension.st deleted file mode 100644 index 2d64f47..0000000 --- a/DebuggingSpy/BreakpointAnnouncement.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : 'BreakpointAnnouncement' } - -{ #category : '*DebuggingSpy' } -BreakpointAnnouncement >> recordBreakpoint [ - ^self breakpoint breakpointRecordFor: self -] diff --git a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st b/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st deleted file mode 100644 index 33102ec..0000000 --- a/DebuggingSpy/DSAbstractBreakpointEventRecord.class.st +++ /dev/null @@ -1,91 +0,0 @@ -" -I record breakpoint events information, whatever the type of breakpoint. -My subclasses have to handle the real recording, depending on the breakpoint. -" -Class { - #name : 'DSAbstractBreakpointEventRecord', - #superclass : 'DSAbstractEventRecord', - #instVars : [ - 'target', - 'objectCentric', - 'eventName', - 'once', - 'breakpointHash' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'converting' } -DSAbstractBreakpointEventRecord >> asBreakpointRecord [ - - ^ self modelClass - perform: eventName asLowercase asSymbol asMutator - with: self -] - -{ #category : 'accessing' } -DSAbstractBreakpointEventRecord >> breakpointHash [ - ^breakpointHash -] - -{ #category : 'testing' } -DSAbstractBreakpointEventRecord >> canOpenDebuggers [ - ^eventName = 'BreakpointHit' -] - -{ #category : 'accessing' } -DSAbstractBreakpointEventRecord >> eventName [ - ^eventName -] - -{ #category : 'converting' } -DSAbstractBreakpointEventRecord >> modelClass [ - - ^ self subclassResponsibility -] - -{ #category : 'accessing' } -DSAbstractBreakpointEventRecord >> objectCentric [ - - ^ objectCentric -] - -{ #category : 'accessing' } -DSAbstractBreakpointEventRecord >> once [ - ^ once -] - -{ #category : 'printing' } -DSAbstractBreakpointEventRecord >> printTargetInstance: anObject [ - - | str | - str := WriteStream on: String new. - str << '['. - str << anObject identityHash printString. - str << '] instance of '. - str space. - str << anObject class name. - ^ str contents -] - -{ #category : 'actions api' } -DSAbstractBreakpointEventRecord >> record: aBreakpointEvent [ - - eventName := aBreakpointEvent class name. - objectCentric := aBreakpointEvent breakpoint isObjectCentric. - target := objectCentric - ifTrue: [ - self printTargetInstance: - aBreakpointEvent breakpoint targetInstance ] - ifFalse: [ nil ]. - once := aBreakpointEvent breakpoint once. - breakpointHash := aBreakpointEvent breakpoint hash -] - -{ #category : 'accessing' } -DSAbstractBreakpointEventRecord >> target [ - - ^ target -] diff --git a/DebuggingSpy/DSAbstractDebugPointEventRecord.class.st b/DebuggingSpy/DSAbstractDebugPointEventRecord.class.st new file mode 100644 index 0000000..2863995 --- /dev/null +++ b/DebuggingSpy/DSAbstractDebugPointEventRecord.class.st @@ -0,0 +1,78 @@ +" +I record breakpoint events information, whatever the type of breakpoint. +My subclasses have to handle the real recording, depending on the breakpoint. +" +Class { + #name : 'DSAbstractDebugPointEventRecord', + #superclass : 'DSAbstractEventRecord', + #instVars : [ + 'target', + 'behaviors', + 'arguments', + 'link', + 'enabled', + 'eventName', + 'debugPointHash' + ], + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'converting' } +DSAbstractDebugPointEventRecord >> asDebugPointRecord [ + + ^ self modelClass + perform: eventName asLowercase asSymbol asMutator + with: self +] + +{ #category : 'testing' } +DSAbstractDebugPointEventRecord >> canOpenDebuggers [ + ^eventName = 'BreakpointHit' +] + +{ #category : 'accessing' } +DSAbstractDebugPointEventRecord >> debugPointHash [ + ^debugPointHash +] + +{ #category : 'accessing' } +DSAbstractDebugPointEventRecord >> eventName [ + ^eventName +] + +{ #category : 'converting' } +DSAbstractDebugPointEventRecord >> modelClass [ + + ^ self subclassResponsibility +] + +{ #category : 'printing' } +DSAbstractDebugPointEventRecord >> printTargetInstance: anObject [ + + | str | + str := WriteStream on: String new. + str << '['. + str << anObject identityHash printString. + str << '] instance of '. + str space. + str << anObject class name. + ^ str contents +] + +{ #category : 'actions api' } +DSAbstractDebugPointEventRecord >> record: aDebugPointEvent [ + + eventName := aDebugPointEvent class name. + behaviors := aDebugPointEvent debugPoint behaviors collect: [ :behavior | behavior asString ]. + debugPointHash := aDebugPointEvent debugPoint hash. + target := aDebugPointEvent debugPoint target debugPointTargetRecord + +] + +{ #category : 'accessing' } +DSAbstractDebugPointEventRecord >> target [ + + ^ target +] diff --git a/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st b/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st new file mode 100644 index 0000000..3ea7b30 --- /dev/null +++ b/DebuggingSpy/DSAbstractDebugPointTargetRecord.class.st @@ -0,0 +1,28 @@ +Class { + #name : 'DSAbstractDebugPointTargetRecord', + #superclass : 'Object', + #instVars : [ + 'target' + ], + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'instance creation' } +DSAbstractDebugPointTargetRecord class >> for: aDebugPointTarget [ + + ^ self new record: aDebugPointTarget +] + +{ #category : 'actions api' } +DSAbstractDebugPointTargetRecord >> record: aDebugPointTarget [ + + target := aDebugPointTarget target asString +] + +{ #category : 'accessing' } +DSAbstractDebugPointTargetRecord >> target [ + + ^ target +] diff --git a/DebuggingSpy/DSBreakDebugPointEventRecord.class.st b/DebuggingSpy/DSBreakDebugPointEventRecord.class.st new file mode 100644 index 0000000..66331f8 --- /dev/null +++ b/DebuggingSpy/DSBreakDebugPointEventRecord.class.st @@ -0,0 +1,16 @@ +" +I record breakpoint events information. +" +Class { + #name : 'DSBreakDebugPointEventRecord', + #superclass : 'DSAbstractDebugPointEventRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'converting' } +DSBreakDebugPointEventRecord >> modelClass [ + + ^ DSMethodDebugPointRecord +] diff --git a/DebuggingSpy/DSBreakpointEventRecord.class.st b/DebuggingSpy/DSBreakpointEventRecord.class.st deleted file mode 100644 index ea8481e..0000000 --- a/DebuggingSpy/DSBreakpointEventRecord.class.st +++ /dev/null @@ -1,41 +0,0 @@ -" -I record breakpoint events information. -" -Class { - #name : 'DSBreakpointEventRecord', - #superclass : 'DSAbstractBreakpointEventRecord', - #instVars : [ - 'method', - 'node' - ], - #category : 'DebuggingSpy-Records', - #package : 'DebuggingSpy', - #tag : 'Records' -} - -{ #category : 'accessing' } -DSBreakpointEventRecord >> method [ - - ^ method -] - -{ #category : 'converting' } -DSBreakpointEventRecord >> modelClass [ - - ^ DSMethodBreakpointRecord -] - -{ #category : 'accessing' } -DSBreakpointEventRecord >> node [ - - ^ node -] - -{ #category : 'actions api' } -DSBreakpointEventRecord >> record: aBreakpointEvent [ - - super record: aBreakpointEvent. - method := aBreakpointEvent breakpoint node methodNode compiledMethod - name. - node := aBreakpointEvent breakpoint node printString -] diff --git a/DebuggingSpy/DSBreakpointAdd.class.st b/DebuggingSpy/DSDebugPointAdd.class.st similarity index 59% rename from DebuggingSpy/DSBreakpointAdd.class.st rename to DebuggingSpy/DSDebugPointAdd.class.st index a86ad1f..f9290c3 100644 --- a/DebuggingSpy/DSBreakpointAdd.class.st +++ b/DebuggingSpy/DSDebugPointAdd.class.st @@ -1,12 +1,12 @@ Class { - #name : 'DSBreakpointAdd', - #superclass : 'DSMethodBreakpointRecord', + #name : 'DSDebugPointAdd', + #superclass : 'DSMethodDebugPointRecord', #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', #tag : 'Records-Extensions' } { #category : 'accessing' } -DSBreakpointAdd >> eventSymbol [ +DSDebugPointAdd >> eventSymbol [ ^'+b' ] diff --git a/DebuggingSpy/DSVariableBreakpointAdd.class.st b/DebuggingSpy/DSDebugPointChanged.class.st similarity index 52% rename from DebuggingSpy/DSVariableBreakpointAdd.class.st rename to DebuggingSpy/DSDebugPointChanged.class.st index e871238..8c979da 100644 --- a/DebuggingSpy/DSVariableBreakpointAdd.class.st +++ b/DebuggingSpy/DSDebugPointChanged.class.st @@ -1,12 +1,12 @@ Class { - #name : 'DSVariableBreakpointAdd', - #superclass : 'DSVariableBreakpointRecord', + #name : 'DSDebugPointChanged', + #superclass : 'DSMethodDebugPointRecord', #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', #tag : 'Records-Extensions' } { #category : 'accessing' } -DSVariableBreakpointAdd >> eventSymbol [ - ^'+vb' +DSDebugPointChanged >> eventSymbol [ + ^'~b' ] diff --git a/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st b/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st new file mode 100644 index 0000000..11d9018 --- /dev/null +++ b/DebuggingSpy/DSDebugPointCheckBehaviorRecord.class.st @@ -0,0 +1,7 @@ +Class { + #name : 'DSDebugPointCheckBehaviorRecord', + #superclass : 'Object', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} diff --git a/DebuggingSpy/DSDebugPointClassTargetRecord.class.st b/DebuggingSpy/DSDebugPointClassTargetRecord.class.st new file mode 100644 index 0000000..730e81b --- /dev/null +++ b/DebuggingSpy/DSDebugPointClassTargetRecord.class.st @@ -0,0 +1,7 @@ +Class { + #name : 'DSDebugPointClassTargetRecord', + #superclass : 'DSAbstractDebugPointTargetRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} diff --git a/DebuggingSpy/DSBreakpointHit.class.st b/DebuggingSpy/DSDebugPointHit.class.st similarity index 59% rename from DebuggingSpy/DSBreakpointHit.class.st rename to DebuggingSpy/DSDebugPointHit.class.st index 3d8b6ed..3c4c040 100644 --- a/DebuggingSpy/DSBreakpointHit.class.st +++ b/DebuggingSpy/DSDebugPointHit.class.st @@ -1,12 +1,12 @@ Class { - #name : 'DSBreakpointHit', - #superclass : 'DSMethodBreakpointRecord', + #name : 'DSDebugPointHit', + #superclass : 'DSMethodDebugPointRecord', #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', #tag : 'Records-Extensions' } { #category : 'accessing' } -DSBreakpointHit >> eventSymbol [ +DSDebugPointHit >> eventSymbol [ ^'*b' ] diff --git a/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st b/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st new file mode 100644 index 0000000..1e84d2a --- /dev/null +++ b/DebuggingSpy/DSDebugPointInstanceVariableTargetRecord.class.st @@ -0,0 +1,23 @@ +Class { + #name : 'DSDebugPointInstanceVariableTargetRecord', + #superclass : 'DSDebugPointClassTargetRecord', + #instVars : [ + 'accessStrategy' + ], + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'accessing' } +DSDebugPointInstanceVariableTargetRecord >> accessStrategy [ + + ^ accessStrategy +] + +{ #category : 'actions api' } +DSDebugPointInstanceVariableTargetRecord >> record: aDebugPointTarget [ + + super record: aDebugPointTarget. + accessStrategy := aDebugPointTarget accessStrategy +] diff --git a/DebuggingSpy/DSDebugPointMetaBehaviorRecord.class.st b/DebuggingSpy/DSDebugPointMetaBehaviorRecord.class.st new file mode 100644 index 0000000..8acef38 --- /dev/null +++ b/DebuggingSpy/DSDebugPointMetaBehaviorRecord.class.st @@ -0,0 +1,7 @@ +Class { + #name : 'DSDebugPointMetaBehaviorRecord', + #superclass : 'Object', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} diff --git a/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st b/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st new file mode 100644 index 0000000..97e7ff5 --- /dev/null +++ b/DebuggingSpy/DSDebugPointNodeTargetRecord.class.st @@ -0,0 +1,7 @@ +Class { + #name : 'DSDebugPointNodeTargetRecord', + #superclass : 'DSDebugPointClassTargetRecord', + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} diff --git a/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st b/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st new file mode 100644 index 0000000..b052f4b --- /dev/null +++ b/DebuggingSpy/DSDebugPointObjectTargetRecord.class.st @@ -0,0 +1,23 @@ +Class { + #name : 'DSDebugPointObjectTargetRecord', + #superclass : 'DSAbstractDebugPointTargetRecord', + #instVars : [ + 'subTarget' + ], + #category : 'DebuggingSpy-Records', + #package : 'DebuggingSpy', + #tag : 'Records' +} + +{ #category : 'actions api' } +DSDebugPointObjectTargetRecord >> record: aDebugPointTarget [ + + super record: aDebugPointTarget. + subTarget := aDebugPointTarget subTarget +] + +{ #category : 'accessing' } +DSDebugPointObjectTargetRecord >> subTarget [ + + ^ subTarget +] diff --git a/DebuggingSpy/DSBreakpointRecord.class.st b/DebuggingSpy/DSDebugPointRecord.class.st similarity index 65% rename from DebuggingSpy/DSBreakpointRecord.class.st rename to DebuggingSpy/DSDebugPointRecord.class.st index 70b7392..2c5ea5f 100644 --- a/DebuggingSpy/DSBreakpointRecord.class.st +++ b/DebuggingSpy/DSDebugPointRecord.class.st @@ -1,5 +1,5 @@ Class { - #name : 'DSBreakpointRecord', + #name : 'DSDebugPointRecord', #superclass : 'DSAbstractExtendedRecord', #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', @@ -7,57 +7,57 @@ Class { } { #category : 'instance creation' } -DSBreakpointRecord class >> breakpointadded: event [ +DSDebugPointRecord class >> debugpointadded: event [ ^ self subclassResponsibility ] { #category : 'instance creation' } -DSBreakpointRecord class >> breakpointhit: event [ +DSDebugPointRecord class >> debugpointhit: event [ ^ self subclassResponsibility ] { #category : 'instance creation' } -DSBreakpointRecord class >> breakpointremoved: event [ +DSDebugPointRecord class >> debugpointremoved: event [ ^ self subclassResponsibility ] -{ #category : 'accessing' } -DSBreakpointRecord >> breakpointHash [ +{ #category : 'testing' } +DSDebugPointRecord >> canOpenDebuggers [ - ^ sourceRecord breakpointHash + ^ sourceRecord canOpenDebuggers ] -{ #category : 'testing' } -DSBreakpointRecord >> canOpenDebuggers [ +{ #category : 'accessing' } +DSDebugPointRecord >> debugPointHash [ - ^ sourceRecord canOpenDebuggers + ^ sourceRecord debugPointHash ] { #category : 'accessing' } -DSBreakpointRecord >> eventName [ +DSDebugPointRecord >> eventName [ ^ sourceRecord eventName ] { #category : 'accessing' } -DSBreakpointRecord >> eventSymbol [ +DSDebugPointRecord >> eventSymbol [ ^self subclassResponsibility ] { #category : 'accessing' } -DSBreakpointRecord >> objectCentric [ +DSDebugPointRecord >> objectCentric [ ^ sourceRecord objectCentric ] { #category : 'accessing' } -DSBreakpointRecord >> once [ +DSDebugPointRecord >> once [ ^ sourceRecord once ] { #category : 'printing' } -DSBreakpointRecord >> printContextAndNode [ +DSDebugPointRecord >> printContextAndNode [ self flag: 'This cannot work with the DSVariableBreakpointRecord subclass: is this even called?'. ^ String streamContents: [ :s | | nodeStream peek | @@ -69,24 +69,24 @@ DSBreakpointRecord >> printContextAndNode [ ] { #category : 'printing' } -DSBreakpointRecord >> printTargetInstance: anObject [ +DSDebugPointRecord >> printTargetInstance: anObject [ ^sourceRecord printTargetInstance: anObject ] { #category : 'accessing' } -DSBreakpointRecord >> submethodTargets [ +DSDebugPointRecord >> submethodTargets [ ^ self subclassResponsibility ] { #category : 'accessing' } -DSBreakpointRecord >> target [ +DSDebugPointRecord >> target [ ^ sourceRecord target ] { #category : 'accessing' } -DSBreakpointRecord >> targetClassOrMethod [ +DSDebugPointRecord >> targetClassOrMethod [ ^ self subclassResponsibility ] diff --git a/DebuggingSpy/DSBreakpointRemoved.class.st b/DebuggingSpy/DSDebugPointRemoved.class.st similarity index 57% rename from DebuggingSpy/DSBreakpointRemoved.class.st rename to DebuggingSpy/DSDebugPointRemoved.class.st index 2d5b8e0..787e021 100644 --- a/DebuggingSpy/DSBreakpointRemoved.class.st +++ b/DebuggingSpy/DSDebugPointRemoved.class.st @@ -1,12 +1,12 @@ Class { - #name : 'DSBreakpointRemoved', - #superclass : 'DSMethodBreakpointRecord', + #name : 'DSDebugPointRemoved', + #superclass : 'DSMethodDebugPointRecord', #category : 'DebuggingSpy-Records-Extensions', #package : 'DebuggingSpy', #tag : 'Records-Extensions' } { #category : 'accessing' } -DSBreakpointRemoved >> eventSymbol [ +DSDebugPointRemoved >> eventSymbol [ ^'-b' ] diff --git a/DebuggingSpy/DSDebuggerOpeningRecord.class.st b/DebuggingSpy/DSDebuggerOpeningRecord.class.st index eb46654..a7fc182 100644 --- a/DebuggingSpy/DSDebuggerOpeningRecord.class.st +++ b/DebuggingSpy/DSDebuggerOpeningRecord.class.st @@ -33,8 +33,8 @@ DSDebuggerOpeningRecord >> eventName [ DSDebuggerOpeningRecord >> primarySourcesOfWindowOpenings [ ^ ({ - DSBreakpointRecord. - DSAbstractBreakpointEventRecord. + DSDebugPointRecord. + DSAbstractDebugPointEventRecord. DSHaltHitRecord. DSUnhandledExceptionRecord } collect: [ :c | c withAllSubclasses ]) flattened diff --git a/DebuggingSpy/DSHaltHitRecord.class.st b/DebuggingSpy/DSHaltHitRecord.class.st index 4e4fb71..52e7f22 100644 --- a/DebuggingSpy/DSHaltHitRecord.class.st +++ b/DebuggingSpy/DSHaltHitRecord.class.st @@ -37,7 +37,7 @@ DSHaltHitRecord >> record: anRBProgramNodeAndASelector [ conditional := false. super record: anRBProgramNodeAndASelector first. selector := anRBProgramNodeAndASelector second. - selector = #once ifTrue:[once := true]. + selector = #once: ifTrue:[once := true]. selector = #haltIf: ifTrue:[conditional := true] ] diff --git a/DebuggingSpy/DSMethodBreakpointRecord.class.st b/DebuggingSpy/DSMethodBreakpointRecord.class.st deleted file mode 100644 index 1ba0529..0000000 --- a/DebuggingSpy/DSMethodBreakpointRecord.class.st +++ /dev/null @@ -1,68 +0,0 @@ -Class { - #name : 'DSMethodBreakpointRecord', - #superclass : 'DSBreakpointRecord', - #category : 'DebuggingSpy-Records-Extensions', - #package : 'DebuggingSpy', - #tag : 'Records-Extensions' -} - -{ #category : 'instance creation' } -DSMethodBreakpointRecord class >> breakpointadded: event [ - - ^DSBreakpointAdd for: event - -] - -{ #category : 'instance creation' } -DSMethodBreakpointRecord class >> breakpointhit: event [ - - ^DSBreakpointHit for: event - -] - -{ #category : 'instance creation' } -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 : 'accessing' } -DSMethodBreakpointRecord >> eventName [ - - ^ String streamContents: [ :s | - s << 'Method'. - s << super eventName ] -] - -{ #category : 'accessing' } -DSMethodBreakpointRecord >> method [ - ^sourceRecord method -] - -{ #category : 'accessing' } -DSMethodBreakpointRecord >> node [ - ^sourceRecord node -] - -{ #category : 'accessing' } -DSMethodBreakpointRecord >> submethodTargets [ - - ^ {self node} -] - -{ #category : 'accessing' } -DSMethodBreakpointRecord >> targetClassOrMethod [ - - ^ self method -] diff --git a/DebuggingSpy/DSMethodDebugPointRecord.class.st b/DebuggingSpy/DSMethodDebugPointRecord.class.st new file mode 100644 index 0000000..48efc57 --- /dev/null +++ b/DebuggingSpy/DSMethodDebugPointRecord.class.st @@ -0,0 +1,75 @@ +Class { + #name : 'DSMethodDebugPointRecord', + #superclass : 'DSDebugPointRecord', + #category : 'DebuggingSpy-Records-Extensions', + #package : 'DebuggingSpy', + #tag : 'Records-Extensions' +} + +{ #category : 'instance creation' } +DSMethodDebugPointRecord class >> debugpointadded: event [ + + ^DSDebugPointAdd for: event + +] + +{ #category : 'instance creation' } +DSMethodDebugPointRecord class >> debugpointchanged: event [ + + ^DSDebugPointChanged for: event + +] + +{ #category : 'instance creation' } +DSMethodDebugPointRecord class >> debugpointhit: event [ + + ^DSDebugPointHit for: event + +] + +{ #category : 'instance creation' } +DSMethodDebugPointRecord class >> debugpointremoved: event [ + + ^DSDebugPointRemoved for: event + +] + +{ #category : 'instance creation' } +DSMethodDebugPointRecord class >> for: anEvent [ + + | debugPoint | + debugPoint := self new. + debugPoint become: anEvent. + anEvent record: debugPoint. + ^ anEvent +] + +{ #category : 'accessing' } +DSMethodDebugPointRecord >> eventName [ + + ^ String streamContents: [ :s | + s << 'Method'. + s << super eventName ] +] + +{ #category : 'accessing' } +DSMethodDebugPointRecord >> method [ + ^sourceRecord method +] + +{ #category : 'accessing' } +DSMethodDebugPointRecord >> node [ + ^sourceRecord node +] + +{ #category : 'accessing' } +DSMethodDebugPointRecord >> submethodTargets [ + + ^ {self node} +] + +{ #category : 'accessing' } +DSMethodDebugPointRecord >> targetClassOrMethod [ + + ^ self method +] diff --git a/DebuggingSpy/DSRecordHistory.class.st b/DebuggingSpy/DSRecordHistory.class.st index 194aab9..ab21aaa 100644 --- a/DebuggingSpy/DSRecordHistory.class.st +++ b/DebuggingSpy/DSRecordHistory.class.st @@ -86,7 +86,7 @@ DSRecordHistory >> breakpointAnalysisMap [ | report | report := Dictionary new. - (self allRecordsOfKind: DSBreakpointRecord) do: [ :bp | + (self allRecordsOfKind: DSDebugPointRecord) do: [ :bp | (report at: bp targetClassOrMethod ifAbsentPut: [ DSBreakpointReport new method: bp targetClassOrMethod; @@ -98,8 +98,8 @@ DSRecordHistory >> breakpointAnalysisMap [ DSRecordHistory >> breakpointEvents [ ^ self records select: [ :r | - (r isKindOf: DSAbstractBreakpointEventRecord) or: [ - r isKindOf: DSBreakpointRecord ] ] + (r isKindOf: DSAbstractDebugPointEventRecord) or: [ + r isKindOf: DSDebugPointRecord ] ] ] { #category : 'private - history' } @@ -518,7 +518,7 @@ DSRecordHistory >> processRecords: array [ "Transform raw events to model events" (self allRecordsOfKind: DSStepActionRecord) do: #asStepRecord. - (self allRecordsOfKind: DSAbstractBreakpointEventRecord) do: #asBreakpointRecord. + (self allRecordsOfKind: DSAbstractDebugPointEventRecord) do: #asDebugPointRecord. "Detect if we're in a specific task" (self records first isKindOf: DSStartTaskRecord) ifTrue: [ diff --git a/DebuggingSpy/DSSTONFileLogger.class.st b/DebuggingSpy/DSSTONFileLogger.class.st index ec4067a..99eafa1 100644 --- a/DebuggingSpy/DSSTONFileLogger.class.st +++ b/DebuggingSpy/DSSTONFileLogger.class.st @@ -4,8 +4,8 @@ I log DSRecords as STON into files. Class { #name : 'DSSTONFileLogger', #superclass : 'Object', - #traits : 'TDSLogger', - #classTraits : 'TDSLogger classTrait', + #traits : 'TExperimentLogger', + #classTraits : 'TExperimentLogger classTrait', #instVars : [ 'loggingDirectory', 'loggingFilename', diff --git a/DebuggingSpy/DSSindarinStepToNextCallInClassCommand.class.st b/DebuggingSpy/DSSindarinStepToNextExecutionInClassCommand.class.st similarity index 71% rename from DebuggingSpy/DSSindarinStepToNextCallInClassCommand.class.st rename to DebuggingSpy/DSSindarinStepToNextExecutionInClassCommand.class.st index 14aa745..82ac5de 100644 --- a/DebuggingSpy/DSSindarinStepToNextCallInClassCommand.class.st +++ b/DebuggingSpy/DSSindarinStepToNextExecutionInClassCommand.class.st @@ -3,8 +3,8 @@ I specialize SindarinStepToNextCallInClassCommand with debugging spy record crea I am meant to replace SindarinStepToNextCallInClassCommand commands in the debugger in order to provide such instrumentation. " Class { - #name : 'DSSindarinStepToNextCallInClassCommand', - #superclass : 'SindarinStepToNextCallInClassCommand', + #name : 'DSSindarinStepToNextExecutionInClassCommand', + #superclass : 'SindarinStepToNextExecutionInClassCommand', #traits : 'DSTCommandForTests', #classTraits : 'DSTCommandForTests classTrait', #category : 'DebuggingSpy-Commands', @@ -13,9 +13,9 @@ Class { } { #category : 'hooks' } -DSSindarinStepToNextCallInClassCommand >> execute [ +DSSindarinStepToNextExecutionInClassCommand >> execute [ - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_CALL_IN_CLASS]. + [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_EXECUTION_IN_CLASS]. self forTests ifTrue: [ ^ self ]. ^ super execute ] diff --git a/DebuggingSpy/DSSindarinStepToNextCallInObjectCommand.class.st b/DebuggingSpy/DSSindarinStepToNextExecutionInObjectCommand.class.st similarity index 71% rename from DebuggingSpy/DSSindarinStepToNextCallInObjectCommand.class.st rename to DebuggingSpy/DSSindarinStepToNextExecutionInObjectCommand.class.st index 1ba471b..14ce17b 100644 --- a/DebuggingSpy/DSSindarinStepToNextCallInObjectCommand.class.st +++ b/DebuggingSpy/DSSindarinStepToNextExecutionInObjectCommand.class.st @@ -3,8 +3,8 @@ I specialize SindarinStepToNextCallInObjectCommand with debugging spy record cre I am meant to replace SindarinStepToNextCallInObjectCommand commands in the debugger in order to provide such instrumentation. " Class { - #name : 'DSSindarinStepToNextCallInObjectCommand', - #superclass : 'SindarinStepToNextCallInObjectCommand', + #name : 'DSSindarinStepToNextExecutionInObjectCommand', + #superclass : 'SindarinStepToNextExecutionInObjectCommand', #traits : 'DSTCommandForTests', #classTraits : 'DSTCommandForTests classTrait', #category : 'DebuggingSpy-Commands', @@ -13,9 +13,9 @@ Class { } { #category : 'hooks' } -DSSindarinStepToNextCallInObjectCommand >> execute [ +DSSindarinStepToNextExecutionInObjectCommand >> execute [ - [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_CALL_IN_OBJECT]. + [DSStepActionRecord for: self] on: Error do:[:e| DSSpy log: #ERROR key: #TO_NEXT_EXECUTION_IN_OBJECT]. self forTests ifTrue: [ ^ self ]. ^ super execute ] diff --git a/DebuggingSpy/DSSpy.class.st b/DebuggingSpy/DSSpy.class.st index bac12ce..8959e6f 100644 --- a/DebuggingSpy/DSSpy.class.st +++ b/DebuggingSpy/DSSpy.class.st @@ -63,7 +63,7 @@ DSSpy class >> handlingError: anObject [ ^ HandlingError := anObject ] -{ #category : 'events - breakpoints' } +{ #category : 'events - debugpoints' } DSSpy class >> indexesOfHaltNodesIn: aMethod [ | haltNodes | @@ -225,11 +225,6 @@ DSSpy class >> packagesMonitoredForSourceCodeChanges: anObject [ packagesMonitoredForSourceCodeChanges := anObject ] -{ #category : 'events - breakpoints' } -DSSpy class >> recordBreakpointEvent: aBreakpointEvent [ - ^aBreakpointEvent recordBreakpoint -] - { #category : 'accessing' } DSSpy class >> recordClipboardContent [ @@ -242,7 +237,13 @@ DSSpy class >> recordClipboardContent: anObject [ recordClipboardContent := anObject ] -{ #category : 'events - breakpoints' } +{ #category : 'events - debugpoints' } +DSSpy class >> recordDebugPointEvent: aDebugPointEvent [ + + ^ aDebugPointEvent recordDebugpoint +] + +{ #category : 'events - debugpoints' } DSSpy class >> recordHaltInAddedMethod: method [ |nodesSelectorsWithIndexes record| nodesSelectorsWithIndexes := self indexesOfHaltNodesIn: method. @@ -251,7 +252,7 @@ DSSpy class >> recordHaltInAddedMethod: method [ record method: method name ] -{ #category : 'events - breakpoints' } +{ #category : 'events - debugpoints' } DSSpy class >> recordHaltInMethod: oldMethod modifiedBy: newMethod [ | oldHalts newHalts record | @@ -267,7 +268,7 @@ DSSpy class >> recordHaltInMethod: oldMethod modifiedBy: newMethod [ record method: newMethod name ] -{ #category : 'events - breakpoints' } +{ #category : 'events - debugpoints' } DSSpy class >> recordHaltInRemovedMethod: oldMethod [ |nodesSelectorsWithIndexes record| nodesSelectorsWithIndexes := self indexesOfHaltNodesIn: oldMethod. diff --git a/DebuggingSpy/DSSpyInstrumenter.class.st b/DebuggingSpy/DSSpyInstrumenter.class.st index 8383c38..c8e5a06 100644 --- a/DebuggingSpy/DSSpyInstrumenter.class.st +++ b/DebuggingSpy/DSSpyInstrumenter.class.st @@ -86,7 +86,8 @@ DSSpyInstrumenter >> instrumentCodePresenter [ self withSyntaxHighlight. self withSmartCharacters. - self withLineNumbers. + self showLineNumbers. + self subscribeToSettingsChangesAnnouncements. self registerEventsForStyling. self clearInteractionModel. @@ -119,10 +120,10 @@ DSSpyInstrumenter >> instrumentDebuggerOpening [ super initializeWindow: aWindowPresenter. aWindowPresenter - title: self debuggerActionModel statusStringForContext; - initialExtent: self initialExtent; + initialPosition: self settings lastKnownPosition; whenClosedDo: [ self clear ]. + self settings initializeWindow: aWindowPresenter. self initializeShortcuts: aWindowPresenter. [DSDebuggerOpeningRecord for: self ] on: Error do:[:err| DSSpy log: err key: #DEBUGGER_STACK ] ' @@ -143,7 +144,7 @@ stackTable := self newList. stackTable selection isEmpty ifFalse: [ self updateInspectorFromContext: context. self updateCodeFromContext: context. - self updateExtensionsFrom: self session. + self updateExtensionsFromSession: self session. self expandStackIfLastItemIsSelected. self updateWindowTitle. [DSBrowseContextRecord for: { context . [self window window] on: Error do:[0] } ] on: Error do:[:err| DSSpy log: #ERROR key: #DEBUGGER_STACK ] ] ]. @@ -151,14 +152,16 @@ stackTable := self newList. stackHeader label: ''Stack''' ] -{ #category : 'breakpoints' } +{ #category : 'debugpoints ' } DSSpyInstrumenter >> instrumentExceptionSignalling [ + Exception compile: 'raiseUnhandledError + "No one has handled this error, but now give them a chance to decide how to debug it. If none handle this either then open debugger (see UnhandedError>>#defaultAction)" self class = Halt ifFalse:[[ DSUnhandledExceptionRecord for: self] on: Error do:[:err| DSSpy log: #ERROR key: self class name asSymbol ]]. - ^ UnhandledError signalForException: self'. + ^ UnhandledError signalForException: self' ] { #category : 'inspector' } @@ -171,14 +174,14 @@ DSSpyInstrumenter >> instrumentExpandAttribute [ self refreshTable ]' ] -{ #category : 'breakpoints' } +{ #category : 'debugpoints ' } DSSpyInstrumenter >> instrumentHaltHits [ Halt class compile: 'signalIn: ctx self = Halt ifTrue:[ [|sender| sender := thisContext sender sender sender sender sender sender sender sender sender. - ctx selector = #once ifFalse:[sender := sender sender]. + ctx selector = #once: ifFalse:[sender := sender sender]. DSHaltHitRecord for: {sender sourceNodeExecuted. ctx selector}] on: Error do:[ DSSpy log: #ERROR key: #HALT_HIT ]]. @@ -304,9 +307,7 @@ DSSpyInstrumenter >> instrumentNavigateAttribute [ StRawInspectionPresenter compile: 'setAttributeTable - attributeTable - roots: self inspectorNodes; - children: [ :node | node children ]. + attributeTable children: [ :node | node children ]. self outputSelectionPort transmitDo: [ :val | val ifNotNil: [ @@ -321,7 +322,7 @@ DSSpyInstrumenter >> instrumentPlaygroundCode [ StPlaygroundPresenter class compile: 'open