@@ -41,6 +41,7 @@ export interface JerryDebugProtocolDelegate {
4141 onBreakpointHit ?( message : JerryMessageBreakpointHit ) : void ;
4242 onEvalResult ?( subType : number , result : string ) : void ;
4343 onError ?( code : number , message : string ) : void ;
44+ onOutputResult ?( subType : number , result : string ) : void ;
4445 onResume ?( ) : void ;
4546 onScriptParsed ?( message : JerryMessageScriptParsed ) : void ;
4647}
@@ -97,6 +98,7 @@ export class JerryDebugProtocolHandler {
9798 private functionName ?: string ;
9899 private functionNameData ?: Uint8Array ;
99100 private evalResultData ?: Uint8Array ;
101+ private outputResultData ?: Uint8Array ;
100102 private functions : FunctionMap = { } ;
101103 private newFunctions : FunctionMap = { } ;
102104 private backtrace : Array < Breakpoint > = [ ] ;
@@ -135,6 +137,8 @@ export class JerryDebugProtocolHandler {
135137 [ SP . JERRY_DEBUGGER_BACKTRACE_END ] : this . onBacktrace ,
136138 [ SP . JERRY_DEBUGGER_EVAL_RESULT ] : this . onEvalResult ,
137139 [ SP . JERRY_DEBUGGER_EVAL_RESULT_END ] : this . onEvalResult ,
140+ [ SP . JERRY_DEBUGGER_OUTPUT_RESULT ] : this . onOutputResult ,
141+ [ SP . JERRY_DEBUGGER_OUTPUT_RESULT_END ] : this . onOutputResult ,
138142 } ;
139143 }
140144
@@ -489,6 +493,19 @@ export class JerryDebugProtocolHandler {
489493 }
490494 }
491495
496+ onOutputResult ( data : Uint8Array ) {
497+ this . logPacket ( 'Output Result' ) ;
498+ this . outputResultData = assembleUint8Arrays ( this . outputResultData , data ) ;
499+ if ( data [ 0 ] === SP . JERRY_DEBUGGER_OUTPUT_RESULT_END ) {
500+ const subType = data [ data . length - 1 ] ;
501+ const outputResult = cesu8ToString ( this . outputResultData . slice ( 0 , - 1 ) ) ;
502+ if ( this . delegate . onOutputResult ) {
503+ this . delegate . onOutputResult ( subType , outputResult ) ;
504+ }
505+ this . outputResultData = undefined ;
506+ }
507+ }
508+
492509 onMessage ( message : Uint8Array ) {
493510 if ( message . byteLength < 1 ) {
494511 this . abort ( 'message too short' ) ;
0 commit comments