Merge remote-tracking branch 'origin/patch'

This commit is contained in:
Ryan Kurtz 2021-10-07 08:16:36 -04:00
commit 1566bcb7e6
4 changed files with 22 additions and 5 deletions

View file

@ -15,6 +15,7 @@
*/
package agent.gdb;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import agent.gdb.manager.GdbManager;
@ -23,6 +24,7 @@ import agent.gdb.pty.linux.LinuxPtyFactory;
import ghidra.dbg.DebuggerModelFactory;
import ghidra.dbg.DebuggerObjectModel;
import ghidra.dbg.util.ConfigurableFactory.FactoryDescription;
import ghidra.dbg.util.ShellUtils;
/**
* Note this is in the testing source because it's not meant to be shipped in the release.... That
@ -49,8 +51,12 @@ public class GdbInJvmDebuggerModelFactory implements DebuggerModelFactory {
@Override
public CompletableFuture<? extends DebuggerObjectModel> build() {
// TODO: Choose Linux or Windows pty based on host OS
List<String> gdbCmdLine = ShellUtils.parseArgs(gdbCmd);
GdbModelImpl model = new GdbModelImpl(new LinuxPtyFactory());
return model.startGDB(existing ? null : gdbCmd, new String[] {}).thenApply(__ -> model);
return model
.startGDB(existing ? null : gdbCmdLine.get(0),
gdbCmdLine.subList(1, gdbCmdLine.size()).toArray(String[]::new))
.thenApply(__ -> model);
}
@Override

View file

@ -15,12 +15,14 @@
*/
package agent.gdb;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import agent.gdb.model.impl.GdbModelImpl;
import agent.gdb.pty.ssh.GhidraSshPtyFactory;
import ghidra.dbg.DebuggerModelFactory;
import ghidra.dbg.DebuggerObjectModel;
import ghidra.dbg.util.ShellUtils;
import ghidra.dbg.util.ConfigurableFactory.FactoryDescription;
@FactoryDescription(
@ -66,6 +68,7 @@ public class GdbOverSshDebuggerModelFactory implements DebuggerModelFactory {
@Override
public CompletableFuture<? extends DebuggerObjectModel> build() {
List<String> gdbCmdLine = ShellUtils.parseArgs(gdbCmd);
return CompletableFuture.supplyAsync(() -> {
GhidraSshPtyFactory factory = new GhidraSshPtyFactory();
factory.setHostname(hostname);
@ -80,7 +83,10 @@ public class GdbOverSshDebuggerModelFactory implements DebuggerModelFactory {
else {
model.setUnixNewLine();
}
return model.startGDB(existing ? null : gdbCmd, new String[] {}).thenApply(__ -> model);
return model
.startGDB(existing ? null : gdbCmdLine.get(0),
gdbCmdLine.subList(1, gdbCmdLine.size()).toArray(String[]::new))
.thenApply(__ -> model);
});
}

View file

@ -714,8 +714,13 @@ public class GdbManagerImpl implements GdbManager {
* @return a future which completes when the rc commands are complete
*/
protected CompletableFuture<Void> rc() {
if (cliThread != null) {
return AsyncUtils.NIL;
}
else {
return console("set confirm off", CompletesWithRunning.CANNOT);
}
}
protected void resync() {
AsyncFence fence = new AsyncFence();

View file

@ -2400,7 +2400,8 @@ void Heritage::heritage(void)
}
disjoint.add((*liter).first,(*liter).second.size,pass,prev);
}
else {
else { // Partially contained in old range, but may contain new stuff
disjoint.add((*liter).first,(*liter).second.size,pass,prev);
if ((!needwarning)&&(info->deadremoved>0)) {
// TODO: We should check if this varnode is tiled by previously heritaged ranges
if (vn->isHeritageKnown()) continue; // Assume that it is tiled and produced by merging
@ -2409,7 +2410,6 @@ void Heritage::heritage(void)
bumpDeadcodeDelay(vn);
warnvn = vn;
}
disjoint.add((*liter).first,(*liter).second.size,pass,prev);
}
}