1. 解决设置异常断点后不显示断点问题

This commit is contained in:
xuhong 2023-09-21 19:01:55 +08:00
parent 29d4b36587
commit 21a95aef96
3 changed files with 16 additions and 5 deletions

View File

@ -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 {

View File

@ -608,7 +608,7 @@ export class MI2 extends EventEmitter implements IBackend {
setBreakPointCondition(bkptNum, condition): Thenable<any> {
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<any> {
@ -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) => {

View File

@ -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());