mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GP-3846: fix for stripped quotes in dbgmodel args
GP-3846: fix for stripped quotes in dbgeng args
This commit is contained in:
parent
8cfd98f933
commit
3d69cf1ae9
5 changed files with 98 additions and 37 deletions
|
@ -372,8 +372,6 @@ public interface DbgManager extends AutoCloseable, DbgBreakpointInsertions {
|
|||
*/
|
||||
CompletableFuture<Void> deleteBreakpoints(long... numbers);
|
||||
|
||||
CompletableFuture<?> launch(List<String> args);
|
||||
|
||||
CompletableFuture<Void> launch(Map<String, ?> args);
|
||||
|
||||
/********** NEEDED FOR TESTING ************/
|
||||
|
|
|
@ -15,14 +15,17 @@
|
|||
*/
|
||||
package agent.dbgeng.manager.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.dbgeng.DebugClient.*;
|
||||
import agent.dbgeng.manager.*;
|
||||
import agent.dbgeng.dbgeng.DebugClient;
|
||||
import agent.dbgeng.dbgeng.DebugClient.DebugCreateFlags;
|
||||
import agent.dbgeng.dbgeng.DebugClient.DebugEngCreateFlags;
|
||||
import agent.dbgeng.dbgeng.DebugClient.DebugVerifierFlags;
|
||||
import agent.dbgeng.dbgeng.DebugProcessInfo;
|
||||
import agent.dbgeng.dbgeng.DebugSystemObjects;
|
||||
import agent.dbgeng.dbgeng.DebugThreadId;
|
||||
import agent.dbgeng.dbgeng.DebugThreadInfo;
|
||||
import agent.dbgeng.manager.DbgEvent;
|
||||
import agent.dbgeng.manager.DbgProcess;
|
||||
import agent.dbgeng.manager.DbgThread;
|
||||
import agent.dbgeng.manager.evt.AbstractDbgCompletedCommandEvent;
|
||||
import agent.dbgeng.manager.evt.DbgProcessCreatedEvent;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
|
@ -35,14 +38,14 @@ public class DbgLaunchProcessCommand extends AbstractDbgCommand<DbgThread> {
|
|||
|
||||
private DbgProcessCreatedEvent created = null;
|
||||
private boolean completed = false;
|
||||
private List<String> args;
|
||||
private String args;
|
||||
private String initialDirectory;
|
||||
private String environment;
|
||||
private BitmaskSet<DebugCreateFlags> createFlags;
|
||||
private BitmaskSet<DebugEngCreateFlags> engCreateFlags;
|
||||
private BitmaskSet<DebugVerifierFlags> verifierFlags;
|
||||
|
||||
public DbgLaunchProcessCommand(DbgManagerImpl manager, List<String> args,
|
||||
public DbgLaunchProcessCommand(DbgManagerImpl manager, String args,
|
||||
String initialDirectory, String environment,
|
||||
BitmaskSet<DebugCreateFlags> createFlags,
|
||||
BitmaskSet<DebugEngCreateFlags> engCreateFlags,
|
||||
|
@ -81,11 +84,6 @@ public class DbgLaunchProcessCommand extends AbstractDbgCommand<DbgThread> {
|
|||
DebugClient dbgeng = manager.getClient();
|
||||
//DebugControl control = dbgeng.getControl();
|
||||
|
||||
List<String> newArgs = new ArrayList<>();
|
||||
for (String arg : args) {
|
||||
newArgs.add(fixPath(arg));
|
||||
}
|
||||
|
||||
initialDirectory = fixPath(initialDirectory);
|
||||
environment = fixPath(environment);
|
||||
// NB: The intent here is to enable multi-line input via a single dialog field
|
||||
|
@ -93,7 +91,7 @@ public class DbgLaunchProcessCommand extends AbstractDbgCommand<DbgThread> {
|
|||
environment = environment.replace("\\0", "\0");
|
||||
}
|
||||
|
||||
dbgeng.createProcess(dbgeng.getLocalServer(), StringUtils.join(newArgs, " "),
|
||||
dbgeng.createProcess(dbgeng.getLocalServer(), args,
|
||||
initialDirectory, environment, createFlags, engCreateFlags, verifierFlags);
|
||||
manager.waitForEventEx();
|
||||
}
|
||||
|
|
|
@ -148,8 +148,6 @@ import ghidra.async.AsyncReference;
|
|||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.async.TypeSpec;
|
||||
import ghidra.comm.util.BitmaskSet;
|
||||
import ghidra.dbg.target.TargetLauncher.CmdLineParser;
|
||||
import ghidra.dbg.target.TargetLauncher.TargetCmdLineLauncher;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.util.HandlerMap;
|
||||
import ghidra.lifecycle.Internal;
|
||||
|
@ -1414,21 +1412,9 @@ public class DbgManagerImpl implements DbgManager {
|
|||
return AsyncUtils.NIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<?> launch(List<String> args) {
|
||||
BitmaskSet<DebugCreateFlags> cf = BitmaskSet.of(DebugCreateFlags.DEBUG_PROCESS);
|
||||
BitmaskSet<DebugEngCreateFlags> ef =
|
||||
BitmaskSet.of(DebugEngCreateFlags.DEBUG_ECREATE_PROCESS_DEFAULT);
|
||||
BitmaskSet<DebugVerifierFlags> vf =
|
||||
BitmaskSet.of(DebugVerifierFlags.DEBUG_VERIFIER_DEFAULT);
|
||||
return execute(new DbgLaunchProcessCommand(this, args,
|
||||
null, null, cf, ef, vf));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> launch(Map<String, ?> map) {
|
||||
List<String> args =
|
||||
CmdLineParser.tokenize(TargetCmdLineLauncher.PARAMETER_CMDLINE_ARGS.get(map));
|
||||
String args = (String) map.get("args");
|
||||
String initDir = (String) map.get("dir");
|
||||
String env = (String) map.get("env");
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
*/
|
||||
package agent.dbgeng.model.iface1;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import agent.dbgeng.model.iface2.DbgModelTargetObject;
|
||||
import ghidra.dbg.error.DebuggerUserException;
|
||||
import ghidra.dbg.target.TargetLauncher.TargetCmdLineLauncher;
|
||||
import ghidra.dbg.target.TargetCmdLineLauncherEx;
|
||||
|
||||
/**
|
||||
* An interface which indicates this object is capable of launching targets.
|
||||
|
@ -30,10 +30,10 @@ import ghidra.dbg.target.TargetLauncher.TargetCmdLineLauncher;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetLauncher extends DbgModelTargetObject, TargetCmdLineLauncher {
|
||||
public interface DbgModelTargetLauncher extends DbgModelTargetObject, TargetCmdLineLauncherEx {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> launch(List<String> args) {
|
||||
public default CompletableFuture<Void> launch(Map<String, ?> args) {
|
||||
return getModel().gateFuture(getManager().launch(args)).exceptionally((exc) -> {
|
||||
throw new DebuggerUserException("Launch failed for " + args);
|
||||
}).thenApply(__ -> null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue