Skip to content

Commit

Permalink
Support checking gdb.exe on Windows (#1001)
Browse files Browse the repository at this point in the history
* Support checking gdb.exe on Windows

This PR adds additional checks to look for gdb on Windows.
If a user does not specify miDebuggerPath, we will check for gdb and
gdb.exe in PATH. If a miDebuggerPath is provided and does not supply any
directory, we will search that binary and binary.exe in PATH.
  • Loading branch information
WardenGnaw authored May 18, 2020
1 parent 54b7d6b commit 9743dd7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/MICore/LaunchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,8 @@ private static string ResolveFromPath(string command)
{
string pathVar = System.Environment.GetEnvironmentVariable("PATH");

bool checkForWindowsExe = PlatformUtilities.IsWindows() && String.IsNullOrEmpty(Path.GetExtension(command));

// Check each portion of the PATH environment variable to see if it contains the requested file
foreach (string pathPart in pathVar.Split(Path.PathSeparator))
{
Expand All @@ -551,6 +553,15 @@ private static string ResolveFromPath(string command)
{
return candidate;
}

if (checkForWindowsExe)
{
string exeCandidate = candidate + ".exe";
if (File.Exists(exeCandidate))
{
return exeCandidate;
}
}
}

return null;
Expand Down

0 comments on commit 9743dd7

Please sign in to comment.