Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/GP-1678_Dan_objectRecorder--SQUASHED'

Ryan Kurtz0e8e418bfaed
diff --cc Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaX64RegistersTest.java
index 4e533f565f,4e533f565f..1c959ef0e5
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaX64RegistersTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaX64RegistersTest.java
@@@ -15,28 -15,28 +15,19 @@@
*/
package agent.frida.model;
--import static org.junit.Assert.assertArrayEquals;
--import static org.junit.Assert.assertEquals;
--import static org.junit.Assert.assertTrue;
--import static org.junit.Assume.assumeNotNull;
--
--import java.util.HashMap;
--import java.util.List;
--import java.util.Map;
--import java.util.Objects;
++import static org.junit.Assert.*;
++import static org.junit.Assume.*;
++
++import java.util.*;
import java.util.Map.Entry;
import org.junit.Ignore;
import org.junit.Test;
import agent.frida.model.iface2.FridaModelTargetProcess;
--import agent.frida.model.iface2.FridaModelTargetThreadContainer;
import agent.frida.model.impl.FridaModelTargetThreadContainerImpl;
--import ghidra.dbg.agent.DefaultTargetModelRoot;
import ghidra.dbg.target.*;
--import ghidra.dbg.test.AbstractDebuggerModelRegistersTest;
--import ghidra.dbg.test.AbstractDebuggerModelTest;
--import ghidra.dbg.test.ProvidesTargetViaLaunchSpecimen;
++import ghidra.dbg.test.*;
import ghidra.dbg.util.PathUtils;
public abstract class AbstractModelForFridaX64RegistersTest
@@@ -94,7 -94,7 +85,7 @@@
for (Entry<String, byte[]> ent : getRegisterWrites().entrySet()) {
String regName = ent.getKey();
Map<List<String>, TargetRegister> regs = m.findAll(TargetRegister.class,
-- path, pred -> pred.applyIndices(regName), false);
++ path, pred -> pred.applyKeys(regName), false);
for (TargetRegister reg : regs.values()) {
assertEquals(ent.getValue().length, (reg.getBitLength() + 7) / 8);
}
@@@ -134,7 -134,7 +125,7 @@@
for (TargetRegisterBank bank : banks.values()) {
for (String name : exp.keySet()) {
Map<List<String>, TargetRegister> regs = m.findAll(TargetRegister.class,
-- bank.getPath(), pred -> pred.applyIndices(name), false);
++ bank.getPath(), pred -> pred.applyKeys(name), false);
for (TargetRegister reg : regs.values()) {
byte[] bytes = waitOn(bank.readRegister(reg));
read.put(name, bytes);
@@@ -163,7 -163,7 +154,7 @@@
for (TargetRegisterBank bank : banks.values()) {
for (String name : write.keySet()) {
Map<List<String>, TargetRegister> regs = m.findAll(TargetRegister.class,
-- bank.getPath(), pred -> pred.applyIndices(name), false);
++ bank.getPath(), pred -> pred.applyKeys(name), false);
for (TargetRegister reg : regs.values()) {
waitOn(bank.writeRegister(reg, write.get(name)));
diff --cc Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyIntoProgramDialog.java
index 440cb0e4d2,1f9bbf5d63..dc86cd230a
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyIntoProgramDialog.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyIntoProgramDialog.java
@@@ -810,13 -810,7 +810,13 @@@ public class DebuggerCopyIntoProgramDia
throws Exception {
synchronized (this) {
monitor.checkCanceled();
- this.captureTask = recorder.readMemoryBlocks(new AddressSet(range), monitor, false);
+ CompletableFuture<NavigableMap<Address, byte[]>> recCapture =
- recorder.captureProcessMemory(new AddressSet(range), monitor, false);
++ recorder.readMemoryBlocks(new AddressSet(range), monitor, false);
+ this.captureTask = recCapture.thenCompose(__ -> {
+ return recorder.getTarget().getModel().flushEvents();
+ }).thenCompose(__ -> {
+ return recorder.flushTransactions();
+ });
}
try {
captureTask.get(); // Not a fan, but whatever.
diff --cc Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/DebuggerLogicalBreakpointServicePlugin.java
index 23a4cba4bb,00f2f8dbe0..2f0d47cf2e
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/DebuggerLogicalBreakpointServicePlugin.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/DebuggerLogicalBreakpointServicePlugin.java
@@@ -234,17 -237,24 +234,22 @@@ public class DebuggerLogicalBreakpointS
}
}
- private void breakpointChanged(TraceBreakpoint breakpoint) {
- if (!breakpoint.getLifespan().contains(info.recorder.getSnap())) {
+ private void breakpointChanged(TraceBreakpoint tb) {
+ if (!tb.getLifespan().contains(info.recorder.getSnap())) {
return;
}
- try (AddCollector c = new AddCollector(changeListeners.fire)) {
- synchronized (lock) {
- info.trackTraceBreakpoint(breakpoint, c, true);
- }
+ try {
+ info.trackTraceBreakpoint(c.a, tb, true);
}
catch (TrackedTooSoonException e) {
- Msg.info(this, "Ignoring " + breakpoint +
+ Msg.info(this, "Ignoring " + tb +
" changed until service has finished loading its trace");
}
+ catch (NoSuchElementException e) {
+ // TODO: This catch clause should not be necessary.
+ Msg.error(this,
- "!!!! Object-based breakpoint emitted event without a spec: " + breakpoint);
++ "!!!! Object-based breakpoint emitted event without a spec: " + tb);
+ }
}
private void breakpointLifespanChanged(TraceAddressSpace spaceIsNull,