From 7de12c0fed728941f217217d41909943ee175b5e Mon Sep 17 00:00:00 2001 From: Niklas Therning Date: Mon, 19 Sep 2016 14:11:54 +0200 Subject: [PATCH] Use the path of the current executable by default in soft debugger tests on Windows to launch the child mono process The 'mono' shell script generated by the Cygwin make file system doesn't work when running the soft debugger tests against an MSVC built mono executable. This patch first tries with the main module of the current process when running on Windows (and mono is built using MSVC). If it looks like a mono executable the tests will use it before falling back to the shell script. --- mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 1933fc5e827..581e90744aa 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -69,9 +69,17 @@ public class DebuggerTests if (!listening) { var pi = new Diag.ProcessStartInfo (); - if (runtime != null) + if (runtime != null) { pi.FileName = runtime; - else + } else if (Path.DirectorySeparatorChar == '\\') { + string processExe = Diag.Process.GetCurrentProcess ().MainModule.FileName; + if (processExe != null) { + string fileName = Path.GetFileName (processExe); + if (fileName.StartsWith ("mono") && fileName.EndsWith (".exe")) + pi.FileName = processExe; + } + } + if (string.IsNullOrEmpty (pi.FileName)) pi.FileName = "mono"; pi.Arguments = String.Join (" ", args); vm = VirtualMachineManager.Launch (pi, new LaunchOptions { AgentArgs = agent_args }); -- 2.25.1