@@ -32,7 +32,6 @@ export default class LiveInstrumentRemote {
3232 breakpointIdToInstrumentIds : Map < string , string [ ] > = new Map < string , string [ ] > ( ) ;
3333 instrumentCache : Map < string , CachedInstrument > = new Map < string , CachedInstrument > ( ) ;
3434 eventBus : EventBus ;
35- pendingBreakpoints : Map < string , Promise < string > > = new Map < string , Promise < string > > ( ) ;
3635
3736 constructor ( eventBus : EventBus ) {
3837 this . eventBus = eventBus ;
@@ -147,6 +146,7 @@ export default class LiveInstrumentRemote {
147146 if ( data [ i ] . success ) {
148147 let instrument = instruments [ i ] ;
149148 if ( ! instrument ) {
149+ debugLog ( `Instrument ${ instrumentIds [ i ] } not found` ) ;
150150 continue ;
151151 }
152152
@@ -225,26 +225,23 @@ export default class LiveInstrumentRemote {
225225
226226 private async setBreakpoint ( scriptId : string , line : number ) : Promise < string > {
227227 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" , {
232229 location : {
233230 scriptId : scriptId ,
234231 lineNumber : line
235232 }
236233 } , ( err , res ) => {
237234 if ( err ) {
235+ debugLog ( `Error setting breakpoint at ${ scriptId } :${ line } : ${ err } ` ) ;
238236 reject ( err ) ;
239237 } else {
240238 resolve ( res . breakpointId ) ;
241239 }
242240 } ) ) ;
243- this . pendingBreakpoints . set ( scriptId + ':' + line , promise ) ;
244- return promise ;
245241 }
246242
247243 private removeBreakpoint ( breakpointId : string ) {
244+ debugLog ( `Removing breakpoint ${ breakpointId } ` ) ;
248245 this . breakpointIdToInstrumentIds . delete ( breakpointId ) ;
249246 this . locationToBreakpointId . forEach ( ( value , key ) => {
250247 if ( value === breakpointId ) {
@@ -279,15 +276,17 @@ export default class LiveInstrumentRemote {
279276 if ( breakpointId ) {
280277 this . breakpointIdToInstrumentIds . get ( breakpointId ) . push ( instrument . id ) ;
281278 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 ( ) ) } ` ) ;
283281 return ;
284282 }
285283
286284 return this . setBreakpoint ( location . scriptId , location . line ) . then ( breakpointId => {
287285 this . locationToBreakpointId . set ( location . scriptId + ":" + location . line , breakpointId ) ;
288286 this . breakpointIdToInstrumentIds . set ( breakpointId , [ instrument . id ] ) ;
289287 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 ( ) ) } ` ) ;
291290 } )
292291 }
293292
0 commit comments