support breakpoint hit count
This commit is contained in:
parent
2f2d0294f4
commit
c7370d894a
7 changed files with 27 additions and 10 deletions
|
|
@ -13,7 +13,7 @@
|
||||||
"publisher": "webfreak",
|
"publisher": "webfreak",
|
||||||
"icon": "images/icon-plain.svg",
|
"icon": "images/icon-plain.svg",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^0.10.10"
|
"vscode": "^1.7.2"
|
||||||
},
|
},
|
||||||
"main": "./out/src/frontend/extension",
|
"main": "./out/src/frontend/extension",
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ export interface Breakpoint {
|
||||||
line?: number;
|
line?: number;
|
||||||
raw?: string;
|
raw?: string;
|
||||||
condition: string;
|
condition: string;
|
||||||
|
countCondition?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Stack {
|
export interface Stack {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ export function escape(str: string) {
|
||||||
|
|
||||||
const nonOutput = /^(?:\d*|undefined)[\*\+\=]|[\~\@\&\^]/;
|
const nonOutput = /^(?:\d*|undefined)[\*\+\=]|[\~\@\&\^]/;
|
||||||
const gdbMatch = /(?:\d*|undefined)\(gdb\)/;
|
const gdbMatch = /(?:\d*|undefined)\(gdb\)/;
|
||||||
|
const numRegex = /\d+/;
|
||||||
|
|
||||||
function couldBeOutput(line: string) {
|
function couldBeOutput(line: string) {
|
||||||
if (nonOutput.exec(line))
|
if (nonOutput.exec(line))
|
||||||
|
|
@ -232,8 +233,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
this.buffer = this.buffer.substr(end + 1);
|
this.buffer = this.buffer.substr(end + 1);
|
||||||
}
|
}
|
||||||
if (this.buffer.length) {
|
if (this.buffer.length) {
|
||||||
if (this.onOutputPartial(this.buffer))
|
if (this.onOutputPartial(this.buffer)) {
|
||||||
{
|
|
||||||
this.buffer = "";
|
this.buffer = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -358,7 +358,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
let to = setTimeout(() => {
|
let to = setTimeout(() => {
|
||||||
proc.signal("KILL");
|
proc.signal("KILL");
|
||||||
}, 1000);
|
}, 1000);
|
||||||
this.stream.on("exit", function(code) {
|
this.stream.on("exit", function (code) {
|
||||||
clearTimeout(to);
|
clearTimeout(to);
|
||||||
})
|
})
|
||||||
this.sendRaw("-gdb-exit");
|
this.sendRaw("-gdb-exit");
|
||||||
|
|
@ -368,7 +368,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
let to = setTimeout(() => {
|
let to = setTimeout(() => {
|
||||||
process.kill(-proc.pid);
|
process.kill(-proc.pid);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
this.process.on("exit", function(code) {
|
this.process.on("exit", function (code) {
|
||||||
clearTimeout(to);
|
clearTimeout(to);
|
||||||
});
|
});
|
||||||
this.sendRaw("-gdb-exit");
|
this.sendRaw("-gdb-exit");
|
||||||
|
|
@ -380,7 +380,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
let to = setTimeout(() => {
|
let to = setTimeout(() => {
|
||||||
process.kill(-proc.pid);
|
process.kill(-proc.pid);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
this.process.on("exit", function(code) {
|
this.process.on("exit", function (code) {
|
||||||
clearTimeout(to);
|
clearTimeout(to);
|
||||||
});
|
});
|
||||||
this.sendRaw("-target-detach");
|
this.sendRaw("-target-detach");
|
||||||
|
|
@ -465,10 +465,23 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
if (this.breakpoints.has(breakpoint))
|
if (this.breakpoints.has(breakpoint))
|
||||||
return resolve(false);
|
return resolve(false);
|
||||||
let location = "";
|
let location = "";
|
||||||
|
if (breakpoint.countCondition) {
|
||||||
|
if (breakpoint.countCondition[0] == ">")
|
||||||
|
location += "-i " + numRegex.exec(breakpoint.countCondition.substr(1))[0] + " ";
|
||||||
|
else {
|
||||||
|
let match = numRegex.exec(breakpoint.countCondition)[0];
|
||||||
|
if (match.length != breakpoint.countCondition.length) {
|
||||||
|
this.log("stderr", "Unsupported break count expression: '" + breakpoint.countCondition + "'. Only supports 'X' for breaking once after X times or '>X' for ignoring the first X breaks");
|
||||||
|
location += "-t ";
|
||||||
|
}
|
||||||
|
else if (parseInt(match) != 0)
|
||||||
|
location += "-t -i " + parseInt(match) + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (breakpoint.raw)
|
if (breakpoint.raw)
|
||||||
location = '"' + escape(breakpoint.raw) + '"';
|
location += '"' + escape(breakpoint.raw) + '"';
|
||||||
else
|
else
|
||||||
location = '"' + escape(breakpoint.file) + ":" + breakpoint.line + '"';
|
location += '"' + escape(breakpoint.file) + ":" + breakpoint.line + '"';
|
||||||
this.sendCommand("break-insert -f " + location).then((result) => {
|
this.sendCommand("break-insert -f " + location).then((result) => {
|
||||||
if (result.resultRecords.resultClass == "done") {
|
if (result.resultRecords.resultClass == "done") {
|
||||||
let bkptNum = parseInt(result.result("bkpt.number"));
|
let bkptNum = parseInt(result.result("bkpt.number"));
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export interface AttachRequestArguments {
|
||||||
|
|
||||||
class GDBDebugSession extends MI2DebugSession {
|
class GDBDebugSession extends MI2DebugSession {
|
||||||
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
|
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
|
||||||
|
response.body.supportsHitConditionalBreakpoints = true;
|
||||||
response.body.supportsConfigurationDoneRequest = true;
|
response.body.supportsConfigurationDoneRequest = true;
|
||||||
response.body.supportsConditionalBreakpoints = true;
|
response.body.supportsConditionalBreakpoints = true;
|
||||||
response.body.supportsFunctionBreakpoints = true;
|
response.body.supportsFunctionBreakpoints = true;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ export interface AttachRequestArguments {
|
||||||
|
|
||||||
class LLDBDebugSession extends MI2DebugSession {
|
class LLDBDebugSession extends MI2DebugSession {
|
||||||
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
|
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
|
||||||
|
response.body.supportsHitConditionalBreakpoints = true;
|
||||||
response.body.supportsConfigurationDoneRequest = true;
|
response.body.supportsConfigurationDoneRequest = true;
|
||||||
response.body.supportsConditionalBreakpoints = true;
|
response.body.supportsConditionalBreakpoints = true;
|
||||||
response.body.supportsFunctionBreakpoints = true;
|
response.body.supportsFunctionBreakpoints = true;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ class MagoDebugSession extends MI2DebugSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
|
protected initializeRequest(response: DebugProtocol.InitializeResponse, args: DebugProtocol.InitializeRequestArguments): void {
|
||||||
|
response.body.supportsHitConditionalBreakpoints = true;
|
||||||
response.body.supportsConfigurationDoneRequest = true;
|
response.body.supportsConfigurationDoneRequest = true;
|
||||||
response.body.supportsConditionalBreakpoints = true;
|
response.body.supportsConditionalBreakpoints = true;
|
||||||
response.body.supportsFunctionBreakpoints = true;
|
response.body.supportsFunctionBreakpoints = true;
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ export class MI2DebugSession extends DebugSession {
|
||||||
this.debugReady = true;
|
this.debugReady = true;
|
||||||
let all = [];
|
let all = [];
|
||||||
args.breakpoints.forEach(brk => {
|
args.breakpoints.forEach(brk => {
|
||||||
all.push(this.miDebugger.addBreakPoint({ raw: brk.name, condition: brk.condition }));
|
all.push(this.miDebugger.addBreakPoint({ raw: brk.name, condition: brk.condition, countCondition: brk.hitCondition }));
|
||||||
});
|
});
|
||||||
Promise.all(all).then(brkpoints => {
|
Promise.all(all).then(brkpoints => {
|
||||||
let finalBrks = [];
|
let finalBrks = [];
|
||||||
|
|
@ -168,7 +168,7 @@ export class MI2DebugSession extends DebugSession {
|
||||||
}
|
}
|
||||||
let all = [];
|
let all = [];
|
||||||
args.breakpoints.forEach(brk => {
|
args.breakpoints.forEach(brk => {
|
||||||
all.push(this.miDebugger.addBreakPoint({ file: path, line: brk.line, condition: brk.condition }));
|
all.push(this.miDebugger.addBreakPoint({ file: path, line: brk.line, condition: brk.condition, countCondition: brk.hitCondition }));
|
||||||
});
|
});
|
||||||
Promise.all(all).then(brkpoints => {
|
Promise.all(all).then(brkpoints => {
|
||||||
let finalBrks = [];
|
let finalBrks = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue