Skip to content

Commit

Permalink
Fixes #166 debugger frame selection gone awry
Browse files Browse the repository at this point in the history
Bug fix explanation - #166 (comment)

Test added.
  • Loading branch information
Eric Winger authored and Eric Winger committed Sep 14, 2018
1 parent 4a0524e commit 4d62533
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 8 deletions.
4 changes: 2 additions & 2 deletions sources/JadeDebugger.cls
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ createComponents
createSchematicWiring

super createSchematicWiring.
frameListPresenter when: #selectionChanged send: #selectedFrame to: self.
frameListPresenter when: #selectionChanged send: #selectedFrameWithErrorHandling to: self.
processListPresenter when: #selectionChanged send: #selectedProcess to: self.
variableListPresenter when: #selectionChanged send: #selectedVariable to: self.
variableListPresenter when: #actionPerformed send: #inspectVariable to: self.
Expand Down Expand Up @@ -115,7 +115,7 @@ implement

initializeProcess: aProcess message: aString terminateOnClose: aBoolean

gsProcess := aProcess.
gsProcess := aProcess.
errorMessagePresenter value: aString.
terminateOnClose := aBoolean.
[
Expand Down
33 changes: 31 additions & 2 deletions sources/JadeiteDebuggerTestCase.cls
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ openDebuggerOn: aString
yourself.
!

selectFrameAt: integer
debugger frameListPresenter selection: (debugger frameListPresenter list at: integer)!

setUp

| list1 list2 |
Expand Down Expand Up @@ -187,6 +190,28 @@ test_restartInBlock
[self methodListPresenter selection clearBreakAtStepPoint: 8 session: session.
self unloadSampleProject]!

test_selectAfterDiveNoStepPoint
self testsIssue: #issue166
withTitle: 'Debugger step with unsaved edits results in empty source pane'.
self openProjectsBrowser.
self ensureRowanSample1Available.
self selectRowanSample1Class.
self saveInterestingLoopMethod.
self methodListPresenter selection setBreakAtStepPoint: 8 session: session. "inside the block"

[self openDebuggerOn: 'RowanSample1 new interestingLoop'.
self debuggerDo: [debugger stepInto].
self assert: debugger frameListPresenter list first equals: 'RowanSample1 >> test @1 line 1'.
self assert: (debugger frameListPresenter list at: 2)
equals: '[] in ExecBlock1 (RowanSample1) >> interestingLoop @2 line 8'.
[self selectFrameAt: 2] fork. "<<< Walkback occurred here" "Fork so that the tests' error handler doesn't catch the expected error raised in #selectedFrame"
(Delay forMilliseconds: 100) wait.
self assert: debugger documentPresenter value replaceLfWithCrLf
equals: self interestingLoopMethodSource]
ensure:
[self methodListPresenter selection clearBreakAtStepPoint: 8 session: session.
self unloadSampleProject]!

test_terminateDoesNotWalkback
"Terminate a process other than the primary one"

Expand Down Expand Up @@ -503,7 +528,8 @@ testDebuggerCopyToClipboard
debugger methodSourcePresenter documentPresenter value: 'new text'.
debugger methodSourcePresenter documentPresenter view isModified: true.
TestMessageBox plannedResult: #yes. "confirm we want to copy to clipboard"
debugger frameListPresenter selection: (debugger frameListPresenter list at: 2).
[self selectFrameAt: 2] fork. "Fork so that the tests' error handler doesn't catch the expected error raised in #selectedFrame"
(Delay forMilliseconds: 100) wait.
self assert: Clipboard current getText = 'new text']
ensure: [TestMessageBox disableJadeiteTestMessageBox]!

Expand All @@ -521,7 +547,8 @@ testDebuggerDoNotCopyToClipboard
debugger methodSourcePresenter documentPresenter value: 'new text'.
debugger methodSourcePresenter documentPresenter view isModified: true.
TestMessageBox plannedResult: #no. "reject offer to copy to clip board"
debugger frameListPresenter selection: (debugger frameListPresenter list at: 2).
[self selectFrameAt: 2] fork. "Fork so that the tests' error handler doesn't catch the expected error raised in #selectedFrame"
(Delay forMilliseconds: 100) wait.
self assert: Clipboard current getText = 'notCopiedYet']
ensure: [TestMessageBox disableJadeiteTestMessageBox]!

