GP-3311: Fix issues launching binaries with spaces using GDB.

This commit is contained in:
Dan 2023-04-20 16:46:39 -04:00
parent ef93801aa1
commit 6547432f94
3 changed files with 5 additions and 4 deletions

View File

@ -43,7 +43,7 @@ public class GdbInferiorImpl implements GdbInferior {
"0x(?<end>[0-9,A-F,a-f]+)\\s+" +
"0x(?<size>[0-9,A-F,a-f]+)\\s+" +
"0x(?<offset>[0-9,A-F,a-f]+)\\s+" +
"(?<file>\\S*)\\s*");
"(?<file>.*)");
protected static final Pattern MEMORY_MAPPING_LINE_PATTERN =
Pattern.compile("\\s*" + //
@ -52,7 +52,7 @@ public class GdbInferiorImpl implements GdbInferior {
"0x(?<size>[0-9,A-F,a-f]+)\\s+" +
"0x(?<offset>[0-9,A-F,a-f]+)\\s+" +
"(?<flags>[rwsxp\\-]+)\\s+" +
"(?<file>\\S*)\\s*");
"(?<file>.*)");
protected final GdbManagerImpl manager;
private final int id;

View File

@ -15,6 +15,8 @@
*/
package agent.gdb.manager.impl.cmd;
import org.apache.commons.text.StringEscapeUtils;
import agent.gdb.manager.GdbInferior;
import agent.gdb.manager.evt.GdbCommandDoneEvent;
import agent.gdb.manager.impl.GdbManagerImpl;
@ -34,7 +36,7 @@ public class GdbFileExecAndSymbolsCommand extends AbstractGdbCommand<Void> {
@Override
public String encode() {
return "-file-exec-and-symbols " + file;
return "-file-exec-and-symbols \"" + StringEscapeUtils.escapeJava(file) + "\"";
}
@Override

View File

@ -19,7 +19,6 @@ import java.util.*;
import java.util.concurrent.CompletableFuture;
import agent.gdb.manager.*;
import agent.gdb.manager.impl.cmd.GdbConsoleExecCommand.CompletesWithRunning;
import agent.gdb.manager.impl.cmd.GdbStateChangeRecord;
import agent.gdb.manager.reason.*;
import ghidra.async.AsyncFence;