检查gdb调试工具
Signed-off-by: Haoyang Chen <chenhaoyang@kylinos.cn>
This commit is contained in:
parent
65a2acc2c7
commit
0e04620791
13
src/gdb.ts
13
src/gdb.ts
|
@ -4,6 +4,7 @@ import { DebugProtocol } from 'vscode-debugprotocol';
|
||||||
import { MI2, escape } from "./backend/mi2/mi2";
|
import { MI2, escape } from "./backend/mi2/mi2";
|
||||||
import { SSHArguments, ValuesFormattingMode } from './backend/backend';
|
import { SSHArguments, ValuesFormattingMode } from './backend/backend';
|
||||||
import { GdbDisassembler } from './backend/disasm';
|
import { GdbDisassembler } from './backend/disasm';
|
||||||
|
import * as child_process from 'child_process';
|
||||||
|
|
||||||
export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
|
export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
@ -70,6 +71,12 @@ export class GDBDebugSession extends MI2DebugSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
|
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
|
||||||
|
const check_gdb = child_process.exec(`which ${args.gdbpath || "gdb"}`, (e,x,stderr)=>{
|
||||||
|
if (e || !x || x.length == 0) {
|
||||||
|
this.sendErrorResponse(response, 104, `No ${args.gdbpath || "gdb"} found, please install it.`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
|
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.disassember = new GdbDisassembler(this, args.showDevDebugOutput);
|
this.disassember = new GdbDisassembler(this, args.showDevDebugOutput);
|
||||||
|
@ -121,6 +128,12 @@ export class GDBDebugSession extends MI2DebugSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
|
protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
|
||||||
|
const check_gdb = child_process.exec(`which ${args.gdbpath || "gdb"}`, (e,x,stderr)=>{
|
||||||
|
if (e || !x || x.length == 0) {
|
||||||
|
this.sendErrorResponse(response, 104, `No ${args.gdbpath || "gdb"} found, please install it.`);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
|
this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
|
||||||
this.setPathSubstitutions(args.pathSubstitutions);
|
this.setPathSubstitutions(args.pathSubstitutions);
|
||||||
this.initDebugger();
|
this.initDebugger();
|
||||||
|
|
Loading…
Reference in New Issue