@@ -166,7 +166,7 @@ export class BreakpointGroups {
166
166
//功能和disableCurrentBreakpointGroupBreakpoints有重合。
167
167
//断点被触发时会调用该函数。如果空间发生变化(如kernel=>'src/bin/initproc.rs')
168
168
//缓存旧空间的断点,令GDB清除旧断点组的断点,卸载旧断点组的符号表文件,加载新断点组的符号表文件,加载新断点组的断点
169
- public updateCurrentBreakpointGroup ( updateTo : string ) {
169
+ public updateCurrentBreakpointGroup ( updateTo : string , continueAfterUpdate : boolean = false ) {
170
170
let newIndex = - 1 ;
171
171
for ( let i = 0 ; i < this . groups . length ; i ++ ) {
172
172
if ( this . groups [ i ] . name === updateTo ) {
@@ -201,8 +201,8 @@ export class BreakpointGroups {
201
201
this . debugSession . miDebugger . addSymbolFile ( f ) ;
202
202
}
203
203
204
- this . groups [ newIndex ] . setBreakpointsArguments . forEach ( ( args ) => {
205
- this . debugSession . miDebugger . clearBreakPoints ( args . source . path ) . then (
204
+ const breakpointPromises = this . groups [ newIndex ] . setBreakpointsArguments . map ( ( args ) => {
205
+ return this . debugSession . miDebugger . clearBreakPoints ( args . source . path ) . then (
206
206
( ) => {
207
207
let path = args . source . path ;
208
208
if ( this . debugSession . isSSH ) {
@@ -218,12 +218,20 @@ export class BreakpointGroups {
218
218
logMessage : brk . logMessage
219
219
} ) ;
220
220
} ) ;
221
+ return Promise . all ( all ) ;
221
222
} ,
222
223
( msg ) => {
223
224
//TODO
224
225
}
225
226
) ;
226
227
} ) ;
228
+
229
+ Promise . all ( breakpointPromises ) . then ( ( ) => {
230
+ if ( continueAfterUpdate ) {
231
+ this . debugSession . miDebugger . continue ( ) ;
232
+ }
233
+ } ) ;
234
+
227
235
this . currentBreakpointGroupName = this . groups [ newIndex ] . name ;
228
236
this . debugSession . showInformationMessage ( "breakpoint group changed to " + updateTo ) ;
229
237
}
@@ -1370,7 +1378,7 @@ example: {"token":43,"outOfBandRecord":[],"resultRecords":{"resultClass":"done",
1370
1378
}
1371
1379
1372
1380
public async getStringVariable ( name :string ) :Promise < string > {
1373
- const node = await this . miDebugger . sendCliCommand ( 'x /s ' + name ) ;
1381
+ const node = await this . miDebugger . sendCliCommand ( 'print ' + name ) ; // x /s may work
1374
1382
const resultstring = this . miDebugger . getOriginallyNoTokenMINodes ( node . token ) [ 0 ] . outOfBandRecord [ 0 ] . content ;
1375
1383
this . showInformationMessage ( "`getStringVariable` got string: " + resultstring ) ;
1376
1384
return / " ( .* ?) " / . exec ( resultstring ) [ 1 ] ; // we want things INSIDE double quotes so it's [1], the first captured group.
@@ -1490,13 +1498,13 @@ example: {"token":43,"outOfBandRecord":[],"resultRecords":{"resultClass":"done",
1490
1498
}
1491
1499
else if ( action . type === DebuggerActions . high_level_switch_breakpoint_group_to_low_level ) { //for example, user to kernel
1492
1500
const high_level_breakpoint_group_name = this . breakpointGroups . getCurrentBreakpointGroupName ( ) ;
1493
- this . breakpointGroups . updateCurrentBreakpointGroup ( this . breakpointGroups . getNextBreakpointGroup ( ) ) ;
1501
+ this . breakpointGroups . updateCurrentBreakpointGroup ( this . breakpointGroups . getNextBreakpointGroup ( ) , true ) ;
1494
1502
this . breakpointGroups . setNextBreakpointGroup ( high_level_breakpoint_group_name ) ; // if a hook is triggered during low level execution, NextBreakpointGroup will be set to the return value of hook behavior function.
1495
1503
}
1496
1504
else if ( action . type === DebuggerActions . low_level_switch_breakpoint_group_to_high_level ) { //for example, kernel to user
1497
1505
const low_level_breakpoint_group_name = this . breakpointGroups . getCurrentBreakpointGroupName ( ) ;
1498
1506
const high_level_breakpoint_group_name = this . breakpointGroups . getNextBreakpointGroup ( ) ;
1499
- this . breakpointGroups . updateCurrentBreakpointGroup ( high_level_breakpoint_group_name ) ;
1507
+ this . breakpointGroups . updateCurrentBreakpointGroup ( high_level_breakpoint_group_name , true ) ;
1500
1508
this . breakpointGroups . setNextBreakpointGroup ( low_level_breakpoint_group_name ) ;
1501
1509
}
1502
1510
0 commit comments