MCPcopy Index your code
hub / github.com/WebFreak001/code-debug / attachRequest

Method attachRequest

src/gdb.ts:96–141  ·  view source on GitHub ↗
(response: DebugProtocol.AttachResponse, args: AttachRequestArguments)

Source from the content-addressed store, hash-verified

94 }
95
96 protected attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): void {
97 this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args, args.env);
98 this.setPathSubstitutions(args.pathSubstitutions);
99 this.initDebugger();
100 this.quit = false;
101 this.attached = !args.remote;
102 this.initialRunCommand = args.stopAtConnect ? RunCommand.NONE : RunCommand.CONTINUE;
103 this.isSSH = false;
104 this.setValuesFormattingMode(args.valuesFormatting);
105 this.miDebugger.printCalls = !!args.printCalls;
106 this.miDebugger.debugOutput = !!args.showDevDebugOutput;
107 this.stopAtEntry = args.stopAtEntry;
108 if (args.ssh !== undefined) {
109 if (args.ssh.forwardX11 === undefined)
110 args.ssh.forwardX11 = true;
111 if (args.ssh.port === undefined)
112 args.ssh.port = 22;
113 if (args.ssh.x11port === undefined)
114 args.ssh.x11port = 6000;
115 if (args.ssh.x11host === undefined)
116 args.ssh.x11host = "localhost";
117 if (args.ssh.remotex11screen === undefined)
118 args.ssh.remotex11screen = 0;
119 this.isSSH = true;
120 this.setSourceFileMap(args.ssh.sourceFileMap, args.ssh.cwd, args.cwd);
121 this.miDebugger.ssh(args.ssh, args.ssh.cwd, args.target, "", undefined, true, args.autorun || []).then(() => {
122 this.sendResponse(response);
123 }, err => {
124 this.sendErrorResponse(response, 104, `Failed to SSH: ${err.toString()}`);
125 });
126 } else {
127 if (args.remote) {
128 this.miDebugger.connect(args.cwd, args.executable, args.target, args.autorun || []).then(() => {
129 this.sendResponse(response);
130 }, err => {
131 this.sendErrorResponse(response, 102, `Failed to attach: ${err.toString()}`);
132 });
133 } else {
134 this.miDebugger.attach(args.cwd, args.executable, args.target, args.autorun || []).then(() => {
135 this.sendResponse(response);
136 }, err => {
137 this.sendErrorResponse(response, 101, `Failed to attach: ${err.toString()}`);
138 });
139 }
140 }
141 }
142
143 // Add extra commands for source file path substitution in GDB-specific syntax
144 protected setPathSubstitutions(substitutions: { [index: string]: string }): void {

Callers

nothing calls this directly

Calls 8

setPathSubstitutionsMethod · 0.95
initDebuggerMethod · 0.80
setSourceFileMapMethod · 0.80
toStringMethod · 0.80
sshMethod · 0.65
connectMethod · 0.65
attachMethod · 0.65

Tested by

no test coverage detected