Skip to content

Commit 88d670b

Browse files
robertsipkaLaszloLango
authored andcommitted
Highlight where we stopped in the source code (#21)
The ScopesRequest will called automatically after the first StackTraceResponse. It is responsible for highlighting where we are in the code. Since the backtrace array was empty after the first response, it was not called properly. Handling the BACTRACE_TOTAL response message separately resolves this issue. IoT.js-VSCode-DCO-1.0-Signed-off-by: Robert Sipka [email protected]
1 parent 6f0e43b commit 88d670b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/JerryProtocolHandler.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class JerryDebugProtocolHandler {
192192
[SP.SERVER.JERRY_DEBUGGER_EXCEPTION_HIT]: this.onBreakpointHit,
193193
[SP.SERVER.JERRY_DEBUGGER_EXCEPTION_STR]: this.onExceptionStr,
194194
[SP.SERVER.JERRY_DEBUGGER_EXCEPTION_STR_END]: this.onExceptionStr,
195-
[SP.SERVER.JERRY_DEBUGGER_BACKTRACE_TOTAL]: this.onBacktrace,
195+
[SP.SERVER.JERRY_DEBUGGER_BACKTRACE_TOTAL]: this.onBacktraceTotal,
196196
[SP.SERVER.JERRY_DEBUGGER_BACKTRACE]: this.onBacktrace,
197197
[SP.SERVER.JERRY_DEBUGGER_BACKTRACE_END]: this.onBacktrace,
198198
[SP.SERVER.JERRY_DEBUGGER_EVAL_RESULT]: this.onEvalResult,
@@ -553,17 +553,21 @@ export class JerryDebugProtocolHandler {
553553
this.lastStopType = null;
554554
}
555555

556-
public onBacktrace(data: Uint8Array): JerryBacktraceResult {
557-
this.logPacket('Backtrace');
556+
public onBacktraceTotal(data: Uint8Array): void {
557+
this.logPacket('Backtrace Total');
558558

559559
if (data[0] === SP.SERVER.JERRY_DEBUGGER_BACKTRACE_TOTAL) {
560560
this.backtraceData.totalFrames = this.decodeMessage('I', data, 1);
561561
this.backtraceData.backtrace = [];
562-
} else {
563-
for (let i = 1; i < data.byteLength; i += this.byteConfig.cpointerSize + 4) {
564-
const breakpointData = this.decodeMessage('CI', data, i);
565-
this.backtraceData.backtrace.push(this.getBreakpoint(breakpointData).breakpoint);
566-
}
562+
}
563+
}
564+
565+
public onBacktrace(data: Uint8Array): JerryBacktraceResult {
566+
this.logPacket('Backtrace');
567+
568+
for (let i = 1; i < data.byteLength; i += this.byteConfig.cpointerSize + 4) {
569+
const breakpointData = this.decodeMessage('CI', data, i);
570+
this.backtraceData.backtrace.push(this.getBreakpoint(breakpointData).breakpoint);
567571
}
568572

569573
if (data[0] === SP.SERVER.JERRY_DEBUGGER_BACKTRACE_END) {

0 commit comments

Comments
 (0)