Skip to content

Commit

Permalink
Fixing display of fullblocks methods in debugger stack
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenCostiou committed Jul 29, 2020
1 parent 197c227 commit 951b3cf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 18 deletions.
22 changes: 22 additions & 0 deletions src/NewTools-Debugger-Tests/StDebuggerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,28 @@ StDebuggerTest >> testStackTableAfterStepIn [
self assert: stackTableItems equals: session shortStack
]

{ #category : #'tests - stack table' }
StDebuggerTest >> testStackTableElementsPrinting [
| columns classColumn methodColumn senderColumn method block context |
self debugger session: session.
columns := self initializedDebugger stackTable columns.
classColumn := columns first.
methodColumn := columns second.
senderColumn := columns third.
method := self class >> #testStackTableElementsPrinting.
block := [ :a | a ].

context := (Context newForMethod: method) setSender: self receiver: self method: method arguments: #( ).
self assert: (classColumn evaluation value: context) equals: self class.
self assert: (methodColumn evaluation value: context) equals: method selector.
self assert: (senderColumn evaluation value: context) equals: self stDisplayString.

context := (Context newForMethod: method) setSender: self receiver: self method: block method arguments: #( ).
self assert: (classColumn evaluation value: context) equals: self class.
self assert: (methodColumn evaluation value: context) equals: block sourceNode sourceCode.
self assert: (senderColumn evaluation value: context) equals: self stDisplayString.
]

{ #category : #'tests - stack table' }
StDebuggerTest >> testStackTableInitialization [
self assert: self debugger stackTable isNil
Expand Down
36 changes: 18 additions & 18 deletions src/NewTools-Debugger/StDebugger.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -753,25 +753,25 @@ StDebugger >> initializePresenters [
StDebugger >> initializeStack [
stackTable := self newTable.
stackTable
addColumn: (SpStringTableColumn
title: 'Class'
evaluated: [ :item | item receiver class ]);
addColumn:
(SpStringTableColumn
title: 'Class'
evaluated: [ :item | item receiver class ]);
addColumn:
(SpStringTableColumn
title: 'Method'
evaluated: [ :item | item method selector ]);
addColumn:
(SpStringTableColumn
title: 'Context'
evaluated: [ :item | item sender stDisplayString ]).
stackTable
transmitDo: [ :context |
stackTable selection isEmpty
ifFalse: [ self updateInspectorFromContext: context.
self updateCodeFromContext: context.
self updateTitle.
self expandStackIfLastItemIsSelected ] ].
(SpStringTableColumn title: 'Method' evaluated: [ :item |
| method |
method := item method.
method isCompiledBlock
ifTrue: [ method sourceNode sourceCode ]
ifFalse: [ method selector ] ]);
addColumn: (SpStringTableColumn
title: 'Context'
evaluated: [ :item | item sender stDisplayString ]).
stackTable transmitDo: [ :context |
stackTable selection isEmpty ifFalse: [
self updateInspectorFromContext: context.
self updateCodeFromContext: context.
self updateTitle.
self expandStackIfLastItemIsSelected ] ].
stackHeader := self instantiate: StHeaderBar.
stackHeader label: 'Stack'
]
Expand Down

0 comments on commit 951b3cf

Please sign in to comment.