Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/patch'

Ryan Kurtz878ab5d664a8
diff --cc Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/action/DebuggerReadsMemoryTrait.java
index 24d5722f54,94a4c3a53d..238913a213
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/action/DebuggerReadsMemoryTrait.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/action/DebuggerReadsMemoryTrait.java
@@@ -60,25 -66,43 +66,43 @@@ public abstract class DebuggerReadsMemo
@Override
public void actionPerformed(ActionContext context) {
- AddressSetView selection = getSelection();
- if (selection == null || selection.isEmpty() || !current.isAliveAndReadsPresent()) {
+ if (!current.isAliveAndReadsPresent()) {
return;
}
+ AddressSetView selection = getSelection();
+ if (selection == null || selection.isEmpty()) {
+ selection = visible;
+ }
+ final AddressSetView sel = selection;
Trace trace = current.getTrace();
TraceRecorder recorder = current.getRecorder();
- BackgroundUtils.async(tool, trace, NAME, true, true, false,
- (__, monitor) -> recorder.readMemoryBlocks(selection, monitor, false));
+ BackgroundUtils.async(tool, trace, NAME, true, true, false, (_t, monitor) -> {
+ TargetObject target = recorder.getTarget();
+ DebuggerObjectModel model = target.getModel();
+ model.invalidateAllLocalCaches();
+ PathMatcher memMatcher = target.getSchema().searchFor(TargetMemory.class, true);
+ Collection<TargetObject> memories = memMatcher.getCachedSuccessors(target).values();
+ CompletableFuture<?>[] requests = memories.stream()
+ .map(TargetObject::invalidateCaches)
+ .toArray(CompletableFuture[]::new);
+ return CompletableFuture.allOf(requests).thenCompose(_r -> {
- return recorder.captureProcessMemory(sel, monitor, false);
++ return recorder.readMemoryBlocks(sel, monitor, false);
+ });
+ });
}
@Override
public boolean isEnabledForContext(ActionContext context) {
- AddressSetView selection = getSelection();
- if (selection == null || selection.isEmpty() || !current.isAliveAndReadsPresent()) {
+ if (!current.isAliveAndReadsPresent()) {
return false;
}
+ AddressSetView selection = getSelection();
+ if (selection == null || selection.isEmpty()) {
+ selection = visible;
+ }
TraceRecorder recorder = current.getRecorder();
// TODO: Either allow partial, or provide action to intersect with accessible
- if (!recorder.getAccessibleProcessMemory().contains(selection)) {
+ if (!recorder.getAccessibleMemory().contains(selection)) {
return false;
}
return true;