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; package agent.gdb;
import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import agent.gdb.manager.GdbManager; import agent.gdb.manager.GdbManager;
@ -23,6 +24,7 @@ import agent.gdb.pty.linux.LinuxPtyFactory;
import ghidra.dbg.DebuggerModelFactory; import ghidra.dbg.DebuggerModelFactory;
import ghidra.dbg.DebuggerObjectModel; import ghidra.dbg.DebuggerObjectModel;
import ghidra.dbg.util.ConfigurableFactory.FactoryDescription; 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 * 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 @Override
public CompletableFuture<? extends DebuggerObjectModel> build() { public CompletableFuture<? extends DebuggerObjectModel> build() {
// TODO: Choose Linux or Windows pty based on host OS // TODO: Choose Linux or Windows pty based on host OS
List<String> gdbCmdLine = ShellUtils.parseArgs(gdbCmd);
GdbModelImpl model = new GdbModelImpl(new LinuxPtyFactory()); 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 @Override

View file

@ -15,12 +15,14 @@
*/ */
package agent.gdb; package agent.gdb;
import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import agent.gdb.model.impl.GdbModelImpl; import agent.gdb.model.impl.GdbModelImpl;
import agent.gdb.pty.ssh.GhidraSshPtyFactory; import agent.gdb.pty.ssh.GhidraSshPtyFactory;
import ghidra.dbg.DebuggerModelFactory; import ghidra.dbg.DebuggerModelFactory;
import ghidra.dbg.DebuggerObjectModel; import ghidra.dbg.DebuggerObjectModel;
import ghidra.dbg.util.ShellUtils;
import ghidra.dbg.util.ConfigurableFactory.FactoryDescription; import ghidra.dbg.util.ConfigurableFactory.FactoryDescription;
@FactoryDescription( @FactoryDescription(
@ -66,6 +68,7 @@ public class GdbOverSshDebuggerModelFactory implements DebuggerModelFactory {
@Override @Override
public CompletableFuture<? extends DebuggerObjectModel> build() { public CompletableFuture<? extends DebuggerObjectModel> build() {
List<String> gdbCmdLine = ShellUtils.parseArgs(gdbCmd);
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
GhidraSshPtyFactory factory = new GhidraSshPtyFactory(); GhidraSshPtyFactory factory = new GhidraSshPtyFactory();
factory.setHostname(hostname); factory.setHostname(hostname);
@ -80,7 +83,10 @@ public class GdbOverSshDebuggerModelFactory implements DebuggerModelFactory {
else { else {
model.setUnixNewLine(); 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,7 +714,12 @@ public class GdbManagerImpl implements GdbManager {
* @return a future which completes when the rc commands are complete * @return a future which completes when the rc commands are complete
*/ */
protected CompletableFuture<Void> rc() { protected CompletableFuture<Void> rc() {
return AsyncUtils.NIL; if (cliThread != null) {
return AsyncUtils.NIL;
}
else {
return console("set confirm off", CompletesWithRunning.CANNOT);
}
} }
protected void resync() { protected void resync() {

View file

@ -2400,7 +2400,8 @@ void Heritage::heritage(void)
} }
disjoint.add((*liter).first,(*liter).second.size,pass,prev); 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)) { if ((!needwarning)&&(info->deadremoved>0)) {
// TODO: We should check if this varnode is tiled by previously heritaged ranges // 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 if (vn->isHeritageKnown()) continue; // Assume that it is tiled and produced by merging
@ -2409,7 +2410,6 @@ void Heritage::heritage(void)
bumpDeadcodeDelay(vn); bumpDeadcodeDelay(vn);
warnvn = vn; warnvn = vn;
} }
disjoint.add((*liter).first,(*liter).second.size,pass,prev);
} }
} }