Expand Down Expand Up @@ -642,12 +669,14 @@ testUnsavedChangesActionStepping
!JadeiteDebuggerTestCase categoriesFor: #menuItemIsEnabled:!private!support! !
!JadeiteDebuggerTestCase categoriesFor: #methodListBrowser!private! !
!JadeiteDebuggerTestCase categoriesFor: #openDebuggerOn:!private! !
!JadeiteDebuggerTestCase categoriesFor: #selectFrameAt:!private!support!tests! !
!JadeiteDebuggerTestCase categoriesFor: #setUp!private!running! !
!JadeiteDebuggerTestCase categoriesFor: #systemBrowser!private! !
!JadeiteDebuggerTestCase categoriesFor: #tearDown!private!running! !
!JadeiteDebuggerTestCase categoriesFor: #terminateGsProcess!private!running! !
!JadeiteDebuggerTestCase categoriesFor: #test_browseClass!public!tests! !
!JadeiteDebuggerTestCase categoriesFor: #test_restartInBlock!public!tests! !
!JadeiteDebuggerTestCase categoriesFor: #test_selectAfterDiveNoStepPoint!public!tests! !
!JadeiteDebuggerTestCase categoriesFor: #test_terminateDoesNotWalkback!public!tests! !
!JadeiteDebuggerTestCase categoriesFor: #test1!public!tests! !
!JadeiteDebuggerTestCase categoriesFor: #test2!public!tests! !
Expand Down
8 changes: 7 additions & 1 deletion sources/Rowan UI Base.pax
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ package methodNames
add: #JadeDebugger -> #gsProcess;
add: #JadeDebugger -> #gsProcess:;
add: #JadeDebugger -> #onViewClosed;
add: #JadeDebugger -> #selectedFrameWithErrorHandling;
add: #JadeDebugger -> #updateCaption;
add: #JadeErrorShell -> #doCopy;
add: #JadeErrorShell -> #onViewOpened;
Expand Down Expand Up @@ -932,7 +933,7 @@ gsProcess
^gsProcess!

gsProcess: anObject
gsProcess := anObject!
gsProcess := anObject.!

onViewClosed
(processList notNil and: [processList notEmpty])
Expand All @@ -944,6 +945,10 @@ onViewClosed
[gsProcess terminate.
self error: 'We should never get here!!']]!

selectedFrameWithErrorHandling
[self selectedFrame] on: RowanDebuggerStepPointError
do: [:ex | ex isNested ifTrue: [ex pass] ifFalse: [ex resume]]!

updateCaption
self caption: (gciSession
titleBarFor: (self class == RowanDebugger
Expand All @@ -952,6 +957,7 @@ updateCaption
!JadeDebugger categoriesFor: #gsProcess!accessing!private! !
!JadeDebugger categoriesFor: #gsProcess:!accessing!private! !
!JadeDebugger categoriesFor: #onViewClosed!event handlers!public! !
!JadeDebugger categoriesFor: #selectedFrameWithErrorHandling!public! !
!JadeDebugger categoriesFor: #updateCaption!public! !

!JadeErrorShell methodsFor!
Expand Down
5 changes: 2 additions & 3 deletions sources/RowanDebugger.cls
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,8 @@ selectedFrame
variableListPresenter list: frame vars.
self handleSourceChanges.
codePane
gsMethod: frame gsMethod;
showStepPoint: frame stepPoint;
yourself.
gsMethod: frame gsMethod.
frame stepPoint ifNotNil: [codePane showStepPoint: frame stepPoint].
(self view viewNamed: 'toolbar') update!

stepInto
Expand Down
8 changes: 8 additions & 0 deletions sources/RowanDebuggerStepPointError.cls
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ Error subclass: #RowanDebuggerStepPointError
RowanDebuggerStepPointError guid: (GUID fromString: '{6f572ac8-2ed4-4f1a-aab6-47e28ac6fb01}')!
RowanDebuggerStepPointError comment: ''!
!RowanDebuggerStepPointError categoriesForClass!Kernel-Exception Handling! !
!RowanDebuggerStepPointError methodsFor!

isResumable


^true! !
!RowanDebuggerStepPointError categoriesFor: #isResumable!public!testing! !

0 comments on commit 4d62533

Please sign in to comment.