MCPcopy Index your code
hub / github.com/Marus/cortex-debug / getGdbPath

Method getGdbPath

src/gdb.ts:833–855  ·  view source on GitHub ↗
(response: DebugProtocol.LaunchResponse)

Source from the content-addressed store, hash-verified

831 }
832
833 private getGdbPath(response: DebugProtocol.LaunchResponse): string {
834 let gdbExePath = os.platform() !== 'win32' ? `${this.args.toolchainPrefix}-gdb` : `${this.args.toolchainPrefix}-gdb.exe`;
835 if (this.args.toolchainPath) {
836 gdbExePath = path.normalize(path.join(this.args.toolchainPath, gdbExePath));
837 }
838 const gdbMissingMsg = `GDB executable "${gdbExePath}" was not found.\n` +
839 'Please configure "cortex-debug.armToolchainPath" or "cortex-debug.gdbPath" correctly.';
840
841 if (this.args.gdbPath) {
842 gdbExePath = this.args.gdbPath;
843 } else if (path.isAbsolute(gdbExePath)) {
844 if (fs.existsSync(gdbExePath) === false) {
845 this.launchErrorResponse(response, 103, gdbMissingMsg);
846 return null;
847 }
848 }
849 else if (!hasbin.sync(gdbExePath.replace(/\.exe$/i, ''))) {
850 this.launchErrorResponse(response, 103, gdbMissingMsg);
851 return null;
852 }
853 this.args.gdbPath = gdbExePath; // This now becomes the official gdb-path
854 return gdbExePath;
855 }
856
857 private gdbInitCommands: string[] = [];
858 private startGdb(response: DebugProtocol.LaunchResponse): Promise<void> {

Callers 1

Calls 2

launchErrorResponseMethod · 0.95
normalizeMethod · 0.80

Tested by

no test coverage detected