mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-12 19:59:27 +00:00
Added 'optimize for debug' option
This commit is contained in:
@@ -13,6 +13,10 @@ export interface ArduinoLaunchRequestArguments extends DebugProtocol.LaunchReque
|
||||
|
||||
export class ArduinoDebugSession extends GDBDebugSession {
|
||||
|
||||
protected get arduinoBackend(): ArduinoGDBBackend {
|
||||
return this.gdb as ArduinoGDBBackend;
|
||||
}
|
||||
|
||||
protected createBackend(): GDBBackend {
|
||||
return new ArduinoGDBBackend();
|
||||
}
|
||||
@@ -38,4 +42,24 @@ export class ArduinoDebugSession extends GDBDebugSession {
|
||||
}
|
||||
}
|
||||
|
||||
protected async disconnectRequest(response: DebugProtocol.DisconnectResponse): Promise<void> {
|
||||
try {
|
||||
if (this.isRunning) {
|
||||
// Need to pause first
|
||||
const waitPromise = new Promise(resolve => this.waitPaused = resolve);
|
||||
this.gdb.pause();
|
||||
await waitPromise;
|
||||
}
|
||||
try {
|
||||
await this.arduinoBackend.sendTargetDetach();
|
||||
} catch (e) {
|
||||
// Need to catch here as the command result being returned will never exist as it's detached
|
||||
}
|
||||
await this.gdb.sendGDBExit();
|
||||
this.sendResponse(response);
|
||||
} catch (err) {
|
||||
this.sendErrorResponse(response, 1, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ArduinoLaunchRequestArguments } from './arduino-debug-session';
|
||||
|
||||
export class ArduinoGDBBackend extends GDBBackend {
|
||||
|
||||
public spawn(requestArgs: ArduinoLaunchRequestArguments): Promise<void> {
|
||||
spawn(requestArgs: ArduinoLaunchRequestArguments): Promise<void> {
|
||||
if (!requestArgs.sketch) {
|
||||
throw new Error('Missing argument: sketch');
|
||||
}
|
||||
@@ -28,14 +28,18 @@ export class ArduinoGDBBackend extends GDBBackend {
|
||||
return this.parser.parse(proc.stdout);
|
||||
}
|
||||
|
||||
public sendFileExecAndSymbols(): Promise<void> {
|
||||
sendFileExecAndSymbols(): Promise<void> {
|
||||
// The program file is already sent by `arduino-cli`
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public pause(): boolean {
|
||||
pause(): boolean {
|
||||
this.sendCommand('-exec-interrupt');
|
||||
return true;
|
||||
}
|
||||
|
||||
sendTargetDetach(): Promise<void> {
|
||||
return this.sendCommand('-target-detach');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user