@@ -76,6 +76,7 @@ export class RawDebugSession implements IDisposable {
76
76
// DA events
77
77
private readonly _onDidExitAdapter = new Emitter < AdapterEndEvent > ( ) ;
78
78
private debugAdapter : IDebugAdapter | null ;
79
+ private stoppedSinceLastStep = false ;
79
80
80
81
private toDispose : IDisposable [ ] = [ ] ;
81
82
@@ -122,6 +123,7 @@ export class RawDebugSession implements IDisposable {
122
123
break ;
123
124
case 'stopped' :
124
125
this . didReceiveStoppedEvent = true ; // telemetry: remember that debugger stopped successfully
126
+ this . stoppedSinceLastStep = true ;
125
127
this . _onDidStop . fire ( < DebugProtocol . StoppedEvent > event ) ;
126
128
break ;
127
129
case 'continued' :
@@ -326,29 +328,41 @@ export class RawDebugSession implements IDisposable {
326
328
}
327
329
328
330
async next ( args : DebugProtocol . NextArguments ) : Promise < DebugProtocol . NextResponse | undefined > {
331
+ this . stoppedSinceLastStep = false ;
329
332
const response = await this . send ( 'next' , args ) ;
330
- this . fireSimulatedContinuedEvent ( args . threadId ) ;
333
+ if ( ! this . stoppedSinceLastStep ) {
334
+ this . fireSimulatedContinuedEvent ( args . threadId ) ;
335
+ }
331
336
return response ;
332
337
}
333
338
334
339
async stepIn ( args : DebugProtocol . StepInArguments ) : Promise < DebugProtocol . StepInResponse | undefined > {
340
+ this . stoppedSinceLastStep = false ;
335
341
const response = await this . send ( 'stepIn' , args ) ;
336
- this . fireSimulatedContinuedEvent ( args . threadId ) ;
342
+ if ( ! this . stoppedSinceLastStep ) {
343
+ this . fireSimulatedContinuedEvent ( args . threadId ) ;
344
+ }
337
345
return response ;
338
346
}
339
347
340
348
async stepOut ( args : DebugProtocol . StepOutArguments ) : Promise < DebugProtocol . StepOutResponse | undefined > {
349
+ this . stoppedSinceLastStep = false ;
341
350
const response = await this . send ( 'stepOut' , args ) ;
342
- this . fireSimulatedContinuedEvent ( args . threadId ) ;
351
+ if ( ! this . stoppedSinceLastStep ) {
352
+ this . fireSimulatedContinuedEvent ( args . threadId ) ;
353
+ }
343
354
return response ;
344
355
}
345
356
346
357
async continue ( args : DebugProtocol . ContinueArguments ) : Promise < DebugProtocol . ContinueResponse | undefined > {
358
+ this . stoppedSinceLastStep = false ;
347
359
const response = await this . send < DebugProtocol . ContinueResponse > ( 'continue' , args ) ;
348
360
if ( response && response . body && response . body . allThreadsContinued !== undefined ) {
349
361
this . allThreadsContinued = response . body . allThreadsContinued ;
350
362
}
351
- this . fireSimulatedContinuedEvent ( args . threadId , this . allThreadsContinued ) ;
363
+ if ( ! this . stoppedSinceLastStep ) {
364
+ this . fireSimulatedContinuedEvent ( args . threadId , this . allThreadsContinued ) ;
365
+ }
352
366
353
367
return response ;
354
368
}
@@ -380,8 +394,11 @@ export class RawDebugSession implements IDisposable {
380
394
381
395
async restartFrame ( args : DebugProtocol . RestartFrameArguments , threadId : number ) : Promise < DebugProtocol . RestartFrameResponse | undefined > {
382
396
if ( this . capabilities . supportsRestartFrame ) {
397
+ this . stoppedSinceLastStep = false ;
383
398
const response = await this . send ( 'restartFrame' , args ) ;
384
- this . fireSimulatedContinuedEvent ( threadId ) ;
399
+ if ( ! this . stoppedSinceLastStep ) {
400
+ this . fireSimulatedContinuedEvent ( threadId ) ;
401
+ }
385
402
return response ;
386
403
}
387
404
return Promise . reject ( new Error ( 'restartFrame not supported' ) ) ;
@@ -484,17 +501,23 @@ export class RawDebugSession implements IDisposable {
484
501
485
502
async stepBack ( args : DebugProtocol . StepBackArguments ) : Promise < DebugProtocol . StepBackResponse | undefined > {
486
503
if ( this . capabilities . supportsStepBack ) {
504
+ this . stoppedSinceLastStep = false ;
487
505
const response = await this . send ( 'stepBack' , args ) ;
488
- this . fireSimulatedContinuedEvent ( args . threadId ) ;
506
+ if ( ! this . stoppedSinceLastStep ) {
507
+ this . fireSimulatedContinuedEvent ( args . threadId ) ;
508
+ }
489
509
return response ;
490
510
}
491
511
return Promise . reject ( new Error ( 'stepBack not supported' ) ) ;
492
512
}
493
513
494
514
async reverseContinue ( args : DebugProtocol . ReverseContinueArguments ) : Promise < DebugProtocol . ReverseContinueResponse | undefined > {
495
515
if ( this . capabilities . supportsStepBack ) {
516
+ this . stoppedSinceLastStep = false ;
496
517
const response = await this . send ( 'reverseContinue' , args ) ;
497
- this . fireSimulatedContinuedEvent ( args . threadId ) ;
518
+ if ( ! this . stoppedSinceLastStep ) {
519
+ this . fireSimulatedContinuedEvent ( args . threadId ) ;
520
+ }
498
521
return response ;
499
522
}
500
523
return Promise . reject ( new Error ( 'reverseContinue not supported' ) ) ;
@@ -509,8 +532,11 @@ export class RawDebugSession implements IDisposable {
509
532
510
533
async goto ( args : DebugProtocol . GotoArguments ) : Promise < DebugProtocol . GotoResponse | undefined > {
511
534
if ( this . capabilities . supportsGotoTargetsRequest ) {
535
+ this . stoppedSinceLastStep = false ;
512
536
const response = await this . send ( 'goto' , args ) ;
513
- this . fireSimulatedContinuedEvent ( args . threadId ) ;
537
+ if ( ! this . stoppedSinceLastStep ) {
538
+ this . fireSimulatedContinuedEvent ( args . threadId ) ;
539
+ }
514
540
return response ;
515
541
}
516
542
0 commit comments