File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -690,6 +690,12 @@ export class MI2 extends EventEmitter implements IBackend {
690690 return this . sendCommand ( `var-update --all-values ${ name } ` )
691691 }
692692
693+ async varAssign ( name : string , rawValue : string ) : Promise < MINode > {
694+ if ( trace )
695+ this . log ( "stderr" , "varAssign" ) ;
696+ return this . sendCommand ( `var-assign ${ name } ${ rawValue } ` ) ;
697+ }
698+
693699 logNoNewLine ( type : string , msg : string ) {
694700 this . emit ( "msg" , type , msg ) ;
695701 }
Original file line number Diff line number Diff line change @@ -130,15 +130,23 @@ export class MI2DebugSession extends DebugSession {
130130 this . sendResponse ( response ) ;
131131 }
132132
133- protected setVariableRequest ( response : DebugProtocol . SetVariableResponse , args : DebugProtocol . SetVariableArguments ) : void {
134- this . miDebugger . changeVariable ( args . name , args . value ) . then ( ( ) => {
133+ protected async setVariableRequest ( response : DebugProtocol . SetVariableResponse , args : DebugProtocol . SetVariableArguments ) : Promise < void > {
134+ try {
135+ let name = args . name ;
136+ if ( args . variablesReference >= VAR_HANDLES_START ) {
137+ const parent = this . variableHandles . get ( args . variablesReference ) as VariableObject ;
138+ name = `${ parent . name } .${ name } ` ;
139+ }
140+
141+ let res = await this . miDebugger . varAssign ( name , args . value ) ;
135142 response . body = {
136- value : args . value
143+ value : res . result ( " value" )
137144 } ;
138145 this . sendResponse ( response ) ;
139- } , err => {
146+ }
147+ catch ( err ) {
140148 this . sendErrorResponse ( response , 11 , `Could not continue: ${ err } ` ) ;
141- } ) ;
149+ } ;
142150 }
143151
144152 protected setFunctionBreakPointsRequest ( response : DebugProtocol . SetFunctionBreakpointsResponse , args : DebugProtocol . SetFunctionBreakpointsArguments ) : void {
You can’t perform that action at this time.
0 commit comments