GP-4690: Fix ClassCastException with qemu+gdb launcher.

This commit is contained in:
Dan 2024-06-13 11:17:38 -04:00
parent d9d0a899db
commit 67f6c13117
2 changed files with 21 additions and 4 deletions

View File

@ -42,8 +42,7 @@ import ghidra.debug.api.modules.*;
import ghidra.debug.api.modules.ModuleMapProposal.ModuleMapEntry; import ghidra.debug.api.modules.ModuleMapProposal.ModuleMapEntry;
import ghidra.debug.api.tracermi.*; import ghidra.debug.api.tracermi.*;
import ghidra.framework.options.SaveState; import ghidra.framework.options.SaveState;
import ghidra.framework.plugintool.AutoConfigState.ConfigStateField; import ghidra.framework.plugintool.AutoConfigState.*;
import ghidra.framework.plugintool.AutoConfigState.PathIsFile;
import ghidra.framework.plugintool.PluginTool; import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program; import ghidra.program.model.listing.Program;
@ -299,8 +298,18 @@ public abstract class AbstractTraceRmiLaunchOffer implements TraceRmiLaunchOffer
List<String> names = List<String> names =
program.getLanguage().getLanguageDescription().getExternalNames(tool); program.getLanguage().getLanguageDescription().getExternalNames(tool);
if (names != null && !names.isEmpty()) { if (names != null && !names.isEmpty()) {
var paramStr = (ParameterDescription<String>) param; if (param.type == String.class) {
paramStr.set(map, names.get(0)); var paramStr = (ParameterDescription<String>) param;
paramStr.set(map, names.get(0));
}
else if (param.type == PathIsFile.class) {
var paramPIF = (ParameterDescription<PathIsFile>) param;
paramPIF.set(map, PathIsFile.fromString(names.get(0)));
}
else if (param.type == PathIsDir.class) {
var paramPID = (ParameterDescription<PathIsDir>) param;
paramPID.set(map, PathIsDir.fromString(names.get(0)));
}
} }
} }
} }

View File

@ -305,6 +305,10 @@ public interface AutoConfigState {
} }
record PathIsDir(Path path) { record PathIsDir(Path path) {
public static PathIsDir fromString(String string) {
return new PathIsDir(Paths.get(string));
}
@Override @Override
public String toString() { public String toString() {
return path.toString(); return path.toString();
@ -328,6 +332,10 @@ public interface AutoConfigState {
} }
record PathIsFile(Path path) { record PathIsFile(Path path) {
public static PathIsFile fromString(String string) {
return new PathIsFile(Paths.get(string));
}
@Override @Override
public String toString() { public String toString() {
return path.toString(); return path.toString();