Merge remote-tracking branch 'origin/patch'

Conflicts:
	Ghidra/application.properties
This commit is contained in:
Ryan Kurtz 2021-10-04 17:45:54 -04:00
commit 45421bcbb9
2 changed files with 20 additions and 3 deletions

View file

@ -37,16 +37,19 @@ import agent.gdb.manager.impl.cmd.*;
import agent.gdb.manager.parsing.GdbMiParser; import agent.gdb.manager.parsing.GdbMiParser;
import agent.gdb.manager.parsing.GdbParsingUtils.GdbParseError; import agent.gdb.manager.parsing.GdbParsingUtils.GdbParseError;
import agent.gdb.pty.*; import agent.gdb.pty.*;
import ghidra.GhidraApplicationLayout;
import ghidra.async.*; import ghidra.async.*;
import ghidra.async.AsyncLock.Hold; import ghidra.async.AsyncLock.Hold;
import ghidra.dbg.error.DebuggerModelTerminatingException; import ghidra.dbg.error.DebuggerModelTerminatingException;
import ghidra.dbg.util.HandlerMap; import ghidra.dbg.util.HandlerMap;
import ghidra.dbg.util.PrefixMap; import ghidra.dbg.util.PrefixMap;
import ghidra.framework.Application; import ghidra.framework.Application;
import ghidra.framework.GhidraApplicationConfiguration;
import ghidra.lifecycle.Internal; import ghidra.lifecycle.Internal;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.SystemUtilities; import ghidra.util.SystemUtilities;
import ghidra.util.datastruct.ListenerSet; import ghidra.util.datastruct.ListenerSet;
import ghidra.util.task.ConsoleTaskMonitor;
import sun.misc.Signal; import sun.misc.Signal;
import sun.misc.SignalHandler; import sun.misc.SignalHandler;
@ -206,7 +209,8 @@ public class GdbManagerImpl implements GdbManager {
private void initLog() { private void initLog() {
try { try {
File userSettings = Application.getUserSettingsDirectory(); GhidraApplicationLayout layout = new GhidraApplicationLayout();
File userSettings = layout.getUserSettingsDir();
File logFile = new File(userSettings, "GDB.log"); File logFile = new File(userSettings, "GDB.log");
try { try {
logFile.createNewFile(); logFile.createNewFile();
@ -216,7 +220,7 @@ public class GdbManagerImpl implements GdbManager {
} }
DBG_LOG = new PrintWriter(new FileOutputStream(logFile)); DBG_LOG = new PrintWriter(new FileOutputStream(logFile));
} }
catch (FileNotFoundException e) { catch (IOException e) {
throw new AssertionError(e); throw new AssertionError(e);
} }
} }

View file

@ -47,6 +47,11 @@ public abstract class AbstractGadpLocalDebuggerModelFactory implements DebuggerM
public final Property<Integer> jdwpPortOption = public final Property<Integer> jdwpPortOption =
Property.fromAccessors(int.class, this::getJdwpPort, this::setJdwpPort); Property.fromAccessors(int.class, this::getJdwpPort, this::setJdwpPort);
protected boolean jdwpSuspend = false;
@FactoryOption("Suspend for JDWP")
public final Property<Boolean> jdwpSuspendOption =
Property.fromAccessors(boolean.class, this::isJdwpSuspend, this::setJdwpSuspend);
/** /**
* Get the name of the thread which processes the agent's stdout * Get the name of the thread which processes the agent's stdout
*/ */
@ -86,6 +91,14 @@ public abstract class AbstractGadpLocalDebuggerModelFactory implements DebuggerM
this.jdwpPort = jdwpPort; this.jdwpPort = jdwpPort;
} }
public boolean isJdwpSuspend() {
return jdwpSuspend;
}
public void setJdwpSuspend(boolean jdwpSuspend) {
this.jdwpSuspend = jdwpSuspend;
}
class AgentThread extends Thread { class AgentThread extends Thread {
int port; int port;
Process process; Process process;
@ -104,7 +117,7 @@ public abstract class AbstractGadpLocalDebuggerModelFactory implements DebuggerM
cmd.addAll(List.of("-cp", System.getProperty("java.class.path"))); cmd.addAll(List.of("-cp", System.getProperty("java.class.path")));
if (jdwpPort >= 0) { if (jdwpPort >= 0) {
cmd.add("-agentlib:jdwp=server=y,transport=dt_socket,address=" + jdwpPort + cmd.add("-agentlib:jdwp=server=y,transport=dt_socket,address=" + jdwpPort +
",suspend=n"); ",suspend=" + (jdwpSuspend ? "y" : "n"));
} }
completeCommandLine(cmd); completeCommandLine(cmd);
builder.command(cmd); builder.command(cmd);