debugger: addition of MIPS/PPC opinions

This commit is contained in:
d-millar 2021-03-24 16:19:33 -04:00
parent 2c5090706f
commit e83a893493
2 changed files with 29 additions and 4 deletions

View File

@ -16,11 +16,12 @@
package ghidra.app.plugin.core.debug.platform;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import ghidra.app.plugin.core.debug.mapping.DebuggerMappingOffer;
import ghidra.app.plugin.core.debug.mapping.DebuggerMappingOpinion;
import ghidra.dbg.target.TargetEnvironment;
import ghidra.dbg.target.TargetProcess;
import ghidra.dbg.DebugModelConventions;
import ghidra.dbg.target.*;
import ghidra.program.model.lang.CompilerSpecID;
import ghidra.program.model.lang.LanguageID;
@ -75,6 +76,17 @@ public class GdbMipsDebuggerMappingOpinion implements DebuggerMappingOpinion {
}
}
@Override
public CompletableFuture<Set<DebuggerMappingOffer>> getOffers(TargetObject target) {
if (!(target instanceof TargetProcess)) {
return CompletableFuture.completedFuture(Set.of());
}
TargetProcess process = (TargetProcess) target;
CompletableFuture<? extends TargetEnvironment> futureEnv =
DebugModelConventions.findSuitable(TargetEnvironment.class, target);
return futureEnv.thenApply(env -> offersForEnv(env, process));
}
public Set<DebuggerMappingOffer> offersForEnv(TargetEnvironment env, TargetProcess process) {
if (!env.getDebugger().toLowerCase().contains("gdb")) {
return Set.of();
@ -111,4 +123,5 @@ public class GdbMipsDebuggerMappingOpinion implements DebuggerMappingOpinion {
}
return Set.of();
}
}

View File

@ -16,11 +16,12 @@
package ghidra.app.plugin.core.debug.platform;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import ghidra.app.plugin.core.debug.mapping.DebuggerMappingOffer;
import ghidra.app.plugin.core.debug.mapping.DebuggerMappingOpinion;
import ghidra.dbg.target.TargetEnvironment;
import ghidra.dbg.target.TargetProcess;
import ghidra.dbg.DebugModelConventions;
import ghidra.dbg.target.*;
import ghidra.program.model.lang.CompilerSpecID;
import ghidra.program.model.lang.LanguageID;
@ -61,6 +62,17 @@ public class GdbPowerPCDebuggerMappingOpinion implements DebuggerMappingOpinion
}
}
@Override
public CompletableFuture<Set<DebuggerMappingOffer>> getOffers(TargetObject target) {
if (!(target instanceof TargetProcess)) {
return CompletableFuture.completedFuture(Set.of());
}
TargetProcess process = (TargetProcess) target;
CompletableFuture<? extends TargetEnvironment> futureEnv =
DebugModelConventions.findSuitable(TargetEnvironment.class, target);
return futureEnv.thenApply(env -> offersForEnv(env, process));
}
public Set<DebuggerMappingOffer> offersForEnv(TargetEnvironment env, TargetProcess process) {
if (!env.getDebugger().toLowerCase().contains("gdb")) {
return Set.of();