Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1399: No longer permit a null value for GDB's exit value.

Danf8ec0071db7c
diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/PtySession.java b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/PtySession.java
index e24a04c8ec..631147092b 100644
--- a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/PtySession.java
+++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/PtySession.java
@@ -29,7 +29,7 @@ public interface PtySession {
* @return the status code, if applicable and implemented
* @throws InterruptedException if the wait is interrupted
*/
- Integer waitExited() throws InterruptedException;
+ int waitExited() throws InterruptedException;
/**
* Take the greatest efforts to terminate the session (leader and descendants)
diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/local/LocalProcessPtySession.java b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/local/LocalProcessPtySession.java
index a4d522851b..ddf26b2757 100644
--- a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/local/LocalProcessPtySession.java
+++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/local/LocalProcessPtySession.java
@@ -30,7 +30,7 @@ public class LocalProcessPtySession implements PtySession {
}
@Override
- public Integer waitExited() throws InterruptedException {
+ public int waitExited() throws InterruptedException {
return process.waitFor();
}
diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/SshPtySession.java b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/SshPtySession.java
index e1d04c693e..0cbce41e3b 100644
--- a/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/SshPtySession.java
+++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/java/agent/gdb/pty/ssh/SshPtySession.java
@@ -28,7 +28,7 @@ public class SshPtySession implements PtySession {
}
@Override
- public Integer waitExited() throws InterruptedException {
+ public int waitExited() throws InterruptedException {
// Doesn't look like there's a clever way to wait. So do the spin sleep :(
while (!channel.isEOF()) {
Thread.sleep(1000);
diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/linux/LinuxPtyTest.java b/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/linux/LinuxPtyTest.java
index 46697ccfe8..4530c6db87 100644
--- a/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/linux/LinuxPtyTest.java
+++ b/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/linux/LinuxPtyTest.java
@@ -65,7 +65,7 @@ public class LinuxPtyTest {
PtySession bash =
pty.getChild().session(new String[] { DummyProc.which("bash") }, null);
pty.getParent().getOutputStream().write("exit\n".getBytes());
- assertEquals(0, bash.waitExited().intValue());
+ assertEquals(0, bash.waitExited());
}
}
@@ -78,7 +78,7 @@ public class LinuxPtyTest {
* NOTE: Java subprocess dies with code 1 on unhandled exception. TODO: Is there a nice
* way to distinguish whether the code is from java or the execed image?
*/
- assertEquals(1, dies.waitExited().intValue());
+ assertEquals(1, dies.waitExited());
}
}
@@ -117,7 +117,7 @@ public class LinuxPtyTest {
while (true) {
try {
assertEquals("Early exit with wrong code", expected,
- session.waitExited().intValue());
+ session.waitExited());
return;
}
catch (InterruptedException e) {
@@ -159,7 +159,7 @@ public class LinuxPtyTest {
assertTrue("Not 'exit 3' or 'BASH:exit 3': '" + line + "'",
Set.of("BASH:exit 3", "exit 3").contains(line));
- assertEquals(3, bash.waitExited().intValue());
+ assertEquals(3, bash.waitExited());
}
}
@@ -214,7 +214,7 @@ public class LinuxPtyTest {
writer.flush();
assertTrue(Set.of("BASH:exit 3", "exit 3").contains(reader.readLine()));
- assertEquals(3, bash.waitExited().intValue());
+ assertEquals(3, bash.waitExited());
}
}
}
diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/ssh/SshPtyTest.java b/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/ssh/SshPtyTest.java
index 39d61096bb..732827b969 100644
--- a/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/ssh/SshPtyTest.java
+++ b/Ghidra/Debug/Debugger-agent-gdb/src/test/java/agent/gdb/pty/ssh/SshPtyTest.java
@@ -82,7 +82,7 @@ public class SshPtyTest extends AbstractGhidraHeadedIntegrationTest {
out.write("exit\n".getBytes("UTF-8"));
out.flush();
new StreamPumper(pty.getParent().getInputStream(), System.out).start();
- assertEquals(0, bash.waitExited().intValue());
+ assertEquals(0, bash.waitExited());
}
}
}