Merge branch 'GP-3122_ghidra1_AutoTransaction'

This commit is contained in:
ghidra1 2023-02-28 14:53:27 -05:00
commit 725c752320
209 changed files with 1892 additions and 2054 deletions

View file

@ -18,6 +18,7 @@ import java.nio.ByteOrder;
import agent.dbgeng.manager.impl.DbgManagerImpl; import agent.dbgeng.manager.impl.DbgManagerImpl;
import agent.dbgeng.model.AbstractDbgModel; import agent.dbgeng.model.AbstractDbgModel;
import db.Transaction;
import ghidra.app.script.GhidraScript; import ghidra.app.script.GhidraScript;
import ghidra.app.services.DebuggerModelService; import ghidra.app.services.DebuggerModelService;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
@ -29,7 +30,6 @@ import ghidra.trace.model.Trace;
import ghidra.trace.model.memory.*; import ghidra.trace.model.memory.*;
import ghidra.util.LockHold; import ghidra.util.LockHold;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
/** /**
@ -119,7 +119,7 @@ public class BangAddressToMemory extends GhidraScript {
} }
private void parse(String result) { private void parse(String result) {
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Populate memory"); try (Transaction tx = trace.openTransaction("Populate memory");
LockHold hold = trace.lockWrite();) { LockHold hold = trace.lockWrite();) {
//Pattern pattern = Pattern.compile("\\s+(*)\\s+(*)\\s+"); //Pattern pattern = Pattern.compile("\\s+(*)\\s+(*)\\s+");
//Matcher matcher = pattern.matcher(fullclassname); //Matcher matcher = pattern.matcher(fullclassname);

View file

@ -25,6 +25,7 @@ import agent.dbgmodel.dbgmodel.DbgModel;
import agent.dbgmodel.dbgmodel.bridge.HostDataModelAccess; import agent.dbgmodel.dbgmodel.bridge.HostDataModelAccess;
import agent.dbgmodel.dbgmodel.main.ModelObject; import agent.dbgmodel.dbgmodel.main.ModelObject;
import agent.dbgmodel.impl.dbgmodel.bridge.HDMAUtil; import agent.dbgmodel.impl.dbgmodel.bridge.HDMAUtil;
import db.Transaction;
import ghidra.app.script.GhidraScript; import ghidra.app.script.GhidraScript;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
@ -39,7 +40,6 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.thread.TraceThreadManager; import ghidra.trace.model.thread.TraceThreadManager;
import ghidra.trace.model.time.TraceTimeManager; import ghidra.trace.model.time.TraceTimeManager;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
/** /**
* This script populates a trace database for demonstrations purposes and opens it in the current * This script populates a trace database for demonstrations purposes and opens it in the current
@ -189,8 +189,7 @@ public class PopulateTraceLocal extends GhidraScript {
client.openDumpFileWide(f.getAbsolutePath()); client.openDumpFileWide(f.getAbsolutePath());
control.waitForEvent(); control.waitForEvent();
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Populate Events")) {
UndoableTransaction.start(trace, "Populate Events")) {
List<ModelObject> children = List<ModelObject> children =
util.getElements(List.of("Debugger", "State", "DebuggerVariables", "curprocess", util.getElements(List.of("Debugger", "State", "DebuggerVariables", "curprocess",
@ -282,8 +281,7 @@ public class PopulateTraceLocal extends GhidraScript {
} }
} }
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Populate Registers")) {
UndoableTransaction.start(trace, "Populate Registers")) {
//for (Long tick : tickManager.getAllTicks()) { //for (Long tick : tickManager.getAllTicks()) {
for (Long snap : eventSnaps) { for (Long snap : eventSnaps) {
control.execute("!tt " + Long.toHexString(snap) + ":0"); control.execute("!tt " + Long.toHexString(snap) + ":0");
@ -331,7 +329,7 @@ public class PopulateTraceLocal extends GhidraScript {
} }
/* /*
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Populate Heap", true)) { try (Transaction tx = trace.openTransaction("Populate Heap")) {
ModelObject currentSession = util.getCurrentSession(); ModelObject currentSession = util.getCurrentSession();
ModelObject data = currentSession.getKeyValue("TTD").getKeyValue("Data"); ModelObject data = currentSession.getKeyValue("TTD").getKeyValue("Data");
ModelMethod heap = data.getMethod("Heap"); ModelMethod heap = data.getMethod("Heap");

View file

@ -16,6 +16,7 @@
import java.io.File; import java.io.File;
import java.util.Set; import java.util.Set;
import db.Transaction;
import ghidra.app.script.GhidraScript; import ghidra.app.script.GhidraScript;
import ghidra.app.services.DebuggerModelService; import ghidra.app.services.DebuggerModelService;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
@ -28,7 +29,6 @@ import ghidra.program.model.lang.*;
import ghidra.trace.database.DBTrace; import ghidra.trace.database.DBTrace;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.time.TraceTimeManager; import ghidra.trace.model.time.TraceTimeManager;
import ghidra.util.database.UndoableTransaction;
/** /**
* This script populates a trace database for demonstrations purposes and opens it in the current * This script populates a trace database for demonstrations purposes and opens it in the current
@ -151,7 +151,7 @@ public class PopulateTraceRemote extends GhidraScript {
manager = tool.getService(DebuggerTraceManagerService.class); manager = tool.getService(DebuggerTraceManagerService.class);
targets = tool.getService(DebuggerModelService.class); targets = tool.getService(DebuggerModelService.class);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Populate Events")) { try (Transaction tx = trace.openTransaction("Populate Events")) {
timeManager = trace.getTimeManager(); timeManager = trace.getTimeManager();
timeManager.createSnapshot("init"); timeManager.createSnapshot("init");
} }

View file

@ -18,6 +18,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.util.*; import java.util.*;
import db.Transaction;
import ghidra.app.plugin.assembler.Assembler; import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers; import ghidra.app.plugin.assembler.Assemblers;
import ghidra.app.script.GhidraScript; import ghidra.app.script.GhidraScript;
@ -39,7 +40,6 @@ import ghidra.trace.model.symbol.TraceLabelSymbol;
import ghidra.trace.model.symbol.TraceNamespaceSymbol; import ghidra.trace.model.symbol.TraceNamespaceSymbol;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -289,12 +289,10 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* For clarity, I will add each tick to the trace in its own transaction. The * For clarity, I will add each tick to the trace in its own transaction. The
* UndoableTransaction class eases the syntax and reduces errors in starting and ending * Transaction class eases the syntax and reduces errors in starting and ending
* transactions. This Utility deprecates ProgramTransaction, as it can be used on any domain * transactions.
* object.
*/ */
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Populate First Snapshot")) {
UndoableTransaction.start(trace, "Populate First Snapshot")) {
/** /**
* While not strictly required, each tick should be explicitly added to the database and * While not strictly required, each tick should be explicitly added to the database and
* given a description. Some things may mis-behave if there does not exist at least one * given a description. Some things may mis-behave if there does not exist at least one
@ -438,7 +436,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* Just hand emulate the stepping * Just hand emulate the stepping
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = trace.getTimeManager().createSnapshot("Stepped: PUSH RBP").getKey(); long snap = trace.getTimeManager().createSnapshot("Stepped: PUSH RBP").getKey();
stack1offset -= 8; stack1offset -= 8;
@ -465,7 +463,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* More hand emulation * More hand emulation
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = trace.getTimeManager().createSnapshot("Stepped: MOV RBP,RSP").getKey(); long snap = trace.getTimeManager().createSnapshot("Stepped: MOV RBP,RSP").getKey();
putRIP(snap, regs1, mainInstructions.get(++pc1)); putRIP(snap, regs1, mainInstructions.get(++pc1));
@ -481,7 +479,7 @@ public class PopulateDemoTrace extends GhidraScript {
* While this is a complicated call, there is nothing new to demonstrate in its * While this is a complicated call, there is nothing new to demonstrate in its
* implementation. As an exercise, see if you can follow what is happening within. * implementation. As an exercise, see if you can follow what is happening within.
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = trace.getTimeManager() long snap = trace.getTimeManager()
.createSnapshot("Stepped Thread 1: CALL clone -> Thread 2") .createSnapshot("Stepped Thread 1: CALL clone -> Thread 2")
.getKey(); .getKey();
@ -519,7 +517,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* Hand emulate thread1 a few steps * Hand emulate thread1 a few steps
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: RET from clone").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: RET from clone").getKey();
@ -534,7 +532,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* ... * ...
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: TEST EAX,EAX").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: TEST EAX,EAX").getKey();
@ -544,7 +542,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread1); placeRegUnits(snap, thread1);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: JNZ child").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: JNZ child").getKey();
@ -556,7 +554,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* Switch to thread2 * Switch to thread2
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: RET from clone").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: RET from clone").getKey();
@ -568,7 +566,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread2); placeRegUnits(snap, thread2);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: TEST EAX,EAX").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: TEST EAX,EAX").getKey();
@ -578,7 +576,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread2); placeRegUnits(snap, thread2);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: JNZ child").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: JNZ child").getKey();
@ -590,7 +588,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* Switch to thread1 * Switch to thread1
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: SUB RSP,0x10").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: SUB RSP,0x10").getKey();
@ -602,7 +600,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread1); placeRegUnits(snap, thread1);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(1)").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(1)").getKey();
@ -613,7 +611,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread1); placeRegUnits(snap, thread1);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(2)").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(2)").getKey();
@ -624,7 +622,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread1); placeRegUnits(snap, thread1);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(3)").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(3)").getKey();
@ -635,7 +633,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread1); placeRegUnits(snap, thread1);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(4)").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: MOV...(4)").getKey();
@ -649,7 +647,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* Switch to thread2 * Switch to thread2
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: SUB RSP,0x10").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: SUB RSP,0x10").getKey();
@ -661,7 +659,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread2); placeRegUnits(snap, thread2);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: MOV...(1)").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: MOV...(1)").getKey();
@ -672,7 +670,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread2); placeRegUnits(snap, thread2);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: MOV...(2)").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: MOV...(2)").getKey();
@ -683,7 +681,7 @@ public class PopulateDemoTrace extends GhidraScript {
placeRegUnits(snap, thread2); placeRegUnits(snap, thread2);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: MOV...(3)").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: MOV...(3)").getKey();
@ -697,7 +695,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* Let thread2 exit first * Let thread2 exit first
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 2: CALL exit").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 2: CALL exit").getKey();
@ -707,7 +705,7 @@ public class PopulateDemoTrace extends GhidraScript {
/** /**
* Terminate * Terminate
*/ */
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Step")) { try (Transaction tx = trace.openTransaction("Step")) {
long snap = long snap =
trace.getTimeManager().createSnapshot("Stepped Thread 1: CALL exit").getKey(); trace.getTimeManager().createSnapshot("Stepped Thread 1: CALL exit").getKey();

View file

@ -20,6 +20,7 @@ import java.util.concurrent.CompletableFuture;
import javax.swing.Icon; import javax.swing.Icon;
import db.Transaction;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.plugin.core.debug.gui.DebuggerResources.AutoReadMemoryAction; import ghidra.app.plugin.core.debug.gui.DebuggerResources.AutoReadMemoryAction;
import ghidra.app.plugin.core.debug.service.emulation.ProgramEmulationUtils; import ghidra.app.plugin.core.debug.service.emulation.ProgramEmulationUtils;
@ -34,7 +35,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.memory.TraceMemoryManager; import ghidra.trace.model.memory.TraceMemoryManager;
import ghidra.trace.model.memory.TraceMemoryState; import ghidra.trace.model.memory.TraceMemoryState;
import ghidra.util.database.UndoableTransaction;
public class LoadEmulatorAutoReadMemorySpec implements AutoReadMemorySpec { public class LoadEmulatorAutoReadMemorySpec implements AutoReadMemorySpec {
public static final String CONFIG_NAME = "LOAD_EMULATOR"; public static final String CONFIG_NAME = "LOAD_EMULATOR";
@ -85,7 +85,7 @@ public class LoadEmulatorAutoReadMemorySpec implements AutoReadMemorySpec {
long snap = coordinates.getSnap(); long snap = coordinates.getSnap();
ByteBuffer buf = ByteBuffer.allocate(4096); ByteBuffer buf = ByteBuffer.allocate(4096);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Load Visible")) { try (Transaction tx = trace.openTransaction("Load Visible")) {
new AbstractMappedMemoryBytesVisitor(mappingService, buf.array()) { new AbstractMappedMemoryBytesVisitor(mappingService, buf.array()) {
@Override @Override
protected void visitData(Address hostAddr, byte[] data, int size) { protected void visitData(Address hostAddr, byte[] data, int size) {

View file

@ -18,13 +18,13 @@ package ghidra.app.plugin.core.debug.gui.breakpoint;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import db.Transaction;
import ghidra.app.services.LogicalBreakpoint; import ghidra.app.services.LogicalBreakpoint;
import ghidra.app.services.LogicalBreakpoint.State; import ghidra.app.services.LogicalBreakpoint.State;
import ghidra.pcode.exec.SleighUtils; import ghidra.pcode.exec.SleighUtils;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.trace.model.breakpoint.TraceBreakpoint; import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
public class BreakpointLocationRow { public class BreakpointLocationRow {
private final DebuggerBreakpointsProvider provider; private final DebuggerBreakpointsProvider provider;
@ -73,8 +73,7 @@ public class BreakpointLocationRow {
} }
public void setName(String name) { public void setName(String name) {
try (UndoableTransaction tid = try (Transaction tid = loc.getTrace().openTransaction("Set breakpoint name")) {
UndoableTransaction.start(loc.getTrace(), "Set breakpoint name")) {
loc.setName(name); loc.setName(name);
} }
} }
@ -100,8 +99,7 @@ public class BreakpointLocationRow {
} }
public void setComment(String comment) { public void setComment(String comment) {
try (UndoableTransaction tid = try (Transaction tid = loc.getTrace().openTransaction("Set breakpoint comment")) {
UndoableTransaction.start(loc.getTrace(), "Set breakpoint comment")) {
loc.setComment(comment); loc.setComment(comment);
} }
} }

View file

@ -27,6 +27,7 @@ import javax.swing.*;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel; import javax.swing.table.TableColumnModel;
import db.Transaction;
import docking.ReusableDialogComponentProvider; import docking.ReusableDialogComponentProvider;
import docking.widgets.table.*; import docking.widgets.table.*;
import docking.widgets.table.DefaultEnumeratedColumnTableModel.EnumeratedTableColumn; import docking.widgets.table.DefaultEnumeratedColumnTableModel.EnumeratedTableColumn;
@ -47,7 +48,6 @@ import ghidra.trace.model.memory.TraceMemoryRegion;
import ghidra.trace.model.modules.*; import ghidra.trace.model.modules.*;
import ghidra.trace.model.program.TraceProgramView; import ghidra.trace.model.program.TraceProgramView;
import ghidra.util.*; import ghidra.util.*;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.table.GhidraTableFilterPanel; import ghidra.util.table.GhidraTableFilterPanel;
import ghidra.util.task.*; import ghidra.util.task.*;
@ -831,7 +831,7 @@ public class DebuggerCopyIntoProgramDialog extends ReusableDialogComponentProvid
Program dest = getDestination().getOrCreateProgram(source, this); Program dest = getDestination().getOrCreateProgram(source, this);
boolean doRelease = !Arrays.asList(programManager.getAllOpenPrograms()).contains(dest); boolean doRelease = !Arrays.asList(programManager.getAllOpenPrograms()).contains(dest);
TraceRecorder recorder = getRecorderIfEnabledAndReadsPresent(); TraceRecorder recorder = getRecorderIfEnabledAndReadsPresent();
try (UndoableTransaction tid = UndoableTransaction.start(dest, "Copy From Trace")) { try (Transaction tx = dest.openTransaction("Copy From Trace")) {
monitor.initialize(tableModel.getRowCount()); monitor.initialize(tableModel.getRowCount());
for (RangeEntry entry : tableModel.getModelData()) { for (RangeEntry entry : tableModel.getModelData()) {
monitor.setMessage("Copying into " + entry.getDstRange()); monitor.setMessage("Copying into " + entry.getDstRange());

View file

@ -15,11 +15,11 @@
*/ */
package ghidra.app.plugin.core.debug.gui.memory; package ghidra.app.plugin.core.debug.gui.memory;
import db.Transaction;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressRange; import ghidra.program.model.address.AddressRange;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.TraceMemoryRegion; import ghidra.trace.model.memory.TraceMemoryRegion;
import ghidra.util.database.UndoableTransaction;
public class RegionRow { public class RegionRow {
private final TraceMemoryRegion region; private final TraceMemoryRegion region;
@ -33,8 +33,7 @@ public class RegionRow {
} }
public void setName(String name) { public void setName(String name) {
try (UndoableTransaction tid = try (Transaction tx = region.getTrace().openTransaction("Rename region")) {
UndoableTransaction.start(region.getTrace(), "Rename region")) {
region.setName(name); region.setName(name);
} }
} }
@ -73,8 +72,8 @@ public class RegionRow {
} }
public void setRead(boolean read) { public void setRead(boolean read) {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(region.getTrace(), "Toggle region read flag")) { region.getTrace().openTransaction("Toggle region read flag")) {
region.setRead(read); region.setRead(read);
} }
} }
@ -84,8 +83,8 @@ public class RegionRow {
} }
public void setWrite(boolean write) { public void setWrite(boolean write) {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(region.getTrace(), "Toggle region write flag")) { region.getTrace().openTransaction("Toggle region write flag")) {
region.setWrite(write); region.setWrite(write);
} }
} }
@ -95,8 +94,8 @@ public class RegionRow {
} }
public void setExecute(boolean execute) { public void setExecute(boolean execute) {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(region.getTrace(), "Toggle region execute flag")) { region.getTrace().openTransaction("Toggle region execute flag")) {
region.setExecute(execute); region.setExecute(execute);
} }
} }
@ -106,8 +105,8 @@ public class RegionRow {
} }
public void setVolatile(boolean vol) { public void setVolatile(boolean vol) {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(region.getTrace(), "Toggle region volatile flag")) { region.getTrace().openTransaction("Toggle region volatile flag")) {
region.setVolatile(vol); region.setVolatile(vol);
} }
} }

View file

@ -15,6 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.gui.model.columns; package ghidra.app.plugin.core.debug.gui.model.columns;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueProperty; import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueProperty;
import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow; import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;
import ghidra.docking.settings.Settings; import ghidra.docking.settings.Settings;
@ -22,7 +23,6 @@ import ghidra.framework.plugintool.ServiceProvider;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.target.TraceObject; import ghidra.trace.model.target.TraceObject;
import ghidra.util.database.UndoableTransaction;
public class TraceValueObjectEditableAttributeColumn<T> extends TraceValueObjectAttributeColumn<T> public class TraceValueObjectEditableAttributeColumn<T> extends TraceValueObjectAttributeColumn<T>
implements EditableColumn<ValueRow, ValueProperty<T>, Trace> { implements EditableColumn<ValueRow, ValueProperty<T>, Trace> {
@ -40,8 +40,8 @@ public class TraceValueObjectEditableAttributeColumn<T> extends TraceValueObject
public void setValue(ValueRow row, ValueProperty<T> value, Settings settings, Trace dataSource, public void setValue(ValueRow row, ValueProperty<T> value, Settings settings, Trace dataSource,
ServiceProvider serviceProvider) { ServiceProvider serviceProvider) {
TraceObject object = row.getValue().getChild(); TraceObject object = row.getValue().getChild();
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(object.getTrace(), "Edit column " + getColumnName())) { object.getTrace().openTransaction("Edit column " + getColumnName())) {
object.setAttribute(Lifespan.nowOn(row.currentSnap()), attributeName, value.getValue()); object.setAttribute(Lifespan.nowOn(row.currentSnap()), attributeName, value.getValue());
} }
} }

View file

@ -27,6 +27,7 @@ import javax.swing.*;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel; import javax.swing.table.TableColumnModel;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.action.DockingAction; import docking.action.DockingAction;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
@ -50,11 +51,9 @@ import ghidra.trace.model.*;
import ghidra.trace.model.Trace.TraceStaticMappingChangeType; import ghidra.trace.model.Trace.TraceStaticMappingChangeType;
import ghidra.trace.model.modules.TraceStaticMapping; import ghidra.trace.model.modules.TraceStaticMapping;
import ghidra.trace.model.modules.TraceStaticMappingManager; import ghidra.trace.model.modules.TraceStaticMappingManager;
import ghidra.trace.model.program.TraceProgramView;
import ghidra.util.MathUtilities; import ghidra.util.MathUtilities;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.ObjectKey; import ghidra.util.database.ObjectKey;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.table.GhidraTableFilterPanel; import ghidra.util.table.GhidraTableFilterPanel;
public class DebuggerStaticMappingProvider extends ComponentProviderAdapter public class DebuggerStaticMappingProvider extends ComponentProviderAdapter
@ -305,8 +304,7 @@ public class DebuggerStaticMappingProvider extends ComponentProviderAdapter
private void activatedRemove(DebuggerStaticMappingActionContext ctx) { private void activatedRemove(DebuggerStaticMappingActionContext ctx) {
// TODO: Action to adjust life span? // TODO: Action to adjust life span?
// Note: provider displays mappings for all time, so delete means delete, not truncate // Note: provider displays mappings for all time, so delete means delete, not truncate
try (UndoableTransaction tid = try (Transaction tid = currentTrace.openTransaction("Remove Static Mappings")) {
UndoableTransaction.start(currentTrace, "Remove Static Mappings")) {
for (StaticMappingRow mapping : ctx.getSelectedMappings()) { for (StaticMappingRow mapping : ctx.getSelectedMappings()) {
mapping.getMapping().delete(); mapping.getMapping().delete();
} }

View file

@ -15,10 +15,10 @@
*/ */
package ghidra.app.plugin.core.debug.gui.modules; package ghidra.app.plugin.core.debug.gui.modules;
import db.Transaction;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.trace.model.modules.TraceModule; import ghidra.trace.model.modules.TraceModule;
import ghidra.util.database.UndoableTransaction;
public class ModuleRow { public class ModuleRow {
private final TraceModule module; private final TraceModule module;
@ -32,8 +32,7 @@ public class ModuleRow {
} }
public void setName(String name) { public void setName(String name) {
try (UndoableTransaction tid = try (Transaction tx = module.getTrace().openTransaction("Renamed module")) {
UndoableTransaction.start(module.getTrace(), "Renamed module")) {
module.setName(name); module.setName(name);
} }
} }

View file

@ -15,6 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.gui.modules; package ghidra.app.plugin.core.debug.gui.modules;
import db.Transaction;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressRange; import ghidra.program.model.address.AddressRange;
import ghidra.trace.model.DefaultTraceLocation; import ghidra.trace.model.DefaultTraceLocation;
@ -22,7 +23,6 @@ import ghidra.trace.model.TraceLocation;
import ghidra.trace.model.modules.TraceModule; import ghidra.trace.model.modules.TraceModule;
import ghidra.trace.model.modules.TraceSection; import ghidra.trace.model.modules.TraceSection;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
public class SectionRow { public class SectionRow {
@ -41,8 +41,7 @@ public class SectionRow {
} }
public void setName(String name) { public void setName(String name) {
try (UndoableTransaction tid = try (Transaction tx = section.getTrace().openTransaction("Rename section")) {
UndoableTransaction.start(section.getTrace(), "Rename section")) {
section.setName(name); section.setName(name);
} }
catch (DuplicateNameException e) { catch (DuplicateNameException e) {

View file

@ -30,6 +30,7 @@ import javax.swing.table.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import db.Transaction;
import docking.action.DockingAction; import docking.action.DockingAction;
import docking.widgets.table.*; import docking.widgets.table.*;
import docking.widgets.table.DefaultEnumeratedColumnTableModel.EnumeratedTableColumn; import docking.widgets.table.DefaultEnumeratedColumnTableModel.EnumeratedTableColumn;
@ -62,7 +63,6 @@ import ghidra.trace.model.Trace;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.ColorUtils; import ghidra.util.ColorUtils;
import ghidra.util.HTMLUtilities; import ghidra.util.HTMLUtilities;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.table.GhidraTable; import ghidra.util.table.GhidraTable;
import ghidra.util.table.GhidraTableFilterPanel; import ghidra.util.table.GhidraTableFilterPanel;
import ghidra.util.table.column.AbstractGColumnRenderer; import ghidra.util.table.column.AbstractGColumnRenderer;
@ -241,8 +241,8 @@ public class DebuggerPcodeStepperProvider extends ComponentProviderAdapter {
if (dataType == null) { if (dataType == null) {
return null; return null;
} }
try (UndoableTransaction tid = try (Transaction tid =
UndoableTransaction.start(current.getTrace(), "Resolve DataType")) { current.getTrace().openTransaction("Resolve DataType")) {
return current.getTrace().getDataTypeManager().resolve(dataType, null); return current.getTrace().getDataTypeManager().resolve(dataType, null);
} }
} }

View file

@ -31,6 +31,7 @@ import javax.swing.table.TableColumnModel;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import db.Transaction;
import docking.*; import docking.*;
import docking.action.*; import docking.action.*;
import docking.action.builder.ActionBuilder; import docking.action.builder.ActionBuilder;
@ -78,7 +79,6 @@ import ghidra.trace.util.TraceRegisterUtils;
import ghidra.util.*; import ghidra.util.*;
import ghidra.util.classfinder.ClassSearcher; import ghidra.util.classfinder.ClassSearcher;
import ghidra.util.data.DataTypeParser.AllowedDataTypes; import ghidra.util.data.DataTypeParser.AllowedDataTypes;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.table.GhidraTable; import ghidra.util.table.GhidraTable;
import ghidra.util.table.GhidraTableFilterPanel; import ghidra.util.table.GhidraTableFilterPanel;
@ -450,8 +450,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
if (dataType == null) { if (dataType == null) {
return null; return null;
} }
try (UndoableTransaction tid = try (Transaction tx = currentTrace.openTransaction("Resolve DataType")) {
UndoableTransaction.start(currentTrace, "Resolve DataType")) {
return currentTrace.getDataTypeManager().resolve(dataType, null); return currentTrace.getDataTypeManager().resolve(dataType, null);
} }
} }
@ -902,8 +901,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
* register and modify it.... Well, that works until you consider changes in time.... * register and modify it.... Well, that works until you consider changes in time....
*/ */
void writeRegisterDataType(Register register, DataType dataType) { void writeRegisterDataType(Register register, DataType dataType) {
try (UndoableTransaction tid = try (Transaction tx = current.getTrace().openTransaction("Edit Register Type")) {
UndoableTransaction.start(current.getTrace(), "Edit Register Type")) {
if (dataType instanceof Pointer ptrType && register.getAddress().isRegisterAddress()) { if (dataType instanceof Pointer ptrType && register.getAddress().isRegisterAddress()) {
// Because we're about to use the size, resolve it first // Because we're about to use the size, resolve it first
ptrType = (Pointer) current.getTrace() ptrType = (Pointer) current.getTrace()
@ -1004,8 +1002,8 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
void prepareRegisterSpace() { void prepareRegisterSpace() {
if (current.getThread() != null && if (current.getThread() != null &&
current.getTrace().getObjectManager().getRootSchema() != null) { current.getTrace().getObjectManager().getRootSchema() != null) {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(current.getTrace(), "Create/initialize register space")) { current.getTrace().openTransaction("Create/initialize register space")) {
getRegisterMemorySpace(true); getRegisterMemorySpace(true);
} }
} }

View file

@ -15,10 +15,10 @@
*/ */
package ghidra.app.plugin.core.debug.gui.stack; package ghidra.app.plugin.core.debug.gui.stack;
import db.Transaction;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Function; import ghidra.program.model.listing.Function;
import ghidra.trace.model.stack.TraceStackFrame; import ghidra.trace.model.stack.TraceStackFrame;
import ghidra.util.database.UndoableTransaction;
public class StackFrameRow { public class StackFrameRow {
public static class Synthetic extends StackFrameRow { public static class Synthetic extends StackFrameRow {
@ -73,8 +73,8 @@ public class StackFrameRow {
} }
public void setComment(String comment) { public void setComment(String comment) {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(frame.getStack().getThread().getTrace(), "Frame comment")) { frame.getStack().getThread().getTrace().openTransaction("Frame comment")) {
frame.setComment(getSnap(), comment); frame.setComment(getSnap(), comment);
} }
} }

View file

@ -15,6 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.gui.thread; package ghidra.app.plugin.core.debug.gui.thread;
import db.Transaction;
import ghidra.app.services.DebuggerModelService; import ghidra.app.services.DebuggerModelService;
import ghidra.app.services.TraceRecorder; import ghidra.app.services.TraceRecorder;
import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState; import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;
@ -22,7 +23,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
public class ThreadRow { public class ThreadRow {
private final DebuggerModelService service; private final DebuggerModelService service;
@ -42,8 +42,7 @@ public class ThreadRow {
} }
public void setName(String name) { public void setName(String name) {
try (UndoableTransaction tid = try (Transaction tx = thread.getTrace().openTransaction("Rename thread")) {
UndoableTransaction.start(thread.getTrace(), "Rename thread")) {
thread.setName(name); thread.setName(name);
} }
} }
@ -67,8 +66,7 @@ public class ThreadRow {
} }
public void setComment(String comment) { public void setComment(String comment) {
try (UndoableTransaction tid = try (Transaction tx = thread.getTrace().openTransaction("Set thread comment")) {
UndoableTransaction.start(thread.getTrace(), "Rename thread")) {
thread.setComment(comment); thread.setComment(comment);
} }
} }

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.debug.gui.time;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.action.DockingAction; import docking.action.DockingAction;
import docking.widgets.dialogs.InputDialog; import docking.widgets.dialogs.InputDialog;
@ -37,7 +38,6 @@ import ghidra.trace.model.Trace;
import ghidra.trace.model.program.TraceProgramView; import ghidra.trace.model.program.TraceProgramView;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.trace.model.time.TraceTimeManager; import ghidra.trace.model.time.TraceTimeManager;
import ghidra.util.database.UndoableTransaction;
@PluginInfo( @PluginInfo(
shortDescription = "Lists recorded snapshots in a trace", shortDescription = "Lists recorded snapshots in a trace",
@ -112,7 +112,7 @@ public class DebuggerTimePlugin extends AbstractDebuggerPlugin {
if (dialog.isCanceled()) { if (dialog.isCanceled()) {
return; return;
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Rename Snapshot")) { try (Transaction tx = trace.openTransaction("Rename Snapshot")) {
if (snapshot == null) { if (snapshot == null) {
snapshot = manager.getSnapshot(snap, true); snapshot = manager.getSnapshot(snap, true);
} }

View file

@ -17,11 +17,11 @@ package ghidra.app.plugin.core.debug.gui.time;
import java.util.Date; import java.util.Date;
import db.Transaction;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.util.DateUtils; import ghidra.util.DateUtils;
import ghidra.util.database.UndoableTransaction;
public class SnapshotRow { public class SnapshotRow {
//private static final DateFormat FORMAT = DateFormat.getDateTimeInstance(); //private static final DateFormat FORMAT = DateFormat.getDateTimeInstance();
@ -60,8 +60,7 @@ public class SnapshotRow {
} }
public void setDescription(String description) { public void setDescription(String description) {
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Modify snapshot description")) {
UndoableTransaction.start(trace, "Modify snapshot description")) {
snapshot.setDescription(description); snapshot.setDescription(description);
} }
} }

View file

@ -31,6 +31,7 @@ import javax.swing.table.TableColumnModel;
import org.jdom.Element; import org.jdom.Element;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.WindowPosition; import docking.WindowPosition;
import docking.action.DockingAction; import docking.action.DockingAction;
@ -81,7 +82,6 @@ import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.trace.util.TraceAddressSpace; import ghidra.trace.util.TraceAddressSpace;
import ghidra.util.HelpLocation; import ghidra.util.HelpLocation;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.table.GhidraTable; import ghidra.util.table.GhidraTable;
import ghidra.util.table.GhidraTableFilterPanel; import ghidra.util.table.GhidraTableFilterPanel;
@ -280,8 +280,7 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter
if (dataType == null) { if (dataType == null) {
return null; return null;
} }
try (UndoableTransaction tid = try (Transaction tx = currentTrace.openTransaction("Resolve DataType")) {
UndoableTransaction.start(currentTrace, "Resolve DataType")) {
return currentTrace.getDataTypeManager().resolve(dataType, null); return currentTrace.getDataTypeManager().resolve(dataType, null);
} }
} }
@ -605,8 +604,8 @@ public class DebuggerWatchesProvider extends ComponentProviderAdapter
return; return;
} }
} }
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(current.getTrace(), "Apply Watch Data Type")) { current.getTrace().openTransaction("Apply Watch Data Type")) {
try { try {
listing.clearCodeUnits(row.getAddress(), row.getRange().getMaxAddress(), false); listing.clearCodeUnits(row.getAddress(), row.getRange().getMaxAddress(), false);
Data data = listing.createData(address, dataType, size); Data data = listing.createData(address, dataType, size);

View file

@ -19,6 +19,7 @@ import java.math.BigInteger;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import db.Transaction;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.plugin.processors.sleigh.SleighLanguage; import ghidra.app.plugin.processors.sleigh.SleighLanguage;
import ghidra.app.services.DataTypeManagerService; import ghidra.app.services.DataTypeManagerService;
@ -44,7 +45,6 @@ import ghidra.trace.model.memory.TraceMemoryState;
import ghidra.trace.model.symbol.TraceLabelSymbol; import ghidra.trace.model.symbol.TraceLabelSymbol;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.NumericUtilities; import ghidra.util.NumericUtilities;
import ghidra.util.database.UndoableTransaction;
public class WatchRow { public class WatchRow {
public static final int TRUNCATE_BYTES_LENGTH = 64; public static final int TRUNCATE_BYTES_LENGTH = 64;
@ -234,8 +234,7 @@ public class WatchRow {
dataType = dataType =
new PointerTypedef(null, ptrType.getDataType(), ptrType.getLength(), dtm, space); new PointerTypedef(null, ptrType.getDataType(), ptrType.getLength(), dtm, space);
if (dtm != null) { if (dtm != null) {
try (UndoableTransaction tid = try (Transaction tid = dtm.openTransaction("Resolve data type")) {
UndoableTransaction.start(dtm, "Resolve data type")) {
dataType = dtm.resolve(dataType, DataTypeConflictHandler.DEFAULT_HANDLER); dataType = dtm.resolve(dataType, DataTypeConflictHandler.DEFAULT_HANDLER);
} }
} }

View file

@ -15,6 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.mapping; package ghidra.app.plugin.core.debug.mapping;
import db.Transaction;
import ghidra.framework.plugintool.PluginTool; import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.lang.CompilerSpec; import ghidra.program.model.lang.CompilerSpec;
@ -24,7 +25,6 @@ import ghidra.trace.model.guest.*;
import ghidra.trace.model.target.TraceObject; import ghidra.trace.model.target.TraceObject;
import ghidra.util.MathUtilities; import ghidra.util.MathUtilities;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
public class DefaultDebuggerPlatformMapper extends AbstractDebuggerPlatformMapper { public class DefaultDebuggerPlatformMapper extends AbstractDebuggerPlatformMapper {
@ -57,7 +57,7 @@ public class DefaultDebuggerPlatformMapper extends AbstractDebuggerPlatformMappe
public void addToTrace(long snap) { public void addToTrace(long snap) {
String description = "Add guest " + cSpec.getLanguage().getLanguageDescription() + "/" + String description = "Add guest " + cSpec.getLanguage().getLanguageDescription() + "/" +
cSpec.getCompilerSpecDescription(); cSpec.getCompilerSpecDescription();
try (UndoableTransaction tid = UndoableTransaction.start(trace, description)) { try (Transaction tx = trace.openTransaction(description)) {
TracePlatformManager platformManager = trace.getPlatformManager(); TracePlatformManager platformManager = trace.getPlatformManager();
TracePlatform platform = platformManager.getOrAddPlatform(cSpec); TracePlatform platform = platformManager.getOrAddPlatform(cSpec);
if (platform.isHost()) { if (platform.isHost()) {

View file

@ -18,9 +18,9 @@ package ghidra.app.plugin.core.debug.mapping;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import db.Transaction;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
public class ObjectBasedDebuggerMemoryMapper implements DebuggerMemoryMapper { public class ObjectBasedDebuggerMemoryMapper implements DebuggerMemoryMapper {
@ -77,8 +77,7 @@ public class ObjectBasedDebuggerMemoryMapper implements DebuggerMemoryMapper {
} }
protected AddressSpace createSpace(String name) { protected AddressSpace createSpace(String name) {
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Create space for mapping")) {
UndoableTransaction.start(trace, "Create space for mapping")) {
AddressFactory factory = trace.getBaseAddressFactory(); AddressFactory factory = trace.getBaseAddressFactory();
AddressSpace space = factory.getAddressSpace(name); AddressSpace space = factory.getAddressSpace(name);
if (space == null) { if (space == null) {

View file

@ -17,15 +17,15 @@ package ghidra.app.plugin.core.debug.service.breakpoint;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import db.Transaction;
import ghidra.async.AsyncUtils; import ghidra.async.AsyncUtils;
import ghidra.trace.model.breakpoint.TraceBreakpoint; import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.util.database.UndoableTransaction;
public record DeleteEmuBreakpointActionItem(TraceBreakpoint bpt) implements BreakpointActionItem { public record DeleteEmuBreakpointActionItem(TraceBreakpoint bpt) implements BreakpointActionItem {
@Override @Override
public CompletableFuture<Void> execute() { public CompletableFuture<Void> execute() {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(bpt.getTrace(), "Delete Emulated Breakpoint")) { bpt.getTrace().openTransaction("Delete Emulated Breakpoint")) {
String emuName = PlaceEmuBreakpointActionItem.createName(bpt.getMinAddress()); String emuName = PlaceEmuBreakpointActionItem.createName(bpt.getMinAddress());
if (bpt.getPath().contains(emuName)) { if (bpt.getPath().contains(emuName)) {
bpt.delete(); bpt.delete();

View file

@ -17,16 +17,16 @@ package ghidra.app.plugin.core.debug.service.breakpoint;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import db.Transaction;
import ghidra.async.AsyncUtils; import ghidra.async.AsyncUtils;
import ghidra.trace.model.breakpoint.TraceBreakpoint; import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.util.database.UndoableTransaction;
public record DisableEmuBreakpointActionItem(TraceBreakpoint bpt) public record DisableEmuBreakpointActionItem(TraceBreakpoint bpt)
implements BreakpointActionItem { implements BreakpointActionItem {
@Override @Override
public CompletableFuture<Void> execute() { public CompletableFuture<Void> execute() {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(bpt.getTrace(), "Disable Emulated Breakpoint")) { bpt.getTrace().openTransaction("Disable Emulated Breakpoint")) {
bpt.setEmuEnabled(false); bpt.setEmuEnabled(false);
} }
return AsyncUtils.NIL; return AsyncUtils.NIL;

View file

@ -17,15 +17,15 @@ package ghidra.app.plugin.core.debug.service.breakpoint;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import db.Transaction;
import ghidra.async.AsyncUtils; import ghidra.async.AsyncUtils;
import ghidra.trace.model.breakpoint.TraceBreakpoint; import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.util.database.UndoableTransaction;
public record EnableEmuBreakpointActionItem(TraceBreakpoint bpt) implements BreakpointActionItem { public record EnableEmuBreakpointActionItem(TraceBreakpoint bpt) implements BreakpointActionItem {
@Override @Override
public CompletableFuture<Void> execute() { public CompletableFuture<Void> execute() {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(bpt.getTrace(), "Enable Emulated Breakpoint")) { bpt.getTrace().openTransaction("Enable Emulated Breakpoint")) {
bpt.setEmuEnabled(true); bpt.setEmuEnabled(true);
} }
return AsyncUtils.NIL; return AsyncUtils.NIL;

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.debug.service.breakpoint;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import db.Transaction;
import ghidra.async.AsyncUtils; import ghidra.async.AsyncUtils;
import ghidra.dbg.target.TargetBreakpointSpec; import ghidra.dbg.target.TargetBreakpointSpec;
import ghidra.dbg.target.TargetBreakpointSpecContainer; import ghidra.dbg.target.TargetBreakpointSpecContainer;
@ -30,7 +31,6 @@ import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.trace.model.memory.TraceMemoryRegion; import ghidra.trace.model.memory.TraceMemoryRegion;
import ghidra.trace.model.memory.TraceObjectMemoryRegion; import ghidra.trace.model.memory.TraceObjectMemoryRegion;
import ghidra.trace.model.target.TraceObject; import ghidra.trace.model.target.TraceObject;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
public record PlaceEmuBreakpointActionItem(Trace trace, long snap, Address address, long length, public record PlaceEmuBreakpointActionItem(Trace trace, long snap, Address address, long length,
@ -97,8 +97,7 @@ public record PlaceEmuBreakpointActionItem(Trace trace, long snap, Address addre
@Override @Override
public CompletableFuture<Void> execute() { public CompletableFuture<Void> execute() {
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Place Emulated Breakpoint")) {
UndoableTransaction.start(trace, "Place Emulated Breakpoint")) {
// Defaults with emuEnable=true // Defaults with emuEnable=true
TraceBreakpoint bpt = trace.getBreakpointManager() TraceBreakpoint bpt = trace.getBreakpointManager()
.addBreakpoint(computePath(), Lifespan.at(snap), range(address, length), .addBreakpoint(computePath(), Lifespan.at(snap), range(address, length),

View file

@ -19,6 +19,8 @@ import java.util.*;
import com.google.gson.*; import com.google.gson.*;
import db.Transaction;
import ghidra.app.services.LogicalBreakpoint;
import ghidra.app.services.LogicalBreakpoint.ProgramMode; import ghidra.app.services.LogicalBreakpoint.ProgramMode;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSet; import ghidra.program.model.address.AddressSet;
@ -27,7 +29,6 @@ import ghidra.program.util.ProgramLocation;
import ghidra.trace.model.breakpoint.TraceBreakpointKind; import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet; import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -194,8 +195,7 @@ public class ProgramBreakpoint {
} }
private void writeProperties(Bookmark bookmark) { private void writeProperties(Bookmark bookmark) {
try (UndoableTransaction tid = try (Transaction tx = program.openTransaction("Rename breakpoint")) {
UndoableTransaction.start(program, "Rename breakpoint")) {
bookmark.set(bookmark.getCategory(), computeComment()); bookmark.set(bookmark.getCategory(), computeComment());
} }
catch (ConcurrentModificationException e) { catch (ConcurrentModificationException e) {
@ -297,7 +297,7 @@ public class ProgramBreakpoint {
// volatile reads // volatile reads
Bookmark eBookmark = this.eBookmark; Bookmark eBookmark = this.eBookmark;
Bookmark dBookmark = this.dBookmark; Bookmark dBookmark = this.dBookmark;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Clear breakpoint")) { try (Transaction tx = program.openTransaction("Clear breakpoint")) {
BookmarkManager bookmarkManager = program.getBookmarkManager(); BookmarkManager bookmarkManager = program.getBookmarkManager();
if (eBookmark != null) { if (eBookmark != null) {
bookmarkManager.removeBookmark(eBookmark); bookmarkManager.removeBookmark(eBookmark);
@ -452,13 +452,12 @@ public class ProgramBreakpoint {
*/ */
public void toggleWithComment(boolean enabled, String comment) { public void toggleWithComment(boolean enabled, String comment) {
String addType = String addType =
enabled ? LogicalBreakpointInternal.BREAKPOINT_ENABLED_BOOKMARK_TYPE enabled ? LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE
: LogicalBreakpointInternal.BREAKPOINT_DISABLED_BOOKMARK_TYPE; : LogicalBreakpoint.BREAKPOINT_DISABLED_BOOKMARK_TYPE;
String delType = String delType =
enabled ? LogicalBreakpointInternal.BREAKPOINT_DISABLED_BOOKMARK_TYPE enabled ? LogicalBreakpoint.BREAKPOINT_DISABLED_BOOKMARK_TYPE
: LogicalBreakpointInternal.BREAKPOINT_ENABLED_BOOKMARK_TYPE; : LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE;
try (UndoableTransaction tid = try (Transaction tx = program.openTransaction("Toggle breakpoint")) {
UndoableTransaction.start(program, "Enable breakpoint")) {
BookmarkManager manager = program.getBookmarkManager(); BookmarkManager manager = program.getBookmarkManager();
String catStr = computeCategory(); String catStr = computeCategory();
manager.setBookmark(address, addType, catStr, comment); manager.setBookmark(address, addType, catStr, comment);

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.debug.service.breakpoint;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import db.Transaction;
import ghidra.app.services.*; import ghidra.app.services.*;
import ghidra.app.services.LogicalBreakpoint.TraceMode; import ghidra.app.services.LogicalBreakpoint.TraceMode;
import ghidra.dbg.target.*; import ghidra.dbg.target.*;
@ -29,7 +30,6 @@ import ghidra.program.model.address.AddressRange;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.breakpoint.TraceBreakpoint; import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.trace.model.breakpoint.TraceBreakpointKind; import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.util.database.UndoableTransaction;
import utilities.util.IDHashed; import utilities.util.IDHashed;
/** /**
@ -217,7 +217,7 @@ class TraceBreakpointSet {
*/ */
public void setEmuSleigh(String emuSleigh) { public void setEmuSleigh(String emuSleigh) {
this.emuSleigh = emuSleigh; this.emuSleigh = emuSleigh;
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Set breakpoint Sleigh")) { try (Transaction tx = trace.openTransaction("Set breakpoint Sleigh")) {
for (IDHashed<TraceBreakpoint> bpt : breakpoints) { for (IDHashed<TraceBreakpoint> bpt : breakpoints) {
bpt.obj.setEmuSleigh(emuSleigh); bpt.obj.setEmuSleigh(emuSleigh);
} }
@ -254,8 +254,7 @@ class TraceBreakpointSet {
*/ */
public boolean add(TraceBreakpoint bpt) { public boolean add(TraceBreakpoint bpt) {
if (SleighUtils.UNCONDITIONAL_BREAK.equals(bpt.getEmuSleigh()) && emuSleigh != null) { if (SleighUtils.UNCONDITIONAL_BREAK.equals(bpt.getEmuSleigh()) && emuSleigh != null) {
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Set breakpoint Sleigh")) {
UndoableTransaction.start(trace, "Set breakpoint Sleigh")) {
bpt.setEmuSleigh(emuSleigh); bpt.setEmuSleigh(emuSleigh);
} }
} }

View file

@ -27,6 +27,7 @@ import javax.swing.event.ChangeListener;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.action.DockingAction; import docking.action.DockingAction;
import docking.action.ToggleDockingAction; import docking.action.ToggleDockingAction;
@ -62,7 +63,6 @@ import ghidra.trace.model.time.schedule.Scheduler.RunResult;
import ghidra.util.HelpLocation; import ghidra.util.HelpLocation;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.classfinder.ClassSearcher; import ghidra.util.classfinder.ClassSearcher;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.ListenerSet; import ghidra.util.datastruct.ListenerSet;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.Task; import ghidra.util.task.Task;
@ -556,8 +556,7 @@ public class DebuggerEmulationServicePlugin extends Plugin implements DebuggerEm
DebuggerCoordinates current = traceManager.getCurrent(); DebuggerCoordinates current = traceManager.getCurrent();
Trace trace = current.getTrace(); Trace trace = current.getTrace();
long version = trace.getEmulatorCacheVersion(); long version = trace.getEmulatorCacheVersion();
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Invalidate Emulator Cache")) {
UndoableTransaction.start(trace, "Invalidate Emulator Cache")) {
trace.setEmulatorCacheVersion(version + 1); trace.setEmulatorCacheVersion(version + 1);
} }
// NB. Success should already display on screen, since it's current. // NB. Success should already display on screen, since it's current.
@ -750,7 +749,7 @@ public class DebuggerEmulationServicePlugin extends Plugin implements DebuggerEm
} }
protected TraceSnapshot writeToScratch(CacheKey key, CachedEmulator ce) { protected TraceSnapshot writeToScratch(CacheKey key, CachedEmulator ce) {
try (UndoableTransaction tid = UndoableTransaction.start(key.trace, "Emulate")) { try (Transaction tx = key.trace.openTransaction("Emulate")) {
TraceSnapshot destSnap = findScratch(key.trace, key.time); TraceSnapshot destSnap = findScratch(key.trace, key.time);
try { try {
ce.emulator().writeDown(key.platform, destSnap.getKey(), key.time.getSnap()); ce.emulator().writeDown(key.platform, destSnap.getKey(), key.time.getSnap());
@ -794,7 +793,7 @@ public class DebuggerEmulationServicePlugin extends Plugin implements DebuggerEm
// Cause object-register support to copy values into new register spaces // Cause object-register support to copy values into new register spaces
// TODO: I wish this were not necessary // TODO: I wish this were not necessary
monitor.setMessage("Creating register spaces"); monitor.setMessage("Creating register spaces");
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Prepare emulation")) { try (Transaction tx = trace.openTransaction("Prepare emulation")) {
for (TraceThread thread : time.getThreads(trace)) { for (TraceThread thread : time.getThreads(trace)) {
trace.getMemoryManager().getMemoryRegisterSpace(thread, 0, true); trace.getMemoryManager().getMemoryRegisterSpace(thread, 0, true);
} }

View file

@ -21,6 +21,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils; import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils.Extrema; import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils.Extrema;
import ghidra.app.services.DebuggerEmulationService; import ghidra.app.services.DebuggerEmulationService;
@ -44,7 +45,6 @@ import ghidra.trace.model.thread.*;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.util.DifferenceAddressSetView; import ghidra.util.DifferenceAddressSetView;
import ghidra.util.NumericUtilities; import ghidra.util.NumericUtilities;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
/** /**
@ -339,7 +339,7 @@ public enum ProgramEmulationUtils {
boolean success = false; boolean success = false;
try { try {
trace = new DBTrace(getTraceName(program), program.getCompilerSpec(), consumer); trace = new DBTrace(getTraceName(program), program.getCompilerSpec(), consumer);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Emulate")) { try (Transaction tx = trace.openTransaction("Emulate")) {
TraceSnapshot initial = TraceSnapshot initial =
trace.getTimeManager().createSnapshot(EMULATION_STARTED_AT + pc); trace.getTimeManager().createSnapshot(EMULATION_STARTED_AT + pc);
long snap = initial.getKey(); long snap = initial.getKey();
@ -383,8 +383,7 @@ public enum ProgramEmulationUtils {
*/ */
public static TraceThread launchEmulationThread(Trace trace, long snap, Program program, public static TraceThread launchEmulationThread(Trace trace, long snap, Program program,
Address tracePc, Address programPc) { Address tracePc, Address programPc) {
try (UndoableTransaction tid = try (Transaction tx = trace.openTransaction("Emulate new Thread")) {
UndoableTransaction.start(trace, "Emulate new Thread")) {
TraceThread thread = doLaunchEmulationThread(trace, snap, program, tracePc, programPc); TraceThread thread = doLaunchEmulationThread(trace, snap, program, tracePc, programPc);
return thread; return thread;
} }

View file

@ -25,6 +25,7 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.action.DockingAction; import docking.action.DockingAction;
import docking.action.builder.MultiStateActionBuilder; import docking.action.builder.MultiStateActionBuilder;
@ -58,7 +59,6 @@ import ghidra.program.model.util.StringPropertyMap;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.CollectionChangeListener; import ghidra.util.datastruct.CollectionChangeListener;
import ghidra.util.datastruct.ListenerSet; import ghidra.util.datastruct.ListenerSet;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
@ -305,7 +305,7 @@ public class DebuggerModelServiceProxyPlugin extends Plugin
protected void writeMostRecentLaunches(Program program, List<String> mrl) { protected void writeMostRecentLaunches(Program program, List<String> mrl) {
ProgramUserData userData = program.getProgramUserData(); ProgramUserData userData = program.getProgramUserData();
try (UndoableTransaction tid = UndoableTransaction.start(userData)) { try (Transaction tid = userData.openTransaction()) {
StringPropertyMap prop = userData StringPropertyMap prop = userData
.getStringProperty(getName(), KEY_MOST_RECENT_LAUNCHES, true); .getStringProperty(getName(), KEY_MOST_RECENT_LAUNCHES, true);
Address min = program.getAddressFactory().getDefaultAddressSpace().getMinAddress(); Address min = program.getAddressFactory().getDefaultAddressSpace().getMinAddress();

View file

@ -15,27 +15,27 @@
*/ */
package ghidra.app.plugin.core.debug.service.model; package ghidra.app.plugin.core.debug.service.model;
import db.Transaction;
import ghidra.framework.model.UndoableDomainObject; import ghidra.framework.model.UndoableDomainObject;
import ghidra.util.database.UndoableTransaction;
public class RecorderPermanentTransaction implements AutoCloseable { public class RecorderPermanentTransaction implements AutoCloseable {
public static RecorderPermanentTransaction start(UndoableDomainObject obj, String description) { public static RecorderPermanentTransaction start(UndoableDomainObject obj, String description) {
UndoableTransaction tid = UndoableTransaction.start(obj, description); Transaction tx = obj.openTransaction(description);
return new RecorderPermanentTransaction(obj, tid); return new RecorderPermanentTransaction(obj, tx);
} }
private final UndoableDomainObject obj; private final UndoableDomainObject obj;
private final UndoableTransaction tid; private final Transaction tx;
public RecorderPermanentTransaction(UndoableDomainObject obj, UndoableTransaction tid) { public RecorderPermanentTransaction(UndoableDomainObject obj, Transaction tx) {
this.obj = obj; this.obj = obj;
this.tid = tid; this.tx = tx;
} }
@Override @Override
public void close() { public void close() {
tid.close(); tx.close();
obj.clearUndo(); obj.clearUndo();
} }
} }

View file

@ -22,6 +22,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.*; import java.util.function.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import db.Transaction;
import ghidra.app.plugin.core.debug.mapping.*; import ghidra.app.plugin.core.debug.mapping.*;
import ghidra.app.plugin.core.debug.service.model.interfaces.*; import ghidra.app.plugin.core.debug.service.model.interfaces.*;
import ghidra.app.services.TraceRecorder; import ghidra.app.services.TraceRecorder;
@ -38,7 +39,6 @@ import ghidra.trace.model.modules.TraceModule;
import ghidra.trace.model.modules.TraceSection; import ghidra.trace.model.modules.TraceSection;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.ListenerSet; import ghidra.util.datastruct.ListenerSet;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
@ -254,8 +254,8 @@ public class TraceObjectManager {
ManagedThreadRecorder threadRecorder = recorder.getThreadRecorder((TargetThread) added); ManagedThreadRecorder threadRecorder = recorder.getThreadRecorder((TargetThread) added);
TraceThread traceThread = threadRecorder.getTraceThread(); TraceThread traceThread = threadRecorder.getTraceThread();
recorder.createSnapshot(traceThread + " started", traceThread, null); recorder.createSnapshot(traceThread + " started", traceThread, null);
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(recorder.getTrace(), "Adjust thread creation")) { recorder.getTrace().openTransaction("Adjust thread creation")) {
long existing = traceThread.getCreationSnap(); long existing = traceThread.getCreationSnap();
if (existing == Long.MIN_VALUE) { if (existing == Long.MIN_VALUE) {
traceThread.setCreationSnap(recorder.getSnap()); traceThread.setCreationSnap(recorder.getSnap());
@ -546,8 +546,7 @@ public class TraceObjectManager {
ManagedThreadRecorder rec = recorder.getThreadRecorderForSuccessor(thread); ManagedThreadRecorder rec = recorder.getThreadRecorderForSuccessor(thread);
if (rec != null) { if (rec != null) {
String name = (String) added.get(TargetObject.DISPLAY_ATTRIBUTE_NAME); String name = (String) added.get(TargetObject.DISPLAY_ATTRIBUTE_NAME);
try (UndoableTransaction tid = try (Transaction tx = rec.getTrace().openTransaction("Rename thread")) {
UndoableTransaction.start(rec.getTrace(), "Rename thread")) {
rec.getTraceThread().setName(name); rec.getTraceThread().setName(name);
} }
} }

View file

@ -15,7 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.service.model.launch; package ghidra.app.plugin.core.debug.service.model.launch;
import static ghidra.async.AsyncUtils.loop; import static ghidra.async.AsyncUtils.*;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -29,6 +29,7 @@ import javax.swing.JOptionPane;
import org.jdom.Element; import org.jdom.Element;
import org.jdom.JDOMException; import org.jdom.JDOMException;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.objects.components.DebuggerMethodInvocationDialog; import ghidra.app.plugin.core.debug.gui.objects.components.DebuggerMethodInvocationDialog;
import ghidra.app.services.*; import ghidra.app.services.*;
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause; import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
@ -53,7 +54,6 @@ import ghidra.trace.model.TraceLocation;
import ghidra.trace.model.modules.TraceModule; import ghidra.trace.model.modules.TraceModule;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.Swing; import ghidra.util.Swing;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.CollectionChangeListener; import ghidra.util.datastruct.CollectionChangeListener;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -243,7 +243,7 @@ public abstract class AbstractDebuggerProgramLaunchOffer implements DebuggerProg
} }
if (program != null) { if (program != null) {
ProgramUserData userData = program.getProgramUserData(); ProgramUserData userData = program.getProgramUserData();
try (UndoableTransaction tid = UndoableTransaction.start(userData)) { try (Transaction tx = userData.openTransaction()) {
Element element = state.saveToXml(); Element element = state.saveToXml();
userData.setStringProperty(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, userData.setStringProperty(TargetCmdLineLauncher.CMDLINE_ARGS_NAME,
XmlUtilities.toString(element)); XmlUtilities.toString(element));

View file

@ -21,6 +21,7 @@ import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import db.Transaction;
import ghidra.app.plugin.core.debug.mapping.*; import ghidra.app.plugin.core.debug.mapping.*;
import ghidra.app.plugin.core.debug.service.model.DebuggerModelServicePlugin; import ghidra.app.plugin.core.debug.service.model.DebuggerModelServicePlugin;
import ghidra.app.plugin.core.debug.service.model.PermanentTransactionExecutor; import ghidra.app.plugin.core.debug.service.model.PermanentTransactionExecutor;
@ -56,7 +57,6 @@ import ghidra.trace.model.thread.TraceObjectThread;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.ListenerSet; import ghidra.util.datastruct.ListenerSet;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -193,8 +193,7 @@ public class ObjectBasedTraceRecorder implements TraceRecorder {
long snap = timeRecorder.getSnap(); long snap = timeRecorder.getSnap();
String path = object.getJoinedPath("."); String path = object.getJoinedPath(".");
// Don't offload, because we need a consistent map // Don't offload, because we need a consistent map
try (UndoableTransaction tid = try (Transaction trans = trace.openTransaction("Object created: " + path)) {
UndoableTransaction.start(trace, "Object created: " + path)) {
objectRecorder.recordCreated(snap, object); objectRecorder.recordCreated(snap, object);
} }
} }

View file

@ -24,6 +24,7 @@ import org.apache.commons.collections4.bidimap.DualHashBidiMap;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import db.Transaction;
import ghidra.dbg.DebuggerObjectModel; import ghidra.dbg.DebuggerObjectModel;
import ghidra.dbg.attributes.TargetDataType; import ghidra.dbg.attributes.TargetDataType;
import ghidra.dbg.target.*; import ghidra.dbg.target.*;
@ -45,7 +46,6 @@ import ghidra.trace.model.target.*;
import ghidra.trace.model.thread.TraceObjectThread; import ghidra.trace.model.thread.TraceObjectThread;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import utilities.util.IDKeyed; import utilities.util.IDKeyed;
class ObjectRecorder { class ObjectRecorder {
@ -64,8 +64,7 @@ class ObjectRecorder {
this.isSupportsFocus = !schema.searchFor(TargetFocusScope.class, false).isEmpty(); this.isSupportsFocus = !schema.searchFor(TargetFocusScope.class, false).isEmpty();
this.isSupportsActivation = !schema.searchFor(TargetActiveScope.class, false).isEmpty(); this.isSupportsActivation = !schema.searchFor(TargetActiveScope.class, false).isEmpty();
try (UndoableTransaction tid = try (Transaction tx = recorder.trace.openTransaction("Create root")) {
UndoableTransaction.start(recorder.trace, "Create root")) {
objectManager.createRootObject(schema); objectManager.createRootObject(schema);
} }
} }

View file

@ -23,6 +23,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import db.Transaction;
import ghidra.app.events.ProgramClosedPluginEvent; import ghidra.app.events.ProgramClosedPluginEvent;
import ghidra.app.events.ProgramOpenedPluginEvent; import ghidra.app.events.ProgramOpenedPluginEvent;
import ghidra.app.plugin.PluginCategoryNames; import ghidra.app.plugin.PluginCategoryNames;
@ -53,7 +54,6 @@ import ghidra.trace.model.memory.TraceMemoryRegion;
import ghidra.trace.model.modules.*; import ghidra.trace.model.modules.*;
import ghidra.trace.model.program.TraceProgramView; import ghidra.trace.model.program.TraceProgramView;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.ListenerSet; import ghidra.util.datastruct.ListenerSet;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -733,8 +733,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
@Override @Override
public void addMapping(TraceLocation from, ProgramLocation to, long length, public void addMapping(TraceLocation from, ProgramLocation to, long length,
boolean truncateExisting) throws TraceConflictedMappingException { boolean truncateExisting) throws TraceConflictedMappingException {
try (UndoableTransaction tid = try (Transaction tx = from.getTrace().openTransaction("Add mapping")) {
UndoableTransaction.start(from.getTrace(), "Add mapping")) {
DebuggerStaticMappingUtils.addMapping(from, to, length, truncateExisting); DebuggerStaticMappingUtils.addMapping(from, to, length, truncateExisting);
} }
} }
@ -742,8 +741,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
@Override @Override
public void addMapping(MapEntry<?, ?> entry, boolean truncateExisting) public void addMapping(MapEntry<?, ?> entry, boolean truncateExisting)
throws TraceConflictedMappingException { throws TraceConflictedMappingException {
try (UndoableTransaction tid = try (Transaction tx = entry.getFromTrace().openTransaction("Add mapping")) {
UndoableTransaction.start(entry.getFromTrace(), "Add mapping")) {
DebuggerStaticMappingUtils.addMapping(entry, truncateExisting); DebuggerStaticMappingUtils.addMapping(entry, truncateExisting);
} }
} }
@ -755,7 +753,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
entries.stream().collect(Collectors.groupingBy(ent -> ent.getFromTrace())); entries.stream().collect(Collectors.groupingBy(ent -> ent.getFromTrace()));
for (Map.Entry<Trace, List<MapEntry<?, ?>>> ent : byTrace.entrySet()) { for (Map.Entry<Trace, List<MapEntry<?, ?>>> ent : byTrace.entrySet()) {
Trace trace = ent.getKey(); Trace trace = ent.getKey();
try (UndoableTransaction tid = UndoableTransaction.start(trace, description)) { try (Transaction tx = trace.openTransaction(description)) {
doAddMappings(trace, ent.getValue(), monitor, truncateExisting); doAddMappings(trace, ent.getValue(), monitor, truncateExisting);
} }
} }
@ -778,8 +776,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
@Override @Override
public void addIdentityMapping(Trace from, Program toProgram, Lifespan lifespan, public void addIdentityMapping(Trace from, Program toProgram, Lifespan lifespan,
boolean truncateExisting) { boolean truncateExisting) {
try (UndoableTransaction tid = try (Transaction tx = from.openTransaction("Add identity mappings")) {
UndoableTransaction.start(from, "Add identity mappings")) {
DebuggerStaticMappingUtils.addIdentityMapping(from, toProgram, lifespan, DebuggerStaticMappingUtils.addIdentityMapping(from, toProgram, lifespan,
truncateExisting); truncateExisting);
} }
@ -798,8 +795,8 @@ public class DebuggerStaticMappingServicePlugin extends Plugin
} }
} }
for (Map.Entry<Program, List<ModuleMapEntry>> ent : entriesByProgram.entrySet()) { for (Map.Entry<Program, List<ModuleMapEntry>> ent : entriesByProgram.entrySet()) {
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(ent.getKey(), "Memorize module mapping")) { ent.getKey().openTransaction("Memorize module mapping")) {
for (ModuleMapEntry entry : ent.getValue()) { for (ModuleMapEntry entry : ent.getValue()) {
ProgramModuleIndexer.addModulePaths(entry.getToProgram(), ProgramModuleIndexer.addModulePaths(entry.getToProgram(),
List.of(entry.getModule().getName())); List.of(entry.getModule().getName()));

View file

@ -161,13 +161,13 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
public TransactionEndFuture(Trace trace) { public TransactionEndFuture(Trace trace) {
this.trace = trace; this.trace = trace;
this.trace.addTransactionListener(this); this.trace.addTransactionListener(this);
if (this.trace.getCurrentTransaction() == null) { if (this.trace.getCurrentTransactionInfo() == null) {
complete(null); complete(null);
} }
} }
@Override @Override
public void transactionStarted(DomainObjectAdapterDB domainObj, Transaction tx) { public void transactionStarted(DomainObjectAdapterDB domainObj, TransactionInfo tx) {
} }
@Override @Override

View file

@ -20,6 +20,7 @@ import java.util.Map.Entry;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import db.Transaction;
import docking.DockingWindowManager; import docking.DockingWindowManager;
import docking.Tool; import docking.Tool;
import ghidra.app.plugin.core.debug.mapping.DebuggerPlatformMapper; import ghidra.app.plugin.core.debug.mapping.DebuggerPlatformMapper;
@ -33,7 +34,8 @@ import ghidra.framework.model.DomainObject;
import ghidra.framework.options.annotation.HelpInfo; import ghidra.framework.options.annotation.HelpInfo;
import ghidra.framework.plugintool.PluginTool; import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
import ghidra.program.model.data.*; import ghidra.program.model.data.PointerTypedef;
import ghidra.program.model.data.VoidDataType;
import ghidra.program.model.lang.Register; import ghidra.program.model.lang.Register;
import ghidra.program.model.util.CodeUnitInsertionException; import ghidra.program.model.util.CodeUnitInsertionException;
import ghidra.trace.model.*; import ghidra.trace.model.*;
@ -49,7 +51,6 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.util.*; import ghidra.trace.util.*;
import ghidra.util.*; import ghidra.util.*;
import ghidra.util.classfinder.ClassSearcher; import ghidra.util.classfinder.ClassSearcher;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@DebuggerBotInfo( // @DebuggerBotInfo( //
@ -222,8 +223,8 @@ public class DisassembleAtPcDebuggerBot implements DebuggerBot {
return; return;
} }
TraceData pcUnit = null; TraceData pcUnit = null;
try (UndoableTransaction tid = try (Transaction tx =
UndoableTransaction.start(trace, "Disassemble: PC is code pointer")) { trace.openTransaction("Disassemble: PC is code pointer")) {
TraceCodeSpace regCode = codeManager.getCodeRegisterSpace(thread, frameLevel, true); TraceCodeSpace regCode = codeManager.getCodeRegisterSpace(thread, frameLevel, true);
// TODO: Should be same platform as pc, not necessarily base // TODO: Should be same platform as pc, not necessarily base
AddressSpace space = trace.getBaseAddressFactory().getDefaultAddressSpace(); AddressSpace space = trace.getBaseAddressFactory().getDefaultAddressSpace();

View file

@ -22,6 +22,7 @@ import java.util.concurrent.CompletableFuture;
import javax.swing.Icon; import javax.swing.Icon;
import db.Transaction;
import generic.theme.GIcon; import generic.theme.GIcon;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause; import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
@ -41,7 +42,6 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.PatchStep; import ghidra.trace.model.time.schedule.PatchStep;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.trace.util.TraceRegisterUtils; import ghidra.trace.util.TraceRegisterUtils;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -214,8 +214,7 @@ public enum ControlMode {
} }
TraceMemoryOperations memOrRegs; TraceMemoryOperations memOrRegs;
Address overlayAddress; Address overlayAddress;
try (UndoableTransaction txid = try (Transaction tx = trace.openTransaction("Edit Variable")) {
UndoableTransaction.start(trace, "Edit Variable")) {
if (hostAddress.isRegisterAddress()) { if (hostAddress.isRegisterAddress()) {
TraceThread thread = coordinates.getThread(); TraceThread thread = coordinates.getThread();
if (thread == null) { if (thread == null) {

View file

@ -21,6 +21,7 @@ import java.util.Set;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.core.codebrowser.CodeViewerProvider; import ghidra.app.plugin.core.codebrowser.CodeViewerProvider;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper;
@ -42,7 +43,6 @@ import ghidra.trace.model.*;
import ghidra.trace.model.breakpoint.TraceBreakpointKind; import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.Swing; import ghidra.util.Swing;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
@ -98,7 +98,7 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
.getRootFolder() .getRootFolder()
.createFile("WinHelloCPP", program, TaskMonitor.DUMMY); .createFile("WinHelloCPP", program, TaskMonitor.DUMMY);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add Mapping")) { try (Transaction tx = trace.openTransaction("Add Mapping")) {
mappingService.addIdentityMapping(trace, program, Lifespan.nowOn(0), true); mappingService.addIdentityMapping(trace, program, Lifespan.nowOn(0), true);
} }
waitForValue(() -> mappingService.getOpenMappedLocation( waitForValue(() -> mappingService.getOpenMappedLocation(
@ -148,7 +148,7 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
.getRootFolder() .getRootFolder()
.createFile("WinHelloCPP", program, TaskMonitor.DUMMY); .createFile("WinHelloCPP", program, TaskMonitor.DUMMY);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add Mapping")) { try (Transaction tx = trace.openTransaction("Add Mapping")) {
mappingService.addIdentityMapping(trace, program, Lifespan.nowOn(0), true); mappingService.addIdentityMapping(trace, program, Lifespan.nowOn(0), true);
} }
waitForValue(() -> mappingService.getOpenMappedLocation( waitForValue(() -> mappingService.getOpenMappedLocation(

View file

@ -15,14 +15,14 @@
*/ */
package ghidra.app.plugin.core.debug.gui.breakpoint; package ghidra.app.plugin.core.debug.gui.breakpoint;
import static ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.waitForPass; import static ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.*;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import java.util.Set; import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper;
import ghidra.app.plugin.core.debug.service.breakpoint.DebuggerLogicalBreakpointServicePlugin; import ghidra.app.plugin.core.debug.service.breakpoint.DebuggerLogicalBreakpointServicePlugin;
@ -44,7 +44,6 @@ import ghidra.test.ToyProgramBuilder;
import ghidra.trace.model.*; import ghidra.trace.model.*;
import ghidra.trace.model.breakpoint.TraceBreakpoint; import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
@ -127,19 +126,19 @@ public class DebuggerBreakpointsPluginScreenShots extends GhidraScreenShotGenera
mb.testProcess1.addRegion("echo:.data", mb.rng(0x00600000, 0x00600fff), "rw"); mb.testProcess1.addRegion("echo:.data", mb.rng(0x00600000, 0x00600fff), "rw");
mb.testProcess3.addRegion("echo:.text", mb.rng(0x7fac0000, 0x7fac0fff), "rx"); mb.testProcess3.addRegion("echo:.text", mb.rng(0x7fac0000, 0x7fac0fff), "rx");
try (UndoableTransaction tid = UndoableTransaction.start(trace1, "Add mapping")) { try (Transaction tx = trace1.openTransaction("Add mapping")) {
DebuggerStaticMappingUtils.addMapping( DebuggerStaticMappingUtils.addMapping(
new DefaultTraceLocation(trace1, null, Lifespan.nowOn(0), addr(trace1, 0x00400000)), new DefaultTraceLocation(trace1, null, Lifespan.nowOn(0), addr(trace1, 0x00400000)),
new ProgramLocation(program, addr(program, 0x00400000)), 0x00210000, false); new ProgramLocation(program, addr(program, 0x00400000)), 0x00210000, false);
} }
try (UndoableTransaction tid = UndoableTransaction.start(trace3, "Add mapping")) { try (Transaction tx = trace3.openTransaction("Add mapping")) {
DebuggerStaticMappingUtils.addMapping( DebuggerStaticMappingUtils.addMapping(
new DefaultTraceLocation(trace3, null, Lifespan.nowOn(0), addr(trace3, 0x7fac0000)), new DefaultTraceLocation(trace3, null, Lifespan.nowOn(0), addr(trace3, 0x7fac0000)),
new ProgramLocation(program, addr(program, 0x00400000)), 0x00010000, false); new ProgramLocation(program, addr(program, 0x00400000)), 0x00010000, false);
} }
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add breakpoint")) { try (Transaction tx = program.openTransaction("Add breakpoint")) {
program.getBookmarkManager() program.getBookmarkManager()
.setBookmark(addr(program, 0x00401234), .setBookmark(addr(program, 0x00401234),
LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE, "SW_EXECUTE;1", LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE, "SW_EXECUTE;1",

View file

@ -19,6 +19,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider;
@ -40,7 +41,6 @@ import ghidra.trace.model.DefaultTraceLocation;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.modules.TraceModule; import ghidra.trace.model.modules.TraceModule;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
@ -87,7 +87,7 @@ public class DebuggerCopyActionsPluginScreenShots extends GhidraScreenShotGenera
@Test @Test
public void testCaptureDebuggerCopyIntoProgramDialog() throws Throwable { public void testCaptureDebuggerCopyIntoProgramDialog() throws Throwable {
long snap; long snap;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
DBTraceMemoryManager mem = tb.trace.getMemoryManager(); DBTraceMemoryManager mem = tb.trace.getMemoryManager();
mem.createRegion(".text", snap, tb.range(0x55550000, 0x5555ffff), mem.createRegion(".text", snap, tb.range(0x55550000, 0x5555ffff),
@ -110,7 +110,7 @@ public class DebuggerCopyActionsPluginScreenShots extends GhidraScreenShotGenera
program = createDefaultProgram("echo", "Toy:BE:64:default", this); program = createDefaultProgram("echo", "Toy:BE:64:default", this);
AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add memory")) { try (Transaction tx = program.openTransaction("Add memory")) {
program.setImageBase(tb.addr(stSpace, 0x00400000), true); program.setImageBase(tb.addr(stSpace, 0x00400000), true);
Memory memory = program.getMemory(); Memory memory = program.getMemory();
memory.createInitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x10000, (byte) 0, memory.createInitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x10000, (byte) 0,
@ -123,7 +123,7 @@ public class DebuggerCopyActionsPluginScreenShots extends GhidraScreenShotGenera
root.createFile(tb.trace.getName(), tb.trace, TaskMonitor.DUMMY); root.createFile(tb.trace.getName(), tb.trace, TaskMonitor.DUMMY);
root.createFile(program.getName(), program, TaskMonitor.DUMMY); root.createFile(program.getName(), program, TaskMonitor.DUMMY);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingService.addMapping( mappingService.addMapping(
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(snap), tb.addr(0x55550000)), new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(snap), tb.addr(0x55550000)),
new ProgramLocation(program, tb.addr(stSpace, 0x00400000)), 0x10000, true); new ProgramLocation(program, tb.addr(stSpace, 0x00400000)), 0x10000, true);

View file

@ -15,13 +15,14 @@
*/ */
package ghidra.app.plugin.core.debug.gui.diff; package ghidra.app.plugin.core.debug.gui.diff;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.*;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider;
import ghidra.app.plugin.core.debug.gui.time.DebuggerTimeSelectionDialog; import ghidra.app.plugin.core.debug.gui.time.DebuggerTimeSelectionDialog;
@ -36,7 +37,6 @@ import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.Swing; import ghidra.util.Swing;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerTraceViewDiffPluginScreenShots extends GhidraScreenShotGenerator public class DebuggerTraceViewDiffPluginScreenShots extends GhidraScreenShotGenerator
@ -66,7 +66,7 @@ public class DebuggerTraceViewDiffPluginScreenShots extends GhidraScreenShotGene
@Test @Test
public void testCaptureDebuggerTraceViewDiffPlugin() throws Throwable { public void testCaptureDebuggerTraceViewDiffPlugin() throws Throwable {
long snap1, snap2; long snap1, snap2;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceTimeManager tm = tb.trace.getTimeManager(); DBTraceTimeManager tm = tb.trace.getTimeManager();
snap1 = tm.createSnapshot("Baseline").getKey(); snap1 = tm.createSnapshot("Baseline").getKey();
snap2 = tm.createSnapshot("X's first move").getKey(); snap2 = tm.createSnapshot("X's first move").getKey();
@ -106,7 +106,7 @@ public class DebuggerTraceViewDiffPluginScreenShots extends GhidraScreenShotGene
@Test @Test
public void testCaptureDebuggerTimeSelectionDialog() throws Throwable { public void testCaptureDebuggerTimeSelectionDialog() throws Throwable {
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceTimeManager tm = tb.trace.getTimeManager(); DBTraceTimeManager tm = tb.trace.getTimeManager();
thread = tb.getOrAddThread("main", 0); thread = tb.getOrAddThread("main", 0);
tm.createSnapshot("Break on main").setEventThread(thread); tm.createSnapshot("Break on main").setEventThread(thread);

View file

@ -19,6 +19,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.assembler.Assembler; import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers; import ghidra.app.plugin.assembler.Assemblers;
import ghidra.app.plugin.core.debug.gui.action.DebuggerGoToDialog; import ghidra.app.plugin.core.debug.gui.action.DebuggerGoToDialog;
@ -33,7 +34,6 @@ import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.memory.TraceMemorySpace; import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.symbol.*; import ghidra.trace.model.symbol.*;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerListingPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerListingPluginScreenShots extends GhidraScreenShotGenerator {
@ -59,7 +59,7 @@ public class DebuggerListingPluginScreenShots extends GhidraScreenShotGenerator
@Test @Test
public void testCaptureDebuggerListingPlugin() throws Throwable { public void testCaptureDebuggerListingPlugin() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion(".text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), .addRegion(".text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
@ -123,7 +123,7 @@ public class DebuggerListingPluginScreenShots extends GhidraScreenShotGenerator
@Test @Test
public void testCaptureDebuggerGoToDialog() throws Throwable { public void testCaptureDebuggerGoToDialog() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getTimeManager().createSnapshot("First").getKey(); tb.trace.getTimeManager().createSnapshot("First").getKey();
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("bash:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), .addRegion("bash:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),

View file

@ -19,6 +19,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.assembler.Assembler; import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers; import ghidra.app.plugin.assembler.Assemblers;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
@ -33,7 +34,6 @@ import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.memory.TraceMemorySpace; import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.symbol.*; import ghidra.trace.model.symbol.*;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerMemoryBytesPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerMemoryBytesPluginScreenShots extends GhidraScreenShotGenerator {
@ -63,7 +63,7 @@ public class DebuggerMemoryBytesPluginScreenShots extends GhidraScreenShotGenera
@Test @Test
public void testCaptureDebuggerMemoryBytesPlugin() throws Throwable { public void testCaptureDebuggerMemoryBytesPlugin() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion(".text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), .addRegion(".text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),

View file

@ -19,6 +19,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin; import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
@ -32,7 +33,6 @@ import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.database.memory.DBTraceMemoryManager; import ghidra.trace.database.memory.DBTraceMemoryManager;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
@ -74,7 +74,7 @@ public class DebuggerRegionsPluginScreenShots extends GhidraScreenShotGenerator
} }
private void populateTrace() throws Exception { private void populateTrace() throws Exception {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
@ -102,7 +102,7 @@ public class DebuggerRegionsPluginScreenShots extends GhidraScreenShotGenerator
progBash = createDefaultProgram("bash", ProgramBuilder._X64, this); progBash = createDefaultProgram("bash", ProgramBuilder._X64, this);
progLibC = createDefaultProgram("libc.so.6", ProgramBuilder._X64, this); progLibC = createDefaultProgram("libc.so.6", ProgramBuilder._X64, this);
try (UndoableTransaction tid = UndoableTransaction.start(progBash, "Add memory")) { try (Transaction tx = progBash.openTransaction("Add memory")) {
progBash.setImageBase(addr(progBash, 0x00400000), true); progBash.setImageBase(addr(progBash, 0x00400000), true);
progBash.getMemory() progBash.getMemory()
.createInitializedBlock(".text", addr(progBash, 0x00400000), 0x10000, (byte) 0, .createInitializedBlock(".text", addr(progBash, 0x00400000), 0x10000, (byte) 0,
@ -112,7 +112,7 @@ public class DebuggerRegionsPluginScreenShots extends GhidraScreenShotGenerator
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
} }
try (UndoableTransaction tid = UndoableTransaction.start(progLibC, "Add memory")) { try (Transaction tx = progLibC.openTransaction("Add memory")) {
progLibC.setImageBase(addr(progLibC, 0x00400000), true); progLibC.setImageBase(addr(progLibC, 0x00400000), true);
progLibC.getMemory() progLibC.getMemory()
.createInitializedBlock(".text", addr(progLibC, 0x00400000), 0x10000, (byte) 0, .createInitializedBlock(".text", addr(progLibC, 0x00400000), 0x10000, (byte) 0,

View file

@ -20,6 +20,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin; import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
@ -31,7 +32,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.breakpoint.TraceBreakpointKind; import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerMemviewPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerMemviewPluginScreenShots extends GhidraScreenShotGenerator {
@ -78,13 +78,13 @@ public class DebuggerMemviewPluginScreenShots extends GhidraScreenShotGenerator
private void populateTraceAndPrograms() throws Exception { private void populateTraceAndPrograms() throws Exception {
tool.getProject().getProjectData().getRootFolder(); tool.getProject().getProjectData().getRootFolder();
TraceThread thread1; TraceThread thread1;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread1 = tb.trace.getThreadManager().addThread("[0]", Lifespan.span(1, 40)); thread1 = tb.trace.getThreadManager().addThread("[0]", Lifespan.span(1, 40));
tb.trace.getThreadManager().addThread("[1]", Lifespan.span(4, 50)); tb.trace.getThreadManager().addThread("[1]", Lifespan.span(4, 50));
tb.trace.getThreadManager().addThread("[2]", Lifespan.span(6, 20)); tb.trace.getThreadManager().addThread("[2]", Lifespan.span(6, 20));
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getModuleManager() tb.trace.getModuleManager()
.addLoadedModule("/bin/bash", "/bin/bash", tb.range(0x00400000, 0x0060ffff), 0); .addLoadedModule("/bin/bash", "/bin/bash", tb.range(0x00400000, 0x0060ffff), 0);
tb.trace.getModuleManager() tb.trace.getModuleManager()
@ -92,7 +92,7 @@ public class DebuggerMemviewPluginScreenShots extends GhidraScreenShotGenerator
tb.range(0x7fac0000, 0x7faeffff), 10); tb.range(0x7fac0000, 0x7faeffff), 10);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("bash.text", Lifespan.nowOn(5), tb.range(0x00400000, 0x0040ffff), .addRegion("bash.text", Lifespan.nowOn(5), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.EXECUTE); TraceMemoryFlag.EXECUTE);
@ -108,7 +108,7 @@ public class DebuggerMemviewPluginScreenShots extends GhidraScreenShotGenerator
TraceMemoryFlag.READ, TraceMemoryFlag.WRITE); TraceMemoryFlag.READ, TraceMemoryFlag.WRITE);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
Set<TraceThread> threads = new HashSet<TraceThread>(); Set<TraceThread> threads = new HashSet<TraceThread>();
Set<TraceBreakpointKind> kinds = new HashSet<TraceBreakpointKind>(); Set<TraceBreakpointKind> kinds = new HashSet<TraceBreakpointKind>();
threads.add(thread1); threads.add(thread1);

View file

@ -19,6 +19,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin; import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
@ -30,7 +31,6 @@ import ghidra.program.model.listing.Program;
import ghidra.test.ToyProgramBuilder; import ghidra.test.ToyProgramBuilder;
import ghidra.trace.database.ToyDBTraceBuilder; import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.model.modules.TraceModule; import ghidra.trace.model.modules.TraceModule;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
@ -69,7 +69,7 @@ public class DebuggerModulesPluginScreenShots extends GhidraScreenShotGenerator
@Test @Test
public void testCaptureDebuggerModulesPlugin() throws Throwable { public void testCaptureDebuggerModulesPlugin() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
TraceModule bin = tb.trace.getModuleManager() TraceModule bin = tb.trace.getModuleManager()
@ -96,7 +96,7 @@ public class DebuggerModulesPluginScreenShots extends GhidraScreenShotGenerator
private void populateTraceAndPrograms() throws Exception { private void populateTraceAndPrograms() throws Exception {
DomainFolder root = tool.getProject().getProjectData().getRootFolder(); DomainFolder root = tool.getProject().getProjectData().getRootFolder();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
TraceModule bin = tb.trace.getModuleManager() TraceModule bin = tb.trace.getModuleManager()
@ -114,7 +114,7 @@ public class DebuggerModulesPluginScreenShots extends GhidraScreenShotGenerator
progBash = createDefaultProgram("bash", ProgramBuilder._X64, this); progBash = createDefaultProgram("bash", ProgramBuilder._X64, this);
progLibC = createDefaultProgram("libc.so.6", ProgramBuilder._X64, this); progLibC = createDefaultProgram("libc.so.6", ProgramBuilder._X64, this);
try (UndoableTransaction tid = UndoableTransaction.start(progBash, "Add memory")) { try (Transaction tx = progBash.openTransaction("Add memory")) {
progBash.setImageBase(addr(progBash, 0x00400000), true); progBash.setImageBase(addr(progBash, 0x00400000), true);
progBash.getMemory() progBash.getMemory()
.createInitializedBlock(".text", addr(progBash, 0x00400000), 0x10000, (byte) 0, .createInitializedBlock(".text", addr(progBash, 0x00400000), 0x10000, (byte) 0,
@ -124,7 +124,7 @@ public class DebuggerModulesPluginScreenShots extends GhidraScreenShotGenerator
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
} }
try (UndoableTransaction tid = UndoableTransaction.start(progLibC, "Add memory")) { try (Transaction tx = progLibC.openTransaction("Add memory")) {
progLibC.setImageBase(addr(progLibC, 0x00400000), true); progLibC.setImageBase(addr(progLibC, 0x00400000), true);
progLibC.getMemory() progLibC.getMemory()
.createInitializedBlock(".text", addr(progLibC, 0x00400000), 0x10000, (byte) 0, .createInitializedBlock(".text", addr(progLibC, 0x00400000), 0x10000, (byte) 0,

View file

@ -19,6 +19,7 @@ import java.util.*;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin; import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin; import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;
@ -31,7 +32,6 @@ import ghidra.program.model.listing.Program;
import ghidra.test.ToyProgramBuilder; import ghidra.test.ToyProgramBuilder;
import ghidra.trace.database.ToyDBTraceBuilder; import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.model.modules.TraceModule; import ghidra.trace.model.modules.TraceModule;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
@ -76,7 +76,7 @@ public class DebuggerStaticMappingPluginScreenShots extends GhidraScreenShotGene
@Test @Test
public void testCaptureDebuggerStaticMappingPlugin() throws Throwable { public void testCaptureDebuggerStaticMappingPlugin() throws Throwable {
DomainFolder root = tool.getProject().getProjectData().getRootFolder(); DomainFolder root = tool.getProject().getProjectData().getRootFolder();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
TraceModule bin = tb.trace.getModuleManager() TraceModule bin = tb.trace.getModuleManager()
@ -94,7 +94,7 @@ public class DebuggerStaticMappingPluginScreenShots extends GhidraScreenShotGene
progEcho = createDefaultProgram("bash", ProgramBuilder._X64, this); progEcho = createDefaultProgram("bash", ProgramBuilder._X64, this);
progLibC = createDefaultProgram("libc.so.6", ProgramBuilder._X64, this); progLibC = createDefaultProgram("libc.so.6", ProgramBuilder._X64, this);
try (UndoableTransaction tid = UndoableTransaction.start(progEcho, "Add memory")) { try (Transaction tx = progEcho.openTransaction("Add memory")) {
progEcho.setImageBase(addr(progEcho, 0x00400000), true); progEcho.setImageBase(addr(progEcho, 0x00400000), true);
progEcho.getMemory() progEcho.getMemory()
.createInitializedBlock(".text", addr(progEcho, 0x00400000), 0x10000, (byte) 0, .createInitializedBlock(".text", addr(progEcho, 0x00400000), 0x10000, (byte) 0,
@ -104,7 +104,7 @@ public class DebuggerStaticMappingPluginScreenShots extends GhidraScreenShotGene
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
} }
try (UndoableTransaction tid = UndoableTransaction.start(progLibC, "Add memory")) { try (Transaction tx = progLibC.openTransaction("Add memory")) {
progLibC.setImageBase(addr(progLibC, 0x00400000), true); progLibC.setImageBase(addr(progLibC, 0x00400000), true);
progLibC.getMemory() progLibC.getMemory()
.createInitializedBlock(".text", addr(progLibC, 0x00400000), 0x10000, (byte) 0, .createInitializedBlock(".text", addr(progLibC, 0x00400000), 0x10000, (byte) 0,
@ -124,7 +124,7 @@ public class DebuggerStaticMappingPluginScreenShots extends GhidraScreenShotGene
programManager.openProgram(progEcho); programManager.openProgram(progEcho);
programManager.openProgram(progLibC); programManager.openProgram(progLibC);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
Map<TraceModule, ModuleMapProposal> proposal = Map<TraceModule, ModuleMapProposal> proposal =
mappingService.proposeModuleMaps(tb.trace.getModuleManager().getAllModules(), mappingService.proposeModuleMaps(tb.trace.getModuleManager().getAllModules(),
List.of(programManager.getAllOpenPrograms())); List.of(programManager.getAllOpenPrograms()));

View file

@ -17,6 +17,7 @@ package ghidra.app.plugin.core.debug.gui.pcode;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.assembler.Assembler; import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers; import ghidra.app.plugin.assembler.Assemblers;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
@ -29,7 +30,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerPcodeStepperPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerPcodeStepperPluginScreenShots extends GhidraScreenShotGenerator {
@ -56,7 +56,7 @@ public class DebuggerPcodeStepperPluginScreenShots extends GhidraScreenShotGener
@Test @Test
public void testCaptureDebuggerPcodeStepperPlugin() throws Throwable { public void testCaptureDebuggerPcodeStepperPlugin() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey();
tb.trace.getMemoryManager() tb.trace.getMemoryManager()

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.debug.gui.platform;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
import ghidra.dbg.target.schema.SchemaContext; import ghidra.dbg.target.schema.SchemaContext;
@ -25,7 +26,6 @@ import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;
import ghidra.dbg.target.schema.XmlSchemaContext; import ghidra.dbg.target.schema.XmlSchemaContext;
import ghidra.trace.database.ToyDBTraceBuilder; import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.database.target.DBTraceObjectManagerTest; import ghidra.trace.database.target.DBTraceObjectManagerTest;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerPlatformPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerPlatformPluginScreenShots extends GhidraScreenShotGenerator {
@ -43,7 +43,7 @@ public class DebuggerPlatformPluginScreenShots extends GhidraScreenShotGenerator
public void testCaptureDebuggerSelectPlatformOfferDialog() throws Throwable { public void testCaptureDebuggerSelectPlatformOfferDialog() throws Throwable {
SchemaContext ctx = XmlSchemaContext.deserialize(DBTraceObjectManagerTest.XML_CTX); SchemaContext ctx = XmlSchemaContext.deserialize(DBTraceObjectManagerTest.XML_CTX);
try (ToyDBTraceBuilder tb = new ToyDBTraceBuilder("echo", "DATA:BE:64:default")) { try (ToyDBTraceBuilder tb = new ToyDBTraceBuilder("echo", "DATA:BE:64:default")) {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getObjectManager() tb.trace.getObjectManager()
.createRootObject(ctx.getSchema(new SchemaName("Session"))); .createRootObject(ctx.getSchema(new SchemaName("Session")));
} }

View file

@ -19,6 +19,7 @@ import java.math.BigInteger;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
import ghidra.program.model.data.PointerDataType; import ghidra.program.model.data.PointerDataType;
@ -29,7 +30,6 @@ import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.TraceMemorySpace; import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerRegistersPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerRegistersPluginScreenShots extends GhidraScreenShotGenerator {
@ -56,7 +56,7 @@ public class DebuggerRegistersPluginScreenShots extends GhidraScreenShotGenerato
@Test @Test
public void testCaptureDebuggerRegistersPlugin() throws Throwable { public void testCaptureDebuggerRegistersPlugin() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey();
long snap1 = tb.trace.getTimeManager().createSnapshot("Second").getKey(); long snap1 = tb.trace.getTimeManager().createSnapshot("Second").getKey();
@ -106,7 +106,7 @@ public class DebuggerRegistersPluginScreenShots extends GhidraScreenShotGenerato
@Test @Test
public void testCaptureDebuggerAvailableRegistersDialog() throws Throwable { public void testCaptureDebuggerAvailableRegistersDialog() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
long snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey(); long snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey();
TraceThread thread = tb.getOrAddThread("[1]", snap0); TraceThread thread = tb.getOrAddThread("[1]", snap0);

View file

@ -22,6 +22,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.assembler.*; import ghidra.app.plugin.assembler.*;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
@ -37,8 +38,8 @@ import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerService
import ghidra.app.plugin.core.debug.stack.*; import ghidra.app.plugin.core.debug.stack.*;
import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin; import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;
import ghidra.app.services.*; import ghidra.app.services.*;
import ghidra.app.services.DebuggerEmulationService.EmulationResult;
import ghidra.app.services.DebuggerControlService.StateEditor; import ghidra.app.services.DebuggerControlService.StateEditor;
import ghidra.app.services.DebuggerEmulationService.EmulationResult;
import ghidra.async.AsyncTestUtils; import ghidra.async.AsyncTestUtils;
import ghidra.framework.model.DomainFolder; import ghidra.framework.model.DomainFolder;
import ghidra.framework.model.DomainObject; import ghidra.framework.model.DomainObject;
@ -63,7 +64,6 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.Scheduler; import ghidra.trace.model.time.schedule.Scheduler;
import ghidra.util.InvalidNameException; import ghidra.util.InvalidNameException;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.ConsoleTaskMonitor; import ghidra.util.task.ConsoleTaskMonitor;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -113,7 +113,7 @@ public class DebuggerStackPluginScreenShots extends GhidraScreenShotGenerator
public void testCaptureDebuggerStackPlugin() throws Throwable { public void testCaptureDebuggerStackPlugin() throws Throwable {
DomainFolder root = tool.getProject().getProjectData().getRootFolder(); DomainFolder root = tool.getProject().getProjectData().getRootFolder();
program = createDefaultProgram("echo", ToyProgramBuilder._X64, this); program = createDefaultProgram("echo", ToyProgramBuilder._X64, this);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Populate")) { try (Transaction tx = program.openTransaction("Populate")) {
program.setImageBase(addr(program, 0x00400000), true); program.setImageBase(addr(program, 0x00400000), true);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00400000), 0x10000, (byte) 0, .createInitializedBlock(".text", addr(program, 0x00400000), 0x10000, (byte) 0,
@ -128,7 +128,7 @@ public class DebuggerStackPluginScreenShots extends GhidraScreenShotGenerator
} }
long snap; long snap;
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
snap = tb.trace.getTimeManager().createSnapshot("First").getKey(); snap = tb.trace.getTimeManager().createSnapshot("First").getKey();
thread = tb.getOrAddThread("[1]", snap); thread = tb.getOrAddThread("[1]", snap);
TraceStack stack = tb.trace.getStackManager().getStack(thread, snap, true); TraceStack stack = tb.trace.getStackManager().getStack(thread, snap, true);
@ -144,7 +144,7 @@ public class DebuggerStackPluginScreenShots extends GhidraScreenShotGenerator
} }
root.createFile("trace", tb.trace, TaskMonitor.DUMMY); root.createFile("trace", tb.trace, TaskMonitor.DUMMY);
root.createFile("echo", program, TaskMonitor.DUMMY); root.createFile("echo", program, TaskMonitor.DUMMY);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DebuggerStaticMappingUtils.addMapping( DebuggerStaticMappingUtils.addMapping(
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(snap), tb.addr(0x00400000)), new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(snap), tb.addr(0x00400000)),
new ProgramLocation(program, addr(program, 0x00400000)), 0x10000, false); new ProgramLocation(program, addr(program, 0x00400000)), 0x10000, false);
@ -205,7 +205,7 @@ public class DebuggerStackPluginScreenShots extends GhidraScreenShotGenerator
protected Function createFibonacciProgramX86_32() throws Throwable { protected Function createFibonacciProgramX86_32() throws Throwable {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
Address entry = addr(program, 0x00400000); Address entry = addr(program, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false); .createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false);
@ -307,7 +307,7 @@ public class DebuggerStackPluginScreenShots extends GhidraScreenShotGenerator
waitOn(frameAtSetup.setReturnAddress(editor, tb.addr(0xdeadbeef))); waitOn(frameAtSetup.setReturnAddress(editor, tb.addr(0xdeadbeef)));
waitForTasks(); waitForTasks();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getBreakpointManager() tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr,
Set.of(), Set.of(),
@ -321,7 +321,7 @@ public class DebuggerStackPluginScreenShots extends GhidraScreenShotGenerator
traceManager.activateTime(result.schedule()); traceManager.activateTime(result.schedule());
waitForTasks(); waitForTasks();
DebuggerCoordinates tallest = traceManager.getCurrent(); DebuggerCoordinates tallest = traceManager.getCurrent();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
new UnwindStackCommand(tool, tallest).applyTo(tb.trace, monitor); new UnwindStackCommand(tool, tallest).applyTo(tb.trace, monitor);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);

View file

@ -25,6 +25,7 @@ import java.util.*;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import docking.widgets.fieldpanel.FieldPanel; import docking.widgets.fieldpanel.FieldPanel;
import docking.widgets.fieldpanel.support.FieldLocation; import docking.widgets.fieldpanel.support.FieldLocation;
import generic.Unique; import generic.Unique;
@ -44,8 +45,8 @@ import ghidra.app.plugin.core.debug.stack.StackUnwinderTest.HoverLocation;
import ghidra.app.plugin.core.decompile.DecompilerProvider; import ghidra.app.plugin.core.decompile.DecompilerProvider;
import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin; import ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;
import ghidra.app.services.*; import ghidra.app.services.*;
import ghidra.app.services.DebuggerEmulationService.EmulationResult;
import ghidra.app.services.DebuggerControlService.StateEditor; import ghidra.app.services.DebuggerControlService.StateEditor;
import ghidra.app.services.DebuggerEmulationService.EmulationResult;
import ghidra.app.util.viewer.listingpanel.ListingPanel; import ghidra.app.util.viewer.listingpanel.ListingPanel;
import ghidra.async.AsyncTestUtils; import ghidra.async.AsyncTestUtils;
import ghidra.framework.model.DomainFolder; import ghidra.framework.model.DomainFolder;
@ -70,7 +71,6 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.Scheduler; import ghidra.trace.model.time.schedule.Scheduler;
import ghidra.util.InvalidNameException; import ghidra.util.InvalidNameException;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.ConsoleTaskMonitor; import ghidra.util.task.ConsoleTaskMonitor;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
@ -138,7 +138,7 @@ public class VariableValueHoverPluginScreenShots extends GhidraScreenShotGenerat
protected Function createFibonacciProgramX86_32() throws Throwable { protected Function createFibonacciProgramX86_32() throws Throwable {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
Address entry = addr(program, 0x00400000); Address entry = addr(program, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false); .createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false);
@ -244,7 +244,7 @@ public class VariableValueHoverPluginScreenShots extends GhidraScreenShotGenerat
traceManager.activateThread(thread); traceManager.activateThread(thread);
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
MemoryBlock block = program.getMemory().getBlock(".text"); MemoryBlock block = program.getMemory().getBlock(".text");
byte[] text = new byte[(int) block.getSize()]; byte[] text = new byte[(int) block.getSize()];
block.getBytes(block.getStart(), text); block.getBytes(block.getStart(), text);
@ -269,7 +269,7 @@ public class VariableValueHoverPluginScreenShots extends GhidraScreenShotGenerat
waitOn(frameAtSetup.setReturnAddress(editor, tb.addr(0xdeadbeef))); waitOn(frameAtSetup.setReturnAddress(editor, tb.addr(0xdeadbeef)));
waitForTasks(); waitForTasks();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getBreakpointManager() tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr,
Set.of(), Set.of(),
@ -283,7 +283,7 @@ public class VariableValueHoverPluginScreenShots extends GhidraScreenShotGenerat
traceManager.activateTime(result.schedule()); traceManager.activateTime(result.schedule());
waitForTasks(); waitForTasks();
DebuggerCoordinates tallest = traceManager.getCurrent(); DebuggerCoordinates tallest = traceManager.getCurrent();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
new UnwindStackCommand(tool, tallest).applyTo(tb.trace, monitor); new UnwindStackCommand(tool, tallest).applyTo(tb.trace, monitor);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.debug.gui.thread;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest.TestDebuggerTargetTraceMapper;
import ghidra.app.plugin.core.debug.service.model.DebuggerModelServiceProxyPlugin; import ghidra.app.plugin.core.debug.service.model.DebuggerModelServiceProxyPlugin;
@ -26,7 +27,6 @@ import ghidra.app.services.*;
import ghidra.dbg.model.*; import ghidra.dbg.model.*;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerThreadsPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerThreadsPluginScreenShots extends GhidraScreenShotGenerator {
@ -72,7 +72,7 @@ public class DebuggerThreadsPluginScreenShots extends GhidraScreenShotGenerator
waitForValue(() -> recorder.getTraceThread(handler2Thread)); waitForValue(() -> recorder.getTraceThread(handler2Thread));
AbstractGhidraHeadedDebuggerGUITest.waitForDomainObject(trace); AbstractGhidraHeadedDebuggerGUITest.waitForDomainObject(trace);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Comments")) { try (Transaction tx = trace.openTransaction("Comments")) {
recorder.getTraceThread(mainThread).setComment("GUI main loop"); recorder.getTraceThread(mainThread).setComment("GUI main loop");
recorder.getTraceThread(serverThread).setComment("Server"); recorder.getTraceThread(serverThread).setComment("Server");
recorder.getTraceThread(handler1Thread).setComment("Handler 1"); recorder.getTraceThread(handler1Thread).setComment("Handler 1");

View file

@ -17,6 +17,7 @@ package ghidra.app.plugin.core.debug.gui.time;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
import ghidra.test.ToyProgramBuilder; import ghidra.test.ToyProgramBuilder;
@ -24,7 +25,6 @@ import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerTimePluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerTimePluginScreenShots extends GhidraScreenShotGenerator {
@ -52,7 +52,7 @@ public class DebuggerTimePluginScreenShots extends GhidraScreenShotGenerator {
public void testCaptureDebuggerTimePlugin() throws Throwable { public void testCaptureDebuggerTimePlugin() throws Throwable {
long fakeClock = (long) Integer.MAX_VALUE * 1000; long fakeClock = (long) Integer.MAX_VALUE * 1000;
TraceSnapshot snap; TraceSnapshot snap;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
snap = tb.trace.getTimeManager().createSnapshot("Trace started"); snap = tb.trace.getTimeManager().createSnapshot("Trace started");
snap.setRealTime(fakeClock); snap.setRealTime(fakeClock);

View file

@ -17,6 +17,7 @@ package ghidra.app.plugin.core.debug.gui.watch;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin; import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;
import ghidra.app.services.DebuggerTraceManagerService; import ghidra.app.services.DebuggerTraceManagerService;
import ghidra.pcode.exec.PcodeExecutor; import ghidra.pcode.exec.PcodeExecutor;
@ -27,7 +28,6 @@ import ghidra.program.model.symbol.SourceType;
import ghidra.test.ToyProgramBuilder; import ghidra.test.ToyProgramBuilder;
import ghidra.trace.database.ToyDBTraceBuilder; import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import help.screenshot.GhidraScreenShotGenerator; import help.screenshot.GhidraScreenShotGenerator;
public class DebuggerWatchesPluginScreenShots extends GhidraScreenShotGenerator { public class DebuggerWatchesPluginScreenShots extends GhidraScreenShotGenerator {
@ -56,7 +56,7 @@ public class DebuggerWatchesPluginScreenShots extends GhidraScreenShotGenerator
public void testCaptureDebuggerWatchesPlugin() throws Throwable { public void testCaptureDebuggerWatchesPlugin() throws Throwable {
TraceThread thread; TraceThread thread;
long snap0, snap1; long snap0, snap1;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey(); snap0 = tb.trace.getTimeManager().createSnapshot("First").getKey();
snap1 = tb.trace.getTimeManager().createSnapshot("Second").getKey(); snap1 = tb.trace.getTimeManager().createSnapshot("Second").getKey();

View file

@ -27,6 +27,7 @@ import java.util.stream.Collectors;
import org.junit.*; import org.junit.*;
import db.Transaction;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
import generic.Unique; import generic.Unique;
import ghidra.app.context.ListingActionContext; import ghidra.app.context.ListingActionContext;
@ -66,7 +67,6 @@ import ghidra.trace.model.target.TraceObject.ConflictResolution;
import ghidra.trace.model.target.TraceObjectKeyPath; import ghidra.trace.model.target.TraceObjectKeyPath;
import ghidra.trace.model.thread.TraceObjectThread; import ghidra.trace.model.thread.TraceObjectThread;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -150,7 +150,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
createAndOpenTrace("DATA:BE:64:default"); createAndOpenTrace("DATA:BE:64:default");
DBTraceObjectManager objects = tb.trace.getObjectManager(); DBTraceObjectManager objects = tb.trace.getObjectManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
objects.createRootObject(ctx.getSchema(new SchemaName("Session"))); objects.createRootObject(ctx.getSchema(new SchemaName("Session")));
DBTraceObject env = DBTraceObject env =
objects.createObject(TraceObjectKeyPath.parse("Targets[0].Environment")); objects.createObject(TraceObjectKeyPath.parse("Targets[0].Environment"));
@ -190,7 +190,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
Supplier<ByteBuffer> byteSupplier) throws Throwable { Supplier<ByteBuffer> byteSupplier) throws Throwable {
createAndOpenTrace(langID); createAndOpenTrace(langID);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion("Memory[bin:.text]", 0, tb.range(offset, offset + 0xffff), memory.createRegion("Memory[bin:.text]", 0, tb.range(offset, offset + 0xffff),
Set.of(TraceMemoryFlag.EXECUTE)); Set.of(TraceMemoryFlag.EXECUTE));
@ -221,7 +221,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
// Fabricate the cpsr so that ARM is used. Otherwise, it will assume Cortex-M, so THUMB // Fabricate the cpsr so that ARM is used. Otherwise, it will assume Cortex-M, so THUMB
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
DBTraceMemorySpace regs = DBTraceMemorySpace regs =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
@ -255,7 +255,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
// Fabricate the cpsr so that THUMB is used, even though we could omit as in Cortex-M // Fabricate the cpsr so that THUMB is used, even though we could omit as in Cortex-M
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
DBTraceMemorySpace regs = DBTraceMemorySpace regs =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
@ -414,7 +414,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
// Ensure the mapper is added to the trace // Ensure the mapper is added to the trace
assertNotNull(platformService.getMapper(tb.trace, null, 0)); assertNotNull(platformService.getMapper(tb.trace, null, 0));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.addInstruction(0, start, tb.host); tb.addInstruction(0, start, tb.host);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -446,7 +446,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
// Ensure the mapper is added to the trace // Ensure the mapper is added to the trace
assertNotNull(platformService.getMapper(tb.trace, null, 0)); assertNotNull(platformService.getMapper(tb.trace, null, 0));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceDisassembleCommand dis = new TraceDisassembleCommand(tb.host, start, TraceDisassembleCommand dis = new TraceDisassembleCommand(tb.host, start,
new AddressSet(start, start.addWrap(1))); new AddressSet(start, start.addWrap(1)));
dis.setInitialContext(DebuggerDisassemblerPlugin.deriveAlternativeDefaultContext( dis.setInitialContext(DebuggerDisassemblerPlugin.deriveAlternativeDefaultContext(
@ -484,7 +484,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
TraceGuestPlatform guest = TraceGuestPlatform guest =
Unique.assertOne(tb.trace.getPlatformManager().getGuestPlatforms()); Unique.assertOne(tb.trace.getPlatformManager().getGuestPlatforms());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.addInstruction(0, start, guest); tb.addInstruction(0, start, guest);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -519,7 +519,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerGUITest
waitForPass(() -> Unique.assertOne(tb.trace.getPlatformManager().getGuestPlatforms())); waitForPass(() -> Unique.assertOne(tb.trace.getPlatformManager().getGuestPlatforms()));
TraceGuestPlatform guest = TraceGuestPlatform guest =
Unique.assertOne(tb.trace.getPlatformManager().getGuestPlatforms()); Unique.assertOne(tb.trace.getPlatformManager().getGuestPlatforms());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceDisassembleCommand dis = new TraceDisassembleCommand(guest, start, TraceDisassembleCommand dis = new TraceDisassembleCommand(guest, start,
new AddressSet(start, start.addWrap(1))); new AddressSet(start, start.addWrap(1)));
dis.setInitialContext(DebuggerDisassemblerPlugin.deriveAlternativeDefaultContext( dis.setInitialContext(DebuggerDisassemblerPlugin.deriveAlternativeDefaultContext(

View file

@ -37,6 +37,7 @@ import org.junit.rules.TestName;
import org.junit.rules.TestWatcher; import org.junit.rules.TestWatcher;
import org.junit.runner.Description; import org.junit.runner.Description;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.action.ActionContextProvider; import docking.action.ActionContextProvider;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
@ -75,7 +76,6 @@ import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.util.TraceAddressSpace; import ghidra.trace.util.TraceAddressSpace;
import ghidra.util.InvalidNameException; import ghidra.util.InvalidNameException;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.ListenerMap; import ghidra.util.datastruct.ListenerMap;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.task.ConsoleTaskMonitor; import ghidra.util.task.ConsoleTaskMonitor;
@ -702,7 +702,7 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
} }
protected void addSnapshot(String desc) throws IOException { protected void addSnapshot(String desc) throws IOException {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getTimeManager().createSnapshot(desc); tb.trace.getTimeManager().createSnapshot(desc);
} }
} }
@ -773,8 +773,7 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
Language lang = getToyBE64Language(); Language lang = getToyBE64Language();
program = new ProgramDB("static-" + name.getMethodName(), lang, program = new ProgramDB("static-" + name.getMethodName(), lang,
lang.getDefaultCompilerSpec(), this); lang.getDefaultCompilerSpec(), this);
try (UndoableTransaction tid = try (Transaction tx = program.openTransaction("Set Executable Path")) {
UndoableTransaction.start(program, "Set Executable Path")) {
program.setExecutablePath(path); program.setExecutablePath(path);
} }
programManager.openProgram(program); programManager.openProgram(program);

View file

@ -19,6 +19,7 @@ import java.io.IOException;
import org.junit.*; import org.junit.*;
import db.Transaction;
import ghidra.app.plugin.core.bookmark.BookmarkPlugin; import ghidra.app.plugin.core.bookmark.BookmarkPlugin;
import ghidra.app.plugin.core.byteviewer.ByteViewerPlugin; import ghidra.app.plugin.core.byteviewer.ByteViewerPlugin;
import ghidra.app.plugin.core.clear.ClearPlugin; import ghidra.app.plugin.core.clear.ClearPlugin;
@ -48,7 +49,6 @@ import ghidra.trace.database.ToyDBTraceBuilder;
import ghidra.trace.database.guest.DBTraceGuestPlatform; import ghidra.trace.database.guest.DBTraceGuestPlatform;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.memory.TraceOverlappedRegionException; import ghidra.trace.model.memory.TraceOverlappedRegionException;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
public class DebuggerManualTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerManualTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -59,7 +59,7 @@ public class DebuggerManualTest extends AbstractGhidraHeadedDebuggerGUITest {
public void setUpManualTest() throws IOException { public void setUpManualTest() throws IOException {
createTrace(); createTrace();
ub = new ToyDBTraceBuilder("dynamic2-" + name.getMethodName(), LANGID_TOYBE64); ub = new ToyDBTraceBuilder("dynamic2-" + name.getMethodName(), LANGID_TOYBE64);
try (UndoableTransaction tid = ub.startTransaction()) { try (Transaction tx = ub.startTransaction()) {
ub.trace.getTimeManager().createSnapshot("First snap"); ub.trace.getTimeManager().createSnapshot("First snap");
} }
} }
@ -120,7 +120,7 @@ public class DebuggerManualTest extends AbstractGhidraHeadedDebuggerGUITest {
//addPlugin(tool, NextPrevSelectedRangePlugin.class); //addPlugin(tool, NextPrevSelectedRangePlugin.class);
addPlugin(tool, SymbolTablePlugin.class); addPlugin(tool, SymbolTablePlugin.class);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion("Region", 0, tb.range(0x4000, 0x4fff), .createRegion("Region", 0, tb.range(0x4000, 0x4fff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);

View file

@ -33,6 +33,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.action.DockingAction; import docking.action.DockingAction;
import docking.widgets.fieldpanel.FieldPanel; import docking.widgets.fieldpanel.FieldPanel;
import generic.Unique; import generic.Unique;
@ -65,7 +66,6 @@ import ghidra.trace.model.*;
import ghidra.trace.model.breakpoint.TraceBreakpointKind; import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.trace.model.program.TraceProgramView; import ghidra.trace.model.program.TraceProgramView;
import ghidra.util.SystemUtilities; import ghidra.util.SystemUtilities;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -109,7 +109,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
programManager.openProgram(program); programManager.openProgram(program);
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Create function")) { try (Transaction tx = program.openTransaction("Create function")) {
entry = addr(program, 0x00400000); entry = addr(program, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 0x1000, (byte) 0, .createInitializedBlock(".text", entry, 0x1000, (byte) 0,
@ -133,8 +133,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
protected void addStaticMemoryAndBreakpoint() throws LockException, DuplicateNameException, protected void addStaticMemoryAndBreakpoint() throws LockException, DuplicateNameException,
MemoryConflictException, AddressOverflowException, CancelledException { MemoryConflictException, AddressOverflowException, CancelledException {
try (UndoableTransaction tid = try (Transaction tx = program.openTransaction("Add bookmark break")) {
UndoableTransaction.start(program, "Add bookmark break")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00400000), 0x1000, (byte) 0, .createInitializedBlock(".text", addr(program, 0x00400000), 0x1000, (byte) 0,
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
@ -145,7 +144,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
} }
protected void addMapping(Trace trace) throws Exception { protected void addMapping(Trace trace) throws Exception {
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add mapping")) { try (Transaction tx = trace.openTransaction("Add mapping")) {
DebuggerStaticMappingUtils.addMapping( DebuggerStaticMappingUtils.addMapping(
new DefaultTraceLocation(trace, null, Lifespan.nowOn(0), addr(trace, 0x55550123)), new DefaultTraceLocation(trace, null, Lifespan.nowOn(0), addr(trace, 0x55550123)),
new ProgramLocation(program, addr(program, 0x00400123)), 0x1000, false); new ProgramLocation(program, addr(program, 0x00400123)), 0x1000, false);
@ -449,7 +448,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
} }
waitForPass(() -> assertEquals(0, breakpointService.getAllBreakpoints().size())); waitForPass(() -> assertEquals(0, breakpointService.getAllBreakpoints().size()));
try (UndoableTransaction tid = UndoableTransaction.start(program, "Disassemble")) { try (Transaction tx = program.openTransaction("Disassemble")) {
Disassembler.getDisassembler(program, TaskMonitor.DUMMY, msg -> { Disassembler.getDisassembler(program, TaskMonitor.DUMMY, msg -> {
}).disassemble(addr(program, 0x00400123), set(rng(program, 0x00400123, 0x00400123))); }).disassemble(addr(program, 0x00400123), set(rng(program, 0x00400123, 0x00400123)));
} }
@ -478,7 +477,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
} }
waitForPass(() -> assertEquals(0, breakpointService.getAllBreakpoints().size())); waitForPass(() -> assertEquals(0, breakpointService.getAllBreakpoints().size()));
try (UndoableTransaction tid = UndoableTransaction.start(program, "Disassemble")) { try (Transaction tx = program.openTransaction("Disassemble")) {
program.getListing().createData(addr(program, 0x00400123), ByteDataType.dataType); program.getListing().createData(addr(program, 0x00400123), ByteDataType.dataType);
} }
waitForDomainObject(program); waitForDomainObject(program);

View file

@ -19,13 +19,13 @@ import java.io.IOException;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.dbg.target.schema.SchemaContext; import ghidra.dbg.target.schema.SchemaContext;
import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName; import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;
import ghidra.dbg.target.schema.XmlSchemaContext; import ghidra.dbg.target.schema.XmlSchemaContext;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.target.TraceObjectKeyPath; import ghidra.trace.model.target.TraceObjectKeyPath;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
public class DebuggerBreakpointsProviderObjectTest extends DebuggerBreakpointsProviderTest { public class DebuggerBreakpointsProviderObjectTest extends DebuggerBreakpointsProviderTest {
@ -105,7 +105,7 @@ public class DebuggerBreakpointsProviderObjectTest extends DebuggerBreakpointsPr
</context> </context>
""", index)); """, index));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session"))); tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session")));
tb.trace.getObjectManager() tb.trace.getObjectManager()
.createObject( .createObject(

View file

@ -27,6 +27,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.widgets.table.RowWrappedEnumeratedColumnTableModel; import docking.widgets.table.RowWrappedEnumeratedColumnTableModel;
import generic.Unique; import generic.Unique;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
@ -52,7 +53,6 @@ import ghidra.trace.model.*;
import ghidra.trace.model.breakpoint.TraceBreakpoint; import ghidra.trace.model.breakpoint.TraceBreakpoint;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.util.SystemUtilities; import ghidra.util.SystemUtilities;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -82,7 +82,7 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
} }
protected void addMapping(Trace trace, Program prog) throws Exception { protected void addMapping(Trace trace, Program prog) throws Exception {
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add mapping")) { try (Transaction tx = trace.openTransaction("Add mapping")) {
DebuggerStaticMappingUtils.addMapping( DebuggerStaticMappingUtils.addMapping(
new DefaultTraceLocation(trace, null, Lifespan.nowOn(0), addr(trace, 0x55550000)), new DefaultTraceLocation(trace, null, Lifespan.nowOn(0), addr(trace, 0x55550000)),
new ProgramLocation(prog, addr(prog, 0x00400000)), 0x1000, false); new ProgramLocation(prog, addr(prog, 0x00400000)), 0x1000, false);
@ -103,8 +103,7 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
protected void addStaticMemoryAndBreakpoint() throws LockException, DuplicateNameException, protected void addStaticMemoryAndBreakpoint() throws LockException, DuplicateNameException,
MemoryConflictException, AddressOverflowException, CancelledException { MemoryConflictException, AddressOverflowException, CancelledException {
try (UndoableTransaction tid = try (Transaction tx = program.openTransaction("Add bookmark break")) {
UndoableTransaction.start(program, "Add bookmark break")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00400000), 0x1000, (byte) 0, .createInitializedBlock(".text", addr(program, 0x00400000), 0x1000, (byte) 0,
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
@ -705,7 +704,7 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
// Do our own launch, so that object mode is enabled during load (region creation) // Do our own launch, so that object mode is enabled during load (region creation)
createTrace(program.getLanguageID().getIdAsString()); createTrace(program.getLanguageID().getIdAsString());
try (UndoableTransaction startTransaction = tb.startTransaction()) { try (Transaction startTransaction = tb.startTransaction()) {
TraceSnapshot initial = tb.trace.getTimeManager().getSnapshot(0, true); TraceSnapshot initial = tb.trace.getTimeManager().getSnapshot(0, true);
ProgramEmulationUtils.loadExecutable(initial, program); ProgramEmulationUtils.loadExecutable(initial, program);
Address pc = program.getMinAddress(); Address pc = program.getMinAddress();

View file

@ -26,6 +26,7 @@ import java.util.concurrent.CompletableFuture;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.action.DockingAction; import docking.action.DockingAction;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
@ -65,7 +66,6 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.Scheduler; import ghidra.trace.model.time.schedule.Scheduler;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.Swing; import ghidra.util.Swing;
import ghidra.util.database.UndoableTransaction;
/** /**
* Tests for target control and state editing * Tests for target control and state editing
@ -277,7 +277,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerGUITe
Address start = tb.addr(0x00400000); Address start = tb.addr(0x00400000);
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
Assembler asm = Assemblers.getAssembler(tb.language); Assembler asm = Assemblers.getAssembler(tb.language);
AssemblyBuffer buf = new AssemblyBuffer(asm, start); AssemblyBuffer buf = new AssemblyBuffer(asm, start);
buf.assemble("br 0x" + start); buf.assemble("br 0x" + start);
@ -376,7 +376,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerGUITe
protected void create2SnapTrace() throws Throwable { protected void create2SnapTrace() throws Throwable {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getTimeManager().getSnapshot(1, true); tb.trace.getTimeManager().getSnapshot(1, true);
} }
} }
@ -421,7 +421,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerGUITe
createAndOpenTrace(); createAndOpenTrace();
TraceVariableSnapProgramView view = tb.trace.getProgramView(); TraceVariableSnapProgramView view = tb.trace.getProgramView();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.getOrAddThread("Threads[0]", 0); tb.getOrAddThread("Threads[0]", 0);
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion("Memory[bin:.text]", 0, tb.range(0x00400000, 0x00401000), .createRegion("Memory[bin:.text]", 0, tb.range(0x00400000, 0x00401000),
@ -472,7 +472,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerGUITe
createAndOpenTrace(); createAndOpenTrace();
TraceVariableSnapProgramView view = tb.trace.getProgramView(); TraceVariableSnapProgramView view = tb.trace.getProgramView();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.getOrAddThread("Threads[0]", 0); tb.getOrAddThread("Threads[0]", 0);
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion("Memory[bin:.text]", 0, tb.range(0x00400000, 0x00401000), .createRegion("Memory[bin:.text]", 0, tb.range(0x00400000, 0x00401000),
@ -528,7 +528,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerGUITe
createAndOpenTrace(); createAndOpenTrace();
TraceVariableSnapProgramView view = tb.trace.getProgramView(); TraceVariableSnapProgramView view = tb.trace.getProgramView();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.getOrAddThread("Threads[0]", 0); tb.getOrAddThread("Threads[0]", 0);
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion("Memory[bin:.text]", 0, tb.range(0x00400000, 0x00401000), .createRegion("Memory[bin:.text]", 0, tb.range(0x00400000, 0x00401000),

View file

@ -15,7 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.gui.control; package ghidra.app.plugin.core.debug.gui.control;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import java.io.IOException; import java.io.IOException;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
@ -26,6 +26,7 @@ import org.jdom.JDOMException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
import generic.Unique; import generic.Unique;
import ghidra.app.context.ProgramLocationActionContext; import ghidra.app.context.ProgramLocationActionContext;
@ -45,7 +46,6 @@ import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
import ghidra.program.util.ProgramLocation; import ghidra.program.util.ProgramLocation;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.util.database.UndoableTransaction;
public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebuggerGUITest {
public static final XmlSchemaContext SCHEMA_CTX; public static final XmlSchemaContext SCHEMA_CTX;
@ -216,13 +216,13 @@ public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebugge
createProgramFromTrace(tb.trace); createProgramFromTrace(tb.trace);
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add memory")) { try (Transaction tx = program.openTransaction("Add memory")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00400000), 0x1000, .createInitializedBlock(".text", addr(program, 0x00400000), 0x1000,
(byte) 0, monitor, false); (byte) 0, monitor, false);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingService.addIdentityMapping(tb.trace, program, Lifespan.ALL, true); mappingService.addIdentityMapping(tb.trace, program, Lifespan.ALL, true);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -252,13 +252,13 @@ public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebugge
createProgramFromTrace(tb.trace); createProgramFromTrace(tb.trace);
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add memory")) { try (Transaction tx = program.openTransaction("Add memory")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00400000), 0x1000, .createInitializedBlock(".text", addr(program, 0x00400000), 0x1000,
(byte) 0, monitor, false); (byte) 0, monitor, false);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingService.addIdentityMapping(tb.trace, program, Lifespan.ALL, true); mappingService.addIdentityMapping(tb.trace, program, Lifespan.ALL, true);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);

View file

@ -24,6 +24,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
import generic.Unique; import generic.Unique;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
@ -46,7 +47,6 @@ import ghidra.test.ToyProgramBuilder;
import ghidra.trace.database.memory.DBTraceMemoryManager; import ghidra.trace.database.memory.DBTraceMemoryManager;
import ghidra.trace.model.*; import ghidra.trace.model.*;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -92,7 +92,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
assertDisabled(copyActionsPlugin.actionCopyIntoCurrentProgram); assertDisabled(copyActionsPlugin.actionCopyIntoCurrentProgram);
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff), .createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -133,7 +133,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add blocks")) { try (Transaction tx = program.openTransaction("Add blocks")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x8000, (byte) 0, .createInitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x8000, (byte) 0,
monitor, false); monitor, false);
@ -142,7 +142,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
(byte) 0, monitor, false); (byte) 0, monitor, false);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ,
TraceMemoryFlag.EXECUTE); TraceMemoryFlag.EXECUTE);
@ -214,7 +214,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
intoProject(program); intoProject(program);
intoProject(tb.trace); intoProject(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), .createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -227,7 +227,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace();
MemoryBlock block; MemoryBlock block;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Create block")) { try (Transaction tx = program.openTransaction("Create block")) {
block = program.getMemory() block = program.getMemory()
.createUninitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x10000, .createUninitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x10000,
false); false);
@ -236,7 +236,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
TraceLocation tloc = TraceLocation tloc =
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0x55550000)); new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0x55550000));
ProgramLocation ploc = new ProgramLocation(program, tb.addr(stSpace, 0x00400000)); ProgramLocation ploc = new ProgramLocation(program, tb.addr(stSpace, 0x00400000));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingService.addMapping(tloc, ploc, 0x10000, true); mappingService.addMapping(tloc, ploc, 0x10000, true);
} }
@ -276,7 +276,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
intoProject(program); intoProject(program);
intoProject(tb.trace); intoProject(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), .createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -289,7 +289,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace();
MemoryBlock block; MemoryBlock block;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Create block")) { try (Transaction tx = program.openTransaction("Create block")) {
block = program.getMemory() block = program.getMemory()
.createUninitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x10000, .createUninitializedBlock(".text", tb.addr(stSpace, 0x00400000), 0x10000,
false); false);
@ -298,7 +298,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
TraceLocation tloc = TraceLocation tloc =
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0x55550000)); new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0x55550000));
ProgramLocation ploc = new ProgramLocation(program, tb.addr(stSpace, 0x00400000)); ProgramLocation ploc = new ProgramLocation(program, tb.addr(stSpace, 0x00400000));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingService.addMapping(tloc, ploc, 0x10000, true); mappingService.addMapping(tloc, ploc, 0x10000, true);
} }
@ -338,7 +338,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), .createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -380,7 +380,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerG
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), .createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);

View file

@ -25,6 +25,7 @@ import javax.swing.JCheckBox;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import generic.theme.GThemeDefaults.Colors.Palette; import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.app.plugin.assembler.Assembler; import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers; import ghidra.app.plugin.assembler.Assemblers;
@ -49,7 +50,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.breakpoint.TraceBreakpointKind; import ghidra.trace.model.breakpoint.TraceBreakpointKind;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.memory.TraceMemoryState; import ghidra.trace.model.memory.TraceMemoryState;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
@ -74,7 +74,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
Random r = new Random(); Random r = new Random();
byte src[] = new byte[0x10000]; byte src[] = new byte[0x10000];
r.nextBytes(src); r.nextBytes(src);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -83,7 +83,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
Address paddr = tb.addr(stSpace, 0x00400000); Address paddr = tb.addr(stSpace, 0x00400000);
assertTrue(AllCopiers.BYTES.isRequiresInitializedMemory()); assertTrue(AllCopiers.BYTES.isRequiresInitializedMemory());
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
false); false);
@ -106,7 +106,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
DBTraceVariableSnapProgramView view = tb.trace.getProgramView(); DBTraceVariableSnapProgramView view = tb.trace.getProgramView();
assertTrue(AllCopiers.STATE.isAvailable(view, program)); assertTrue(AllCopiers.STATE.isAvailable(view, program));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -116,7 +116,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
Address paddr = tb.addr(stSpace, 0x00400000); Address paddr = tb.addr(stSpace, 0x00400000);
assertFalse(AllCopiers.STATE.isRequiresInitializedMemory()); assertFalse(AllCopiers.STATE.isRequiresInitializedMemory());
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
false); false);
@ -183,7 +183,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
AddressRange trng = tb.range(0x55550000, 0x5555ffff); AddressRange trng = tb.range(0x55550000, 0x5555ffff);
Assembler asm = Assemblers.getAssembler(view); Assembler asm = Assemblers.getAssembler(view);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); memory.createRegion(".text", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
InstructionIterator iit = asm.assemble(tb.addr(0x55550000), InstructionIterator iit = asm.assemble(tb.addr(0x55550000),
@ -193,7 +193,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
assertTrue(iit.hasNext()); assertTrue(iit.hasNext());
} }
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
Address paddr = tb.addr(stSpace, 0x00400000); Address paddr = tb.addr(stSpace, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
@ -231,7 +231,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
AddressRange trng = tb.range(0x55550000, 0x5555ffff); AddressRange trng = tb.range(0x55550000, 0x5555ffff);
Assembler asm = Assemblers.getAssembler(view); Assembler asm = Assemblers.getAssembler(view);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); memory.createRegion(".text", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
InstructionIterator iit = asm.assemble(tb.addr(0x55550000), InstructionIterator iit = asm.assemble(tb.addr(0x55550000),
@ -241,7 +241,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
assertTrue(iit.hasNext()); assertTrue(iit.hasNext());
} }
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
Address paddr = tb.addr(stSpace, 0x00400000); Address paddr = tb.addr(stSpace, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
@ -286,7 +286,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
.getValueWithDefault(tb.host, contextReg, 0, tb.addr(0x55550000)); .getValueWithDefault(tb.host, contextReg, 0, tb.addr(0x55550000));
rv = rv.assign(longMode, BigInteger.ZERO); rv = rv.assign(longMode, BigInteger.ZERO);
Instruction checkCtx; Instruction checkCtx;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); memory.createRegion(".text", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
tb.trace.getRegisterContextManager().setValue(tb.language, rv, Lifespan.nowOn(0), trng); tb.trace.getRegisterContextManager().setValue(tb.language, rv, Lifespan.nowOn(0), trng);
@ -314,7 +314,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
assertFalse(insCtx.equals(tb.trace.getRegisterContextManager() assertFalse(insCtx.equals(tb.trace.getRegisterContextManager()
.getDefaultValue(tb.language, contextReg, checkCtx.getAddress()))); .getDefaultValue(tb.language, contextReg, checkCtx.getAddress())));
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
Address paddr = tb.addr(stSpace, 0x00400000); Address paddr = tb.addr(stSpace, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
@ -358,7 +358,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
assertTrue(AllCopiers.DATA.isAvailable(view, program)); assertTrue(AllCopiers.DATA.isAvailable(view, program));
AddressRange trng = tb.range(0x55560000, 0x5556ffff); AddressRange trng = tb.range(0x55560000, 0x5556ffff);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".data", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.WRITE); memory.createRegion(".data", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.WRITE);
tb.addData(0, tb.addr(0x55560000), ByteDataType.dataType, tb.buf(0x12)); tb.addData(0, tb.addr(0x55560000), ByteDataType.dataType, tb.buf(0x12));
@ -371,7 +371,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
tb.buf(0x00, 0x03, 0x00, 0x01, 0x02)); tb.buf(0x00, 0x03, 0x00, 0x01, 0x02));
} }
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
Address paddr = tb.addr(stSpace, 0x00600000); Address paddr = tb.addr(stSpace, 0x00600000);
program.getMemory() program.getMemory()
.createInitializedBlock(".data", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".data", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
@ -418,7 +418,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
assertTrue(AllCopiers.DYNAMIC_DATA.isAvailable(view, program)); assertTrue(AllCopiers.DYNAMIC_DATA.isAvailable(view, program));
AddressRange trng = tb.range(0x55560000, 0x5556ffff); AddressRange trng = tb.range(0x55560000, 0x5556ffff);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".data", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.WRITE); memory.createRegion(".data", 0, trng, TraceMemoryFlag.READ, TraceMemoryFlag.WRITE);
tb.addData(0, tb.addr(0x55560000), ByteDataType.dataType, tb.buf(0x12)); tb.addData(0, tb.addr(0x55560000), ByteDataType.dataType, tb.buf(0x12));
@ -431,7 +431,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
tb.buf(0x00, 0x03, 0x00, 0x01, 0x02)); tb.buf(0x00, 0x03, 0x00, 0x01, 0x02));
} }
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
Address paddr = tb.addr(stSpace, 0x00600000); Address paddr = tb.addr(stSpace, 0x00600000);
program.getMemory() program.getMemory()
.createInitializedBlock(".data", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".data", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
@ -485,7 +485,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
DBTraceVariableSnapProgramView view = tb.trace.getProgramView(); DBTraceVariableSnapProgramView view = tb.trace.getProgramView();
assertTrue(AllCopiers.LABELS.isAvailable(view, program)); assertTrue(AllCopiers.LABELS.isAvailable(view, program));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -504,7 +504,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
} }
Address paddr = tb.addr(stSpace, 0x00400000); Address paddr = tb.addr(stSpace, 0x00400000);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Copy")) { try (Transaction tx = program.openTransaction("Copy")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY, .createInitializedBlock(".text", paddr, 0x10000, (byte) 0, TaskMonitor.DUMMY,
false); false);
@ -556,7 +556,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
DBTraceVariableSnapProgramView view = tb.trace.getProgramView(); DBTraceVariableSnapProgramView view = tb.trace.getProgramView();
assertTrue(AllCopiers.BREAKPOINTS.isAvailable(view, program)); assertTrue(AllCopiers.BREAKPOINTS.isAvailable(view, program));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -569,7 +569,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
} }
Address paddr = tb.addr(stSpace, 0x55550000); Address paddr = tb.addr(stSpace, 0x55550000);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Init")) { try (Transaction tx = program.openTransaction("Init")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, .createInitializedBlock(".text", paddr, 0x10000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
@ -609,7 +609,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
DBTraceVariableSnapProgramView view = tb.trace.getProgramView(); DBTraceVariableSnapProgramView view = tb.trace.getProgramView();
assertTrue(AllCopiers.BOOKMARKS.isAvailable(view, program)); assertTrue(AllCopiers.BOOKMARKS.isAvailable(view, program));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -620,7 +620,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
} }
Address paddr = tb.addr(stSpace, 0x55550000); Address paddr = tb.addr(stSpace, 0x55550000);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Init")) { try (Transaction tx = program.openTransaction("Init")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, .createInitializedBlock(".text", paddr, 0x10000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
@ -657,7 +657,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
DBTraceVariableSnapProgramView view = tb.trace.getProgramView(); DBTraceVariableSnapProgramView view = tb.trace.getProgramView();
assertTrue(AllCopiers.REFERENCES.isAvailable(view, program)); assertTrue(AllCopiers.REFERENCES.isAvailable(view, program));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -676,7 +676,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
} }
Address paddr = tb.addr(stSpace, 0x55550000); Address paddr = tb.addr(stSpace, 0x55550000);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Init")) { try (Transaction tx = program.openTransaction("Init")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, .createInitializedBlock(".text", paddr, 0x10000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
@ -708,7 +708,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
DBTraceVariableSnapProgramView view = tb.trace.getProgramView(); DBTraceVariableSnapProgramView view = tb.trace.getProgramView();
assertTrue(AllCopiers.COMMENTS.isAvailable(view, program)); assertTrue(AllCopiers.COMMENTS.isAvailable(view, program));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff), memory.createRegion(".text", 0, tb.range(0x55550000, 0x5555ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -719,7 +719,7 @@ public class DebuggerCopyPlanTests extends AbstractGhidraHeadedDebuggerGUITest {
} }
Address paddr = tb.addr(stSpace, 0x55550000); Address paddr = tb.addr(stSpace, 0x55550000);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Init")) { try (Transaction tx = program.openTransaction("Init")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", paddr, 0x10000, .createInitializedBlock(".text", paddr, 0x10000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);

View file

@ -22,6 +22,7 @@ import java.nio.ByteBuffer;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider;
@ -32,7 +33,6 @@ import ghidra.trace.database.memory.DBTraceMemoryManager;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.Swing; import ghidra.util.Swing;
import ghidra.util.database.UndoableTransaction;
public class DebuggerTraceViewDiffPluginTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerTraceViewDiffPluginTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -128,7 +128,7 @@ public class DebuggerTraceViewDiffPluginTest extends AbstractGhidraHeadedDebugge
@Test @Test
public void testColorsDiffBytes() throws Throwable { public void testColorsDiffBytes() throws Throwable {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff), mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -163,7 +163,7 @@ public class DebuggerTraceViewDiffPluginTest extends AbstractGhidraHeadedDebugge
@Test @Test
public void testActionPrevDiff() throws Throwable { public void testActionPrevDiff() throws Throwable {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff), mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -200,7 +200,7 @@ public class DebuggerTraceViewDiffPluginTest extends AbstractGhidraHeadedDebugge
@Test @Test
public void testActionNextDiff() throws Throwable { public void testActionNextDiff() throws Throwable {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff), mm.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);

View file

@ -29,6 +29,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.menu.ActionState; import docking.menu.ActionState;
import docking.menu.MultiStateDockingAction; import docking.menu.MultiStateDockingAction;
import docking.widgets.EventTrigger; import docking.widgets.EventTrigger;
@ -70,7 +71,6 @@ import ghidra.trace.model.modules.TraceModule;
import ghidra.trace.model.stack.TraceStack; import ghidra.trace.model.stack.TraceStack;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.CancelledException; import ghidra.util.exception.CancelledException;
import ghidra.util.exception.VersionException; import ghidra.util.exception.VersionException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -120,12 +120,12 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
intoProject(program); intoProject(program);
AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0, .createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0,
monitor, false); monitor, false);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -144,7 +144,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
public void testListingViewIsRegionsActivateThenAdd() throws Exception { public void testListingViewIsRegionsActivateThenAdd() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -158,7 +158,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
@Test @Test
public void testListingViewIsRegionsAddThenActivate() throws Exception { public void testListingViewIsRegionsAddThenActivate() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -174,7 +174,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
@Test @Test
public void testRegisterTrackingOnRegisterChange() throws Exception { public void testRegisterTrackingOnRegisterChange() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -200,7 +200,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
@Test @Test
public void testRegisterTrackingOnSnapChange() throws Exception { public void testRegisterTrackingOnSnapChange() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -233,7 +233,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread1; TraceThread thread1;
TraceThread thread2; TraceThread thread2;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -279,7 +279,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
.submit(() -> listingPlugin.createListingIfMissing(PCLocationTrackingSpec.INSTANCE, .submit(() -> listingPlugin.createListingIfMissing(PCLocationTrackingSpec.INSTANCE,
true)) true))
.get(); .get();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -315,7 +315,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
@Test @Test
public void testRegisterTrackingOnTrackingSpecChange() throws Exception { public void testRegisterTrackingOnTrackingSpecChange() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -354,7 +354,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) { new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) {
TraceThread t1, t2; TraceThread t1, t2;
try (UndoableTransaction tid = b1.startTransaction()) { try (Transaction tx = b1.startTransaction()) {
b1.trace.getTimeManager().createSnapshot("First snap"); b1.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b1.trace.getMemoryManager(); DBTraceMemoryManager memory = b1.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff),
@ -366,7 +366,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234))); regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234)));
} }
waitForDomainObject(b1.trace); waitForDomainObject(b1.trace);
try (UndoableTransaction tid = b2.startTransaction()) { try (Transaction tx = b2.startTransaction()) {
b2.trace.getTimeManager().createSnapshot("First snap"); b2.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b2.trace.getMemoryManager(); DBTraceMemoryManager memory = b2.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff),
@ -410,7 +410,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) { new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) {
TraceThread t1, t2; TraceThread t1, t2;
try (UndoableTransaction tid = b1.startTransaction()) { try (Transaction tx = b1.startTransaction()) {
b1.trace.getTimeManager().createSnapshot("First snap"); b1.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b1.trace.getMemoryManager(); DBTraceMemoryManager memory = b1.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff),
@ -422,7 +422,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234))); regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234)));
} }
waitForDomainObject(b1.trace); waitForDomainObject(b1.trace);
try (UndoableTransaction tid = b2.startTransaction()) { try (Transaction tx = b2.startTransaction()) {
b2.trace.getTimeManager().createSnapshot("First snap"); b2.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b2.trace.getMemoryManager(); DBTraceMemoryManager memory = b2.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff),
@ -494,13 +494,13 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
intoProject(program); intoProject(program);
AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0, .createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0,
monitor, false); monitor, false);
} }
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -579,7 +579,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForSwing(); waitForSwing();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -607,13 +607,13 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
intoProject(program); intoProject(program);
AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0, .createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0,
monitor, false); monitor, false);
} }
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -769,7 +769,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -829,7 +829,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertFalse(listingProvider.actionGoTo.isEnabled()); assertFalse(listingProvider.actionGoTo.isEnabled());
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -870,7 +870,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertTrue(listingProvider.actionTrackLocation.isEnabled()); assertTrue(listingProvider.actionTrackLocation.isEnabled());
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1017,7 +1017,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread1; TraceThread thread1;
TraceThread thread2; TraceThread thread2;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1069,7 +1069,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
// To verify enabled requires live target // To verify enabled requires live target
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x55550000, 0x555500ff), .addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x55550000, 0x555500ff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1185,7 +1185,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
DebuggerConsolePlugin consolePlugin = addPlugin(tool, DebuggerConsolePlugin.class); DebuggerConsolePlugin consolePlugin = addPlugin(tool, DebuggerConsolePlugin.class);
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("bash:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0041ffff), .addRegion("bash:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0041ffff),
Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE)); Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE));
@ -1216,7 +1216,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
DebuggerConsolePlugin consolePlugin = addPlugin(tool, DebuggerConsolePlugin.class); DebuggerConsolePlugin consolePlugin = addPlugin(tool, DebuggerConsolePlugin.class);
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("bash:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0041ffff), .addRegion("bash:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0041ffff),
Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE)); Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE));
@ -1247,7 +1247,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForSwing(); waitForSwing();
assertEquals("(nowhere)", listingProvider.locationLabel.getText()); assertEquals("(nowhere)", listingProvider.locationLabel.getText());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("test_region", Lifespan.nowOn(0), tb.range(0x55550000, 0x555502ff), .addRegion("test_region", Lifespan.nowOn(0), tb.range(0x55550000, 0x555502ff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1256,7 +1256,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForPass(() -> assertEquals("test_region", listingProvider.locationLabel.getText())); waitForPass(() -> assertEquals("test_region", listingProvider.locationLabel.getText()));
TraceModule modExe; TraceModule modExe;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe = tb.trace.getModuleManager() modExe = tb.trace.getModuleManager()
.addModule("modExe", "modExe", tb.range(0x55550000, 0x555501ff), .addModule("modExe", "modExe", tb.range(0x55550000, 0x555501ff),
Lifespan.nowOn(0)); Lifespan.nowOn(0));
@ -1264,7 +1264,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
waitForPass(() -> assertEquals("modExe", listingProvider.locationLabel.getText())); waitForPass(() -> assertEquals("modExe", listingProvider.locationLabel.getText()));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe.addSection(".text", tb.range(0x55550000, 0x555500ff)); modExe.addSection(".text", tb.range(0x55550000, 0x555500ff));
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -1282,7 +1282,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
new ToyDBTraceBuilder("dynamic2-" + name.getMethodName(), "dsPIC33F:LE:24:default")) { new ToyDBTraceBuilder("dynamic2-" + name.getMethodName(), "dsPIC33F:LE:24:default")) {
TraceThread thread1; TraceThread thread1;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getTimeManager().createSnapshot("First"); tb.trace.getTimeManager().createSnapshot("First");
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff), .createRegion(".text", 0, tb.range(0x00400000, 0x0040ffff),
@ -1292,7 +1292,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
TraceThread thread2; TraceThread thread2;
try (UndoableTransaction tid = tb2.startTransaction()) { try (Transaction tx = tb2.startTransaction()) {
tb2.trace.getTimeManager().createSnapshot("First"); tb2.trace.getTimeManager().createSnapshot("First");
tb2.trace.getMemoryManager() tb2.trace.getMemoryManager()
.createRegion(".text", 0, tb2.range(0x200, 0x3ff), TraceMemoryFlag.READ, .createRegion(".text", 0, tb2.range(0x200, 0x3ff), TraceMemoryFlag.READ,
@ -1323,7 +1323,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread1; TraceThread thread1;
TraceThread thread2; TraceThread thread2;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1354,7 +1354,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1382,7 +1382,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1413,7 +1413,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
thread = tb.getOrAddThread("Thread 1", 0); thread = tb.getOrAddThread("Thread 1", 0);
@ -1426,7 +1426,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertEquals(tb.addr(0x00401234), listingProvider.getLocation().getAddress()); assertEquals(tb.addr(0x00401234), listingProvider.getLocation().getAddress());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true); TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true);
regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16))); regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16)));
} }
@ -1444,7 +1444,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
thread = tb.getOrAddThread("Thread 1", 0); thread = tb.getOrAddThread("Thread 1", 0);
@ -1461,7 +1461,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertEquals(tb.addr(0x00401234), listingProvider.getLocation().getAddress()); assertEquals(tb.addr(0x00401234), listingProvider.getLocation().getAddress());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true); TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true);
regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16))); regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16)));
} }
@ -1478,7 +1478,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
DBTraceStackManager sm = tb.trace.getStackManager(); DBTraceStackManager sm = tb.trace.getStackManager();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1492,7 +1492,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertEquals(tb.addr(0x00401234), listingProvider.getLocation().getAddress()); assertEquals(tb.addr(0x00401234), listingProvider.getLocation().getAddress());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceStack stack = sm.getStack(thread, 0, true); TraceStack stack = sm.getStack(thread, 0, true);
stack.getFrame(0, true).setProgramCounter(Lifespan.ALL, tb.addr(0x00404321)); stack.getFrame(0, true).setProgramCounter(Lifespan.ALL, tb.addr(0x00404321));
} }
@ -1511,12 +1511,12 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
intoProject(program); intoProject(program);
AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace ss = program.getAddressFactory().getDefaultAddressSpace();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0, .createInitializedBlock(".text", ss.getAddress(0x00600000), 0x10000, (byte) 0,
monitor, false); monitor, false);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1625,7 +1625,7 @@ public class DebuggerListingProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
protected Instruction placeGuestInstruction(int guestRangeLength) throws Throwable { protected Instruction placeGuestInstruction(int guestRangeLength) throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("Memory[.text]", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), .addRegion("Memory[.text]", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE)); Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE));

View file

@ -30,6 +30,7 @@ import java.util.Objects;
import org.junit.*; import org.junit.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.ActionContext; import docking.ActionContext;
import docking.action.DockingActionIf; import docking.action.DockingActionIf;
import docking.dnd.GClipboard; import docking.dnd.GClipboard;
@ -66,7 +67,6 @@ import ghidra.trace.model.modules.TraceModule;
import ghidra.trace.model.stack.TraceStack; import ghidra.trace.model.stack.TraceStack;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -110,7 +110,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
public void testBytesViewIsRegionsActivateThenAdd() throws Exception { public void testBytesViewIsRegionsActivateThenAdd() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -126,7 +126,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
@Test @Test
public void testBytesViewIsRegionsAddThenActivate() throws Exception { public void testBytesViewIsRegionsAddThenActivate() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -142,7 +142,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
@Test @Test
public void testRegisterTrackingOnRegisterChange() throws Exception { public void testRegisterTrackingOnRegisterChange() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -168,7 +168,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
@Test @Test
public void testRegisterTrackingOnSnapChange() throws Exception { public void testRegisterTrackingOnSnapChange() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -202,7 +202,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread1; TraceThread thread1;
TraceThread thread2; TraceThread thread2;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -248,7 +248,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
.submit(() -> memBytesPlugin.createViewerIfMissing(PCLocationTrackingSpec.INSTANCE, .submit(() -> memBytesPlugin.createViewerIfMissing(PCLocationTrackingSpec.INSTANCE,
true)) true))
.get(); .get();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -284,7 +284,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
@Test @Test
public void testRegisterTrackingOnTrackingSpecChange() throws Exception { public void testRegisterTrackingOnTrackingSpecChange() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -322,7 +322,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) { new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) {
TraceThread t1, t2; TraceThread t1, t2;
try (UndoableTransaction tid = b1.startTransaction()) { try (Transaction tx = b1.startTransaction()) {
b1.trace.getTimeManager().createSnapshot("First snap"); b1.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b1.trace.getMemoryManager(); DBTraceMemoryManager memory = b1.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff),
@ -334,7 +334,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234))); regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234)));
} }
waitForDomainObject(b1.trace); waitForDomainObject(b1.trace);
try (UndoableTransaction tid = b2.startTransaction()) { try (Transaction tx = b2.startTransaction()) {
b2.trace.getTimeManager().createSnapshot("First snap"); b2.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b2.trace.getMemoryManager(); DBTraceMemoryManager memory = b2.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff),
@ -373,7 +373,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) { new ToyDBTraceBuilder(name.getMethodName() + "_2", LANGID_TOYBE64)) {
TraceThread t1, t2; TraceThread t1, t2;
try (UndoableTransaction tid = b1.startTransaction()) { try (Transaction tx = b1.startTransaction()) {
b1.trace.getTimeManager().createSnapshot("First snap"); b1.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b1.trace.getMemoryManager(); DBTraceMemoryManager memory = b1.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b1.range(0x00400000, 0x0040ffff),
@ -385,7 +385,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234))); regs.setValue(0, new RegisterValue(pc, BigInteger.valueOf(0x00401234)));
} }
waitForDomainObject(b1.trace); waitForDomainObject(b1.trace);
try (UndoableTransaction tid = b2.startTransaction()) { try (Transaction tx = b2.startTransaction()) {
b2.trace.getTimeManager().createSnapshot("First snap"); b2.trace.getTimeManager().createSnapshot("First snap");
DBTraceMemoryManager memory = b2.trace.getMemoryManager(); DBTraceMemoryManager memory = b2.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), b2.range(0x00400000, 0x0040ffff),
@ -445,7 +445,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
waitForSwing(); waitForSwing();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -548,7 +548,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
createAndOpenTrace(); createAndOpenTrace();
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -611,7 +611,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
assertFalse(memBytesProvider.actionGoTo.isEnabled()); assertFalse(memBytesProvider.actionGoTo.isEnabled());
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -655,7 +655,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
assertTrue(memBytesProvider.actionTrackLocation.isEnabled()); assertTrue(memBytesProvider.actionTrackLocation.isEnabled());
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -708,7 +708,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread1; TraceThread thread1;
TraceThread thread2; TraceThread thread2;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager memory = tb.trace.getMemoryManager(); DBTraceMemoryManager memory = tb.trace.getMemoryManager();
memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), memory.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -761,7 +761,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
// To verify enabled requires live target // To verify enabled requires live target
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x55550000, 0x555500ff), .addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x55550000, 0x555500ff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -881,7 +881,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
waitForSwing(); waitForSwing();
assertEquals("(nowhere)", memBytesProvider.locationLabel.getText()); assertEquals("(nowhere)", memBytesProvider.locationLabel.getText());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("test_region", Lifespan.nowOn(0), tb.range(0x55550000, 0x555502ff), .addRegion("test_region", Lifespan.nowOn(0), tb.range(0x55550000, 0x555502ff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -892,7 +892,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
waitForPass(() -> assertEquals("test_region", memBytesProvider.locationLabel.getText())); waitForPass(() -> assertEquals("test_region", memBytesProvider.locationLabel.getText()));
TraceModule modExe; TraceModule modExe;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe = tb.trace.getModuleManager() modExe = tb.trace.getModuleManager()
.addModule("modExe", "modExe", tb.range(0x55550000, 0x555501ff), .addModule("modExe", "modExe", tb.range(0x55550000, 0x555501ff),
Lifespan.nowOn(0)); Lifespan.nowOn(0));
@ -900,7 +900,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
waitForPass(() -> assertEquals("modExe", memBytesProvider.locationLabel.getText())); waitForPass(() -> assertEquals("modExe", memBytesProvider.locationLabel.getText()));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe.addSection(".text", tb.range(0x55550000, 0x555500ff)); modExe.addSection(".text", tb.range(0x55550000, 0x555500ff));
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -916,7 +916,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread1; TraceThread thread1;
TraceThread thread2; TraceThread thread2;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -947,7 +947,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
createAndOpenTrace(); createAndOpenTrace();
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -975,7 +975,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1006,7 +1006,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
thread = tb.getOrAddThread("Thread 1", 0); thread = tb.getOrAddThread("Thread 1", 0);
@ -1019,7 +1019,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
assertEquals(tb.addr(0x00401234), memBytesProvider.getLocation().getAddress()); assertEquals(tb.addr(0x00401234), memBytesProvider.getLocation().getAddress());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true); TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true);
regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16))); regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16)));
} }
@ -1037,7 +1037,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
Register pc = tb.language.getProgramCounter(); Register pc = tb.language.getProgramCounter();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
thread = tb.getOrAddThread("Thread 1", 0); thread = tb.getOrAddThread("Thread 1", 0);
@ -1054,7 +1054,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
assertEquals(tb.addr(0x00401234), memBytesProvider.getLocation().getAddress()); assertEquals(tb.addr(0x00401234), memBytesProvider.getLocation().getAddress());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true); TraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, true);
regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16))); regs.setValue(0, new RegisterValue(pc, new BigInteger("00404321", 16)));
} }
@ -1071,7 +1071,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
createAndOpenTrace(); createAndOpenTrace();
DBTraceStackManager sm = tb.trace.getStackManager(); DBTraceStackManager sm = tb.trace.getStackManager();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("exe:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -1085,7 +1085,7 @@ public class DebuggerMemoryBytesProviderTest extends AbstractGhidraHeadedDebugge
assertEquals(tb.addr(0x00401234), memBytesProvider.getLocation().getAddress()); assertEquals(tb.addr(0x00401234), memBytesProvider.getLocation().getAddress());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceStack stack = sm.getStack(thread, 0, true); TraceStack stack = sm.getStack(thread, 0, true);
stack.getFrame(0, true).setProgramCounter(Lifespan.ALL, tb.addr(0x00404321)); stack.getFrame(0, true).setProgramCounter(Lifespan.ALL, tb.addr(0x00404321));
} }

View file

@ -23,6 +23,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.Unique; import generic.Unique;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
@ -40,7 +41,6 @@ import ghidra.program.util.ProgramSelection;
import ghidra.trace.model.Lifespan; import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.*; import ghidra.trace.model.memory.*;
import ghidra.trace.model.modules.TraceStaticMapping; import ghidra.trace.model.modules.TraceStaticMapping;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -63,7 +63,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
protected void addRegions() throws Exception { protected void addRegions() throws Exception {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
regionExeText = mm.createRegion("Memory[/bin/echo 0x55550000]", 0, regionExeText = mm.createRegion("Memory[/bin/echo 0x55550000]", 0,
tb.range(0x55550000, 0x555500ff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); tb.range(0x55550000, 0x555500ff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
regionExeData = mm.createRegion("Memory[/bin/echo 0x55750000]", 0, regionExeData = mm.createRegion("Memory[/bin/echo 0x55750000]", 0,
@ -76,7 +76,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
} }
protected void addBlocks() throws Exception { protected void addBlocks() throws Exception {
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
Memory mem = program.getMemory(); Memory mem = program.getMemory();
blockExeText = mem.createInitializedBlock(".text", tb.addr(0x00400000), 0x100, (byte) 0, blockExeText = mem.createInitializedBlock(".text", tb.addr(0x00400000), 0x100, (byte) 0,
monitor, false); monitor, false);
@ -104,7 +104,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
createTrace(); createTrace();
TraceMemoryRegion region; TraceMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0),
tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -132,7 +132,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
TraceMemoryRegion region; TraceMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0),
tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -149,7 +149,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
createTrace(); createTrace();
TraceMemoryRegion region; TraceMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0),
tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -162,7 +162,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
RegionRow row = Unique.assertOne(provider.legacyPanel.regionTableModel.getModelData()); RegionRow row = Unique.assertOne(provider.legacyPanel.regionTableModel.getModelData());
assertEquals(region, row.getRegion()); assertEquals(region, row.getRegion());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region.delete(); region.delete();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -174,7 +174,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
public void testUndoRedo() throws Exception { public void testUndoRedo() throws Exception {
createTrace(); createTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -197,14 +197,14 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
createAndOpenTrace(); createAndOpenTrace();
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
Unique.assertOne(provider.legacyPanel.regionTableModel.getModelData()); Unique.assertOne(provider.legacyPanel.regionTableModel.getModelData());
tid.abort(); tx.abort();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
assertEquals(0, provider.legacyPanel.regionTableModel.getModelData().size()); assertEquals(0, provider.legacyPanel.regionTableModel.getModelData().size());
@ -218,7 +218,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
createTrace(); createTrace();
TraceMemoryRegion region; TraceMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0),
tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -256,7 +256,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
assertFalse(provider.actionMapRegions.isEnabled()); assertFalse(provider.actionMapRegions.isEnabled());
addBlocks(); addBlocks();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setName("echo"); program.setName("echo");
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -331,7 +331,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
createTrace(); createTrace();
TraceMemoryRegion region; TraceMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0),
tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
@ -362,7 +362,7 @@ public class DebuggerRegionsProviderLegacyTest extends AbstractGhidraHeadedDebug
createTrace(); createTrace();
TraceMemoryRegion region; TraceMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryManager mm = tb.trace.getMemoryManager(); TraceMemoryManager mm = tb.trace.getMemoryManager();
region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0), region = mm.addRegion("Memory[bin:.text]", Lifespan.nowOn(0),
tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);

View file

@ -23,6 +23,7 @@ import java.util.*;
import org.junit.*; import org.junit.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.widgets.table.DynamicTableColumn; import docking.widgets.table.DynamicTableColumn;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
@ -50,7 +51,6 @@ import ghidra.trace.model.memory.TraceObjectMemoryRegion;
import ghidra.trace.model.modules.TraceStaticMapping; import ghidra.trace.model.modules.TraceStaticMapping;
import ghidra.trace.model.target.*; import ghidra.trace.model.target.*;
import ghidra.trace.model.target.TraceObject.ConflictResolution; import ghidra.trace.model.target.TraceObject.ConflictResolution;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.table.GhidraTable; import ghidra.util.table.GhidraTable;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
@ -100,7 +100,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
</context> </context>
"""); """);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session"))); tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session")));
} }
} }
@ -124,7 +124,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
protected void addRegions() throws Exception { protected void addRegions() throws Exception {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
regionExeText = addRegion("/bin/echo .text", 0, tb.range(0x55550000, 0x555500ff)); regionExeText = addRegion("/bin/echo .text", 0, tb.range(0x55550000, 0x555500ff));
regionExeData = addRegion("/bin/echo .data", 0, tb.range(0x55750000, 0x5575007f)); regionExeData = addRegion("/bin/echo .data", 0, tb.range(0x55750000, 0x5575007f));
regionLibText = addRegion("/lib/libc.so .text", 0, tb.range(0x7f000000, 0x7f0003ff)); regionLibText = addRegion("/lib/libc.so .text", 0, tb.range(0x7f000000, 0x7f0003ff));
@ -133,7 +133,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
protected void addBlocks() throws Exception { protected void addBlocks() throws Exception {
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
Memory mem = program.getMemory(); Memory mem = program.getMemory();
blockExeText = mem.createInitializedBlock(".text", tb.addr(0x00400000), 0x100, (byte) 0, blockExeText = mem.createInitializedBlock(".text", tb.addr(0x00400000), 0x100, (byte) 0,
monitor, false); monitor, false);
@ -206,7 +206,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
} }
@ -228,7 +228,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForPass(() -> assertTableSize(0)); waitForPass(() -> assertTableSize(0));
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
} }
waitForTasks(); waitForTasks();
@ -245,7 +245,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
} }
@ -258,7 +258,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
0x10000, "rx"); 0x10000, "rx");
}); });
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region.getObject().removeTree(Lifespan.nowOn(0)); region.getObject().removeTree(Lifespan.nowOn(0));
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -272,7 +272,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
} }
@ -308,7 +308,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
waitForTasks(); waitForTasks();
@ -318,7 +318,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertRow(0, region.getObject(), "bin:.text", tb.addr(0x00400000), assertRow(0, region.getObject(), "bin:.text", tb.addr(0x00400000),
tb.addr(0x0040ffff), 0x10000, "rx"); tb.addr(0x0040ffff), 0x10000, "rx");
}); });
tid.abort(); tx.abort();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
waitForTasks(); waitForTasks();
@ -334,7 +334,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
} }
@ -376,7 +376,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertFalse(provider.actionMapRegions.isEnabled()); assertFalse(provider.actionMapRegions.isEnabled());
addBlocks(); addBlocks();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setName("echo"); program.setName("echo");
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -449,7 +449,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
} }
@ -479,7 +479,7 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerGUI
createAndOpenTrace(); createAndOpenTrace();
TraceObjectMemoryRegion region; TraceObjectMemoryRegion region;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff)); region = addRegion("bin:.text", 0, tb.range(0x00400000, 0x0040ffff));
} }

View file

@ -24,6 +24,7 @@ import java.util.Set;
import org.jdom.JDOMException; import org.jdom.JDOMException;
import org.junit.*; import org.junit.*;
import db.Transaction;
import docking.widgets.table.DynamicTableColumn; import docking.widgets.table.DynamicTableColumn;
import docking.widgets.table.GDynamicColumnTableModel; import docking.widgets.table.GDynamicColumnTableModel;
import docking.widgets.tree.GTree; import docking.widgets.tree.GTree;
@ -47,7 +48,6 @@ import ghidra.trace.model.target.*;
import ghidra.trace.model.target.TraceObject.ConflictResolution; import ghidra.trace.model.target.TraceObject.ConflictResolution;
import ghidra.trace.model.thread.TraceObjectThread; import ghidra.trace.model.thread.TraceObjectThread;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -130,14 +130,14 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
} }
protected void populateSnapshots() throws Throwable { protected void populateSnapshots() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getTimeManager().getSnapshot(20, true); tb.trace.getTimeManager().getSnapshot(20, true);
} }
} }
protected TraceObjectValue createSessionObject() throws Throwable { protected TraceObjectValue createSessionObject() throws Throwable {
TraceObjectManager objects = tb.trace.getObjectManager(); TraceObjectManager objects = tb.trace.getObjectManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
return objects.createRootObject(CTX.getSchema(new SchemaName("Session"))); return objects.createRootObject(CTX.getSchema(new SchemaName("Session")));
} }
} }
@ -162,7 +162,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
} }
protected TraceObject createStack(TraceObject thread) { protected TraceObject createStack(TraceObject thread) {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObjectKeyPath stackPath = thread.getCanonicalPath().key("Stack"); TraceObjectKeyPath stackPath = thread.getCanonicalPath().key("Stack");
TraceObjectManager objects = tb.trace.getObjectManager(); TraceObjectManager objects = tb.trace.getObjectManager();
TraceObject stack = objects.createObject(stackPath); TraceObject stack = objects.createObject(stackPath);
@ -175,7 +175,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
} }
protected void populateThreads() throws Throwable { protected void populateThreads() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject prevThread = null; TraceObject prevThread = null;
for (long i = 0; i < 10; i++) { for (long i = 0; i < 10; i++) {
TraceObject thread = createThread(i, prevThread); TraceObject thread = createThread(i, prevThread);
@ -186,7 +186,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
protected void addThread10() throws Throwable { protected void addThread10() throws Throwable {
TraceObjectManager objects = tb.trace.getObjectManager(); TraceObjectManager objects = tb.trace.getObjectManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
createThread(10, objects.getObjectByCanonicalPath( createThread(10, objects.getObjectByCanonicalPath(
TraceObjectKeyPath.parse("Processes[0].Threads[9]"))); TraceObjectKeyPath.parse("Processes[0].Threads[9]")));
} }
@ -194,7 +194,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
protected void populateHandles() throws Throwable { protected void populateHandles() throws Throwable {
TraceObjectManager objects = tb.trace.getObjectManager(); TraceObjectManager objects = tb.trace.getObjectManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject handleContainer = TraceObject handleContainer =
objects.createObject(TraceObjectKeyPath.parse("Processes[0].Handles")); objects.createObject(TraceObjectKeyPath.parse("Processes[0].Handles"));
handleContainer.insert(Lifespan.nowOn(0), ConflictResolution.DENY); handleContainer.insert(Lifespan.nowOn(0), ConflictResolution.DENY);
@ -208,7 +208,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
protected void populateLinks() throws Throwable { protected void populateLinks() throws Throwable {
TraceObjectManager objects = tb.trace.getObjectManager(); TraceObjectManager objects = tb.trace.getObjectManager();
TraceObjectKeyPath threadContainerPath = TraceObjectKeyPath.parse("Processes[0].Threads"); TraceObjectKeyPath threadContainerPath = TraceObjectKeyPath.parse("Processes[0].Threads");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject linkContainer = TraceObject linkContainer =
objects.createObject(TraceObjectKeyPath.parse("Processes[0].Links")); objects.createObject(TraceObjectKeyPath.parse("Processes[0].Links"));
linkContainer.insert(Lifespan.nowOn(0), ConflictResolution.DENY); linkContainer.insert(Lifespan.nowOn(0), ConflictResolution.DENY);
@ -221,7 +221,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
protected void populateBoxedPrimitive() throws Throwable { protected void populateBoxedPrimitive() throws Throwable {
TraceObjectManager objects = tb.trace.getObjectManager(); TraceObjectManager objects = tb.trace.getObjectManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject boxed = TraceObject boxed =
objects.createObject(TraceObjectKeyPath.parse("Processes[0].Boxed")); objects.createObject(TraceObjectKeyPath.parse("Processes[0].Boxed"));
boxed.insert(Lifespan.nowOn(0), ConflictResolution.DENY); boxed.insert(Lifespan.nowOn(0), ConflictResolution.DENY);
@ -684,7 +684,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
assertPathIs(path, 0, 3); assertPathIs(path, 0, 3);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject thread = tb.trace.getObjectManager().getObjectByCanonicalPath(path); TraceObject thread = tb.trace.getObjectManager().getObjectByCanonicalPath(path);
thread.setAttribute(Lifespan.nowOn(0), "NewAttribute", 11); thread.setAttribute(Lifespan.nowOn(0), "NewAttribute", 11);
} }
@ -705,7 +705,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
assertPathIsThreadsContainer(); assertPathIsThreadsContainer();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject threads = tb.trace.getObjectManager().getObjectByCanonicalPath(path); TraceObject threads = tb.trace.getObjectManager().getObjectByCanonicalPath(path);
threads.setElement(Lifespan.ALL, 2, null); threads.setElement(Lifespan.ALL, 2, null);
} }
@ -726,7 +726,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
assertPathIs(path, 0, 3); assertPathIs(path, 0, 3);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject thread = tb.trace.getObjectManager().getObjectByCanonicalPath(path); TraceObject thread = tb.trace.getObjectManager().getObjectByCanonicalPath(path);
thread.setAttribute(Lifespan.ALL, "_self", null); thread.setAttribute(Lifespan.ALL, "_self", null);
} }
@ -751,14 +751,14 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
assertPathIs(path, 3, 0); assertPathIs(path, 3, 0);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
element2.setLifespan(Lifespan.nowOn(10), ConflictResolution.DENY); element2.setLifespan(Lifespan.nowOn(10), ConflictResolution.DENY);
} }
waitForTasks(); waitForTasks();
assertPathIs(path, 2, 0); assertPathIs(path, 2, 0);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
element2.setLifespan(Lifespan.nowOn(2), ConflictResolution.DENY); element2.setLifespan(Lifespan.nowOn(2), ConflictResolution.DENY);
} }
waitForTasks(); waitForTasks();
@ -783,14 +783,14 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
assertPathIs(path, 0, 4); // _next created at snap 3 assertPathIs(path, 0, 4); // _next created at snap 3
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
attrSelf.setLifespan(Lifespan.nowOn(10), ConflictResolution.DENY); attrSelf.setLifespan(Lifespan.nowOn(10), ConflictResolution.DENY);
} }
waitForTasks(); waitForTasks();
assertPathIs(path, 0, 3); assertPathIs(path, 0, 3);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
attrSelf.setLifespan(Lifespan.nowOn(2), ConflictResolution.DENY); attrSelf.setLifespan(Lifespan.nowOn(2), ConflictResolution.DENY);
} }
waitForTasks(); waitForTasks();
@ -813,7 +813,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerGUITe
waitForValue(() -> modelProvider.objectsTreePanel.treeModel.getNode(path)); waitForValue(() -> modelProvider.objectsTreePanel.treeModel.getNode(path));
assertEquals("<html>[2]", node.getDisplayText()); assertEquals("<html>[2]", node.getDisplayText());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread.setAttribute(Lifespan.nowOn(0), "_display", "Renamed Thread"); thread.setAttribute(Lifespan.nowOn(0), "_display", "Renamed Thread");
} }
waitForTasks(); waitForTasks();

View file

@ -15,12 +15,12 @@
*/ */
package ghidra.app.plugin.core.debug.gui.model; package ghidra.app.plugin.core.debug.gui.model;
import static ghidra.app.plugin.core.debug.gui.model.DebuggerModelProviderTest.CTX; import static ghidra.app.plugin.core.debug.gui.model.DebuggerModelProviderTest.*;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName; import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;
import ghidra.trace.database.target.DBTraceObjectManager; import ghidra.trace.database.target.DBTraceObjectManager;
@ -28,7 +28,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.target.TraceObject.ConflictResolution; import ghidra.trace.model.target.TraceObject.ConflictResolution;
import ghidra.trace.model.target.TraceObjectKeyPath; import ghidra.trace.model.target.TraceObjectKeyPath;
import ghidra.trace.model.target.TraceObjectValue; import ghidra.trace.model.target.TraceObjectValue;
import ghidra.util.database.UndoableTransaction;
public class ModelQueryTest extends AbstractGhidraHeadedDebuggerGUITest { public class ModelQueryTest extends AbstractGhidraHeadedDebuggerGUITest {
@Test @Test
@ -38,7 +37,7 @@ public class ModelQueryTest extends AbstractGhidraHeadedDebuggerGUITest {
ModelQuery rootQuery = ModelQuery.parse(""); ModelQuery rootQuery = ModelQuery.parse("");
ModelQuery threadQuery = ModelQuery.parse("Processes[].Threads[]"); ModelQuery threadQuery = ModelQuery.parse("Processes[].Threads[]");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceObjectManager objects = tb.trace.getObjectManager(); DBTraceObjectManager objects = tb.trace.getObjectManager();
TraceObjectValue rootVal = TraceObjectValue rootVal =
@ -65,7 +64,7 @@ public class ModelQueryTest extends AbstractGhidraHeadedDebuggerGUITest {
ModelQuery rootQuery = ModelQuery.parse(""); ModelQuery rootQuery = ModelQuery.parse("");
ModelQuery threadQuery = ModelQuery.parse("Processes[].Threads[]"); ModelQuery threadQuery = ModelQuery.parse("Processes[].Threads[]");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceObjectManager objects = tb.trace.getObjectManager(); DBTraceObjectManager objects = tb.trace.getObjectManager();
TraceObjectValue rootVal = TraceObjectValue rootVal =

View file

@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
import org.junit.*; import org.junit.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.widgets.filechooser.GhidraFileChooser; import docking.widgets.filechooser.GhidraFileChooser;
import generic.Unique; import generic.Unique;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
@ -59,7 +60,6 @@ import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.memory.TraceOverlappedRegionException; import ghidra.trace.model.memory.TraceOverlappedRegionException;
import ghidra.trace.model.modules.*; import ghidra.trace.model.modules.*;
import ghidra.trace.model.symbol.TraceSymbol; import ghidra.trace.model.symbol.TraceSymbol;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test @Category(NightlyCategory.class) // this may actually be an @PortSensitive test
@ -83,7 +83,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
protected void addRegionsFromModules() protected void addRegionsFromModules()
throws TraceOverlappedRegionException, DuplicateNameException { throws TraceOverlappedRegionException, DuplicateNameException {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager manager = tb.trace.getMemoryManager(); DBTraceMemoryManager manager = tb.trace.getMemoryManager();
for (TraceModule module : tb.trace.getModuleManager().getAllModules()) { for (TraceModule module : tb.trace.getModuleManager().getAllModules()) {
for (TraceSection section : module.getSections()) { for (TraceSection section : module.getSections()) {
@ -108,7 +108,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
protected void addModules() throws Exception { protected void addModules() throws Exception {
TraceModuleManager manager = tb.trace.getModuleManager(); TraceModuleManager manager = tb.trace.getModuleManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe = manager.addLoadedModule("Processes[1].Modules[first_proc]", "first_proc", modExe = manager.addLoadedModule("Processes[1].Modules[first_proc]", "first_proc",
tb.range(0x55550000, 0x5575007f), 0); tb.range(0x55550000, 0x5575007f), 0);
secExeText = modExe.addSection("Processes[1].Modules[first_proc].Sections[.text]", secExeText = modExe.addSection("Processes[1].Modules[first_proc].Sections[.text]",
@ -126,7 +126,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
} }
protected MemoryBlock addBlock() throws Exception { protected MemoryBlock addBlock() throws Exception {
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
return program.getMemory() return program.getMemory()
.createInitializedBlock(".text", tb.addr(0x00400000), 0x1000, (byte) 0, monitor, .createInitializedBlock(".text", tb.addr(0x00400000), 0x1000, (byte) 0, monitor,
false); false);
@ -225,7 +225,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
waitForSwing(); waitForSwing();
MemoryBlock block = addBlock(); MemoryBlock block = addBlock();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setName(modExe.getName()); program.setName(modExe.getName());
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -261,7 +261,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
assertProviderPopulated(); // Cheap sanity check assertProviderPopulated(); // Cheap sanity check
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe.delete(); modExe.delete();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -355,7 +355,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
assertTrue(modulesProvider.actionMapIdentically.isEnabled()); assertTrue(modulesProvider.actionMapIdentically.isEnabled());
// Need some substance in the program // Need some substance in the program
try (UndoableTransaction tid = UndoableTransaction.start(program, "Populate")) { try (Transaction tx = program.openTransaction("Populate")) {
addBlock(); addBlock();
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -390,7 +390,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
// Still // Still
assertFalse(modulesProvider.actionMapModules.isEnabled()); assertFalse(modulesProvider.actionMapModules.isEnabled());
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setImageBase(addr(program, 0x00400000), true); program.setImageBase(addr(program, 0x00400000), true);
program.setName(modExe.getName()); program.setName(modExe.getName());
@ -459,7 +459,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
assertFalse(modulesProvider.actionMapSections.isEnabled()); assertFalse(modulesProvider.actionMapSections.isEnabled());
MemoryBlock block = addBlock(); MemoryBlock block = addBlock();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setName(modExe.getName()); program.setName(modExe.getName());
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -669,7 +669,7 @@ public class DebuggerModulesProviderLegacyTest extends AbstractGhidraHeadedDebug
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe.setName("/bin/echo"); // File has to exist modExe.setName("/bin/echo"); // File has to exist
} }
waitForPass( waitForPass(

View file

@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
import org.junit.*; import org.junit.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.widgets.filechooser.GhidraFileChooser; import docking.widgets.filechooser.GhidraFileChooser;
import docking.widgets.table.DynamicTableColumn; import docking.widgets.table.DynamicTableColumn;
import generic.Unique; import generic.Unique;
@ -46,9 +47,9 @@ import ghidra.app.plugin.core.debug.gui.modules.DebuggerSectionMapProposalDialog
import ghidra.app.plugin.core.debug.mapping.DebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.mapping.DebuggerTargetTraceMapper;
import ghidra.app.plugin.core.debug.mapping.ObjectBasedDebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.mapping.ObjectBasedDebuggerTargetTraceMapper;
import ghidra.app.services.DebuggerListingService; import ghidra.app.services.DebuggerListingService;
import ghidra.app.services.TraceRecorder;
import ghidra.app.services.ModuleMapProposal.ModuleMapEntry; import ghidra.app.services.ModuleMapProposal.ModuleMapEntry;
import ghidra.app.services.SectionMapProposal.SectionMapEntry; import ghidra.app.services.SectionMapProposal.SectionMapEntry;
import ghidra.app.services.TraceRecorder;
import ghidra.dbg.attributes.TargetPrimitiveDataType.DefaultTargetPrimitiveDataType; import ghidra.dbg.attributes.TargetPrimitiveDataType.DefaultTargetPrimitiveDataType;
import ghidra.dbg.attributes.TargetPrimitiveDataType.PrimitiveKind; import ghidra.dbg.attributes.TargetPrimitiveDataType.PrimitiveKind;
import ghidra.dbg.model.TestTargetModule; import ghidra.dbg.model.TestTargetModule;
@ -56,8 +57,8 @@ import ghidra.dbg.model.TestTargetTypedefDataType;
import ghidra.dbg.target.*; import ghidra.dbg.target.*;
import ghidra.dbg.target.schema.SchemaContext; import ghidra.dbg.target.schema.SchemaContext;
import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName; import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;
import ghidra.dbg.util.*;
import ghidra.dbg.target.schema.XmlSchemaContext; import ghidra.dbg.target.schema.XmlSchemaContext;
import ghidra.dbg.util.*;
import ghidra.framework.main.DataTreeDialog; import ghidra.framework.main.DataTreeDialog;
import ghidra.plugin.importer.ImporterPlugin; import ghidra.plugin.importer.ImporterPlugin;
import ghidra.program.model.address.*; import ghidra.program.model.address.*;
@ -73,7 +74,6 @@ import ghidra.trace.model.modules.*;
import ghidra.trace.model.symbol.TraceSymbol; import ghidra.trace.model.symbol.TraceSymbol;
import ghidra.trace.model.target.*; import ghidra.trace.model.target.*;
import ghidra.trace.model.target.TraceObject.ConflictResolution; import ghidra.trace.model.target.TraceObject.ConflictResolution;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.table.GhidraTable; import ghidra.util.table.GhidraTable;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
@ -175,7 +175,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
</schema> </schema>
</context>"""); </context>""");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session"))); tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session")));
} }
} }
@ -183,7 +183,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
protected void addRegionsFromModules() throws Exception { protected void addRegionsFromModules() throws Exception {
PathPattern regionPattern = new PathPattern(PathUtils.parse("Processes[1].Memory[]")); PathPattern regionPattern = new PathPattern(PathUtils.parse("Processes[1].Memory[]"));
TraceObjectManager om = tb.trace.getObjectManager(); TraceObjectManager om = tb.trace.getObjectManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject root = om.getRootObject(); TraceObject root = om.getRootObject();
for (TraceObject module : (Iterable<TraceObject>) () -> root for (TraceObject module : (Iterable<TraceObject>) () -> root
.querySuccessorsTargetInterface(Lifespan.at(0), TargetModule.class, true) .querySuccessorsTargetInterface(Lifespan.at(0), TargetModule.class, true)
@ -242,7 +242,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
protected void addModules() throws Exception { protected void addModules() throws Exception {
Lifespan zeroOn = Lifespan.nowOn(0); Lifespan zeroOn = Lifespan.nowOn(0);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe = addModule("first_proc", tb.range(0x55550000, 0x5575007f), zeroOn); modExe = addModule("first_proc", tb.range(0x55550000, 0x5575007f), zeroOn);
secExeText = addSection(modExe, ".text", tb.range(0x55550000, 0x555500ff)); secExeText = addSection(modExe, ".text", tb.range(0x55550000, 0x555500ff));
secExeData = addSection(modExe, ".data", tb.range(0x55750000, 0x5575007f)); secExeData = addSection(modExe, ".data", tb.range(0x55750000, 0x5575007f));
@ -254,7 +254,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
protected MemoryBlock addBlock() throws Exception { protected MemoryBlock addBlock() throws Exception {
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
return program.getMemory() return program.getMemory()
.createInitializedBlock(".text", tb.addr(0x00400000), 0x1000, (byte) 0, monitor, .createInitializedBlock(".text", tb.addr(0x00400000), 0x1000, (byte) 0, monitor,
false); false);
@ -392,7 +392,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForTasks(); waitForTasks();
MemoryBlock block = addBlock(); MemoryBlock block = addBlock();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setName(modExe.getName()); program.setName(modExe.getName());
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -427,7 +427,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForPass(() -> assertProviderPopulated()); waitForPass(() -> assertProviderPopulated());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe.getObject().removeTree(Lifespan.nowOn(0)); modExe.getObject().removeTree(Lifespan.nowOn(0));
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -515,7 +515,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForPass(() -> assertTrue(provider.actionMapIdentically.isEnabled())); waitForPass(() -> assertTrue(provider.actionMapIdentically.isEnabled()));
// Need some substance in the program // Need some substance in the program
try (UndoableTransaction tid = UndoableTransaction.start(program, "Populate")) { try (Transaction tx = program.openTransaction("Populate")) {
addBlock(); addBlock();
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -550,7 +550,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
// Still // Still
assertFalse(provider.actionMapModules.isEnabled()); assertFalse(provider.actionMapModules.isEnabled());
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setImageBase(addr(program, 0x00400000), true); program.setImageBase(addr(program, 0x00400000), true);
program.setName(modExe.getName()); program.setName(modExe.getName());
@ -618,7 +618,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertFalse(provider.actionMapSections.isEnabled()); assertFalse(provider.actionMapSections.isEnabled());
MemoryBlock block = addBlock(); MemoryBlock block = addBlock();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Change name")) { try (Transaction tx = program.openTransaction("Change name")) {
program.setName(modExe.getName()); program.setName(modExe.getName());
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -819,7 +819,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerGUI
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
waitForTasks(); waitForTasks();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
modExe.setName("/bin/echo"); // File has to exist modExe.setName("/bin/echo"); // File has to exist
} }
waitForPass(() -> assertModuleTableSize(2)); waitForPass(() -> assertModuleTableSize(2));

View file

@ -25,6 +25,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.Unique; import generic.Unique;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin; import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
@ -39,7 +40,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.modules.TraceStaticMapping; import ghidra.trace.model.modules.TraceStaticMapping;
import ghidra.trace.model.modules.TraceStaticMappingManager; import ghidra.trace.model.modules.TraceStaticMappingManager;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
@ -64,7 +64,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
new URL("ghidra://static"), "DEADBEEF"); new URL("ghidra://static"), "DEADBEEF");
} }
@ -84,7 +84,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
// Note: don't activate yet // Note: don't activate yet
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
new URL("ghidra://static"), "DEADBEEF"); new URL("ghidra://static"), "DEADBEEF");
} }
@ -114,7 +114,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
intoProject(tb.trace); intoProject(tb.trace);
intoProject(program); intoProject(program);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion(".text", Lifespan.nowOn(0), .addRegion(".text", Lifespan.nowOn(0),
tb.range(0xdeadbeefL, 0xdeadbeefL + 0xff), tb.range(0xdeadbeefL, 0xdeadbeefL + 0xff),
@ -122,7 +122,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0xc0de1234L), 0x100, (byte) 0, .createInitializedBlock(".text", addr(program, 0xc0de1234L), 0x100, (byte) 0,
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
@ -162,7 +162,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
new URL("ghidra://static"), "DEADBEEF"); new URL("ghidra://static"), "DEADBEEF");
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
@ -203,7 +203,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
new URL("ghidra://static"), "DEADBEEF"); new URL("ghidra://static"), "DEADBEEF");
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
@ -218,7 +218,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
assertEquals(3, displayed.size()); assertEquals(3, displayed.size());
// Remove the first two in another transaction // Remove the first two in another transaction
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.findContaining(tb.addr(0xdeadbeef), 0).delete(); manager.findContaining(tb.addr(0xdeadbeef), 0).delete();
manager.findContaining(tb.addr(0xdeadbeef + 0x100), 0).delete(); manager.findContaining(tb.addr(0xdeadbeef + 0x100), 0).delete();
} }
@ -236,14 +236,14 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
new URL("ghidra://static"), "DEADBEEF"); new URL("ghidra://static"), "DEADBEEF");
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
new URL("ghidra://static"), "C0DE1234"); new URL("ghidra://static"), "C0DE1234");
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0),
new URL("ghidra://static"), "1E55C0DE"); new URL("ghidra://static"), "1E55C0DE");
} }
@ -263,14 +263,14 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef, 0xdeadbeef + 0xff), Lifespan.nowOn(0),
new URL("ghidra://static"), "DEADBEEF"); new URL("ghidra://static"), "DEADBEEF");
manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef + 0x100, 0xdeadbeef + 0x17f), Lifespan.nowOn(0),
new URL("ghidra://static"), "C0DE1234"); new URL("ghidra://static"), "C0DE1234");
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0), manager.add(tb.range(0xdeadbeef + 0x180, 0xdeadbeef + 0x1bf), Lifespan.nowOn(0),
new URL("ghidra://static"), "1E55C0DE"); new URL("ghidra://static"), "1E55C0DE");
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -278,7 +278,7 @@ public class DebuggerStaticMappingProviderTest extends AbstractGhidraHeadedDebug
// Check that all records are displayed in the interim // Check that all records are displayed in the interim
assertEquals(3, mappingsProvider.mappingTableModel.getModelData().size()); assertEquals(3, mappingsProvider.mappingTableModel.getModelData().size());
tid.abort(); tx.abort();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);

View file

@ -18,10 +18,10 @@ package ghidra.app.plugin.core.debug.gui.objects;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.services.CodeViewerService; import ghidra.app.services.CodeViewerService;
import ghidra.app.services.DebuggerStaticMappingService; import ghidra.app.services.DebuggerStaticMappingService;
import ghidra.util.database.UndoableTransaction;
public class DebuggerObjectsProviderTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerObjectsProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
protected DebuggerObjectsPlugin objectsPlugin; protected DebuggerObjectsPlugin objectsPlugin;
@ -43,7 +43,7 @@ public class DebuggerObjectsProviderTest extends AbstractGhidraHeadedDebuggerGUI
public void testBasic() throws Exception { public void testBasic() throws Exception {
createAndOpenTrace(); createAndOpenTrace();
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
//objectsProvider.importFromXMLAction.run(); //objectsProvider.importFromXMLAction.run();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);

View file

@ -23,6 +23,7 @@ import java.util.List;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.assembler.Assembler; import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers; import ghidra.app.plugin.assembler.Assemblers;
@ -45,7 +46,6 @@ import ghidra.trace.model.Lifespan;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
public class DebuggerPcodeStepperProviderTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerPcodeStepperProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -75,7 +75,7 @@ public class DebuggerPcodeStepperProviderTest extends AbstractGhidraHeadedDebugg
protected void populateTrace() throws Exception { protected void populateTrace() throws Exception {
start = tb.addr(0x00400000); start = tb.addr(0x00400000);
InstructionIterator iit; InstructionIterator iit;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("echo:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff), .addRegion("echo:.text", Lifespan.nowOn(0), tb.range(0x00400000, 0x0040ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);

View file

@ -15,7 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.gui.register; package ghidra.app.plugin.core.debug.gui.register;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
@ -24,6 +24,7 @@ import java.util.stream.Collectors;
import org.junit.Before; import org.junit.Before;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
import ghidra.app.plugin.core.debug.mapping.DebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.mapping.DebuggerTargetTraceMapper;
@ -39,7 +40,6 @@ import ghidra.trace.model.guest.TraceGuestPlatform;
import ghidra.trace.model.guest.TracePlatform; import ghidra.trace.model.guest.TracePlatform;
import ghidra.trace.model.memory.TraceMemorySpace; import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test @Category(NightlyCategory.class) // this may actually be an @PortSensitive test
public class DebuggerRegistersProviderGuestTest extends DebuggerRegistersProviderTest { public class DebuggerRegistersProviderGuestTest extends DebuggerRegistersProviderTest {
@ -52,7 +52,7 @@ public class DebuggerRegistersProviderGuestTest extends DebuggerRegistersProvide
} }
public void createToyPlatform() throws Exception { public void createToyPlatform() throws Exception {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
toy = tb.trace.getPlatformManager() toy = tb.trace.getPlatformManager()
.addGuestPlatform(getToyBE64Language().getDefaultCompilerSpec()); .addGuestPlatform(getToyBE64Language().getDefaultCompilerSpec());
toy.addMappedRange(tb.addr(0), tb.addr(toy, 0), -1); toy.addMappedRange(tb.addr(0), tb.addr(toy, 0), -1);
@ -130,7 +130,7 @@ public class DebuggerRegistersProviderGuestTest extends DebuggerRegistersProvide
} }
@Override @Override
protected void addRegisterValues(TraceThread thread, UndoableTransaction tid) { protected void addRegisterValues(TraceThread thread, Transaction tx) {
TraceMemorySpace regVals = TraceMemorySpace regVals =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
regVals.putBytes(toy, 0, pc, tb.buf(0, 0, 0, 0, 0, 0x40, 0, 0)); regVals.putBytes(toy, 0, pc, tb.buf(0, 0, 0, 0, 0, 0x40, 0, 0));

View file

@ -15,7 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.gui.register; package ghidra.app.plugin.core.debug.gui.register;
import static ghidra.lifecycle.Unfinished.TODO; import static ghidra.lifecycle.Unfinished.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.math.BigInteger; import java.math.BigInteger;
@ -26,6 +26,7 @@ import java.util.stream.Collectors;
import org.junit.*; import org.junit.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.action.NoneLocationTrackingSpec; import ghidra.app.plugin.core.debug.gui.action.NoneLocationTrackingSpec;
@ -48,7 +49,6 @@ import ghidra.trace.model.listing.*;
import ghidra.trace.model.memory.TraceMemoryFlag; import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.memory.TraceMemorySpace; import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test @Category(NightlyCategory.class) // this may actually be an @PortSensitive test
@ -107,7 +107,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
} }
protected TraceThread addThread(String threadName) throws DuplicateNameException { protected TraceThread addThread(String threadName) throws DuplicateNameException {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
return tb.trace.getThreadManager().createThread(threadName, 0); return tb.trace.getThreadManager().createThread(threadName, 0);
} }
} }
@ -121,12 +121,12 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
} }
protected void addRegisterValues(TraceThread thread) { protected void addRegisterValues(TraceThread thread) {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
addRegisterValues(thread, tid); addRegisterValues(thread, tx);
} }
} }
protected void addRegisterValues(TraceThread thread, UndoableTransaction tid) { protected void addRegisterValues(TraceThread thread, Transaction tx) {
TraceMemorySpace regVals = TraceMemorySpace regVals =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
regVals.putBytes(0, pc, tb.buf(0, 0, 0, 0, 0, 0x40, 0, 0)); regVals.putBytes(0, pc, tb.buf(0, 0, 0, 0, 0, 0x40, 0, 0));
@ -134,7 +134,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
regVals.putBytes(0, r0, tb.buf(1, 2, 3, 4, 5, 6, 7, 8)); regVals.putBytes(0, r0, tb.buf(1, 2, 3, 4, 5, 6, 7, 8));
} }
protected void addRegisterTypes(TraceThread thread, UndoableTransaction tid) protected void addRegisterTypes(TraceThread thread, Transaction tx)
throws CodeUnitInsertionException { throws CodeUnitInsertionException {
TraceCodeSpace regCode = TraceCodeSpace regCode =
tb.trace.getCodeManager().getCodeRegisterSpace(thread, true); tb.trace.getCodeManager().getCodeRegisterSpace(thread, true);
@ -146,8 +146,8 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
} }
protected void addRegisterTypes(TraceThread thread) throws CodeUnitInsertionException { protected void addRegisterTypes(TraceThread thread) throws CodeUnitInsertionException {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
addRegisterTypes(thread, tid); addRegisterTypes(thread, tx);
} }
} }
@ -475,7 +475,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
TraceThread thread = addThread(); TraceThread thread = addThread();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.exec(getPlatform(), 0, thread, 0, "pc = 100;"); tb.exec(getPlatform(), 0, thread, 0, "pc = 100;");
} }
activateThread(thread); activateThread(thread);
@ -540,9 +540,9 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
TraceThread thread = addThread(); TraceThread thread = addThread();
activateThread(thread); activateThread(thread);
// Group adds into a single transaction // Group adds into a single transaction
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
addRegisterValues(thread, tid); addRegisterValues(thread, tx);
addRegisterTypes(thread, tid); addRegisterTypes(thread, tx);
} }
waitForSwing(); waitForSwing();
@ -574,9 +574,9 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
TraceThread thread = addThread(); TraceThread thread = addThread();
activateThread(thread); activateThread(thread);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
addRegisterValues(thread, tid); addRegisterValues(thread, tx);
addRegisterTypes(thread, tid); addRegisterTypes(thread, tx);
waitForSwing(); waitForSwing();
// Sanity // Sanity
@ -585,7 +585,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
assertPCRowTypePopulated(); assertPCRowTypePopulated();
assertR0RowTypePopulated(); assertR0RowTypePopulated();
tid.abort(); tx.abort();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -628,7 +628,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
assertPCRowValuePopulated(); assertPCRowValuePopulated();
assertR0RowValuePopulated(); assertR0RowValuePopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regVals = TraceMemorySpace regVals =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
TraceCodeSpace regCode = TraceCodeSpace regCode =
@ -657,7 +657,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
assertEquals(1, traceManager.getCurrentSnap()); assertEquals(1, traceManager.getCurrentSnap());
assertR0RowTypePopulated(); assertR0RowTypePopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceCodeSpace regCode = TraceCodeSpace regCode =
tb.trace.getCodeManager().getCodeRegisterSpace(thread, true); tb.trace.getCodeManager().getCodeRegisterSpace(thread, true);
TraceCodeUnit code = regCode.codeUnits().getContaining(getPlatform(), 1, r0); TraceCodeUnit code = regCode.codeUnits().getContaining(getPlatform(), 1, r0);
@ -687,7 +687,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
assertR0RowTypePopulated(); assertR0RowTypePopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceCodeSpace regCode = TraceCodeSpace regCode =
tb.trace.getCodeManager().getCodeRegisterSpace(thread, true); tb.trace.getCodeManager().getCodeRegisterSpace(thread, true);
TraceCodeUnit code = regCode.codeUnits().getContaining(getPlatform(), 1, r0); TraceCodeUnit code = regCode.codeUnits().getContaining(getPlatform(), 1, r0);
@ -755,7 +755,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
TraceThread thread = addThread(); TraceThread thread = addThread();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// Unconventional start, to ensure goto PC is actually the cause, not just min of view // Unconventional start, to ensure goto PC is actually the cause, not just min of view
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("bin:.text", Lifespan.nowOn(0), tb.range(0x00300000, 0x00500000), .addRegion("bin:.text", Lifespan.nowOn(0), tb.range(0x00300000, 0x00500000),
@ -864,7 +864,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
traceManager.openTrace(ub.trace); traceManager.openTrace(ub.trace);
TraceThread thread3; TraceThread thread3;
try (UndoableTransaction tid = ub.startTransaction()) { try (Transaction tx = ub.startTransaction()) {
thread3 = ub.trace.getThreadManager().createThread("Thread3", 0); thread3 = ub.trace.getThreadManager().createThread("Thread3", 0);
} }
traceManager.activateTrace(ub.trace); traceManager.activateTrace(ub.trace);
@ -898,7 +898,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
assertR0RowValuePopulated(); assertR0RowValuePopulated();
assertR0RowTypePopulated(); assertR0RowTypePopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regVals = TraceMemorySpace regVals =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
TraceCodeSpace regCode = TraceCodeSpace regCode =
@ -940,7 +940,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
assertR0RowValuePopulated(); assertR0RowValuePopulated();
assertR0RowTypePopulated(); assertR0RowTypePopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regVals = TraceMemorySpace regVals =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, 1, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, 1, true);
regVals.putBytes(getPlatform(), 0, pc, tb.buf(0, 0, 0, 0, 0, 0x50, 0, 0)); regVals.putBytes(getPlatform(), 0, pc, tb.buf(0, 0, 0, 0, 0, 0x50, 0, 0));

View file

@ -23,6 +23,7 @@ import java.util.List;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin; import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;
@ -41,7 +42,6 @@ import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.stack.TraceStack; import ghidra.trace.model.stack.TraceStack;
import ghidra.trace.model.stack.TraceStackFrame; import ghidra.trace.model.stack.TraceStackFrame;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.DuplicateNameException;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@ -63,13 +63,13 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
} }
protected TraceThread addThread(String n) throws DuplicateNameException { protected TraceThread addThread(String n) throws DuplicateNameException {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
return tb.trace.getThreadManager().createThread(n, 0); return tb.trace.getThreadManager().createThread(n, 0);
} }
} }
protected void addRegVals(TraceThread thread) { protected void addRegVals(TraceThread thread) {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regs = TraceMemorySpace regs =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
regs.setValue(0, new RegisterValue(pc, new BigInteger("00400123", 16))); regs.setValue(0, new RegisterValue(pc, new BigInteger("00400123", 16)));
@ -77,7 +77,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
} }
protected TraceStack addStack(TraceThread thread, int snap) { protected TraceStack addStack(TraceThread thread, int snap) {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
return tb.trace.getStackManager().getStack(thread, snap, true); return tb.trace.getStackManager().getStack(thread, snap, true);
} }
} }
@ -87,7 +87,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
} }
protected void addStackFrames(TraceStack stack) { protected void addStackFrames(TraceStack stack) {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.setDepth(2, false); stack.setDepth(2, false);
TraceStackFrame frame = stack.getFrame(0, false); TraceStackFrame frame = stack.getFrame(0, false);
@ -234,7 +234,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
assertProviderPopulated(); assertProviderPopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.setDepth(3, false); stack.setDepth(3, false);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -259,7 +259,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
assertProviderPopulated(); assertProviderPopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.setDepth(3, true); stack.setDepth(3, true);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -284,7 +284,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
assertProviderPopulated(); assertProviderPopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.setDepth(1, false); stack.setDepth(1, false);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -307,7 +307,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
assertProviderPopulated(); assertProviderPopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.setDepth(1, true); stack.setDepth(1, true);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -330,7 +330,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
assertProviderPopulated(); assertProviderPopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.delete(); stack.delete();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -472,7 +472,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
assertProviderPopulated(); assertProviderPopulated();
Function func; Function func;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add Function")) { try (Transaction tx = program.openTransaction("Add Function")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00600000), 0x1000, (byte) 0, .createInitializedBlock(".text", addr(program, 0x00600000), 0x1000, (byte) 0,
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
@ -483,7 +483,7 @@ public class DebuggerStackProviderLegacyTest extends AbstractGhidraHeadedDebugge
} }
waitForDomainObject(program); waitForDomainObject(program);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.addRegion("Processes[1].Memory[bin:.text]", Lifespan.nowOn(0), .addRegion("Processes[1].Memory[bin:.text]", Lifespan.nowOn(0),
tb.drng(0x00400000, 0x00400fff), tb.drng(0x00400000, 0x00400fff),

View file

@ -15,8 +15,7 @@
*/ */
package ghidra.app.plugin.core.debug.gui.stack; package ghidra.app.plugin.core.debug.gui.stack;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -24,6 +23,7 @@ import java.util.Objects;
import org.junit.*; import org.junit.*;
import db.Transaction;
import docking.widgets.table.DynamicTableColumn; import docking.widgets.table.DynamicTableColumn;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
@ -52,7 +52,6 @@ import ghidra.trace.model.stack.TraceObjectStack;
import ghidra.trace.model.target.*; import ghidra.trace.model.target.*;
import ghidra.trace.model.target.TraceObject.ConflictResolution; import ghidra.trace.model.target.TraceObject.ConflictResolution;
import ghidra.trace.model.thread.TraceObjectThread; import ghidra.trace.model.thread.TraceObjectThread;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
/** /**
@ -159,7 +158,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
</context> </context>
"""); """);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session"))); tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session")));
} }
} }
@ -168,7 +167,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
PathPattern threadPattern = new PathPattern(PathUtils.parse("Processes[1].Threads[]")); PathPattern threadPattern = new PathPattern(PathUtils.parse("Processes[1].Threads[]"));
TraceObjectKeyPath threadPath = TraceObjectKeyPath threadPath =
TraceObjectKeyPath.of(threadPattern.applyIntKeys(n).getSingletonPath()); TraceObjectKeyPath.of(threadPattern.applyIntKeys(n).getSingletonPath());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
return Objects.requireNonNull(tb.trace.getObjectManager() return Objects.requireNonNull(tb.trace.getObjectManager()
.createObject(threadPath) .createObject(threadPath)
.insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE) .insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE)
@ -179,7 +178,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
protected TraceObjectStack addStack(TraceObjectThread thread) { protected TraceObjectStack addStack(TraceObjectThread thread) {
TraceObjectKeyPath stackPath = thread.getObject().getCanonicalPath().extend("Stack"); TraceObjectKeyPath stackPath = thread.getObject().getCanonicalPath().extend("Stack");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
return Objects.requireNonNull(tb.trace.getObjectManager() return Objects.requireNonNull(tb.trace.getObjectManager()
.createObject(stackPath) .createObject(stackPath)
.insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE) .insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE)
@ -195,7 +194,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
protected void addStackFrames(TraceObjectStack stack, int count) { protected void addStackFrames(TraceObjectStack stack, int count) {
TraceObjectKeyPath stackPath = stack.getObject().getCanonicalPath(); TraceObjectKeyPath stackPath = stack.getObject().getCanonicalPath();
TraceObjectManager om = tb.trace.getObjectManager(); TraceObjectManager om = tb.trace.getObjectManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
TraceObject frame = om.createObject(stackPath.index(i)) TraceObject frame = om.createObject(stackPath.index(i))
.insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE) .insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE)
@ -346,7 +345,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
waitForPass(() -> assertProviderPopulated()); waitForPass(() -> assertProviderPopulated());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject frame2 = tb.trace.getObjectManager() TraceObject frame2 = tb.trace.getObjectManager()
.createObject(stack.getObject().getCanonicalPath().index(2)) .createObject(stack.getObject().getCanonicalPath().index(2))
.insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE) .insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE)
@ -379,7 +378,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
waitForPass(() -> assertProviderPopulated()); waitForPass(() -> assertProviderPopulated());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObject frame1 = stack.getObject().getElement(0, 1).getChild(); TraceObject frame1 = stack.getObject().getElement(0, 1).getChild();
frame1.removeTree(Lifespan.nowOn(0)); frame1.removeTree(Lifespan.nowOn(0));
} }
@ -405,7 +404,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
waitForPass(() -> assertProviderPopulated()); waitForPass(() -> assertProviderPopulated());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.getObject().removeTree(Lifespan.nowOn(0)); stack.getObject().removeTree(Lifespan.nowOn(0));
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -449,7 +448,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
waitForPass(() -> assertProviderPopulated()); waitForPass(() -> assertProviderPopulated());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
stack.getObject().removeTree(Lifespan.nowOn(1)); stack.getObject().removeTree(Lifespan.nowOn(1));
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -563,7 +562,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
waitForPass(() -> assertProviderPopulated()); waitForPass(() -> assertProviderPopulated());
Function func; Function func;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add Function")) { try (Transaction tx = program.openTransaction("Add Function")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00600000), 0x1000, (byte) 0, .createInitializedBlock(".text", addr(program, 0x00600000), 0x1000, (byte) 0,
TaskMonitor.DUMMY, false); TaskMonitor.DUMMY, false);
@ -574,7 +573,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerGUITe
} }
waitForDomainObject(program); waitForDomainObject(program);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceObjectMemoryRegion region = Objects.requireNonNull(tb.trace.getObjectManager() TraceObjectMemoryRegion region = Objects.requireNonNull(tb.trace.getObjectManager()
.createObject(TraceObjectKeyPath.parse("Processes[1].Memory[bin:.text]")) .createObject(TraceObjectKeyPath.parse("Processes[1].Memory[bin:.text]"))
.insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE) .insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE)

View file

@ -25,6 +25,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.thread.DebuggerLegacyThreadsPanel.ThreadTableColumns; import ghidra.app.plugin.core.debug.gui.thread.DebuggerLegacyThreadsPanel.ThreadTableColumns;
@ -33,7 +34,6 @@ import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.thread.TraceThreadManager; import ghidra.trace.model.thread.TraceThreadManager;
import ghidra.trace.model.time.TraceTimeManager; import ghidra.trace.model.time.TraceTimeManager;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test @Category(NightlyCategory.class) // this may actually be an @PortSensitive test
public class DebuggerThreadsProviderLegacyTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerThreadsProviderLegacyTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -52,7 +52,7 @@ public class DebuggerThreadsProviderLegacyTest extends AbstractGhidraHeadedDebug
protected void addThreads() throws Exception { protected void addThreads() throws Exception {
TraceThreadManager manager = tb.trace.getThreadManager(); TraceThreadManager manager = tb.trace.getThreadManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread1 = manager.addThread("Processes[1].Threads[1]", Lifespan.nowOn(0)); thread1 = manager.addThread("Processes[1].Threads[1]", Lifespan.nowOn(0));
thread1.setComment("A comment"); thread1.setComment("A comment");
thread2 = manager.addThread("Processes[1].Threads[2]", Lifespan.span(5, 10)); thread2 = manager.addThread("Processes[1].Threads[2]", Lifespan.span(5, 10));
@ -267,7 +267,7 @@ public class DebuggerThreadsProviderLegacyTest extends AbstractGhidraHeadedDebug
assertEquals(1, threadsProvider.legacyPanel.spanRenderer.getFullRange().max().longValue()); assertEquals(1, threadsProvider.legacyPanel.spanRenderer.getFullRange().max().longValue());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.getSnapshot(10, true); manager.getSnapshot(10, true);
} }
waitForSwing(); waitForSwing();
@ -284,7 +284,7 @@ public class DebuggerThreadsProviderLegacyTest extends AbstractGhidraHeadedDebug
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread1.setDestructionSnap(15); thread1.setDestructionSnap(15);
} }
waitForSwing(); waitForSwing();
@ -304,7 +304,7 @@ public class DebuggerThreadsProviderLegacyTest extends AbstractGhidraHeadedDebug
assertEquals(2, threadsProvider.legacyPanel.threadTableModel.getModelData().size()); assertEquals(2, threadsProvider.legacyPanel.threadTableModel.getModelData().size());
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread2.delete(); thread2.delete();
} }
waitForSwing(); waitForSwing();

View file

@ -25,6 +25,7 @@ import java.util.Set;
import org.junit.*; import org.junit.*;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import docking.widgets.table.*; import docking.widgets.table.*;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
@ -52,7 +53,6 @@ import ghidra.trace.model.target.TraceObjectKeyPath;
import ghidra.trace.model.target.TraceObjectManager; import ghidra.trace.model.target.TraceObjectManager;
import ghidra.trace.model.thread.TraceObjectThread; import ghidra.trace.model.thread.TraceObjectThread;
import ghidra.trace.model.time.TraceTimeManager; import ghidra.trace.model.time.TraceTimeManager;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.table.GhidraTable; import ghidra.util.table.GhidraTable;
@Category(NightlyCategory.class) @Category(NightlyCategory.class)
@ -133,7 +133,7 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerGUI
</schema> </schema>
</context>"""); </context>""");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session"))); tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session")));
} }
} }
@ -154,7 +154,7 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
protected void addThreads() throws Exception { protected void addThreads() throws Exception {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread1 = addThread(1, Lifespan.nowOn(0), "A comment"); thread1 = addThread(1, Lifespan.nowOn(0), "A comment");
thread2 = addThread(2, Lifespan.span(0, 10), "Another comment"); thread2 = addThread(2, Lifespan.span(0, 10), "Another comment");
} }
@ -411,7 +411,7 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerGUI
assertEquals(1, renderer.getFullRange().max().longValue()); assertEquals(1, renderer.getFullRange().max().longValue());
}); });
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
manager.getSnapshot(10, true); manager.getSnapshot(10, true);
} }
waitForSwing(); waitForSwing();
@ -432,7 +432,7 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerGUI
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
waitForTasks(); waitForTasks();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread1.getObject().removeTree(Lifespan.nowOn(16)); thread1.getObject().removeTree(Lifespan.nowOn(16));
} }
waitForTasks(); waitForTasks();
@ -453,7 +453,7 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerGUI
waitForPass(() -> assertThreadsTableSize(2)); waitForPass(() -> assertThreadsTableSize(2));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread2.getObject().removeTree(Lifespan.ALL); thread2.getObject().removeTree(Lifespan.ALL);
} }
waitForTasks(); waitForTasks();

View file

@ -23,6 +23,7 @@ import java.util.List;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import docking.widgets.dialogs.InputDialog; import docking.widgets.dialogs.InputDialog;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin; import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
@ -32,7 +33,6 @@ import ghidra.trace.database.time.DBTraceTimeManager;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
public class DebuggerTimeProviderTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerTimeProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -47,7 +47,7 @@ public class DebuggerTimeProviderTest extends AbstractGhidraHeadedDebuggerGUITes
protected void addSnapshots() { protected void addSnapshots() {
DBTraceTimeManager timeManager = tb.trace.getTimeManager(); DBTraceTimeManager timeManager = tb.trace.getTimeManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceSnapshot first = timeManager.createSnapshot("First"); TraceSnapshot first = timeManager.createSnapshot("First");
Calendar c = Calendar.getInstance(); // System time zone Calendar c = Calendar.getInstance(); // System time zone
c.set(2020, 0, 1, 9, 0, 0); c.set(2020, 0, 1, 9, 0, 0);
@ -60,7 +60,7 @@ public class DebuggerTimeProviderTest extends AbstractGhidraHeadedDebuggerGUITes
protected void addScratchSnapshot() { protected void addScratchSnapshot() {
DBTraceTimeManager timeManager = tb.trace.getTimeManager(); DBTraceTimeManager timeManager = tb.trace.getTimeManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceSnapshot scratch = timeManager.getSnapshot(Long.MIN_VALUE, true); TraceSnapshot scratch = timeManager.getSnapshot(Long.MIN_VALUE, true);
scratch.setDescription("Scratch"); scratch.setDescription("Scratch");
scratch.setSchedule(TraceSchedule.parse("0:t0-5")); scratch.setSchedule(TraceSchedule.parse("0:t0-5"));
@ -149,7 +149,7 @@ public class DebuggerTimeProviderTest extends AbstractGhidraHeadedDebuggerGUITes
public void testActivateByThreadThenAddSnapshotsPopulatesProvider() throws Exception { public void testActivateByThreadThenAddSnapshotsPopulatesProvider() throws Exception {
createSnaplessTrace(); createSnaplessTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.trace.getThreadManager().createThread("Thread 1", 0); thread = tb.trace.getThreadManager().createThread("Thread 1", 0);
} }
traceManager.openTrace(tb.trace); traceManager.openTrace(tb.trace);
@ -193,7 +193,7 @@ public class DebuggerTimeProviderTest extends AbstractGhidraHeadedDebuggerGUITes
assertProviderPopulated(); assertProviderPopulated();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getTimeManager().getSnapshot(10, false).delete(); tb.trace.getTimeManager().getSnapshot(10, false).delete();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -233,13 +233,13 @@ public class DebuggerTimeProviderTest extends AbstractGhidraHeadedDebuggerGUITes
assertProviderEmpty(); assertProviderEmpty();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
addSnapshots(); addSnapshots();
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
assertProviderPopulated(); assertProviderPopulated();
tid.abort(); tx.abort();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);

View file

@ -24,6 +24,7 @@ import java.util.stream.Collectors;
import org.junit.*; import org.junit.*;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin; import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.codebrowser.CodeViewerProvider; import ghidra.app.plugin.core.codebrowser.CodeViewerProvider;
@ -53,7 +54,6 @@ import ghidra.trace.model.memory.*;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.util.TraceRegisterUtils; import ghidra.trace.util.TraceRegisterUtils;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -96,7 +96,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
createTrace(); createTrace();
r0 = tb.language.getRegister("r0"); r0 = tb.language.getRegister("r0");
r1 = tb.language.getRegister("r1"); r1 = tb.language.getRegister("r1");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Thread1", 0); thread = tb.getOrAddThread("Thread1", 0);
} }
} }
@ -112,7 +112,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
private void setRegisterValues(TraceThread thread) { private void setRegisterValues(TraceThread thread) {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regVals = TraceMemorySpace regVals =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
regVals.setValue(0, new RegisterValue(r0, BigInteger.valueOf(0x00400000))); regVals.setValue(0, new RegisterValue(r0, BigInteger.valueOf(0x00400000)));
@ -595,7 +595,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
} }
protected void setupUnmappedDataSection() throws Throwable { protected void setupUnmappedDataSection() throws Throwable {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryOperations mem = tb.trace.getMemoryManager(); TraceMemoryOperations mem = tb.trace.getMemoryManager();
mem.createRegion("Memory[bin:.data]", 0, tb.range(0x00600000, 0x0060ffff), mem.createRegion("Memory[bin:.data]", 0, tb.range(0x00600000, 0x0060ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.WRITE); TraceMemoryFlag.READ, TraceMemoryFlag.WRITE);
@ -612,7 +612,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
intoProject(tb.trace); intoProject(tb.trace);
intoProject(program); intoProject(program);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemoryOperations mem = tb.trace.getMemoryManager(); TraceMemoryOperations mem = tb.trace.getMemoryManager();
mem.createRegion("Memory[bin:.data]", 0, tb.range(0x55750000, 0x5575ffff), mem.createRegion("Memory[bin:.data]", 0, tb.range(0x55750000, 0x5575ffff),
TraceMemoryFlag.READ, TraceMemoryFlag.WRITE); TraceMemoryFlag.READ, TraceMemoryFlag.WRITE);
@ -624,7 +624,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
programManager.openProgram(program); programManager.openProgram(program);
AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace(); AddressSpace stSpace = program.getAddressFactory().getDefaultAddressSpace();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
Memory mem = program.getMemory(); Memory mem = program.getMemory();
mem.createInitializedBlock(".data", tb.addr(stSpace, 0x00600000), 0x10000, mem.createInitializedBlock(".data", tb.addr(stSpace, 0x00600000), 0x10000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
@ -633,7 +633,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
DefaultTraceLocation tloc = DefaultTraceLocation tloc =
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0x55750000)); new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0x55750000));
ProgramLocation ploc = new ProgramLocation(program, tb.addr(stSpace, 0x00600000)); ProgramLocation ploc = new ProgramLocation(program, tb.addr(stSpace, 0x00600000));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingService.addMapping(tloc, ploc, 0x10000, false); mappingService.addMapping(tloc, ploc, 0x10000, false);
} }
waitForValue(() -> mappingService.getOpenMappedLocation(tloc)); waitForValue(() -> mappingService.getOpenMappedLocation(tloc));
@ -681,7 +681,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
structDt.add(DWordDataType.dataType, "field0", ""); structDt.add(DWordDataType.dataType, "field0", "");
structDt.add(DWordDataType.dataType, "field4", ""); structDt.add(DWordDataType.dataType, "field4", "");
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getCodeManager() tb.trace.getCodeManager()
.definedData() .definedData()
.create(Lifespan.nowOn(0), tb.addr(0x00600000), structDt); .create(Lifespan.nowOn(0), tb.addr(0x00600000), structDt);
@ -705,7 +705,7 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
structDt.add(DWordDataType.dataType, "field0", ""); structDt.add(DWordDataType.dataType, "field0", "");
structDt.add(DWordDataType.dataType, "field4", ""); structDt.add(DWordDataType.dataType, "field4", "");
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add data")) { try (Transaction tx = program.openTransaction("Add data")) {
program.getListing().createData(tb.addr(stSpace, 0x00600000), structDt); program.getListing().createData(tb.addr(stSpace, 0x00600000), structDt);
} }
@ -746,11 +746,11 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUI
setupMappedDataSection(); setupMappedDataSection();
Symbol symbol; Symbol symbol;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add symbol")) { try (Transaction tx = program.openTransaction("Add symbol")) {
symbol = program.getSymbolTable() symbol = program.getSymbolTable()
.createLabel(tb.addr(0x00601234), "my_symbol", SourceType.USER_DEFINED); .createLabel(tb.addr(0x00601234), "my_symbol", SourceType.USER_DEFINED);
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceMemorySpace regVals = TraceMemorySpace regVals =
tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
regVals.setValue(0, new RegisterValue(r0, BigInteger.valueOf(0x55751234))); regVals.setValue(0, new RegisterValue(r0, BigInteger.valueOf(0x55751234)));

View file

@ -17,12 +17,12 @@ package ghidra.app.plugin.core.debug.service.breakpoint;
import java.io.IOException; import java.io.IOException;
import db.Transaction;
import ghidra.dbg.target.schema.SchemaContext; import ghidra.dbg.target.schema.SchemaContext;
import ghidra.dbg.target.schema.XmlSchemaContext;
import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName; import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;
import ghidra.dbg.target.schema.XmlSchemaContext;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.target.TraceObjectKeyPath; import ghidra.trace.model.target.TraceObjectKeyPath;
import ghidra.util.database.UndoableTransaction;
public class DebuggerLogicalBreakpointServiceObjectTest public class DebuggerLogicalBreakpointServiceObjectTest
extends DebuggerLogicalBreakpointServiceTest { extends DebuggerLogicalBreakpointServiceTest {
@ -102,7 +102,7 @@ public class DebuggerLogicalBreakpointServiceObjectTest
</context> </context>
""", index)); """, index));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session"))); tb.trace.getObjectManager().createRootObject(ctx.getSchema(new SchemaName("Session")));
tb.trace.getObjectManager() tb.trace.getObjectManager()
.createObject( .createObject(

View file

@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
import org.junit.*; import org.junit.*;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.service.control.DebuggerControlServicePlugin; import ghidra.app.plugin.core.debug.service.control.DebuggerControlServicePlugin;
@ -46,7 +47,6 @@ import ghidra.trace.model.memory.TraceMemoryRegion;
import ghidra.trace.model.modules.TraceStaticMapping; import ghidra.trace.model.modules.TraceStaticMapping;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.SystemUtilities; import ghidra.util.SystemUtilities;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.ListenerMap; import ghidra.util.datastruct.ListenerMap;
public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -256,8 +256,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
} }
protected void addProgramTextBlock(Program p) throws Throwable { protected void addProgramTextBlock(Program p) throws Throwable {
try (UndoableTransaction tid = try (Transaction tx = program.openTransaction("Add .text block")) {
UndoableTransaction.start(program, "Add .text block")) {
p.getMemory() p.getMemory()
.createInitializedBlock(".text", addr(p, 0x00400000), 0x1000, (byte) 0, .createInitializedBlock(".text", addr(p, 0x00400000), 0x1000, (byte) 0,
monitor, false); monitor, false);
@ -281,8 +280,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
Trace t = r.getTrace(); Trace t = r.getTrace();
TraceMemoryRegion textRegion = TraceMemoryRegion textRegion =
waitFor(() -> r.getTraceMemoryRegion(region), "Recorder missed region: " + region); waitFor(() -> r.getTraceMemoryRegion(region), "Recorder missed region: " + region);
try (UndoableTransaction tid = try (Transaction tx = t.openTransaction("Add .text mapping")) {
UndoableTransaction.start(t, "Add .text mapping")) {
DebuggerStaticMappingUtils.addMapping( DebuggerStaticMappingUtils.addMapping(
new DefaultTraceLocation(t, null, textRegion.getLifespan(), new DefaultTraceLocation(t, null, textRegion.getLifespan(),
textRegion.getMinAddress()), textRegion.getMinAddress()),
@ -293,7 +291,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
protected void removeTextMapping(TraceRecorder r, Program p) throws Throwable { protected void removeTextMapping(TraceRecorder r, Program p) throws Throwable {
Trace t = r.getTrace(); Trace t = r.getTrace();
try (UndoableTransaction tid = UndoableTransaction.start(t, "Remove .text mapping")) { try (Transaction tx = t.openTransaction("Remove .text mapping")) {
TraceStaticMapping mapping = TraceStaticMapping mapping =
t.getStaticMappingManager().findContaining(addr(t, 0x55550000), r.getSnap()); t.getStaticMappingManager().findContaining(addr(t, 0x55550000), r.getSnap());
mapping.delete(); mapping.delete();
@ -342,7 +340,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
} }
protected void addProgramBreakpoints(Program p) throws Throwable { protected void addProgramBreakpoints(Program p) throws Throwable {
try (UndoableTransaction tid = UndoableTransaction.start(p, "Create bookmarks")) { try (Transaction tx = p.openTransaction("Create bookmarks")) {
enBm = p.getBookmarkManager() enBm = p.getBookmarkManager()
.setBookmark(addr(p, 0x00400123), .setBookmark(addr(p, 0x00400123),
LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE, "SW_EXECUTE;1", ""); LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE, "SW_EXECUTE;1", "");
@ -363,7 +361,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
} }
protected void removeProgramBreakpoints(Program p) throws Throwable { protected void removeProgramBreakpoints(Program p) throws Throwable {
try (UndoableTransaction tid = UndoableTransaction.start(p, "Remove breakpoints")) { try (Transaction tx = p.openTransaction("Remove breakpoints")) {
p.getBookmarkManager().removeBookmark(enBm); p.getBookmarkManager().removeBookmark(enBm);
p.getBookmarkManager().removeBookmark(disBm); p.getBookmarkManager().removeBookmark(disBm);
} }
@ -1141,13 +1139,13 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
expectMappingChange(() -> addTextMapping(recorder1, text, program)); expectMappingChange(() -> addTextMapping(recorder1, text, program));
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Will abort")) { try (Transaction tx = trace.openTransaction("Will abort")) {
addTargetSoftwareBreakpoint(recorder1, text); addTargetSoftwareBreakpoint(recorder1, text);
waitForDomainObject(trace); waitForDomainObject(trace);
// Sanity // Sanity
assertLogicalBreakpointForMappedSoftwareBreakpoint(trace); assertLogicalBreakpointForMappedSoftwareBreakpoint(trace);
tid.abort(); tx.abort();
} }
waitForDomainObject(trace); waitForDomainObject(trace);
@ -1179,14 +1177,14 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
waitForDomainObject(trace); waitForDomainObject(trace);
changeListener.assertAgreesWithService(); changeListener.assertAgreesWithService();
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Will abort")) { try (Transaction tx = trace.openTransaction("Will abort")) {
expectMappingChange(() -> addTextMapping(recorder1, text, program)); expectMappingChange(() -> addTextMapping(recorder1, text, program));
waitForSwing(); waitForSwing();
// Sanity // Sanity
assertLogicalBreakpointForMappedSoftwareBreakpoint(trace); assertLogicalBreakpointForMappedSoftwareBreakpoint(trace);
expectMappingChange(() -> tid.abort()); expectMappingChange(() -> tx.abort());
} }
waitForPass(() -> { waitForPass(() -> {
@ -1208,7 +1206,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
addProgramTextBlock(program); addProgramTextBlock(program);
TestTargetMemoryRegion text = addTargetTextRegion(mb.testProcess1); TestTargetMemoryRegion text = addTargetTextRegion(mb.testProcess1);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Will abort")) { try (Transaction tx = trace.openTransaction("Will abort")) {
addTargetSoftwareBreakpoint(recorder1, text); addTargetSoftwareBreakpoint(recorder1, text);
expectMappingChange(() -> addTextMapping(recorder1, text, program)); expectMappingChange(() -> addTextMapping(recorder1, text, program));
@ -1217,7 +1215,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
// Sanity // Sanity
assertLogicalBreakpointForMappedSoftwareBreakpoint(trace); assertLogicalBreakpointForMappedSoftwareBreakpoint(trace);
expectMappingChange(() -> tid.abort()); expectMappingChange(() -> tx.abort());
} }
waitForDomainObject(trace); // Duplicative, but for form's sake.... waitForDomainObject(trace); // Duplicative, but for form's sake....
@ -1242,13 +1240,13 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
expectMappingChange(() -> addTextMapping(recorder1, text, program)); expectMappingChange(() -> addTextMapping(recorder1, text, program));
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Will abort")) { try (Transaction tx = program.openTransaction("Will abort")) {
addProgramBreakpoints(program); addProgramBreakpoints(program);
waitForDomainObject(program); waitForDomainObject(program);
// Sanity // Sanity
assertLogicalBreakpointsForMappedBookmarks(trace); assertLogicalBreakpointsForMappedBookmarks(trace);
tid.abort(); tx.abort();
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -1268,7 +1266,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
addProgramTextBlock(program); addProgramTextBlock(program);
TestTargetMemoryRegion text = addTargetTextRegion(mb.testProcess1); TestTargetMemoryRegion text = addTargetTextRegion(mb.testProcess1);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Will undo")) { try (Transaction tx = trace.openTransaction("Will undo")) {
addTargetSoftwareBreakpoint(recorder1, text); addTargetSoftwareBreakpoint(recorder1, text);
expectMappingChange(() -> addTextMapping(recorder1, text, program)); expectMappingChange(() -> addTextMapping(recorder1, text, program));
} }
@ -1310,7 +1308,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
expectMappingChange(() -> addTextMapping(recorder1, text, program)); expectMappingChange(() -> addTextMapping(recorder1, text, program));
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Will undo")) { try (Transaction tx = program.openTransaction("Will undo")) {
addProgramBreakpoints(program); addProgramBreakpoints(program);
} }
waitForDomainObject(program); waitForDomainObject(program);
@ -1536,7 +1534,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
protected void addTextMappingDead(Program p, ToyDBTraceBuilder tb) throws Throwable { protected void addTextMappingDead(Program p, ToyDBTraceBuilder tb) throws Throwable {
addProgramTextBlock(p); addProgramTextBlock(p);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tid = tb.startTransaction()) {
TraceMemoryRegion textRegion = tb.trace.getMemoryManager() TraceMemoryRegion textRegion = tb.trace.getMemoryManager()
.addRegion("Processes[1].Memory[bin:.text]", Lifespan.nowOn(0), .addRegion("Processes[1].Memory[bin:.text]", Lifespan.nowOn(0),
tb.range(0x55550000, 0x55550fff), tb.range(0x55550000, 0x55550fff),
@ -1550,8 +1548,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
} }
protected void addEnabledProgramBreakpointWithSleigh(Program p) { protected void addEnabledProgramBreakpointWithSleigh(Program p) {
try (UndoableTransaction tid = try (Transaction tid = p.openTransaction("Create bookmark bp with sleigh")) {
UndoableTransaction.start(p, "Create bookmark bp with sleigh")) {
enBm = p.getBookmarkManager() enBm = p.getBookmarkManager()
.setBookmark(addr(p, 0x00400123), .setBookmark(addr(p, 0x00400123),
LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE, "SW_EXECUTE;1", LogicalBreakpoint.BREAKPOINT_ENABLED_BOOKMARK_TYPE, "SW_EXECUTE;1",
@ -1632,7 +1629,7 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
intoProject(program); intoProject(program);
programManager.openProgram(program); programManager.openProgram(program);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tid = tb.startTransaction()) {
TraceBreakpoint bpt = tb.trace.getBreakpointManager() TraceBreakpoint bpt = tb.trace.getBreakpointManager()
.addBreakpoint("Processes[1].Breakpoints[0]", Lifespan.nowOn(0), .addBreakpoint("Processes[1].Breakpoints[0]", Lifespan.nowOn(0),
tb.addr(0x55550123), tb.addr(0x55550123),

View file

@ -18,6 +18,7 @@ package ghidra.app.plugin.core.debug.service.control;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
import db.Transaction;
import ghidra.app.plugin.core.debug.mapping.DebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.mapping.DebuggerTargetTraceMapper;
import ghidra.app.plugin.core.debug.mapping.ObjectBasedDebuggerTargetTraceMapper; import ghidra.app.plugin.core.debug.mapping.ObjectBasedDebuggerTargetTraceMapper;
import ghidra.app.plugin.core.debug.service.model.DebuggerModelServicePlugin; import ghidra.app.plugin.core.debug.service.model.DebuggerModelServicePlugin;
@ -28,13 +29,12 @@ import ghidra.program.model.lang.LanguageID;
import ghidra.trace.model.Trace; import ghidra.trace.model.Trace;
import ghidra.trace.model.guest.TraceGuestPlatform; import ghidra.trace.model.guest.TraceGuestPlatform;
import ghidra.trace.model.guest.TracePlatform; import ghidra.trace.model.guest.TracePlatform;
import ghidra.util.database.UndoableTransaction;
public class DebuggerControlServiceGuestTest extends DebuggerControlServiceTest { public class DebuggerControlServiceGuestTest extends DebuggerControlServiceTest {
protected TraceGuestPlatform platform; protected TraceGuestPlatform platform;
public void createToyPlatform() { public void createToyPlatform() {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
platform = tb.trace.getPlatformManager() platform = tb.trace.getPlatformManager()
.addGuestPlatform(getToyBE64Language().getDefaultCompilerSpec()); .addGuestPlatform(getToyBE64Language().getDefaultCompilerSpec());
platform.addMappedRegisterRange(); platform.addMappedRegisterRange();

View file

@ -23,10 +23,10 @@ import java.nio.ByteBuffer;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.assembler.*; import ghidra.app.plugin.assembler.*;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.service.control.DebuggerControlServicePlugin;
import ghidra.app.services.*; import ghidra.app.services.*;
import ghidra.app.services.DebuggerControlService.StateEditor; import ghidra.app.services.DebuggerControlService.StateEditor;
import ghidra.async.AsyncUtils.TemperamentalRunnable; import ghidra.async.AsyncUtils.TemperamentalRunnable;
@ -38,7 +38,6 @@ import ghidra.trace.model.guest.TracePlatform;
import ghidra.trace.model.memory.TraceMemorySpace; import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
protected DebuggerControlService editingService; protected DebuggerControlService editingService;
@ -134,7 +133,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUIT
createAndOpenTrace(); createAndOpenTrace();
editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR); editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// NB. TraceManager should automatically activate the first thread // NB. TraceManager should automatically activate the first thread
tb.getOrAddThread("Threads[0]", 0); tb.getOrAddThread("Threads[0]", 0);
} }
@ -161,7 +160,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUIT
editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR); editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR);
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// NB. TraceManager should automatically activate the first thread // NB. TraceManager should automatically activate the first thread
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
} }
@ -189,7 +188,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUIT
createAndOpenTrace(); createAndOpenTrace();
editingService.setCurrentMode(tb.trace, ControlMode.RW_TRACE); editingService.setCurrentMode(tb.trace, ControlMode.RW_TRACE);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// NB. TraceManager should automatically activate the first thread // NB. TraceManager should automatically activate the first thread
TraceThread thread = tb.getOrAddThread("Threads[0]", 0); TraceThread thread = tb.getOrAddThread("Threads[0]", 0);
Assembler asm = Assemblers.getAssembler(getPlatform().getLanguage()); Assembler asm = Assemblers.getAssembler(getPlatform().getLanguage());
@ -228,7 +227,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUIT
editingService.setCurrentMode(tb.trace, ControlMode.RW_TRACE); editingService.setCurrentMode(tb.trace, ControlMode.RW_TRACE);
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// NB. TraceManager should automatically activate the first thread // NB. TraceManager should automatically activate the first thread
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
Assembler asm = Assemblers.getAssembler(getPlatform().getLanguage()); Assembler asm = Assemblers.getAssembler(getPlatform().getLanguage());
@ -267,7 +266,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUIT
createAndOpenTrace(); createAndOpenTrace();
editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR); editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR);
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// NB. TraceManager should automatically activate the first thread // NB. TraceManager should automatically activate the first thread
tb.getOrAddThread("Threads[0]", 0); tb.getOrAddThread("Threads[0]", 0);
} }
@ -297,7 +296,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUIT
editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR); editingService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR);
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// NB. TraceManager should automatically activate the first thread // NB. TraceManager should automatically activate the first thread
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
} }
@ -367,7 +366,7 @@ public class DebuggerControlServiceTest extends AbstractGhidraHeadedDebuggerGUIT
editingService.setCurrentMode(tb.trace, ControlMode.RW_TRACE); editingService.setCurrentMode(tb.trace, ControlMode.RW_TRACE);
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
// NB. TraceManager should automatically activate the first thread // NB. TraceManager should automatically activate the first thread
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
} }

View file

@ -26,6 +26,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.Unique; import generic.Unique;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.assembler.*; import ghidra.app.plugin.assembler.*;
@ -36,8 +37,8 @@ import ghidra.app.plugin.core.debug.mapping.DebuggerPlatformMapper;
import ghidra.app.plugin.core.debug.mapping.DebuggerPlatformOpinion; import ghidra.app.plugin.core.debug.mapping.DebuggerPlatformOpinion;
import ghidra.app.plugin.core.debug.service.platform.DebuggerPlatformServicePlugin; import ghidra.app.plugin.core.debug.service.platform.DebuggerPlatformServicePlugin;
import ghidra.app.services.DebuggerEmulationService.EmulationResult; import ghidra.app.services.DebuggerEmulationService.EmulationResult;
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
import ghidra.app.services.DebuggerStaticMappingService; import ghidra.app.services.DebuggerStaticMappingService;
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
import ghidra.pcode.exec.InterruptPcodeExecutionException; import ghidra.pcode.exec.InterruptPcodeExecutionException;
import ghidra.pcode.utils.Utils; import ghidra.pcode.utils.Utils;
import ghidra.program.model.address.Address; import ghidra.program.model.address.Address;
@ -57,7 +58,6 @@ import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.Scheduler; import ghidra.trace.model.time.schedule.Scheduler;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor; import ghidra.util.task.TaskMonitor;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test @Category(NightlyCategory.class) // this may actually be an @PortSensitive test
@ -84,7 +84,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Register regPC = program.getRegister("pc"); Register regPC = program.getRegister("pc");
Register regR0 = program.getRegister("r0"); Register regR0 = program.getRegister("r0");
Register regR1 = program.getRegister("r1"); Register regR1 = program.getRegister("r1");
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -139,7 +139,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Register regPC = program.getRegister("pc"); Register regPC = program.getRegister("pc");
Register regR0 = program.getRegister("r0"); Register regR0 = program.getRegister("r0");
Register regR1 = program.getRegister("r1"); Register regR1 = program.getRegister("r1");
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -197,7 +197,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Register regPC = program.getRegister("PC"); Register regPC = program.getRegister("PC");
Register regW0 = program.getRegister("W0"); Register regW0 = program.getRegister("W0");
Register regW1 = program.getRegister("W1"); Register regW1 = program.getRegister("W1");
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -251,7 +251,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Memory memory = program.getMemory(); Memory memory = program.getMemory();
Address addrText = addr(program, 0x00400000); Address addrText = addr(program, 0x00400000);
Address addrData = addr(program, 0x00600000); Address addrData = addr(program, 0x00600000);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock("text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock("text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -271,7 +271,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
CompletableFuture<Void> settled; CompletableFuture<Void> settled;
TraceThread thread; TraceThread thread;
TraceMemorySpace regs; TraceMemorySpace regs;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
regs = tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true); regs = tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true);
regs.setValue(0, new RegisterValue(program.getLanguage().getProgramCounter(), regs.setValue(0, new RegisterValue(program.getLanguage().getProgramCounter(),
@ -304,7 +304,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
AssemblyBuffer buf = new AssemblyBuffer(asm, tb.addr(x64, 0x00400000)); AssemblyBuffer buf = new AssemblyBuffer(asm, tb.addr(x64, 0x00400000));
TraceMemoryManager mem = tb.trace.getMemoryManager(); TraceMemoryManager mem = tb.trace.getMemoryManager();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
buf.assemble("MOV RAX, qword ptr [0x00600800]"); buf.assemble("MOV RAX, qword ptr [0x00600800]");
mem.putBytes(0, tb.addr(0x00400000), ByteBuffer.wrap(buf.getBytes())); mem.putBytes(0, tb.addr(0x00400000), ByteBuffer.wrap(buf.getBytes()));
@ -330,7 +330,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
waitForPass(() -> assertEquals(x64, traceManager.getCurrentPlatform().getLanguage())); waitForPass(() -> assertEquals(x64, traceManager.getCurrentPlatform().getLanguage()));
TracePlatform platform = traceManager.getCurrentPlatform(); TracePlatform platform = traceManager.getCurrentPlatform();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.exec(platform, 0, thread, 0, "RIP = 0x00400000;"); tb.exec(platform, 0, thread, 0, "RIP = 0x00400000;");
} }
@ -355,7 +355,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Register regR1 = program.getRegister("r1"); Register regR1 = program.getRegister("r1");
Register regR2 = program.getRegister("r2"); Register regR2 = program.getRegister("r2");
Address addrI2; Address addrI2;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -381,7 +381,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
TraceThread thread = Unique.assertOne(trace.getThreadManager().getAllThreads()); TraceThread thread = Unique.assertOne(trace.getThreadManager().getAllThreads());
TraceMemorySpace regs = trace.getMemoryManager().getMemoryRegisterSpace(thread, false); TraceMemorySpace regs = trace.getMemoryManager().getMemoryRegisterSpace(thread, false);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add breakpoint")) { try (Transaction tx = trace.openTransaction("Add breakpoint")) {
trace.getBreakpointManager() trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrI2, Set.of(thread), .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrI2, Set.of(thread),
Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test"); Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test");
@ -414,7 +414,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Address addrText = addr(program, 0x000400000); Address addrText = addr(program, 0x000400000);
Address addrI1; Address addrI1;
Address addrI2; Address addrI2;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -439,7 +439,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
TraceThread thread = Unique.assertOne(trace.getThreadManager().getAllThreads()); TraceThread thread = Unique.assertOne(trace.getThreadManager().getAllThreads());
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add breakpoint")) { try (Transaction tx = trace.openTransaction("Add breakpoint")) {
trace.getBreakpointManager() trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrText, Set.of(thread), .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrText, Set.of(thread),
Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test"); Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test");
@ -476,7 +476,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Register regR1 = program.getRegister("r1"); Register regR1 = program.getRegister("r1");
Register regR2 = program.getRegister("r2"); Register regR2 = program.getRegister("r2");
Address addrI2; Address addrI2;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -502,7 +502,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
TraceThread thread = Unique.assertOne(trace.getThreadManager().getAllThreads()); TraceThread thread = Unique.assertOne(trace.getThreadManager().getAllThreads());
TraceMemorySpace regs = trace.getMemoryManager().getMemoryRegisterSpace(thread, false); TraceMemorySpace regs = trace.getMemoryManager().getMemoryRegisterSpace(thread, false);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add breakpoint")) { try (Transaction tx = trace.openTransaction("Add breakpoint")) {
TraceBreakpoint tb = trace.getBreakpointManager() TraceBreakpoint tb = trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrI2, Set.of(thread), .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrI2, Set.of(thread),
Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test"); Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test");
@ -542,7 +542,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Register regR0 = program.getRegister("r0"); Register regR0 = program.getRegister("r0");
Register regR1 = program.getRegister("r1"); Register regR1 = program.getRegister("r1");
Register regR2 = program.getRegister("r2"); Register regR2 = program.getRegister("r2");
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -568,7 +568,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
TraceMemoryManager mem = trace.getMemoryManager(); TraceMemoryManager mem = trace.getMemoryManager();
TraceMemorySpace regs = mem.getMemoryRegisterSpace(thread, false); TraceMemorySpace regs = mem.getMemoryRegisterSpace(thread, false);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add breakpoint")) { try (Transaction tx = trace.openTransaction("Add breakpoint")) {
trace.getBreakpointManager() trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addr(trace, 0x1234), .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addr(trace, 0x1234),
Set.of(thread), Set.of(TraceBreakpointKind.READ), true, "test"); Set.of(thread), Set.of(TraceBreakpointKind.READ), true, "test");
@ -605,7 +605,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
Register regR0 = program.getRegister("r0"); Register regR0 = program.getRegister("r0");
Register regR2 = program.getRegister("r2"); Register regR2 = program.getRegister("r2");
Address addrI2; Address addrI2;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Initialize")) { try (Transaction tx = program.openTransaction("Initialize")) {
MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000, MemoryBlock blockText = memory.createInitializedBlock(".text", addrText, 0x1000,
(byte) 0, TaskMonitor.DUMMY, false); (byte) 0, TaskMonitor.DUMMY, false);
blockText.setExecute(true); blockText.setExecute(true);
@ -646,7 +646,7 @@ public class DebuggerEmulationServiceTest extends AbstractGhidraHeadedDebuggerGU
regs.getViewValue(scratch, regR2).getUnsignedValue()); regs.getViewValue(scratch, regR2).getUnsignedValue());
// Inject some logic that would require a cache refresh to materialize // Inject some logic that would require a cache refresh to materialize
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add breakpoint")) { try (Transaction tx = trace.openTransaction("Add breakpoint")) {
TraceBreakpoint tb = trace.getBreakpointManager() TraceBreakpoint tb = trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrI2, Set.of(thread), .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), addrI2, Set.of(thread),
Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test"); Set.of(TraceBreakpointKind.SW_EXECUTE), true, "test");

View file

@ -22,6 +22,7 @@ import java.util.Map.Entry;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.mapping.DebuggerRegisterMapper; import ghidra.app.plugin.core.debug.mapping.DebuggerRegisterMapper;
import ghidra.app.services.ActionSource; import ghidra.app.services.ActionSource;
@ -36,7 +37,6 @@ import ghidra.trace.model.*;
import ghidra.trace.model.listing.TraceCodeSpace; import ghidra.trace.model.listing.TraceCodeSpace;
import ghidra.trace.model.memory.*; import ghidra.trace.model.memory.*;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
public class DefaultTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITest { public class DefaultTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -73,8 +73,7 @@ public class DefaultTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITes
} }
protected TraceMemorySpace createRegSpace(TraceThread thread) { protected TraceMemorySpace createRegSpace(TraceThread thread) {
try (UndoableTransaction tid = try (Transaction tx = thread.getTrace().openTransaction("Create register space")) {
UndoableTransaction.start(thread.getTrace(), "Create register space")) {
return thread.getTrace().getMemoryManager().getMemoryRegisterSpace(thread, true); return thread.getTrace().getMemoryManager().getMemoryRegisterSpace(thread, true);
} }
} }
@ -140,7 +139,7 @@ public class DefaultTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITes
mb.testProcess1.regs.addRegistersFromLanguage(getToyBE64Language(), mb.testProcess1.regs.addRegistersFromLanguage(getToyBE64Language(),
r -> r.isBaseRegister() && r != pc && r != sp); r -> r.isBaseRegister() && r != pc && r != sp);
TestTargetRegisterBankInThread regs = mb.testThread1.addRegisterBank(); TestTargetRegisterBankInThread regs = mb.testThread1.addRegisterBank();
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add PC type")) { try (Transaction tx = trace.openTransaction("Add PC type")) {
TraceCodeSpace code = trace.getCodeManager().getCodeRegisterSpace(thread, true); TraceCodeSpace code = trace.getCodeManager().getCodeRegisterSpace(thread, true);
code.definedData().create(Lifespan.nowOn(0), pc, PointerDataType.dataType); code.definedData().create(Lifespan.nowOn(0), pc, PointerDataType.dataType);
} }
@ -189,7 +188,7 @@ public class DefaultTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITes
mb.testProcess1.regs.addRegistersFromLanguage(getToyBE64Language(), mb.testProcess1.regs.addRegistersFromLanguage(getToyBE64Language(),
r -> r.isBaseRegister() && r != pc && r != sp); r -> r.isBaseRegister() && r != pc && r != sp);
TestTargetRegisterBankInThread regs = mb.testThread1.addRegisterBank(); TestTargetRegisterBankInThread regs = mb.testThread1.addRegisterBank();
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add SP type")) { try (Transaction tx = trace.openTransaction("Add SP type")) {
TraceCodeSpace code = trace.getCodeManager().getCodeRegisterSpace(thread, true); TraceCodeSpace code = trace.getCodeManager().getCodeRegisterSpace(thread, true);
code.definedData().create(Lifespan.nowOn(0), sp, PointerDataType.dataType); code.definedData().create(Lifespan.nowOn(0), sp, PointerDataType.dataType);
} }
@ -238,7 +237,7 @@ public class DefaultTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITes
//waitForCondition(() -> registerMapped(recorder, thread, pc)); //waitForCondition(() -> registerMapped(recorder, thread, pc));
TraceThread thread = waitForValue(() -> recorder.getTraceThread(mb.testThread1)); TraceThread thread = waitForValue(() -> recorder.getTraceThread(mb.testThread1));
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Add PC type")) { try (Transaction tx = trace.openTransaction("Add PC type")) {
TraceCodeSpace code = trace.getCodeManager().getCodeRegisterSpace(thread, true); TraceCodeSpace code = trace.getCodeManager().getCodeRegisterSpace(thread, true);
code.definedData().create(Lifespan.nowOn(0), pc, PointerDataType.dataType); code.definedData().create(Lifespan.nowOn(0), pc, PointerDataType.dataType);
} }

View file

@ -23,6 +23,7 @@ import java.util.*;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.services.DebuggerStaticMappingService; import ghidra.app.services.DebuggerStaticMappingService;
import ghidra.app.services.DebuggerStaticMappingService.MappedAddressRange; import ghidra.app.services.DebuggerStaticMappingService.MappedAddressRange;
@ -37,7 +38,6 @@ import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.memory.TraceMemoryRegion; import ghidra.trace.model.memory.TraceMemoryRegion;
import ghidra.trace.model.modules.*; import ghidra.trace.model.modules.*;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
// Not technically a GUI test, but must be carried out in the context of a plugin tool // Not technically a GUI test, but must be carried out in the context of a plugin tool
public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -75,7 +75,7 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebugg
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0),
dynSpace.getAddress(0x00100000)); dynSpace.getAddress(0x00100000));
ProgramLocation to = new ProgramLocation(program, stSpace.getAddress(0x00200000)); ProgramLocation to = new ProgramLocation(program, stSpace.getAddress(0x00200000));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DebuggerStaticMappingUtils.addMapping(from, to, 0x1000, false); DebuggerStaticMappingUtils.addMapping(from, to, 0x1000, false);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -85,7 +85,7 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebugg
TraceLocation from = new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(10), TraceLocation from = new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(10),
dynSpace.getAddress(0x00100800)); dynSpace.getAddress(0x00100800));
ProgramLocation to = new ProgramLocation(program, stSpace.getAddress(0x00300000)); ProgramLocation to = new ProgramLocation(program, stSpace.getAddress(0x00300000));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DebuggerStaticMappingUtils.addMapping(from, to, 0x1000, truncateExisting); DebuggerStaticMappingUtils.addMapping(from, to, 0x1000, truncateExisting);
} }
} }
@ -104,7 +104,7 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebugg
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0),
dynSpace.getAddress(0x00102000)); dynSpace.getAddress(0x00102000));
ProgramLocation to = new ProgramLocation(program, stSpace.getAddress(0x00200000)); ProgramLocation to = new ProgramLocation(program, stSpace.getAddress(0x00200000));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DebuggerStaticMappingUtils.addMapping(from, to, 0x800, false); DebuggerStaticMappingUtils.addMapping(from, to, 0x800, false);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -550,12 +550,12 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebugg
TraceLocation goodLoc = TraceLocation goodLoc =
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0),
dynSpace.getAddress(0x00100c0d)); dynSpace.getAddress(0x00100c0d));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingManager.findContaining(dynSpace.getAddress(0x00100000), 0).delete(); mappingManager.findContaining(dynSpace.getAddress(0x00100000), 0).delete();
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
// pre-check // pre-check
assertNull(mappingService.getOpenMappedLocation(goodLoc)); assertNull(mappingService.getOpenMappedLocation(goodLoc));
tid.abort(); tx.abort();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -573,7 +573,7 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebugg
// pre-pre-check // pre-pre-check
assertNotNull(mappingService.getOpenMappedLocation(goodLoc)); assertNotNull(mappingService.getOpenMappedLocation(goodLoc));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
mappingManager.findContaining(dynSpace.getAddress(0x00100000), 0).delete(); mappingManager.findContaining(dynSpace.getAddress(0x00100000), 0).delete();
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -594,7 +594,7 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebugg
public void testGroupRegionsByLikelyModule() throws Exception { public void testGroupRegionsByLikelyModule() throws Exception {
TraceMemoryRegion echoText, echoData, libText, libData; TraceMemoryRegion echoText, echoData, libText, libData;
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
echoText = mm.createRegion("Memory.Regions[/bin/echo (0x00400000)]", echoText = mm.createRegion("Memory.Regions[/bin/echo (0x00400000)]",
0, tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE); 0, tb.range(0x00400000, 0x0040ffff), TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE);
echoData = mm.createRegion("Memory.Regions[/bin/echo (0x00600000)]", echoData = mm.createRegion("Memory.Regions[/bin/echo (0x00600000)]",
@ -620,7 +620,7 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebugg
@Test @Test
public void testMapFullSpace() throws Exception { public void testMapFullSpace() throws Exception {
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
TraceLocation traceLoc = TraceLocation traceLoc =
new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0)); new DefaultTraceLocation(tb.trace, null, Lifespan.nowOn(0), tb.addr(0));
ProgramLocation progLoc = new ProgramLocation(program, stSpace.getAddress(0)); ProgramLocation progLoc = new ProgramLocation(program, stSpace.getAddress(0));

View file

@ -23,6 +23,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import db.Transaction;
import generic.test.category.NightlyCategory; import generic.test.category.NightlyCategory;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
@ -42,7 +43,6 @@ import ghidra.trace.model.target.TraceObject;
import ghidra.trace.model.target.TraceObjectKeyPath; import ghidra.trace.model.target.TraceObjectKeyPath;
import ghidra.trace.model.thread.TraceObjectThread; import ghidra.trace.model.thread.TraceObjectThread;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test @Category(NightlyCategory.class) // this may actually be an @PortSensitive test
public class DebuggerTraceManagerServiceTest extends AbstractGhidraHeadedDebuggerGUITest { public class DebuggerTraceManagerServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -131,7 +131,7 @@ public class DebuggerTraceManagerServiceTest extends AbstractGhidraHeadedDebugge
assertNull(traceManager.getCurrentThread()); assertNull(traceManager.getCurrentThread());
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Thread 1", 0); thread = tb.getOrAddThread("Thread 1", 0);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -231,7 +231,7 @@ public class DebuggerTraceManagerServiceTest extends AbstractGhidraHeadedDebugge
SchemaContext ctx = XmlSchemaContext.deserialize(DBTraceObjectManagerTest.XML_CTX); SchemaContext ctx = XmlSchemaContext.deserialize(DBTraceObjectManagerTest.XML_CTX);
TraceObject objThread0; TraceObject objThread0;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceObjectManager objectManager = tb.trace.getObjectManager(); DBTraceObjectManager objectManager = tb.trace.getObjectManager();
objectManager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild(); objectManager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();
objThread0 = objThread0 =

View file

@ -25,6 +25,7 @@ import java.util.function.Predicate;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import docking.widgets.fieldpanel.Layout; import docking.widgets.fieldpanel.Layout;
import docking.widgets.fieldpanel.field.Field; import docking.widgets.fieldpanel.field.Field;
import docking.widgets.fieldpanel.support.FieldLocation; import docking.widgets.fieldpanel.support.FieldLocation;
@ -48,8 +49,8 @@ import ghidra.app.plugin.core.decompile.DecompilePlugin;
import ghidra.app.plugin.core.decompile.DecompilerProvider; import ghidra.app.plugin.core.decompile.DecompilerProvider;
import ghidra.app.plugin.core.disassembler.DisassemblerPlugin; import ghidra.app.plugin.core.disassembler.DisassemblerPlugin;
import ghidra.app.services.*; import ghidra.app.services.*;
import ghidra.app.services.DebuggerEmulationService.EmulationResult;
import ghidra.app.services.DebuggerControlService.StateEditor; import ghidra.app.services.DebuggerControlService.StateEditor;
import ghidra.app.services.DebuggerEmulationService.EmulationResult;
import ghidra.app.util.viewer.field.FieldFactory; import ghidra.app.util.viewer.field.FieldFactory;
import ghidra.app.util.viewer.field.ListingField; import ghidra.app.util.viewer.field.ListingField;
import ghidra.app.util.viewer.listingpanel.ListingPanel; import ghidra.app.util.viewer.listingpanel.ListingPanel;
@ -78,7 +79,6 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.Scheduler; import ghidra.trace.model.time.schedule.Scheduler;
import ghidra.util.Msg; import ghidra.util.Msg;
import ghidra.util.NumericUtilities; import ghidra.util.NumericUtilities;
import ghidra.util.database.UndoableTransaction;
public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest { public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
@ -135,7 +135,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
protected Function createSumSquaresProgramX86_32() throws Throwable { protected Function createSumSquaresProgramX86_32() throws Throwable {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
Address entry = addr(program, 0x00400000); Address entry = addr(program, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false); .createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false);
@ -199,7 +199,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
protected Function createFibonacciProgramX86_32() throws Throwable { protected Function createFibonacciProgramX86_32() throws Throwable {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
Address entry = addr(program, 0x00400000); Address entry = addr(program, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false); .createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false);
@ -276,7 +276,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
Address entry; Address entry;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
entry = addr(program, 0x00400000); entry = addr(program, 0x00400000);
Address externs = addr(program, 0x00700000); Address externs = addr(program, 0x00700000);
program.getMemory() program.getMemory()
@ -338,7 +338,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
Address entry; Address entry;
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
entry = addr(program, 0x00400000); entry = addr(program, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false); .createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false);
@ -393,7 +393,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
Address entry = addr(program, 0x00400000); Address entry = addr(program, 0x00400000);
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false); .createInitializedBlock(".text", entry, 0x1000, (byte) 0, monitor, false);
@ -430,7 +430,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
ProgramBasedDataTypeManager dtm = program.getDataTypeManager(); ProgramBasedDataTypeManager dtm = program.getDataTypeManager();
Structure structure = new StructureDataType("MyStruct", 0, dtm); Structure structure = new StructureDataType("MyStruct", 0, dtm);
structure.add(WordDataType.dataType, "y", ""); structure.add(WordDataType.dataType, "y", "");
@ -515,7 +515,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
createProgram("x86:LE:32:default", "gcc"); createProgram("x86:LE:32:default", "gcc");
intoProject(program); intoProject(program);
try (UndoableTransaction tid = UndoableTransaction.start(program, "Assemble")) { try (Transaction tx = program.openTransaction("Assemble")) {
ProgramBasedDataTypeManager dtm = program.getDataTypeManager(); ProgramBasedDataTypeManager dtm = program.getDataTypeManager();
Structure structure = new StructureDataType("MyStruct", 0, dtm); Structure structure = new StructureDataType("MyStruct", 0, dtm);
structure.add(WordDataType.dataType, "y", ""); structure.add(WordDataType.dataType, "y", "");
@ -702,7 +702,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
waitOn(frameAtSetup.setValue(editor, param1, BigInteger.valueOf(4))); waitOn(frameAtSetup.setValue(editor, param1, BigInteger.valueOf(4)));
waitForTasks(); waitForTasks();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getBreakpointManager() tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, Set.of(), .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, Set.of(),
Set.of(TraceBreakpointKind.SW_EXECUTE), true, "capture return value"); Set.of(TraceBreakpointKind.SW_EXECUTE), true, "capture return value");
@ -764,7 +764,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
waitForTasks(); waitForTasks();
TraceBreakpoint bptUnwind; TraceBreakpoint bptUnwind;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
bptUnwind = tb.trace.getBreakpointManager() bptUnwind = tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr,
Set.of(), Set.of(),
@ -802,7 +802,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
} }
} }
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
bptUnwind.delete(); bptUnwind.delete();
} }
@ -845,7 +845,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
waitForSwing(); waitForSwing();
DebuggerCoordinates atSetup = traceManager.getCurrent(); DebuggerCoordinates atSetup = traceManager.getCurrent();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
new UnwindStackCommand(tool, atSetup).applyTo(tb.trace, monitor); new UnwindStackCommand(tool, atSetup).applyTo(tb.trace, monitor);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -907,7 +907,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
waitOn(frameAtSetup.setReturnAddress(editor, tb.addr(0xdeadbeef))); waitOn(frameAtSetup.setReturnAddress(editor, tb.addr(0xdeadbeef)));
waitForTasks(); waitForTasks();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getBreakpointManager() tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr,
Set.of(), Set.of(),
@ -921,7 +921,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
traceManager.activateTime(result.schedule()); traceManager.activateTime(result.schedule());
waitForTasks(); waitForTasks();
DebuggerCoordinates tallest = traceManager.getCurrent(); DebuggerCoordinates tallest = traceManager.getCurrent();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
new UnwindStackCommand(tool, tallest).applyTo(tb.trace, monitor); new UnwindStackCommand(tool, tallest).applyTo(tb.trace, monitor);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -950,7 +950,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
Register sp = program.getCompilerSpec().getStackPointer(); Register sp = program.getCompilerSpec().getStackPointer();
waitOn(editor.setRegister(new RegisterValue(sp, BigInteger.valueOf(0x4ff0)))); waitOn(editor.setRegister(new RegisterValue(sp, BigInteger.valueOf(0x4ff0))));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getBreakpointManager() tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr,
Set.of(), Set.of(),
@ -965,7 +965,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
traceManager.activateTime(result.schedule()); traceManager.activateTime(result.schedule());
waitForTasks(); waitForTasks();
DebuggerCoordinates atRet = traceManager.getCurrent(); DebuggerCoordinates atRet = traceManager.getCurrent();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
new UnwindStackCommand(tool, atRet).applyTo(tb.trace, monitor); new UnwindStackCommand(tool, atRet).applyTo(tb.trace, monitor);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -994,7 +994,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
Register sp = program.getCompilerSpec().getStackPointer(); Register sp = program.getCompilerSpec().getStackPointer();
waitOn(editor.setRegister(new RegisterValue(sp, BigInteger.valueOf(0x4ff0)))); waitOn(editor.setRegister(new RegisterValue(sp, BigInteger.valueOf(0x4ff0))));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getBreakpointManager() tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr,
Set.of(), Set.of(),
@ -1009,7 +1009,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
traceManager.activateTime(result.schedule()); traceManager.activateTime(result.schedule());
waitForTasks(); waitForTasks();
DebuggerCoordinates atRet = traceManager.getCurrent(); DebuggerCoordinates atRet = traceManager.getCurrent();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
new UnwindStackCommand(tool, atRet).applyTo(tb.trace, monitor); new UnwindStackCommand(tool, atRet).applyTo(tb.trace, monitor);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -1038,7 +1038,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
Register sp = program.getCompilerSpec().getStackPointer(); Register sp = program.getCompilerSpec().getStackPointer();
waitOn(editor.setRegister(new RegisterValue(sp, BigInteger.valueOf(0x4ff0)))); waitOn(editor.setRegister(new RegisterValue(sp, BigInteger.valueOf(0x4ff0))));
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getBreakpointManager() tb.trace.getBreakpointManager()
.addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr, .addBreakpoint("Breakpoints[0]", Lifespan.nowOn(0), retInstr,
Set.of(), Set.of(),
@ -1053,7 +1053,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
traceManager.activateTime(result.schedule()); traceManager.activateTime(result.schedule());
waitForTasks(); waitForTasks();
DebuggerCoordinates atRet = traceManager.getCurrent(); DebuggerCoordinates atRet = traceManager.getCurrent();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
new UnwindStackCommand(tool, atRet).applyTo(tb.trace, monitor); new UnwindStackCommand(tool, atRet).applyTo(tb.trace, monitor);
} }
waitForDomainObject(tb.trace); waitForDomainObject(tb.trace);
@ -1261,7 +1261,7 @@ public class StackUnwinderTest extends AbstractGhidraHeadedDebuggerGUITest {
TraceLocation dynLoc = mappingService.getOpenMappedLocation(tb.trace, TraceLocation dynLoc = mappingService.getOpenMappedLocation(tb.trace,
new ProgramLocation(program, stIns.getAddress()), current.getSnap()); new ProgramLocation(program, stIns.getAddress()), current.getSnap());
Address dynamicAddress = dynLoc.getAddress(); Address dynamicAddress = dynLoc.getAddress();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
int length = stIns.getLength(); int length = stIns.getLength();
assertEquals(length, tb.trace.getMemoryManager() assertEquals(length, tb.trace.getMemoryManager()
.putBytes(current.getSnap(), dynamicAddress, .putBytes(current.getSnap(), dynamicAddress,

View file

@ -29,6 +29,7 @@ import java.util.function.Function;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import generic.Unique; import generic.Unique;
import ghidra.app.plugin.assembler.Assembler; import ghidra.app.plugin.assembler.Assembler;
import ghidra.app.plugin.assembler.Assemblers; import ghidra.app.plugin.assembler.Assemblers;
@ -65,7 +66,6 @@ import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.trace.model.stack.TraceStack; import ghidra.trace.model.stack.TraceStack;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest { public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
@ -187,7 +187,7 @@ public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
} }
waitForSwing(); waitForSwing();
@ -217,7 +217,7 @@ public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
createAndOpenTrace(); createAndOpenTrace();
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
TraceStack stack = tb.trace.getStackManager().getStack(thread, 0, true); TraceStack stack = tb.trace.getStackManager().getStack(thread, 0, true);
stack.setDepth(3, true); stack.setDepth(3, true);
@ -289,7 +289,7 @@ public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
createTrace(); createTrace();
} }
TraceThread thread; TraceThread thread;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
thread = tb.getOrAddThread("Threads[0]", 0); thread = tb.getOrAddThread("Threads[0]", 0);
TraceStack stack = tb.trace.getStackManager().getStack(thread, 0, true); TraceStack stack = tb.trace.getStackManager().getStack(thread, 0, true);
stack.setDepth(3, true); stack.setDepth(3, true);
@ -354,7 +354,7 @@ public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
protected void createTraceWithBinText() throws Throwable { protected void createTraceWithBinText() throws Throwable {
createAndOpenTrace(); createAndOpenTrace();
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
DBTraceMemoryManager mm = tb.trace.getMemoryManager(); DBTraceMemoryManager mm = tb.trace.getMemoryManager();
mm.createRegion("Memory[bin.text]", 0, tb.range(0x00400000, 0x0040ffff), mm.createRegion("Memory[bin.text]", 0, tb.range(0x00400000, 0x0040ffff),
Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE)); Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE));
@ -401,14 +401,14 @@ public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
programManager.openProgram(program); programManager.openProgram(program);
traceManager.activateTrace(tb.trace); traceManager.activateTrace(tb.trace);
try (UndoableTransaction tid = UndoableTransaction.start(program, "add block")) { try (Transaction tx = program.openTransaction("add block")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", addr(program, 0x00400000), 4096, (byte) 0, .createInitializedBlock(".text", addr(program, 0x00400000), 4096, (byte) 0,
monitor, false); monitor, false);
} }
CompletableFuture<Void> changesSettled; CompletableFuture<Void> changesSettled;
try (UndoableTransaction tid = tb.startTransaction()) { try (Transaction tx = tb.startTransaction()) {
tb.trace.getMemoryManager() tb.trace.getMemoryManager()
.createRegion("Memory[bin.text]", 0, tb.range(0x00400000, 0x00400fff), .createRegion("Memory[bin.text]", 0, tb.range(0x00400000, 0x00400fff),
Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE)); Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE));
@ -463,7 +463,7 @@ public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
programManager.openProgram(program); programManager.openProgram(program);
Address entry = addr(program, 0x00400000); Address entry = addr(program, 0x00400000);
try (UndoableTransaction start = UndoableTransaction.start(program, "init")) { try (Transaction start = program.openTransaction("init")) {
program.getMemory() program.getMemory()
.createInitializedBlock(".text", entry, 4096, (byte) 0, .createInitializedBlock(".text", entry, 4096, (byte) 0,
monitor, false); monitor, false);
@ -1050,7 +1050,7 @@ public class FlatDebuggerAPITest extends AbstractGhidraHeadedDebuggerGUITest {
programManager.openProgram(program); programManager.openProgram(program);
waitForSwing(); waitForSwing();
try (UndoableTransaction tid = UndoableTransaction.start(program, "Add block")) { try (Transaction tx = program.openTransaction("Add block")) {
program.getMemory() program.getMemory()
.createInitializedBlock( .createInitializedBlock(
".text", addr(program, 0x00400000), 1024, (byte) 0, monitor, false); ".text", addr(program, 0x00400000), 1024, (byte) 0, monitor, false);

View file

@ -22,6 +22,7 @@ import java.util.Map;
import org.junit.Test; import org.junit.Test;
import db.Transaction;
import ghidra.app.plugin.core.debug.DebuggerCoordinates; import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.mapping.DebuggerRegisterMapper; import ghidra.app.plugin.core.debug.mapping.DebuggerRegisterMapper;
@ -40,7 +41,6 @@ import ghidra.trace.model.memory.TraceMemorySpace;
import ghidra.trace.model.thread.TraceThread; import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
import ghidra.trace.model.time.schedule.TraceSchedule; import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
/** /**
* Test the {@link DirectBytesTracePcodeExecutorState} in combination with * Test the {@link DirectBytesTracePcodeExecutorState} in combination with
@ -127,7 +127,7 @@ public class TraceRecorderPcodeExecTest extends AbstractGhidraHeadedDebuggerGUIT
}); });
TraceSchedule oneTick = TraceSchedule.snap(recorder.getSnap()).steppedForward(thread, 1); TraceSchedule oneTick = TraceSchedule.snap(recorder.getSnap()).steppedForward(thread, 1);
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Scratch")) { try (Transaction tx = trace.openTransaction("Scratch")) {
TraceSnapshot scratch = trace.getTimeManager().getSnapshot(Long.MIN_VALUE, true); TraceSnapshot scratch = trace.getTimeManager().getSnapshot(Long.MIN_VALUE, true);
scratch.setSchedule(oneTick); scratch.setSchedule(oneTick);
scratch.setDescription("Faked"); scratch.setDescription("Faked");

View file

@ -22,6 +22,7 @@ import java.util.function.Consumer;
import org.apache.commons.collections4.collection.CompositeCollection; import org.apache.commons.collections4.collection.CompositeCollection;
import db.DBHandle; import db.DBHandle;
import db.Transaction;
import generic.depends.DependentService; import generic.depends.DependentService;
import generic.depends.err.ServiceConstructionException; import generic.depends.err.ServiceConstructionException;
import ghidra.framework.model.DomainObjectChangeRecord; import ghidra.framework.model.DomainObjectChangeRecord;
@ -163,7 +164,7 @@ public class DBTrace extends DBCachedDomainObjectAdapter implements Trace, Trace
this.baseAddressFactory = this.baseAddressFactory =
new TraceAddressFactory(this.baseLanguage, this.baseCompilerSpec); new TraceAddressFactory(this.baseLanguage, this.baseCompilerSpec);
try (UndoableTransaction tid = UndoableTransaction.start(this, "Create")) { try (Transaction tx = this.openTransaction("Create")) {
initOptions(DBOpenMode.CREATE); initOptions(DBOpenMode.CREATE);
init(); init();
} }

Some files were not shown because too many files have changed in this diff Show more