GP-4412: Fix default Image for Universal Binaries

This commit is contained in:
Dan 2024-03-28 12:49:08 -04:00
parent 77923fa693
commit 2958b9d868

View File

@ -37,6 +37,7 @@ import ghidra.debug.api.tracermi.TraceRmiLaunchOffer;
import ghidra.debug.api.tracermi.TraceRmiLaunchOffer.LaunchConfigurator;
import ghidra.debug.api.tracermi.TraceRmiLaunchOffer.PromptMode;
import ghidra.debug.spi.tracermi.TraceRmiLaunchOpinion;
import ghidra.formats.gfilesystem.FSRL;
import ghidra.framework.options.*;
import ghidra.framework.plugintool.*;
import ghidra.framework.plugintool.util.PluginStatus;
@ -122,11 +123,7 @@ public class TraceRmiLauncherServicePlugin extends Plugin
}
}
public static File getProgramPath(Program program) {
if (program == null) {
return null;
}
String path = program.getExecutablePath();
public static File tryProgramPath(String path) {
if (path == null) {
return null;
}
@ -143,6 +140,26 @@ public class TraceRmiLauncherServicePlugin extends Plugin
}
}
public static String extractFirstFsrl(Program program) {
FSRL fsrl = FSRL.fromProgram(program);
if (fsrl == null) {
return null;
}
FSRL first = fsrl.split().get(0);
return first.getPath();
}
public static File getProgramPath(Program program) {
if (program == null) {
return null;
}
File exec = tryProgramPath(program.getExecutablePath());
if (exec != null) {
return exec;
}
return tryProgramPath(extractFirstFsrl(program));
}
protected final ToolOptions options;
protected Program currentProgram;