From 97869f6df40a07f7549597bcff294ef670c4a5fd Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:41:57 +0000 Subject: [PATCH] GP-0: Fix tests. --- ...ebuggerLogicalBreakpointServicePlugin.java | 20 +++-- .../breakpoint/LogicalBreakpointInternal.java | 13 ++++ .../breakpoint/LoneLogicalBreakpoint.java | 5 ++ .../breakpoint/MappedLogicalBreakpoint.java | 5 ++ .../service/breakpoint/ProgramBreakpoint.java | 13 ++++ .../DebuggerEmulationIntegration.java | 16 ++-- .../DebuggerEmulationServicePlugin.java | 10 ++- .../gui/model/DebuggerModelProviderTest.java | 3 +- .../exec/trace/TraceEmulationIntegration.java | 76 +++++++++++-------- .../emu/symz3/state/SymZ3PieceHandler.java | 17 +++-- .../agent/lldb/rmi/LldbConnectorsTest.java | 4 +- .../DebuggerCopyActionsPluginTest.java | 36 ++++----- 12 files changed, 137 insertions(+), 81 deletions(-) diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/DebuggerLogicalBreakpointServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/DebuggerLogicalBreakpointServicePlugin.java index 295ac707b3..ae1ed06a6d 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/DebuggerLogicalBreakpointServicePlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/DebuggerLogicalBreakpointServicePlugin.java @@ -762,17 +762,15 @@ public class DebuggerLogicalBreakpointServicePlugin extends Plugin */ for (Set set : List.copyOf(logicalByAddress.values())) { for (LogicalBreakpointInternal lb : Set.copyOf(set)) { - Bookmark pb = lb.getProgramBookmark(); - if (pb == null) { - continue; - } - if (pb != program.getBookmarkManager().getBookmark(pb.getId())) { - forgetProgramBreakpoint(r, pb, false); - continue; - } - if (!lb.getProgramLocation().getByteAddress().equals(pb.getAddress())) { - forgetProgramBreakpoint(r, pb, false); - continue; + for (Bookmark pb : lb.getProgramBookmarksValidOrNot()) { + if (pb != program.getBookmarkManager().getBookmark(pb.getId())) { + forgetProgramBreakpoint(r, pb, false); + continue; + } + if (!lb.getProgramLocation().getByteAddress().equals(pb.getAddress())) { + forgetProgramBreakpoint(r, pb, false); + continue; + } } } } diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java index a66c4ba8a5..03df3ea554 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java @@ -15,6 +15,8 @@ */ package ghidra.app.plugin.core.debug.service.breakpoint; +import java.util.List; + import ghidra.debug.api.breakpoint.LogicalBreakpoint; import ghidra.debug.api.target.Target; import ghidra.program.model.address.Address; @@ -24,6 +26,17 @@ import ghidra.trace.model.Trace; import ghidra.trace.model.breakpoint.TraceBreakpointLocation; public interface LogicalBreakpointInternal extends LogicalBreakpoint { + + /** + * Get any or both of the enabled and disabled program bookmarks for this breakpoint, even if + * they are no longer valid. + *

+ * This is needed to clean up logical breakpoints when the bookmark becomes invalid + * + * @return the bookmarks + */ + List getProgramBookmarksValidOrNot(); + /** * Set the expected address for trace breakpoints in the given trace * diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LoneLogicalBreakpoint.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LoneLogicalBreakpoint.java index 724cd1055f..e63eadda75 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LoneLogicalBreakpoint.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LoneLogicalBreakpoint.java @@ -75,6 +75,11 @@ public class LoneLogicalBreakpoint implements LogicalBreakpointInternal { return null; } + @Override + public List getProgramBookmarksValidOrNot() { + return List.of(); + } + @Override public String getName() { return ""; diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/MappedLogicalBreakpoint.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/MappedLogicalBreakpoint.java index 63982ca362..083776b513 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/MappedLogicalBreakpoint.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/MappedLogicalBreakpoint.java @@ -269,6 +269,11 @@ public class MappedLogicalBreakpoint implements LogicalBreakpointInternal { return progBreak.getBookmark(); } + @Override + public List getProgramBookmarksValidOrNot() { + return progBreak.getBookmarksValidOrNot(); + } + @Override public String getName() { return progBreak.getName(); diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/ProgramBreakpoint.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/ProgramBreakpoint.java index 2a03ac3cb7..f510fc5573 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/ProgramBreakpoint.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/ProgramBreakpoint.java @@ -428,6 +428,19 @@ public class ProgramBreakpoint { return null; } + public List getBookmarksValidOrNot() { + Bookmark eBookmark = this.eBookmark; + Bookmark dBookmark = this.dBookmark; + List result = new ArrayList<>(); + if (eBookmark != null) { + result.add(eBookmark); + } + if (dBookmark != null) { + result.add(dBookmark); + } + return result; + } + protected String getComment() { Bookmark bookmark = getBookmark(); return bookmark == null ? computeComment() : bookmark.getComment(); diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationIntegration.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationIntegration.java index 636b7b8981..801479694c 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationIntegration.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationIntegration.java @@ -151,11 +151,12 @@ public enum DebuggerEmulationIntegration { } @Override - public AddressSetView readUninitialized(PcodeTraceDataAccess acc, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSetView set) { + public AddressSetView readUninitialized(Writer writer, PcodeTraceDataAccess acc, + PcodeThread thread, PcodeExecutorStatePiece piece, + AddressSetView set) { AddressSetView unknown = set.subtract(acc.intersectViewKnown(set, false)); if (unknown.isEmpty()) { - return super.readUninitialized(acc, thread, piece, set); + return super.readUninitialized(writer, acc, thread, piece, set); } if (acc instanceof PcodeDebuggerRegistersAccess regsAcc) { if (regsAcc.isLive()) { @@ -165,13 +166,13 @@ public enum DebuggerEmulationIntegration { * Pass `set` to super, because even if regsAcc has just read from target into * trace, we have yet to read from trace into state piece. */ - return super.readUninitialized(acc, thread, piece, set); + return super.readUninitialized(writer, acc, thread, piece, set); } if (acc instanceof PcodeDebuggerMemoryAccess memAcc) { if (memAcc.isLive() && waitTimeout(memAcc.readFromTargetMemory(unknown))) { unknown = set.subtract(memAcc.intersectViewKnown(set, false)); if (unknown.isEmpty()) { - return super.readUninitialized(acc, thread, piece, set); + return super.readUninitialized(writer, acc, thread, piece, set); } } unknown = unknown.subtract(memAcc.intersectViewKnown(unknown, true)); @@ -183,13 +184,14 @@ public enum DebuggerEmulationIntegration { */ AddressSetView readFromStatic = unknown.subtract(remains); AddressSetView toReadFromTraceToPiece = set.subtract(readFromStatic); - return super.readUninitialized(memAcc, thread, piece, toReadFromTraceToPiece); + return super.readUninitialized(writer, memAcc, thread, piece, + toReadFromTraceToPiece); } throw new AssertionError(); } @Override - public boolean dataWritten(PcodeTraceDataAccess acc, AddressSet written, + public boolean dataWritten(Writer writer, PcodeTraceDataAccess acc, AddressSet written, PcodeThread thread, PcodeExecutorStatePiece piece, Address address, int length, byte[] value) { if (!mode.isWriteTarget()) { diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java index 2fef0fda7a..f68cc4aab9 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/DebuggerEmulationServicePlugin.java @@ -519,10 +519,11 @@ public class DebuggerEmulationServicePlugin extends Plugin implements DebuggerEm private boolean emulateFunctionEnabled(ProgramLocationActionContext ctx) { Program program = ctx.getProgram(); - if (program == null || program instanceof TraceProgramView) { + Address address = ctx.getAddress(); + if (program == null || program instanceof TraceProgramView || address == null) { return false; } - Function function = program.getFunctionManager().getFunctionContaining(ctx.getAddress()); + Function function = program.getFunctionManager().getFunctionContaining(address); if (function == null) { return false; } @@ -531,10 +532,11 @@ public class DebuggerEmulationServicePlugin extends Plugin implements DebuggerEm private void emulateFunctionActivated(ProgramLocationActionContext ctx) { Program program = ctx.getProgram(); - if (program == null) { + Address address = ctx.getAddress(); + if (program == null || address == null) { return; } - Function function = program.getFunctionManager().getFunctionContaining(ctx.getAddress()); + Function function = program.getFunctionManager().getFunctionContaining(address); if (function == null) { return; } diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProviderTest.java index 615f4b9f34..42a9ea6ac7 100644 --- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProviderTest.java +++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProviderTest.java @@ -32,6 +32,7 @@ import docking.widgets.tree.GTree; import docking.widgets.tree.GTreeNode; import docking.widgets.tree.support.GTreeSelectionEvent.EventOrigin; import generic.Unique; +import generic.test.rule.Repeated; import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest; import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.PrimitiveRow; import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow; @@ -1076,7 +1077,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest traceManager.activateSnap(1); waitForSwing(); - modelProvider.setPath(threadsPath); + runSwing(() -> modelProvider.setPath(threadsPath)); waitForTasks(); // Testing 1 then 0, because 0 is default diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceEmulationIntegration.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceEmulationIntegration.java index 2c747e0d50..9dd3f048cb 100644 --- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceEmulationIntegration.java +++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceEmulationIntegration.java @@ -225,6 +225,7 @@ public enum TraceEmulationIntegration { /** * An uninitialized portion of a state piece is being read (concrete addressing). * + * @param writer the writer * @param acc the trace access shim for the relevant state (shared or local) * @param thread the thread, if applicable. This is null if either the state being accessed * is the emulator's shared state, or if the state is bound to a plain @@ -235,12 +236,13 @@ public enum TraceEmulationIntegration { * @see PcodeEmulationCallbacks#readUninitialized(PcodeThread, PcodeExecutorStatePiece, * AddressSetView, Reason) */ - AddressSetView readUninitialized(PcodeTraceDataAccess acc, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSetView set); + AddressSetView readUninitialized(Writer writer, PcodeTraceDataAccess acc, + PcodeThread thread, PcodeExecutorStatePiece piece, AddressSetView set); /** * An uninitialized portion of a state piece is being read (abstract addressing). * + * @param writer the writer * @param acc the trace access shim for the relevant state (shared or local) * @param thread the thread, if applicable. This is null if either the state being accessed * is the emulator's shared state, or if the state is bound to a plain @@ -254,15 +256,16 @@ public enum TraceEmulationIntegration { * @see PcodeEmulationCallbacks#readUninitialized(PcodeThread, PcodeExecutorStatePiece, * AddressSpace, Object, int, Reason) */ - default int abstractReadUninit(PcodeTraceDataAccess acc, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSpace space, A offset, int length, - Reason reason) { + default int abstractReadUninit(Writer writer, PcodeTraceDataAccess acc, + PcodeThread thread, PcodeExecutorStatePiece piece, AddressSpace space, + A offset, int length, Reason reason) { return 0; } /** * Data was written (concrete addressing). * + * @param writer the writer * @param acc the trace access shim for the relevant state (shared or local) * @param written the {@link Writer}'s current log of written addresses (mutable). * Typically, this is not accessed but rather passed to delegate methods. @@ -277,7 +280,7 @@ public enum TraceEmulationIntegration { * @see PcodeEmulationCallbacks#dataWritten(PcodeThread, PcodeExecutorStatePiece, Address, * int, Object) */ - default boolean dataWritten(PcodeTraceDataAccess acc, AddressSet written, + default boolean dataWritten(Writer writer, PcodeTraceDataAccess acc, AddressSet written, PcodeThread thread, PcodeExecutorStatePiece piece, Address address, int length, T value) { return false; @@ -286,6 +289,7 @@ public enum TraceEmulationIntegration { /** * Data was written (abstract addressing). * + * @param writer the writer * @param acc the trace access shim for the relevant state (shared or local) * @param written the {@link Writer}'s current log of written addresses (mutable). * Typically, this is not accessed but rather passed to delegate methods. @@ -300,7 +304,7 @@ public enum TraceEmulationIntegration { * @see PcodeEmulationCallbacks#dataWritten(PcodeThread, PcodeExecutorStatePiece, * AddressSpace, Object, int, Object) */ - default void abstractWritten(PcodeTraceDataAccess acc, AddressSet written, + default void abstractWritten(Writer writer, PcodeTraceDataAccess acc, AddressSet written, PcodeThread thread, PcodeExecutorStatePiece piece, AddressSpace space, A offset, int length, T value) { } @@ -344,8 +348,9 @@ public enum TraceEmulationIntegration { } @Override - public AddressSetView readUninitialized(PcodeTraceDataAccess acc, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSetView set) { + public AddressSetView readUninitialized(Writer writer, PcodeTraceDataAccess acc, + PcodeThread thread, PcodeExecutorStatePiece piece, + AddressSetView set) { return set; } @@ -376,8 +381,9 @@ public enum TraceEmulationIntegration { } @Override - public AddressSetView readUninitialized(PcodeTraceDataAccess acc, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSetView set) { + public AddressSetView readUninitialized(Writer writer, PcodeTraceDataAccess acc, + PcodeThread thread, PcodeExecutorStatePiece piece, + AddressSetView set) { // NOTE: For simplicity, read without regard to gaps // NOTE: We cannot write those gaps, though!!! AddressSetView knownButUninit = acc.intersectViewKnown(set, true); @@ -431,7 +437,7 @@ public enum TraceEmulationIntegration { */ public static class ImmediateBytesPieceHandler extends BytesPieceHandler { @Override - public boolean dataWritten(PcodeTraceDataAccess acc, AddressSet written, + public boolean dataWritten(Writer writer, PcodeTraceDataAccess acc, AddressSet written, PcodeThread thread, PcodeExecutorStatePiece piece, Address address, int length, byte[] value) { if (address.isUniqueAddress()) { @@ -515,8 +521,8 @@ public enum TraceEmulationIntegration { T value); @Override - public AddressSetView readUninitialized(PcodeTraceDataAccess acc, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSetView set) { + public AddressSetView readUninitialized(Writer writer, PcodeTraceDataAccess acc, + PcodeThread thread, PcodeExecutorStatePiece piece, AddressSetView set) { PcodeTracePropertyAccess

property = acc.getPropertyAccess(getPropertyName(), getPropertyType()); AddressSet remains = new AddressSet(set); @@ -551,9 +557,9 @@ public enum TraceEmulationIntegration { * all of the abstract states. */ @Override - public int abstractReadUninit(PcodeTraceDataAccess acc, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSpace space, A offset, int length, - Reason reason) { + public int abstractReadUninit(Writer writer, PcodeTraceDataAccess acc, + PcodeThread thread, PcodeExecutorStatePiece piece, AddressSpace space, + A offset, int length, Reason reason) { throw new UnsupportedOperationException(); } @@ -563,7 +569,7 @@ public enum TraceEmulationIntegration { * This method handles serializing the concrete portion and associating the states to their * respective addresses in the property. Handlers needing to serialize abstracts portions * must both implement the means of tracking what has been written (see - * {@link #abstractWritten(PcodeTraceDataAccess, AddressSet, PcodeThread, PcodeExecutorStatePiece, AddressSpace, Object, int, Object)}), + * {@link #abstractWritten(Writer, PcodeTraceDataAccess, AddressSet, PcodeThread, PcodeExecutorStatePiece, AddressSpace, Object, int, Object)}), * and the placement of that state information into the property. The latter is accomplished * by overriding this method, taking care to invoke the super method for the concrete * portion. @@ -599,7 +605,7 @@ public enum TraceEmulationIntegration { } @Override - public void abstractWritten(PcodeTraceDataAccess acc, AddressSet written, + public void abstractWritten(Writer writer, PcodeTraceDataAccess acc, AddressSet written, PcodeThread thread, PcodeExecutorStatePiece piece, AddressSpace space, A offset, int length, T value) { throw new UnsupportedOperationException(); @@ -738,19 +744,26 @@ public enum TraceEmulationIntegration { protected PcodeTraceDataAccess getDataAccess(PcodeTraceAccess access, AddressSpace space, PcodeThread thread) { - return space.isRegisterSpace() - ? access.getDataForLocalState(thread, 0) - : access.getDataForSharedState(); + if (space.isRegisterSpace()) { + return access.getDataForLocalState(thread, 0); + } + if (space.isMemorySpace()) { + return access.getDataForSharedState(); + } + return null; // e.g., unique, constant } @Override public void dataWritten(PcodeThread thread, PcodeExecutorStatePiece piece, Address address, int length, U value) { PcodeTraceDataAccess acc = getDataAccess(access, address.getAddressSpace(), thread); + if (acc == null) { + return; + } PieceInfo info = - pieces.computeIfAbsent(piece, p -> new PieceInfo(thread, new AddressSet())); - if (handlerFor(piece).dataWritten(acc, info.written, thread, piece, address, length, - value)) { + pieces.computeIfAbsent(piece, _ -> new PieceInfo(thread, new AddressSet())); + if (handlerFor(piece).dataWritten(this, acc, info.written, thread, piece, address, + length, value)) { return; } if (length == 0) { @@ -772,9 +785,12 @@ public enum TraceEmulationIntegration { PcodeExecutorStatePiece piece, AddressSpace space, B offset, int length, U value) { PcodeTraceDataAccess acc = getDataAccess(access, space, thread); + if (acc == null) { + return; + } PieceInfo info = - pieces.computeIfAbsent(piece, p -> new PieceInfo(thread, new AddressSet())); - handlerFor(piece).abstractWritten(acc, info.written, thread, piece, space, offset, + pieces.computeIfAbsent(piece, _ -> new PieceInfo(thread, new AddressSet())); + handlerFor(piece).abstractWritten(this, acc, info.written, thread, piece, space, offset, length, value); } @@ -783,8 +799,8 @@ public enum TraceEmulationIntegration { PcodeExecutorStatePiece piece, AddressSpace space, B offset, int length, Reason reason) { PcodeTraceDataAccess acc = getDataAccess(access, space, thread); - return handlerFor(piece).abstractReadUninit(acc, thread, piece, space, offset, length, - reason); + return handlerFor(piece).abstractReadUninit(this, acc, thread, piece, space, offset, + length, reason); } @Override @@ -798,7 +814,7 @@ public enum TraceEmulationIntegration { return set; } PcodeTraceDataAccess acc = getDataAccess(access, space, thread); - return handlerFor(piece).readUninitialized(acc, thread, piece, set); + return handlerFor(piece).readUninitialized(this, acc, thread, piece, set); } } } diff --git a/Ghidra/Extensions/SymbolicSummaryZ3/src/main/java/ghidra/pcode/emu/symz3/state/SymZ3PieceHandler.java b/Ghidra/Extensions/SymbolicSummaryZ3/src/main/java/ghidra/pcode/emu/symz3/state/SymZ3PieceHandler.java index 410b5a6a90..17de3b4773 100644 --- a/Ghidra/Extensions/SymbolicSummaryZ3/src/main/java/ghidra/pcode/emu/symz3/state/SymZ3PieceHandler.java +++ b/Ghidra/Extensions/SymbolicSummaryZ3/src/main/java/ghidra/pcode/emu/symz3/state/SymZ3PieceHandler.java @@ -25,8 +25,7 @@ import ghidra.pcode.exec.ConcretionError; import ghidra.pcode.exec.PcodeArithmetic.Purpose; import ghidra.pcode.exec.PcodeExecutorStatePiece; import ghidra.pcode.exec.PcodeExecutorStatePiece.Reason; -import ghidra.pcode.exec.trace.TraceEmulationIntegration.AbstractPropertyBasedPieceHandler; -import ghidra.pcode.exec.trace.TraceEmulationIntegration.TraceWriter; +import ghidra.pcode.exec.trace.TraceEmulationIntegration.*; import ghidra.pcode.exec.trace.data.*; import ghidra.program.model.address.*; import ghidra.symz3.model.SymValueZ3; @@ -68,21 +67,23 @@ public class SymZ3PieceHandler } @Override - public void abstractWritten(PcodeTraceDataAccess acc, AddressSet written, PcodeThread thread, - PcodeExecutorStatePiece piece, AddressSpace space, - SymValueZ3 offset, int length, SymValueZ3 value) { + public void abstractWritten(Writer writer, PcodeTraceDataAccess acc, AddressSet written, + PcodeThread thread, PcodeExecutorStatePiece piece, + AddressSpace space, SymValueZ3 offset, int length, SymValueZ3 value) { try { + @SuppressWarnings("unchecked") + PcodeThread cast = (PcodeThread) thread; Address address = piece.getAddressArithmetic().toAddress(offset, space, Purpose.STORE); - dataWritten(acc, written, thread, piece, address, length, value); + writer.dataWritten(cast, piece, address, length, value); } catch (ConcretionError e) { - abstractWritten.computeIfAbsent(thread, t -> new HashSet<>()) + abstractWritten.computeIfAbsent(thread, _ -> new HashSet<>()) .add(new SymZ3Varnode(space, offset, length)); } } @Override - public int abstractReadUninit(PcodeTraceDataAccess acc, PcodeThread thread, + public int abstractReadUninit(Writer writer, PcodeTraceDataAccess acc, PcodeThread thread, PcodeExecutorStatePiece piece, AddressSpace space, SymValueZ3 offset, int length, Reason reason) { String string = acc.getPropertyAccess(NAME, String.class).get(Address.NO_ADDRESS); diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbConnectorsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbConnectorsTest.java index 84e961bc6a..a99312abf1 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbConnectorsTest.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbConnectorsTest.java @@ -16,8 +16,8 @@ package agent.lldb.rmi; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; -import static org.junit.Assume.*; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeFalse; import java.nio.file.Path; import java.util.List; diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyActionsPluginTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyActionsPluginTest.java index cbaf3d5c22..ba6f6d4474 100644 --- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyActionsPluginTest.java +++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/copying/DebuggerCopyActionsPluginTest.java @@ -111,8 +111,8 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI performEnabledAction(copyActionsPlugin.actionCopyIntoCurrentProgram); DebuggerCopyIntoProgramDialog dialog = waitForDialogComponent(DebuggerCopyIntoProgramDialog.class); - dialog.setRelocate(false); - dialog.reset(); + runSwing(() -> dialog.setRelocate(false)); + runSwing(() -> dialog.reset()); RangeEntry entry = Unique.assertOne(dialog.tableModel.getModelData()); @@ -121,7 +121,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI assertEquals(".text", entry.getRegionName()); assertEquals(".text", entry.getBlockName()); assertTrue(entry.isCreate()); - dialog.okCallback(); + runSwing(() -> dialog.okCallback()); waitOn(dialog.lastTask); waitForSwing(); @@ -175,8 +175,8 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI performEnabledAction(copyActionsPlugin.actionCopyIntoCurrentProgram); DebuggerCopyIntoProgramDialog dialog = waitForDialogComponent(DebuggerCopyIntoProgramDialog.class); - dialog.setRelocate(false); - dialog.reset(); + runSwing(() -> dialog.setRelocate(false)); + runSwing(() -> dialog.reset()); List entries = List.copyOf(dialog.tableModel.getModelData()); assertEquals(3, entries.size()); @@ -203,7 +203,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI assertEquals(".straddle", entry.getBlockName()); assertTrue(entry.isCreate()); - dialog.okCallback(); + runSwing(() -> dialog.okCallback()); waitOn(dialog.lastTask); waitForSwing(); @@ -257,8 +257,8 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI performEnabledAction(copyActionsPlugin.actionCopyIntoCurrentProgram); DebuggerCopyIntoProgramDialog dialog = waitForDialogComponent(DebuggerCopyIntoProgramDialog.class); - dialog.setRelocate(true); - dialog.reset(); + runSwing(() -> dialog.setRelocate(true)); + runSwing(() -> dialog.reset()); RangeEntry entry = Unique.assertOne(dialog.tableModel.getModelData()); @@ -267,7 +267,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI assertEquals(".text", entry.getRegionName()); assertEquals(".text *", entry.getBlockName()); assertFalse(entry.isCreate()); - dialog.okCallback(); + runSwing(() -> dialog.okCallback()); waitOn(dialog.lastTask); waitForSwing(); @@ -320,9 +320,9 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI performEnabledAction(copyActionsPlugin.actionCopyIntoCurrentProgram); DebuggerCopyIntoProgramDialog dialog = waitForDialogComponent(DebuggerCopyIntoProgramDialog.class); - dialog.setRelocate(true); - dialog.setUseOverlays(true); - dialog.reset(); + runSwing(() -> dialog.setRelocate(true)); + runSwing(() -> dialog.setUseOverlays(true)); + runSwing(() -> dialog.reset()); RangeEntry entry = Unique.assertOne(dialog.tableModel.getModelData()); @@ -331,7 +331,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI assertEquals(".text", entry.getRegionName()); assertEquals(".text_2", entry.getBlockName()); assertTrue(entry.isCreate()); - dialog.okCallback(); + runSwing(() -> dialog.okCallback()); waitOn(dialog.lastTask); waitForSwing(); @@ -361,7 +361,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI performEnabledAction(copyActionsPlugin.actionCopyIntoNewProgram); DebuggerCopyIntoProgramDialog dialog = waitForDialogComponent(DebuggerCopyIntoProgramDialog.class); - dialog.setDestination(DebuggerCopyIntoProgramDialog.TEMP_PROGRAM); + runSwing(() -> dialog.setDestination(DebuggerCopyIntoProgramDialog.TEMP_PROGRAM)); RangeEntry entry = Unique.assertOne(dialog.tableModel.getModelData()); @@ -371,7 +371,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI assertEquals(".text", entry.getBlockName()); assertTrue(entry.isCreate()); entry.setBlockName(".my_text"); - dialog.okCallback(); + runSwing(() -> dialog.okCallback()); waitOn(dialog.lastTask); waitForSwing(); @@ -409,7 +409,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI waitForDialogComponent(DebuggerCopyIntoProgramDialog.class); assertFalse(dialog.cbCapture.isEnabled()); assertFalse(dialog.cbCapture.isSelected()); - dialog.setDestination(DebuggerCopyIntoProgramDialog.TEMP_PROGRAM); + runSwing(() -> dialog.setDestination(DebuggerCopyIntoProgramDialog.TEMP_PROGRAM)); assertEquals(2, dialog.tableModel.getRowCount()); RangeEntry entry; @@ -428,7 +428,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI assertEquals(".data", entry.getBlockName()); assertTrue(entry.isCreate()); - dialog.okCallback(); + runSwing(() -> dialog.okCallback()); waitOn(dialog.lastTask); waitForSwing(); @@ -468,7 +468,7 @@ public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerI waitForDialogComponent(DebuggerCopyIntoProgramDialog.class); assertTrue(dialog.cbCapture.isEnabled()); assertTrue(dialog.cbCapture.isSelected()); - dialog.setDestination(DebuggerCopyIntoProgramDialog.TEMP_PROGRAM); + runSwing(() -> dialog.setDestination(DebuggerCopyIntoProgramDialog.TEMP_PROGRAM)); RangeEntry entry = Unique.assertOne(dialog.tableModel.getModelData());