mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-0: Fix DBTraceObject.getCanonicalParent(snap)
This commit is contained in:
parent
14f7e1f458
commit
8a3faa73dc
4 changed files with 19 additions and 10 deletions
|
@ -147,6 +147,11 @@ public class DBTraceObjectValue implements TraceObjectValue {
|
||||||
this.wrapped = wrapped;
|
this.wrapped = wrapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return wrapped.toString();
|
||||||
|
}
|
||||||
|
|
||||||
void setWrapped(TraceObjectValueStorage wrapped) {
|
void setWrapped(TraceObjectValueStorage wrapped) {
|
||||||
this.wrapped = wrapped;
|
this.wrapped = wrapped;
|
||||||
if (wrapped instanceof DBTraceObjectValueData data) {
|
if (wrapped instanceof DBTraceObjectValueData data) {
|
||||||
|
|
|
@ -43,6 +43,12 @@ public class DBTraceObjectValueBehind implements TraceObjectValueStorage {
|
||||||
this.wrapper = new DBTraceObjectValue(manager, this);
|
this.wrapper = new DBTraceObjectValue(manager, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "<%s parent=%s entryKey=%s lifespan=%s value=%s>".formatted(
|
||||||
|
getClass().getSimpleName(), parent, entryKey, lifespan, value);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getEntryKey() {
|
public String getEntryKey() {
|
||||||
return entryKey;
|
return entryKey;
|
||||||
|
|
|
@ -222,18 +222,17 @@ class DBTraceObjectValueWriteBehindCache {
|
||||||
public Stream<DBTraceObjectValueBehind> streamCanonicalParents(DBTraceObject child,
|
public Stream<DBTraceObjectValueBehind> streamCanonicalParents(DBTraceObject child,
|
||||||
Lifespan lifespan) {
|
Lifespan lifespan) {
|
||||||
TraceObjectKeyPath path = child.getCanonicalPath();
|
TraceObjectKeyPath path = child.getCanonicalPath();
|
||||||
if (path.isRoot()) {
|
TraceObjectKeyPath parentPath = path.parent();
|
||||||
|
if (parentPath == null) { // child is the root
|
||||||
|
return Stream.of();
|
||||||
|
}
|
||||||
|
DBTraceObject parent = manager.getObjectByCanonicalPath(parentPath);
|
||||||
|
if (parent == null) {
|
||||||
|
// Not inserted yet, or someone deleted the parent object
|
||||||
return Stream.of();
|
return Stream.of();
|
||||||
}
|
}
|
||||||
String entryKey = path.key();
|
String entryKey = path.key();
|
||||||
// TODO: Better indexing?
|
return streamValues(parent, entryKey, lifespan, true);
|
||||||
return cachedValues.values()
|
|
||||||
.stream()
|
|
||||||
.flatMap(v -> v.entrySet()
|
|
||||||
.stream()
|
|
||||||
.filter(e -> entryKey.equals(e.getKey()))
|
|
||||||
.map(e -> e.getValue()))
|
|
||||||
.flatMap(v -> streamSub(v, lifespan, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<DBTraceObjectValueBehind> streamValues(DBTraceObject parent, Lifespan lifespan) {
|
public Stream<DBTraceObjectValueBehind> streamValues(DBTraceObject parent, Lifespan lifespan) {
|
||||||
|
|
|
@ -108,7 +108,6 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {
|
||||||
file bash
|
file bash
|
||||||
ghidra trace start
|
ghidra trace start
|
||||||
%s
|
%s
|
||||||
ghidra trace tx-open "Fake" 'ghidra trace create-obj Breakpoints'
|
|
||||||
starti"""
|
starti"""
|
||||||
.formatted(INSTRUMENT_STOPPED));
|
.formatted(INSTRUMENT_STOPPED));
|
||||||
RemoteMethod refreshBreakpoints = conn.getMethod("refresh_breakpoints");
|
RemoteMethod refreshBreakpoints = conn.getMethod("refresh_breakpoints");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue