mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-3887: Update Debugger course for Trace RMI.
This commit is contained in:
parent
190f1eaa1e
commit
a93a695e6a
79 changed files with 2235 additions and 1663 deletions
|
@ -121,8 +121,19 @@ public class DBTraceObjectBreakpointLocation
|
|||
@Override
|
||||
public String getName() {
|
||||
try (LockHold hold = object.getTrace().lockRead()) {
|
||||
return TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),
|
||||
TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, "");
|
||||
String display = TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),
|
||||
TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, null);
|
||||
if (display != null) {
|
||||
return display;
|
||||
}
|
||||
TraceObject container =
|
||||
object.queryCanonicalAncestorsTargetInterface(TargetBreakpointSpecContainer.class)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (container == null) {
|
||||
return ""; // Should be impossible, but maybe not a sane schema
|
||||
}
|
||||
return container.getCanonicalPath().relativize(object.getCanonicalPath()).toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,8 +323,16 @@ public class DBTraceObjectBreakpointLocation
|
|||
@Override
|
||||
public String getComment() {
|
||||
try (LockHold hold = object.getTrace().lockRead()) {
|
||||
return TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(), KEY_COMMENT,
|
||||
String.class, "");
|
||||
String comment = TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),
|
||||
KEY_COMMENT, String.class, "");
|
||||
if (!comment.isBlank()) {
|
||||
return comment;
|
||||
}
|
||||
TraceObjectBreakpointSpec spec = getSpecification();
|
||||
if (spec == null) {
|
||||
return "";
|
||||
}
|
||||
return spec.getExpression();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -181,6 +181,12 @@ public class DBTraceObjectBreakpointSpec
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExpression() {
|
||||
return TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),
|
||||
TargetBreakpointSpec.EXPRESSION_ATTRIBUTE_NAME, String.class, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<TraceThread> getThreads() {
|
||||
throw new UnsupportedOperationException("Ask a location instead");
|
||||
|
|
|
@ -18,7 +18,12 @@ package ghidra.trace.database.time;
|
|||
import java.io.IOException;
|
||||
|
||||
import db.DBRecord;
|
||||
import ghidra.dbg.target.TargetEventScope;
|
||||
import ghidra.trace.database.target.DBTraceObject;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.target.TraceObject;
|
||||
import ghidra.trace.model.target.TraceObjectValue;
|
||||
import ghidra.trace.model.thread.TraceObjectThread;
|
||||
import ghidra.trace.model.thread.TraceThread;
|
||||
import ghidra.trace.model.time.TraceSnapshot;
|
||||
import ghidra.trace.model.time.schedule.TraceSchedule;
|
||||
|
@ -143,7 +148,26 @@ public class DBTraceSnapshot extends DBAnnotatedObject implements TraceSnapshot
|
|||
@Override
|
||||
public TraceThread getEventThread() {
|
||||
try (LockHold hold = LockHold.lock(manager.lock.readLock())) {
|
||||
return eventThread;
|
||||
if (eventThread != null) {
|
||||
return eventThread;
|
||||
}
|
||||
// TODO: Can it be something other than root?
|
||||
DBTraceObject root = manager.trace.getObjectManager().getRootObject();
|
||||
if (root == null) {
|
||||
return null;
|
||||
}
|
||||
if (!root.getTargetSchema().getInterfaces().contains(TargetEventScope.class)) {
|
||||
return null;
|
||||
}
|
||||
TraceObjectValue eventAttr =
|
||||
root.getAttribute(getKey(), TargetEventScope.EVENT_OBJECT_ATTRIBUTE_NAME);
|
||||
if (eventAttr == null) {
|
||||
return null;
|
||||
}
|
||||
if (!(eventAttr.getValue() instanceof TraceObject eventObj)) {
|
||||
return null;
|
||||
}
|
||||
return eventObj.queryInterface(TraceObjectThread.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,5 +43,7 @@ public interface TraceObjectBreakpointSpec extends TraceBreakpoint, TraceObjectI
|
|||
|
||||
Collection<? extends TraceObjectBreakpointLocation> getLocations();
|
||||
|
||||
String getExpression();
|
||||
|
||||
void setKinds(Lifespan lifespan, Collection<TraceBreakpointKind> kinds);
|
||||
}
|
||||
|
|
|
@ -224,8 +224,8 @@ public final class TraceObjectKeyPath implements Comparable<TraceObjectKeyPath>
|
|||
/**
|
||||
* Stream, starting with the longer paths, paths that match the given predicates
|
||||
*
|
||||
* @param matcher
|
||||
* @return
|
||||
* @param predicates the predicates to filter the ancestor paths
|
||||
* @return the stream of matching paths, longest to shortest
|
||||
*/
|
||||
public Stream<TraceObjectKeyPath> streamMatchingAncestry(PathPredicates predicates) {
|
||||
if (!predicates.ancestorMatches(keyList, false)) {
|
||||
|
@ -253,4 +253,15 @@ public final class TraceObjectKeyPath implements Comparable<TraceObjectKeyPath>
|
|||
public boolean isAncestor(TraceObjectKeyPath that) {
|
||||
return PathUtils.isAncestor(keyList, that.keyList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assuming this is an ancestor of the given successor, compute the relative path from here to
|
||||
* there
|
||||
*
|
||||
* @param successor the successor
|
||||
* @return the relative path
|
||||
*/
|
||||
public TraceObjectKeyPath relativize(TraceObjectKeyPath successor) {
|
||||
return TraceObjectKeyPath.of(PathUtils.relativize(keyList, successor.keyList));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue