diff --git a/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/hooks.py b/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/hooks.py index de91079f6d..1ecb6677e7 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/hooks.py +++ b/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/hooks.py @@ -511,6 +511,7 @@ def on_stop(event: lldb.SBEvent) -> bool: commands.put_threads() commands.put_frames() commands.activate() + commands.put_breakpoints() return True diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java index 81618b2bb1..12ab937987 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java @@ -16,7 +16,7 @@ package agent.dbgeng.rmi; import static org.junit.Assert.*; -import static org.junit.Assume.assumeTrue; +import static org.junit.Assume.*; import java.io.*; import java.net.*; @@ -150,18 +150,25 @@ public abstract class AbstractDbgEngTraceRmiTest extends AbstractGhidraHeadedDeb public void setupTraceRmi() throws Throwable { traceRmi = addPlugin(tool, TraceRmiPlugin.class); - try { - pythonPath = Paths.get(DummyProc.which("python3")); - } - catch (RuntimeException e) { - pythonPath = Paths.get(DummyProc.which("python")); - } + pythonPath = getPathToPython(); assertTrue(pythonPath.toFile().exists()); outFile = Files.createTempFile("pydbgout", null); errFile = Files.createTempFile("pydbgerr", null); } + protected Path getPathToPython() { + try { + String py3path = DummyProc.which("python3"); + if (py3path != null && !py3path.contains("msys")) { + return Paths.get(py3path); + } + } + catch (RuntimeException e) { + } + return Paths.get(DummyProc.which("python")); + } + protected void addAllDebuggerPlugins() throws PluginException { PluginsConfiguration plugConf = new PluginsConfiguration() { @Override diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.java index d8042e9bdb..a21653c7c8 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.java @@ -52,13 +52,12 @@ import ghidra.trace.model.target.TraceObject; import ghidra.trace.model.target.TraceObjectValue; import ghidra.trace.model.target.path.PathFilter; import ghidra.trace.model.target.path.PathPattern; -import ghidra.util.exception.TimeoutException; @Category(NightlyCategory.class) // this may actually be an @PortSensitive test public class GdbMethodsTest extends AbstractGdbTraceRmiTest { private final static long CAPTURE_PC_TIMEOUT_MILLIS = 3000; - + @Test public void testExecuteCapture() throws Exception { try (GdbAndConnection conn = startAndConnectGdb()) { @@ -467,6 +466,8 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest { @Test public void testActivateThread() throws Exception { + // NB: The windows variant does not appear to support multi-process debugging + assumeFalse(IS_WINDOWS); try (GdbAndConnection conn = startAndConnectGdb()) { String target = which("expPrint"); conn.execute(""" diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java index 4bd2a533fc..a8f27a9166 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java @@ -28,7 +28,6 @@ import org.junit.experimental.categories.Category; import generic.Unique; import generic.test.category.NightlyCategory; -import generic.test.rule.Repeated; import ghidra.app.plugin.core.debug.utils.ManagedDomainObject; import ghidra.debug.api.tracermi.RemoteMethod; import ghidra.framework.OperatingSystem; @@ -52,6 +51,8 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest { @Test public void testExecuteCapture() throws Exception { + // NB: print returns no value on Windows + assumeTrue(OperatingSystem.CURRENT_OPERATING_SYSTEM == OperatingSystem.LINUX); try (LldbAndConnection conn = startAndConnectLldb()) { RemoteMethod execute = conn.getMethod("execute"); assertEquals(false, execute.parameters().get("to_string").getDefaultValue()); @@ -572,12 +573,11 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest { TraceObject proc = Objects.requireNonNull(tb.objAny0("Processes[]")); launch.invoke(Map.ofEntries( Map.entry("process", proc), - Map.entry("file", getSpecimenRead()))); + Map.entry("file", getSpecimenSpin()))); txPut(conn, "processes"); waitRunning(conn); - Thread.sleep(100); // Give it plenty of time to block on read conn.execute("process interrupt"); txPut(conn, "processes"); @@ -585,7 +585,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest { waitStopped(conn); String out = conn.executeCapture("bt"); - assertThat(out, containsString("read")); + assertThat(out, containsString("stop")); } conn.success(); } diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.java index b8097e0e4b..abd1cda957 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/AbstractX64dbgTraceRmiTest.java @@ -59,7 +59,7 @@ public abstract class AbstractX64dbgTraceRmiTest extends AbstractGhidraHeadedDeb from x64dbg_automate.models import * """; // Connecting should be the first thing the script does, so use a tight timeout. - protected static final int CONNECT_TIMEOUT_MS = 6000; + protected static final int CONNECT_TIMEOUT_MS = 10000; protected static final int TIMEOUT_SECONDS = SystemUtilities.isInTestingBatchMode() ? 20 : 300; protected static final int QUIT_TIMEOUT_MS = 2000; @@ -144,27 +144,34 @@ public abstract class AbstractX64dbgTraceRmiTest extends AbstractGhidraHeadedDeb public void setupTraceRmi() throws Throwable { traceRmi = addPlugin(tool, TraceRmiPlugin.class); - try { - pythonPath = Paths.get(DummyProc.which("python3")); - } - catch (RuntimeException e) { - pythonPath = Paths.get(DummyProc.which("python")); - } + pythonPath = getPathToPython(); assertTrue("Python must be installed.", pythonPath.toFile().exists()); outFile = Files.createTempFile("pydbgout", null); errFile = Files.createTempFile("pydbgerr", null); } - + + protected Path getPathToPython() { + try { + String py3path = DummyProc.which("python3"); + if (py3path != null && !py3path.contains("msys")) { + return Paths.get(py3path); + } + } + catch (RuntimeException e) { + } + return Paths.get(DummyProc.which("python")); + } + @Before public void killAllx64dbgProcesses() throws IOException, InterruptedException { ProcessBuilder pb = new ProcessBuilder("taskkill", "/IM", "x64dbg.exe", "/F"); - + pb.redirectErrorStream(true); - Process process = pb.start(); - process.waitFor(); - - // don't care about the exit code. + Process process = pb.start(); + process.waitFor(); + + // don't care about the exit code. } protected void addAllDebuggerPlugins() throws PluginException { diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/X64dbgMethodsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/X64dbgMethodsTest.java index 56d1c2c677..1126812ded 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/X64dbgMethodsTest.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/x64dbg/rmi/X64dbgMethodsTest.java @@ -401,7 +401,7 @@ public class X64dbgMethodsTest extends AbstractX64dbgTraceRmiTest { txPut(conn, "processes"); RemoteMethod removeProcess = conn.getMethod("remove_process"); - try (ManagedDomainObject mdo = openDomainObject("/New Traces/x64dbg/netstat.exe")) { + try (ManagedDomainObject mdo = openDomainObject("/New Traces/x64dbg/NETSTAT.EXE")) { tb = new ToyDBTraceBuilder((Trace) mdo.get()); TraceObject proc2 = Objects.requireNonNull(tb.objAny0("Sessions[].Processes[]")); @@ -476,7 +476,7 @@ public class X64dbgMethodsTest extends AbstractX64dbgTraceRmiTest { txPut(conn, "processes"); RemoteMethod detach = conn.getMethod("detach"); - try (ManagedDomainObject mdo = openDomainObject("/New Traces/x64dbg/netstat.exe")) { + try (ManagedDomainObject mdo = openDomainObject("/New Traces/x64dbg/NETSTAT.EXE")) { tb = new ToyDBTraceBuilder((Trace) mdo.get()); TraceObject proc = Objects.requireNonNull(tb.objAny0("Sessions[].Processes[]"));