From 2e563a8533599869d823fbb7d3c1310db35187be Mon Sep 17 00:00:00 2001 From: xuhong Date: Wed, 25 Sep 2024 16:24:35 +0800 Subject: [PATCH] Resolve the issue of not being able to set the GDB path on Windows. --- CHANGELOG.md | 2 ++ src/mibase.ts | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47db805..668ccc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ Versioning]. - solve the problem of failed parsing of containers ([@henryriley0]) - Fixes #421 - Added `registerLimit` option to specify the registers to display - PR #444 ([@chenzhiy2001]) +- resolve the issue of not being able to set the GDB path on Windows + ([@henryriley0]) ## [0.27.0] - 2024-02-07 diff --git a/src/mibase.ts b/src/mibase.ts index ba3fbeb..dae4213 100644 --- a/src/mibase.ts +++ b/src/mibase.ts @@ -96,10 +96,16 @@ export class MI2DebugSession extends DebugSession { // verifies that the specified command can be executed protected checkCommand(debuggerName: string): boolean { try { - const command = process.platform === 'win32' ? 'where' : 'command -v'; - execSync(`${command} ${debuggerName}`, { stdio: 'ignore' }); - return true; - } catch (error) { + if (process.platform === 'win32' && debuggerName.includes("\\")) { + const command = 'dir'; + execSync(`${command} ${debuggerName}`, { stdio: 'ignore' }); + return true; + } + else { + const command = process.platform === 'win32' ? 'where' : 'command -v'; + execSync(`${command} ${debuggerName}`, { stdio: 'ignore' }); + return true; + } } catch (error) { return false; } }