Skip to content

Commit c62513e

Browse files
committed
Fix update of variables using debug info
1 parent 360d2fb commit c62513e

File tree

4 files changed

+36
-30
lines changed

4 files changed

+36
-30
lines changed

src/NewTools-Debugger/StDebugger.class.st

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Class {
8787
'programmaticallyClosed',
8888
'stackAndCodeContainer',
8989
'toolbarPresenter',
90-
'previousASTScope'
90+
'namesVisibleInPreviousScope'
9191
],
9292
#classVars : [
9393
'EnableStackColoring'
@@ -847,6 +847,7 @@ StDebugger >> initializeInspector [
847847
inspector := self
848848
instantiate: self debuggerInspectorClass
849849
on: (self debuggerInspectorModelClass on: self newDebuggerContext).
850+
namesVisibleInPreviousScope := self newDebuggerContext context temporaryVariableNames.
850851
inspector label: 'Receiver'
851852
]
852853

@@ -1602,25 +1603,26 @@ StDebugger >> updateStackFromSession: aSession [
16021603
{ #category : 'updating' }
16031604
StDebugger >> updateStep [
16041605

1605-
| previousContext currentASTScope currentContext |
1606+
| previousContext currentlyVisibleNames currentContext |
16061607
previousContext := self currentContext.
16071608
self updateStackFromSession: self session.
16081609
self updateWindowTitle.
16091610
self updateExtensionsFromSession: self session.
16101611
self updateToolbar.
1611-
1612+
1haltOnce.
16121613
currentContext := self currentContext.
1613-
currentASTScope := currentContext temporaryVariables.
1614+
currentlyVisibleNames := currentContext temporaryVariableNames.
16141615
self flag: #DBG_INSPECTOR_UPDATE_BUG.
1616+
16151617
inspector getRawInspectorPresenterOrNil ifNotNil: [ :p |
16161618
previousContext == currentContext ifTrue: [ "otherwise, if contexts have changed, updating the stack has already updated all nodes.""Here it is necessary to update temporary nodes if we are still in the same context but in a different scope. This is possible when leaving or entering an optimized block scope."
16171619
p
16181620
updateNodesFromScope:
1619-
(previousASTScope ifNil: [ currentASTScope ])
1620-
to: currentASTScope ].
1621+
(namesVisibleInPreviousScope ifNil: [ currentlyVisibleNames ])
1622+
to: currentlyVisibleNames ].
16211623
p update ].
16221624

1623-
previousASTScope := currentASTScope
1625+
namesVisibleInPreviousScope := currentlyVisibleNames
16241626
]
16251627

16261628
{ #category : 'toolbar' }

src/NewTools-Debugger/StDebuggerContext.class.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ StDebuggerContext >> stackTopNode [
161161
{ #category : 'nodes' }
162162
StDebuggerContext >> temporaryVariablesNodes [
163163

164-
^ self context temporaryVariables collect: [ :temp |
165-
(StInspectorNewTempNode hostObject: self context) tempDescriptor: temp ]
164+
^ self context temporaryVariableNames collect: [ :arg1 |
165+
(StInspectorNewTempNode hostObject: self context) tempName: arg1 ]
166166
]
167167

168168
{ #category : 'nodes' }

src/NewTools-Debugger/StRawInspectionPresenter.extension.st

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,14 @@ StRawInspectionPresenter >> updateNodesFromScope: oldTemps to: newTemps [
5050
tempsToRemove := oldTemps difference: newTemps.
5151
tempsToAdd := newTemps difference: oldTemps.
5252
nodes := self attributeTable roots.
53-
5453
nodes removeAllSuchThat: [ :node |
55-
node class = StInspectorTempNode and: [
56-
tempsToRemove includes: node tempVariable ] ].
54+
node class = StInspectorNewTempNode and: [
55+
tempsToRemove includes: node tempName ] ].
5756
tempsToAdd do: [ :temp |
5857
nodes add:
59-
((StInspectorTempNode hostObject:
58+
((StInspectorNewTempNode hostObject:
6059
self model inspectedObject context)
61-
tempVariable: temp;
60+
tempName: temp;
6261
yourself) ].
6362

6463
self attributeTable roots: nodes

src/NewTools-Inspector/StInspectorNewTempNode.class.st

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Class {
77
#superclass : 'StInspectorNode',
88
#instVars : [
99
'debugInfo',
10-
'tempDescriptor'
10+
'tempName'
1111
],
1212
#category : 'NewTools-Inspector-Model',
1313
#package : 'NewTools-Inspector',
@@ -17,12 +17,10 @@ Class {
1717
{ #category : 'comparing' }
1818
StInspectorNewTempNode >> = anObject [
1919

20-
"Answer whether the receiver and anObject represent the same object."
21-
2220
self == anObject ifTrue: [ ^ true ].
21+
nil.
2322
self class = anObject class ifFalse: [ ^ false ].
24-
^ tempDescriptor = anObject name and: [
25-
hostObject = anObject hostObject ]
23+
^ tempName = anObject tempName and: [ hostObject = anObject hostObject ]
2624
]
2725

2826
{ #category : 'accessing' }
@@ -42,12 +40,19 @@ StInspectorNewTempNode >> debugInfo: anObject [
4240
debugInfo := anObject
4341
]
4442

43+
{ #category : 'accessing' }
44+
StInspectorNewTempNode >> debugScope [
45+
46+
^ debugInfo debugScopeAt:
47+
(self hostObject executedPC max: self hostObject method initialPC)
48+
]
49+
4550
{ #category : 'comparing' }
4651
StInspectorNewTempNode >> hash [
4752

4853
"Answer an integer value that is related to the identity of the receiver."
4954

50-
^ tempDescriptor hash bitXor: (hostObject hash)
55+
^ tempName hash bitXor: (hostObject hash)
5156
]
5257

5358
{ #category : 'accessing' }
@@ -60,7 +65,7 @@ StInspectorNewTempNode >> hostObject: aContext [
6065
{ #category : 'accessing' }
6166
StInspectorNewTempNode >> isArgumentVariable [
6267

63-
^ tempDescriptor second
68+
^ self debugScope isArgumentNamed: tempName
6469
]
6570

6671
{ #category : 'accessing' }
@@ -71,28 +76,28 @@ StInspectorNewTempNode >> isTempVariable [
7176

7277
{ #category : 'accessing' }
7378
StInspectorNewTempNode >> key [
74-
^ tempDescriptor first
79+
80+
^ tempName
7581
]
7682

7783
{ #category : 'accessing' }
7884
StInspectorNewTempNode >> rawValue [
79-
"Answer the object value of this object variable (slot, indexed attribute, computed value)."
8085

81-
| scope |
82-
scope := (debugInfo debugScopeAt: (self hostObject executedPC max: self hostObject method initialPC)).
83-
^ scope readVariableNamed: tempDescriptor first at: self hostObject
86+
^ self debugScope
87+
readVariableNamed: tempName
88+
fromContext: self hostObject
8489
]
8590

8691
{ #category : 'accessing' }
87-
StInspectorNewTempNode >> tempDescriptor [
92+
StInspectorNewTempNode >> tempName [
8893

89-
^ tempDescriptor
94+
^ tempName
9095
]
9196

9297
{ #category : 'accessing' }
93-
StInspectorNewTempNode >> tempDescriptor: anObject [
98+
StInspectorNewTempNode >> tempName: anObject [
9499

95-
tempDescriptor := anObject
100+
tempName := anObject
96101
]
97102

98103
{ #category : 'accessing' }

0 commit comments

Comments
 (0)