11/**
2- * Copyright 2026 Arm Limited
2+ * Copyright 2025- 2026 Arm Limited
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@ import { ComponentViewerTreeDataProvider } from './component-viewer-tree-view';
2222
2323
2424export class ComponentViewer {
25- private activeSession : GDBTargetDebugSession | undefined ;
26- private instances : ComponentViewerInstance [ ] = [ ] ;
27- private componentViewerTreeDataProvider : ComponentViewerTreeDataProvider | undefined ;
25+ private _activeSession : GDBTargetDebugSession | undefined ;
26+ private _instances : ComponentViewerInstance [ ] = [ ] ;
27+ private _componentViewerTreeDataProvider : ComponentViewerTreeDataProvider | undefined ;
2828 private _context : vscode . ExtensionContext ;
2929 private _instanceUpdateCounter : number = 0 ;
3030 private _updateSemaphoreFlag : boolean = false ;
@@ -36,8 +36,8 @@ export class ComponentViewer {
3636
3737 public activate ( tracker : GDBTargetDebugTracker ) : void {
3838 /* Create Tree Viewer */
39- this . componentViewerTreeDataProvider = new ComponentViewerTreeDataProvider ( ) ;
40- const treeProviderDisposable = vscode . window . registerTreeDataProvider ( 'cmsis-debugger.componentViewer' , this . componentViewerTreeDataProvider ) ;
39+ this . _componentViewerTreeDataProvider = new ComponentViewerTreeDataProvider ( ) ;
40+ const treeProviderDisposable = vscode . window . registerTreeDataProvider ( 'cmsis-debugger.componentViewer' , this . _componentViewerTreeDataProvider ) ;
4141 this . _context . subscriptions . push (
4242 treeProviderDisposable ) ;
4343 // Subscribe to debug tracker events to update active session
@@ -60,12 +60,12 @@ export class ComponentViewer {
6060 const cbuildRunInstances : ComponentViewerInstance [ ] = [ ] ;
6161 for ( const scvdFilePath of scvdFilesPaths ) {
6262 const instance = new ComponentViewerInstance ( ) ;
63- if ( this . activeSession !== undefined ) {
64- await instance . readModel ( URI . file ( scvdFilePath ) , this . activeSession , tracker ) ;
63+ if ( this . _activeSession !== undefined ) {
64+ await instance . readModel ( URI . file ( scvdFilePath ) , this . _activeSession , tracker ) ;
6565 cbuildRunInstances . push ( instance ) ;
6666 }
6767 }
68- this . instances = cbuildRunInstances ;
68+ this . _instances = cbuildRunInstances ;
6969 }
7070
7171 private async loadCbuildRunInstances ( session : GDBTargetDebugSession , tracker : GDBTargetDebugTracker ) : Promise < void > {
@@ -74,8 +74,8 @@ export class ComponentViewer {
7474 // Try to read SCVD files from cbuild-run file first
7575 await this . readScvdFiles ( tracker , session ) ;
7676 // Are there any SCVD files found in cbuild-run?
77- if ( this . instances . length > 0 ) {
78- // await this.updateInstances();
77+ if ( this . _instances . length > 0 ) {
78+ await this . updateInstances ( ) ;
7979 return ;
8080 }
8181 }
@@ -93,50 +93,50 @@ export class ComponentViewer {
9393 const onDidChangeActiveDebugSessionDisposable = tracker . onDidChangeActiveDebugSession ( async ( session ) => {
9494 await this . handleOnDidChangeActiveDebugSession ( session ) ;
9595 } ) ;
96- const onStackTrace = tracker . onStackTrace ( async ( session ) => {
97- await this . handleOnStackTrace ( session . session ) ;
96+ const onStopped = tracker . onStopped ( async ( session ) => {
97+ await this . handleOnStopped ( session . session ) ;
9898 } ) ;
9999 // clear all disposables on extension deactivation
100100 context . subscriptions . push (
101101 onWillStopSessionDisposable ,
102102 onConnectedDisposable ,
103103 onDidChangeActiveStackItemDisposable ,
104104 onDidChangeActiveDebugSessionDisposable ,
105- onStackTrace
105+ onStopped
106106 ) ;
107107 }
108108
109- private async handleOnStackTrace ( session : GDBTargetDebugSession ) : Promise < void > {
109+ private async handleOnStopped ( session : GDBTargetDebugSession ) : Promise < void > {
110110 // Clear active session if it is NOT the one being stopped
111- if ( this . activeSession ?. session . id !== session . session . id ) {
112- this . activeSession = undefined ;
111+ if ( this . _activeSession ?. session . id !== session . session . id ) {
112+ this . _activeSession = undefined ;
113113 }
114114 // Update component viewer instance(s)
115115 await this . updateInstances ( ) ;
116116 }
117117
118118 private async handleOnWillStopSession ( session : GDBTargetDebugSession ) : Promise < void > {
119119 // Clear active session if it is the one being stopped
120- if ( this . activeSession ?. session . id === session . session . id ) {
121- this . activeSession = undefined ;
120+ if ( this . _activeSession ?. session . id === session . session . id ) {
121+ this . _activeSession = undefined ;
122122 }
123123 // Update component viewer instance(s)
124- // await this.updateInstances();
124+ await this . updateInstances ( ) ;
125125 }
126126
127127 private async handleOnConnected ( session : GDBTargetDebugSession , tracker : GDBTargetDebugTracker ) : Promise < void > {
128128 // if new session is not the current active session, erase old instances and read the new ones
129- if ( this . activeSession ?. session . id !== session . session . id ) {
130- this . instances = [ ] ;
131- this . componentViewerTreeDataProvider ?. deleteModels ( ) ;
129+ if ( this . _activeSession ?. session . id !== session . session . id ) {
130+ this . _instances = [ ] ;
131+ this . _componentViewerTreeDataProvider ?. deleteModels ( ) ;
132132 }
133133 // Update debug session
134- this . activeSession = session ;
134+ this . _activeSession = session ;
135135 // Load SCVD files from cbuild-run
136136 await this . loadCbuildRunInstances ( session , tracker ) ;
137137 // Subscribe to refresh events of the started session
138138 session . refreshTimer . onRefresh ( async ( refreshSession ) => {
139- if ( this . activeSession ?. session . id === refreshSession . session . id ) {
139+ if ( this . _activeSession ?. session . id === refreshSession . session . id ) {
140140 // Update component viewer instance(s)
141141 await this . updateInstances ( ) ;
142142 }
@@ -146,13 +146,13 @@ export class ComponentViewer {
146146 private async handleOnDidChangeActiveStackItem ( stackTraceItem : SessionStackItem ) : Promise < void > {
147147 if ( ( stackTraceItem . item as vscode . DebugStackFrame ) . frameId !== undefined ) {
148148 // Update instance(s) with new stack frame info
149- // await this.updateInstances();
149+ await this . updateInstances ( ) ;
150150 }
151151 }
152152
153153 private async handleOnDidChangeActiveDebugSession ( session : GDBTargetDebugSession | undefined ) : Promise < void > {
154154 // Update debug session
155- this . activeSession = session ;
155+ this . _activeSession = session ;
156156 // Update component viewer instance(s)
157157 await this . updateInstances ( ) ;
158158 }
@@ -163,23 +163,23 @@ export class ComponentViewer {
163163 }
164164 this . _updateSemaphoreFlag = true ;
165165 this . _instanceUpdateCounter = 0 ;
166- if ( ! this . activeSession ) {
167- this . componentViewerTreeDataProvider ?. deleteModels ( ) ;
166+ if ( ! this . _activeSession ) {
167+ this . _componentViewerTreeDataProvider ?. deleteModels ( ) ;
168168 this . _updateSemaphoreFlag = false ;
169169 return ;
170170 }
171- if ( this . instances . length === 0 ) {
171+ if ( this . _instances . length === 0 ) {
172172 this . _updateSemaphoreFlag = false ;
173173 return ;
174174 }
175- this . componentViewerTreeDataProvider ?. resetModelCache ( ) ;
176- for ( const instance of this . instances ) {
175+ this . _componentViewerTreeDataProvider ?. resetModelCache ( ) ;
176+ for ( const instance of this . _instances ) {
177177 this . _instanceUpdateCounter ++ ;
178178 console . log ( `Updating Component Viewer Instance #${ this . _instanceUpdateCounter } ` ) ;
179179 await instance . update ( ) ;
180- this . componentViewerTreeDataProvider ?. addGuiOut ( instance . getGuiTree ( ) ) ;
180+ this . _componentViewerTreeDataProvider ?. addGuiOut ( instance . getGuiTree ( ) ) ;
181181 }
182- this . componentViewerTreeDataProvider ?. showModelData ( ) ;
182+ this . _componentViewerTreeDataProvider ?. showModelData ( ) ;
183183 this . _updateSemaphoreFlag = false ;
184184 }
185185}
0 commit comments