From 21a95aef96ba71efad2e799ce441d01d6a5d08bf Mon Sep 17 00:00:00 2001 From: xuhong Date: Thu, 21 Sep 2023 19:01:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=A7=A3=E5=86=B3=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=96=AD=E7=82=B9=E5=90=8E=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=96=AD=E7=82=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/backend.ts | 2 ++ src/backend/mi2/mi2.ts | 12 +++++++++--- src/mibase.ts | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/backend/backend.ts b/src/backend/backend.ts index 5e88937..696f293 100644 --- a/src/backend/backend.ts +++ b/src/backend/backend.ts @@ -4,12 +4,14 @@ import { DebugProtocol } from "vscode-debugprotocol/lib/debugProtocol"; export type ValuesFormattingMode = "disabled" | "parseText" | "prettyPrinters"; export interface Breakpoint { + id?:number; file?: string; line?: number; raw?: string; condition: string; countCondition?: string; logMessage?: string; + message?: any; } export interface OurInstructionBreakpoint extends DebugProtocol.InstructionBreakpoint { diff --git a/src/backend/mi2/mi2.ts b/src/backend/mi2/mi2.ts index 9f98685..35b80d3 100644 --- a/src/backend/mi2/mi2.ts +++ b/src/backend/mi2/mi2.ts @@ -608,7 +608,7 @@ export class MI2 extends EventEmitter implements IBackend { setBreakPointCondition(bkptNum, condition): Thenable { if (trace) this.log("stderr", "setBreakPointCondition"); - return this.sendCommand("break-condition " + bkptNum + " " + condition); + return this.sendCommand("break-condition " + bkptNum + " " + condition, true); } setLogPoint(bkptNum, command): Thenable { @@ -662,10 +662,13 @@ export class MI2 extends EventEmitter implements IBackend { if (result.resultRecords.resultClass == "done") { const bkptNum = parseInt(result.result("bkpt.number")); const newBrk = { + id: bkptNum, file: breakpoint.file ? breakpoint.file : result.result("bkpt.file"), raw: breakpoint.raw, line: parseInt(result.result("bkpt.line")), - condition: breakpoint.condition + condition: breakpoint.condition, + message:undefined, + verified:undefined }; if (breakpoint.condition) { this.setBreakPointCondition(bkptNum, breakpoint.condition).then((result) => { @@ -675,7 +678,10 @@ export class MI2 extends EventEmitter implements IBackend { } else { resolve([false, undefined]); } - }, reject); + }, (msg)=>{ + newBrk.message = msg; + resolve([false, newBrk]); + }); } else if(breakpoint.logMessage) { this.setLogPoint(bkptNum, breakpoint.logMessage).then((result) => { diff --git a/src/mibase.ts b/src/mibase.ts index 3449eaa..26b7720 100644 --- a/src/mibase.ts +++ b/src/mibase.ts @@ -269,12 +269,15 @@ export class MI2DebugSession extends DebugSession { brkpoints.forEach(brkp => { // TODO: Currently all breakpoints returned are marked as verified, // which leads to verified breakpoints on a broken lldb. - if (brkp[0]) - finalBrks.push(new DebugAdapter.Breakpoint(true, brkp[1].line)); + let bp:any = new DebugAdapter.Breakpoint(brkp[0], brkp[1].line); + bp.id = brkp[1].id; + bp.message = brkp[1].message?.toString(); + finalBrks.push(bp); }); response.body = { breakpoints: finalBrks }; + this.handleMsg("stdout", `response: ${JSON.stringify(response)}\n`); this.sendResponse(response); }, msg => { this.sendErrorResponse(response, 9, msg.toString());