GP-0: Fix tests

This commit is contained in:
Dan
2022-10-20 13:26:17 -04:00
parent c8ac656430
commit 3aa9d21f10
5 changed files with 48 additions and 36 deletions
@@ -61,6 +61,7 @@ public class GdbModelImpl extends AbstractDebuggerObjectModel {
protected final GdbManager gdb;
protected final GdbModelTargetSession session;
private volatile boolean closed;
protected final CompletableFuture<GdbModelTargetSession> completedSession;
protected final GdbStateListener gdbExitListener = this::checkExited;
@@ -141,13 +142,22 @@ public class GdbModelImpl extends AbstractDebuggerObjectModel {
public CompletableFuture<Void> startGDB(String gdbCmd, String[] args) {
return CompletableFuture.runAsync(() -> {
try {
if (closed) {
return;
}
gdb.start(gdbCmd, args);
}
catch (IOException e) {
if (closed) {
return;
}
throw new DebuggerModelTerminatingException(
"Error while starting GDB: " + e.getMessage(), e);
}
}).thenCompose(__ -> {
if (closed) {
return AsyncUtils.NIL;
}
return gdb.runRC();
});
}
@@ -174,6 +184,7 @@ public class GdbModelImpl extends AbstractDebuggerObjectModel {
@Override
public CompletableFuture<Void> close() {
closed = true;
try {
terminate();
return super.close();
@@ -133,6 +133,9 @@ public class GdbModelTargetSession extends DefaultTargetModelRoot
@Override
public void output(GdbManager.Channel gdbChannel, String out) {
if (!valid) {
return;
}
TargetConsole.Channel dbgChannel;
switch (gdbChannel) {
case STDOUT: