mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 16:47:43 +08:00
GP-2760: TraceManager to attempt platform mapping
This commit is contained in:
+2
-3
@@ -22,8 +22,7 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import agent.gdb.manager.GdbStackFrame;
|
import agent.gdb.manager.GdbStackFrame;
|
||||||
import agent.gdb.manager.impl.cmd.GdbStateChangeRecord;
|
import agent.gdb.manager.impl.cmd.GdbStateChangeRecord;
|
||||||
import ghidra.dbg.agent.DefaultTargetObject;
|
import ghidra.dbg.agent.DefaultTargetObject;
|
||||||
import ghidra.dbg.target.TargetObject;
|
import ghidra.dbg.target.*;
|
||||||
import ghidra.dbg.target.TargetStackFrame;
|
|
||||||
import ghidra.dbg.target.schema.*;
|
import ghidra.dbg.target.schema.*;
|
||||||
import ghidra.dbg.util.PathUtils;
|
import ghidra.dbg.util.PathUtils;
|
||||||
import ghidra.lifecycle.Internal;
|
import ghidra.lifecycle.Internal;
|
||||||
@@ -37,7 +36,7 @@ import ghidra.program.model.address.Address;
|
|||||||
@TargetAttributeType(type = Void.class) })
|
@TargetAttributeType(type = Void.class) })
|
||||||
public class GdbModelTargetStackFrame
|
public class GdbModelTargetStackFrame
|
||||||
extends DefaultTargetObject<TargetObject, GdbModelTargetStack>
|
extends DefaultTargetObject<TargetObject, GdbModelTargetStack>
|
||||||
implements TargetStackFrame, GdbModelSelectableObject {
|
implements TargetStackFrame, TargetAggregate, GdbModelSelectableObject {
|
||||||
public static final String FUNC_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "function";
|
public static final String FUNC_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "function";
|
||||||
public static final String FROM_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "from"; // TODO
|
public static final String FROM_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "from"; // TODO
|
||||||
|
|
||||||
|
|||||||
+25
-2
@@ -233,6 +233,8 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
|||||||
private DebuggerModelService modelService;
|
private DebuggerModelService modelService;
|
||||||
@AutoServiceConsumed
|
@AutoServiceConsumed
|
||||||
private DebuggerEmulationService emulationService;
|
private DebuggerEmulationService emulationService;
|
||||||
|
@AutoServiceConsumed
|
||||||
|
private DebuggerPlatformService platformService;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final AutoService.Wiring autoServiceWiring;
|
private final AutoService.Wiring autoServiceWiring;
|
||||||
|
|
||||||
@@ -473,6 +475,21 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
|||||||
return coordinates.recorder(recorder);
|
return coordinates.recorder(recorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DebuggerCoordinates fillInPlatform(DebuggerCoordinates coordinates) {
|
||||||
|
if (platformService == null || coordinates.getTrace() == null) {
|
||||||
|
return coordinates;
|
||||||
|
}
|
||||||
|
// This will emit an event, but it should have no effect
|
||||||
|
DebuggerPlatformMapper mapper = platformService.getMapper(coordinates.getTrace(),
|
||||||
|
coordinates.getObject(), coordinates.getSnap());
|
||||||
|
if (mapper == null) {
|
||||||
|
return coordinates;
|
||||||
|
}
|
||||||
|
TracePlatform platform =
|
||||||
|
getPlatformForMapper(current.getTrace(), current.getObject(), mapper);
|
||||||
|
return coordinates.platform(platform);
|
||||||
|
}
|
||||||
|
|
||||||
protected DebuggerCoordinates doSetCurrent(DebuggerCoordinates newCurrent) {
|
protected DebuggerCoordinates doSetCurrent(DebuggerCoordinates newCurrent) {
|
||||||
newCurrent = newCurrent == null ? DebuggerCoordinates.NOWHERE : newCurrent;
|
newCurrent = newCurrent == null ? DebuggerCoordinates.NOWHERE : newCurrent;
|
||||||
synchronized (listenersByTrace) {
|
synchronized (listenersByTrace) {
|
||||||
@@ -480,6 +497,7 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
|||||||
if (current.equals(resolved)) {
|
if (current.equals(resolved)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
resolved = fillInPlatform(resolved);
|
||||||
current = resolved;
|
current = resolved;
|
||||||
contextChanged();
|
contextChanged();
|
||||||
if (resolved.getTrace() != null) {
|
if (resolved.getTrace() != null) {
|
||||||
@@ -542,6 +560,11 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
|||||||
activateSnap(snap);
|
activateSnap(snap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected TracePlatform getPlatformForMapper(Trace trace, TraceObject object,
|
||||||
|
DebuggerPlatformMapper mapper) {
|
||||||
|
return trace.getPlatformManager().getPlatform(mapper.getCompilerSpec(object));
|
||||||
|
}
|
||||||
|
|
||||||
protected void doPlatformMapperSelected(Trace trace, DebuggerPlatformMapper mapper) {
|
protected void doPlatformMapperSelected(Trace trace, DebuggerPlatformMapper mapper) {
|
||||||
synchronized (listenersByTrace) {
|
synchronized (listenersByTrace) {
|
||||||
if (!listenersByTrace.containsKey(trace)) {
|
if (!listenersByTrace.containsKey(trace)) {
|
||||||
@@ -549,8 +572,8 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
|||||||
}
|
}
|
||||||
DebuggerCoordinates cur =
|
DebuggerCoordinates cur =
|
||||||
lastCoordsByTrace.getOrDefault(trace, DebuggerCoordinates.NOWHERE);
|
lastCoordsByTrace.getOrDefault(trace, DebuggerCoordinates.NOWHERE);
|
||||||
DebuggerCoordinates adj = cur.platform(
|
DebuggerCoordinates adj =
|
||||||
trace.getPlatformManager().getPlatform(mapper.getCompilerSpec(cur.getObject())));
|
cur.platform(getPlatformForMapper(trace, cur.getObject(), mapper));
|
||||||
lastCoordsByTrace.put(trace, adj);
|
lastCoordsByTrace.put(trace, adj);
|
||||||
if (trace == current.getTrace()) {
|
if (trace == current.getTrace()) {
|
||||||
current = adj;
|
current = adj;
|
||||||
|
|||||||
Reference in New Issue
Block a user