@@ -44,7 +44,7 @@ export interface ParserStackFrame {
44
44
45
45
export interface JerryDebugProtocolDelegate {
46
46
onBacktrace ?( backtrace : Array < Breakpoint > ) : void ;
47
- onBreakpointHit ?( message : JerryMessageBreakpointHit ) : void ;
47
+ onBreakpointHit ?( message : JerryMessageBreakpointHit , stopType : string ) : void ;
48
48
onExceptionHit ?( message : JerryMessageExceptionHit ) : void ;
49
49
onEvalResult ?( subType : number , result : string ) : void ;
50
50
onError ?( code : number , message : string ) : void ;
@@ -98,6 +98,10 @@ interface ParsedSource {
98
98
source ?: string ;
99
99
}
100
100
101
+ interface StopTypeMap {
102
+ [ type : number ] : string ;
103
+ }
104
+
101
105
class PendingRequest {
102
106
public data : Uint8Array ;
103
107
public promise : Promise < any > ;
@@ -153,6 +157,8 @@ export class JerryDebugProtocolHandler {
153
157
private log : LoggerFunction ;
154
158
private requestQueue : PendingRequest [ ] ;
155
159
private currentRequest : PendingRequest ;
160
+ private stopTypeMap : StopTypeMap ;
161
+ private lastStopType : number ;
156
162
157
163
constructor ( delegate : JerryDebugProtocolDelegate , log ?: LoggerFunction ) {
158
164
this . delegate = delegate ;
@@ -189,6 +195,15 @@ export class JerryDebugProtocolHandler {
189
195
190
196
this . requestQueue = [ ] ;
191
197
this . currentRequest = null ;
198
+
199
+ this . stopTypeMap = {
200
+ [ SP . CLIENT . JERRY_DEBUGGER_NEXT ] : 'step' ,
201
+ [ SP . CLIENT . JERRY_DEBUGGER_STEP ] : 'step-in' ,
202
+ [ SP . CLIENT . JERRY_DEBUGGER_FINISH ] : 'step-out' ,
203
+ [ SP . CLIENT . JERRY_DEBUGGER_CONTINUE ] : 'continue' ,
204
+ [ SP . CLIENT . JERRY_DEBUGGER_STOP ] : 'pause' ,
205
+ } ;
206
+ this . lastStopType = null ;
192
207
}
193
208
194
209
// FIXME: this lets test suite run for now
@@ -213,6 +228,8 @@ export class JerryDebugProtocolHandler {
213
228
if ( this . lastBreakpointHit ) {
214
229
return Promise . reject ( new Error ( 'attempted pause while at breakpoint' ) ) ;
215
230
}
231
+
232
+ this . lastStopType = SP . CLIENT . JERRY_DEBUGGER_STOP ;
216
233
return this . sendSimpleRequest ( encodeMessage ( this . byteConfig , 'B' , [ SP . CLIENT . JERRY_DEBUGGER_STOP ] ) ) ;
217
234
}
218
235
@@ -516,8 +533,12 @@ export class JerryDebugProtocolHandler {
516
533
}
517
534
518
535
if ( this . delegate . onBreakpointHit ) {
519
- this . delegate . onBreakpointHit ( breakpointRef ) ;
536
+ const stopTypeText = this . stopTypeMap [ this . lastStopType ] || 'entry' ;
537
+ const stopType = `${ breakpoint . activeIndex === - 1 ? 'inactive ' : '' } breakpoint (${ stopTypeText } )` ;
538
+ this . delegate . onBreakpointHit ( breakpointRef , stopType ) ;
520
539
}
540
+
541
+ this . lastStopType = null ;
521
542
}
522
543
523
544
public onBacktrace ( data : Uint8Array ) : Breakpoint [ ] {
@@ -721,6 +742,7 @@ export class JerryDebugProtocolHandler {
721
742
}
722
743
723
744
this . lastBreakpointHit = undefined ;
745
+ this . lastStopType = code ;
724
746
const result = this . sendSimpleRequest ( encodeMessage ( this . byteConfig , 'B' , [ code ] ) ) ;
725
747
726
748
if ( this . delegate . onResume ) {
0 commit comments