@@ -32,7 +32,6 @@ export default class LiveInstrumentRemote {
32
32
breakpointIdToInstrumentIds : Map < string , string [ ] > = new Map < string , string [ ] > ( ) ;
33
33
instrumentCache : Map < string , CachedInstrument > = new Map < string , CachedInstrument > ( ) ;
34
34
eventBus : EventBus ;
35
- pendingBreakpoints : Map < string , Promise < string > > = new Map < string , Promise < string > > ( ) ;
36
35
37
36
constructor ( eventBus : EventBus ) {
38
37
this . eventBus = eventBus ;
@@ -147,6 +146,7 @@ export default class LiveInstrumentRemote {
147
146
if ( data [ i ] . success ) {
148
147
let instrument = instruments [ i ] ;
149
148
if ( ! instrument ) {
149
+ debugLog ( `Instrument ${ instrumentIds [ i ] } not found` ) ;
150
150
continue ;
151
151
}
152
152
@@ -225,26 +225,23 @@ export default class LiveInstrumentRemote {
225
225
226
226
private async setBreakpoint ( scriptId : string , line : number ) : Promise < string > {
227
227
debugLog ( `Setting breakpoint at ${ scriptId } :${ line } ` ) ;
228
- if ( this . pendingBreakpoints . has ( scriptId + ':' + line ) ) {
229
- return this . pendingBreakpoints . get ( scriptId + ':' + line ) ;
230
- }
231
- let promise = new Promise < string > ( ( resolve , reject ) => this . session . post ( "Debugger.setBreakpoint" , {
228
+ return new Promise < string > ( ( resolve , reject ) => this . session . post ( "Debugger.setBreakpoint" , {
232
229
location : {
233
230
scriptId : scriptId ,
234
231
lineNumber : line
235
232
}
236
233
} , ( err , res ) => {
237
234
if ( err ) {
235
+ debugLog ( `Error setting breakpoint at ${ scriptId } :${ line } : ${ err } ` ) ;
238
236
reject ( err ) ;
239
237
} else {
240
238
resolve ( res . breakpointId ) ;
241
239
}
242
240
} ) ) ;
243
- this . pendingBreakpoints . set ( scriptId + ':' + line , promise ) ;
244
- return promise ;
245
241
}
246
242
247
243
private removeBreakpoint ( breakpointId : string ) {
244
+ debugLog ( `Removing breakpoint ${ breakpointId } ` ) ;
248
245
this . breakpointIdToInstrumentIds . delete ( breakpointId ) ;
249
246
this . locationToBreakpointId . forEach ( ( value , key ) => {
250
247
if ( value === breakpointId ) {
@@ -279,15 +276,17 @@ export default class LiveInstrumentRemote {
279
276
if ( breakpointId ) {
280
277
this . breakpointIdToInstrumentIds . get ( breakpointId ) . push ( instrument . id ) ;
281
278
instrument . meta . breakpointId = breakpointId ;
282
- this . eventBus . publish ( "spp.processor.status.live-instrument-applied" , instrument . toJson ( ) )
279
+ this . eventBus . publish ( "spp.processor.status.live-instrument-applied" , instrument . toJson ( ) ) ;
280
+ debugLog ( `Applied instrument: ${ JSON . stringify ( instrument . toJson ( ) ) } ` ) ;
283
281
return ;
284
282
}
285
283
286
284
return this . setBreakpoint ( location . scriptId , location . line ) . then ( breakpointId => {
287
285
this . locationToBreakpointId . set ( location . scriptId + ":" + location . line , breakpointId ) ;
288
286
this . breakpointIdToInstrumentIds . set ( breakpointId , [ instrument . id ] ) ;
289
287
instrument . meta . breakpointId = breakpointId ;
290
- this . eventBus . publish ( "spp.processor.status.live-instrument-applied" , instrument . toJson ( ) )
288
+ this . eventBus . publish ( "spp.processor.status.live-instrument-applied" , instrument . toJson ( ) ) ;
289
+ debugLog ( `Applied instrument: ${ JSON . stringify ( instrument . toJson ( ) ) } ` ) ;
291
290
} )
292
291
}
293
292
0 commit comments