mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 07:09:41 +08:00
GP-6799: Improve display of breakpiont 'kinds' in the UI. Also shorter db/protocol encoding.
This commit is contained in:
+8
-8
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
@@ -59,7 +58,7 @@ import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.database.target.DBTraceObject;
|
||||
import ghidra.trace.model.DefaultTraceLocation;
|
||||
import ghidra.trace.model.Lifespan;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.target.TraceObject.ConflictResolution;
|
||||
import ghidra.trace.model.target.path.KeyPath;
|
||||
import ghidra.util.Msg;
|
||||
@@ -115,7 +114,7 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
|
||||
DBTraceObject objBptLoc = tb.trace.getObjectManager().createObject(pathSpec.index(1));
|
||||
objBptLoc.setAttribute(Lifespan.nowOn(0), "Range",
|
||||
new AddressRangeImpl(dynAddr, dynAddr));
|
||||
objBptSpec.setAttribute(Lifespan.nowOn(0), "Kinds", "SW_EXECUTE");
|
||||
objBptSpec.setAttribute(Lifespan.nowOn(0), "Kinds", "x");
|
||||
objBptSpec.setAttribute(Lifespan.nowOn(0), "Enabled", enabled);
|
||||
objBptLoc.insert(Lifespan.nowOn(0), ConflictResolution.DENY);
|
||||
}
|
||||
@@ -150,7 +149,7 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
|
||||
|
||||
Msg.debug(this, "Placing disabled breakpoint");
|
||||
breakpointService.placeBreakpointAt(program, addr(program, 0x00401c60), 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), "");
|
||||
CommonSet.SWX.kinds(), "");
|
||||
LogicalBreakpoint lbDis = waitForValue(() -> Unique.assertAtMostOne(
|
||||
breakpointService.getBreakpointsAt(program, addr(program, 0x00401c60))));
|
||||
placeBreakpoint(1, lbDis.getTraceAddress(tb.trace), false);
|
||||
@@ -158,7 +157,7 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
|
||||
|
||||
Msg.debug(this, "Placing enabled breakpoint");
|
||||
breakpointService.placeBreakpointAt(program, addr(program, 0x00401c63), 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), "");
|
||||
CommonSet.SWX.kinds(), "");
|
||||
LogicalBreakpoint lbEn = waitForValue(() -> Unique.assertAtMostOne(
|
||||
breakpointService.getBreakpointsAt(program, addr(program, 0x00401c63))));
|
||||
placeBreakpoint(2, lbEn.getTraceAddress(tb.trace), true);
|
||||
@@ -296,7 +295,7 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
|
||||
|
||||
Msg.debug(this, "Placing breakpoint");
|
||||
breakpointService.placeBreakpointAt(program, addr(program, 0x00401070), 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), "");
|
||||
CommonSet.SWX.kinds(), "");
|
||||
LogicalBreakpoint lbEn = waitForValue(() -> Unique.assertAtMostOne(
|
||||
breakpointService.getBreakpointsAt(program, addr(program, 0x00401070))));
|
||||
placeBreakpoint(1, lbEn.getTraceAddress(tb.trace), true);
|
||||
@@ -337,7 +336,7 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
|
||||
|
||||
Msg.debug(this, "Placing breakpoint");
|
||||
breakpointService.placeBreakpointAt(program, addr(program, 0x00401070), 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), "");
|
||||
CommonSet.SWX.kinds(), "");
|
||||
LogicalBreakpoint lbEn = waitForValue(() -> Unique.assertAtMostOne(
|
||||
breakpointService.getBreakpointsAt(program, addr(program, 0x00401070))));
|
||||
placeBreakpoint(1, lbEn.getTraceAddress(tb.trace), true);
|
||||
@@ -357,11 +356,12 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotG
|
||||
public void testCaptureDebuggerPlaceBreakpointDialog() throws Throwable {
|
||||
runSwing(
|
||||
() -> listing.goTo(program, new ProgramLocation(program, addr(program, 0x00401c63))));
|
||||
performAction(breakpointMarkerPlugin.actionSetSoftwareBreakpoint, false);
|
||||
performAction(breakpointMarkerPlugin.actionsSetBreakpoint.get(CommonSet.SWX), false);
|
||||
DebuggerPlaceBreakpointDialog dialog =
|
||||
waitForDialogComponent(DebuggerPlaceBreakpointDialog.class);
|
||||
|
||||
dialog.setName("After setup");
|
||||
dialog.getComponent().grabFocus();
|
||||
captureDialog(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-10
@@ -45,6 +45,7 @@ import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.database.breakpoint.DBTraceBreakpointManager;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
import help.screenshot.GhidraScreenShotGenerator;
|
||||
@@ -137,12 +138,10 @@ public class DebuggerBreakpointsPluginScreenShots extends GhidraScreenShotGenera
|
||||
try (Transaction tx = program.openTransaction("Add breakpoint")) {
|
||||
program.getBookmarkManager()
|
||||
.setBookmark(addr(program, 0x00401234),
|
||||
LogicalBreakpoint.ENABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1", "before connect");
|
||||
LogicalBreakpoint.ENABLED_BOOKMARK_TYPE, "x;1", "before connect");
|
||||
program.getBookmarkManager()
|
||||
.setBookmark(addr(program, 0x00604321),
|
||||
LogicalBreakpoint.ENABLED_BOOKMARK_TYPE,
|
||||
"WRITE;4", "write version");
|
||||
LogicalBreakpoint.ENABLED_BOOKMARK_TYPE, "W;4", "write version");
|
||||
}
|
||||
|
||||
try (Transaction tx = tb1.startTransaction()) {
|
||||
@@ -153,14 +152,14 @@ public class DebuggerBreakpointsPluginScreenShots extends GhidraScreenShotGenera
|
||||
DBTraceBreakpointManager bm = tb1.trace.getBreakpointManager();
|
||||
TraceBreakpointLocation locCx =
|
||||
bm.placeBreakpoint("Breakpoints[1]", snap, tb1.addr(0x00401234), List.of(),
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), true, "");
|
||||
CommonSet.SWX.kinds(), true, "");
|
||||
locCx.getSpecification()
|
||||
.getObject()
|
||||
.setAttribute(Lifespan.nowOn(snap), TraceBreakpointSpec.KEY_EXPRESSION,
|
||||
"*0x00401234");
|
||||
TraceBreakpointLocation locWr =
|
||||
bm.placeBreakpoint("Breakpoints[2]", snap, tb1.range(0x00604321, 0x00604324),
|
||||
List.of(), Set.of(TraceBreakpointKind.WRITE), true, "");
|
||||
List.of(), CommonSet.WRITE.kinds(), true, "");
|
||||
locWr.getSpecification()
|
||||
.getObject()
|
||||
.setAttribute(Lifespan.nowOn(snap), TraceBreakpointSpec.KEY_EXPRESSION,
|
||||
@@ -175,11 +174,11 @@ public class DebuggerBreakpointsPluginScreenShots extends GhidraScreenShotGenera
|
||||
DBTraceBreakpointManager bm = tb2.trace.getBreakpointManager();
|
||||
TraceBreakpointLocation locCx =
|
||||
bm.placeBreakpoint("Breakpoints[1]", snap, tb2.addr(0x7fac1234), List.of(),
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), false, "");
|
||||
CommonSet.SWX.kinds(), false, "");
|
||||
locCx.getSpecification()
|
||||
.getObject()
|
||||
.setAttribute(Lifespan.nowOn(snap), TraceBreakpointSpec.KEY_EXPRESSION,
|
||||
"*0x7fac1234");
|
||||
.getObject()
|
||||
.setAttribute(Lifespan.nowOn(snap), TraceBreakpointSpec.KEY_EXPRESSION,
|
||||
"*0x7fac1234");
|
||||
}
|
||||
|
||||
programManager.openProgram(program);
|
||||
|
||||
+7
-6
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package agent.dbgeng.rmi;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -41,7 +42,7 @@ import ghidra.program.model.lang.RegisterValue;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.listing.TraceCodeSpace;
|
||||
import ghidra.trace.model.listing.TraceData;
|
||||
import ghidra.trace.model.memory.*;
|
||||
@@ -989,9 +990,9 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {
|
||||
Address bp1 = rangeMain.getMinAddress();
|
||||
|
||||
assertBreakLoc(procBreakLocVals.get(0), "[0]", bp1, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), "ntdll!Ldr");
|
||||
CommonSet.SWX.kinds(), "ntdll!Ldr");
|
||||
assertBreakLoc(procBreakLocVals.get(1), "[1]", bp1.add(4), 1,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE), "ntdll!Ldr");
|
||||
CommonSet.HWX.kinds(), "ntdll!Ldr");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1031,11 +1032,11 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {
|
||||
Address main2 = rangeMain2.getMinAddress();
|
||||
|
||||
assertWatchLoc(procBreakVals.get(0), "[0]", main0, (int) rangeMain0.getLength(),
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE), "ntdll!LdrInit");
|
||||
CommonSet.HWX.kinds(), "ntdll!LdrInit");
|
||||
assertWatchLoc(procBreakVals.get(1), "[1]", main1, (int) rangeMain1.getLength(),
|
||||
Set.of(TraceBreakpointKind.WRITE), "ntdll!LdrInit");
|
||||
CommonSet.WRITE.kinds(), "ntdll!LdrInit");
|
||||
assertWatchLoc(procBreakVals.get(2), "[2]", main2, (int) rangeMain2.getLength(),
|
||||
Set.of(TraceBreakpointKind.READ), "ntdll!LdrInit");
|
||||
CommonSet.READ.kinds(), "ntdll!LdrInit");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+8
-10
@@ -15,7 +15,8 @@
|
||||
*/
|
||||
package agent.dbgeng.rmi;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
@@ -38,7 +39,7 @@ import ghidra.pty.testutil.DummyProc;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.Lifespan;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.memory.TraceMemoryRegion;
|
||||
import ghidra.trace.model.memory.TraceMemorySpace;
|
||||
import ghidra.trace.model.modules.TraceModule;
|
||||
@@ -142,9 +143,9 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {
|
||||
Address main = rangeMain.getMinAddress();
|
||||
|
||||
assertBreakLoc(procBreakLocVals.get(0), "[0]", main, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), "ntdll!Ldr");
|
||||
CommonSet.SWX.kinds(), "ntdll!Ldr");
|
||||
assertBreakLoc(procBreakLocVals.get(1), "[1]", main.add(4), 1,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE), "ntdll!Ldr");
|
||||
CommonSet.HWX.kinds(), "ntdll!Ldr");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,14 +186,11 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {
|
||||
Address main2 = rangeMain2.getMinAddress();
|
||||
|
||||
assertWatchLoc(procBreakVals.get(0), "[0]", main0, (int) rangeMain0.getLength(),
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE),
|
||||
"main");
|
||||
CommonSet.HWX.kinds(), "main");
|
||||
assertWatchLoc(procBreakVals.get(1), "[1]", main1, (int) rangeMain1.getLength(),
|
||||
Set.of(TraceBreakpointKind.WRITE),
|
||||
"main+4");
|
||||
CommonSet.WRITE.kinds(), "main+4");
|
||||
assertWatchLoc(procBreakVals.get(2), "[2]", main2, (int) rangeMain1.getLength(),
|
||||
Set.of(TraceBreakpointKind.READ),
|
||||
"main+8");
|
||||
CommonSet.READ.kinds(), "main+8");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-11
@@ -44,7 +44,7 @@ import ghidra.program.model.lang.RegisterValue;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.listing.TraceCodeSpace;
|
||||
import ghidra.trace.model.listing.TraceData;
|
||||
import ghidra.trace.model.memory.*;
|
||||
@@ -1071,20 +1071,15 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {
|
||||
|
||||
// NB. starti avoid use of temporary main breakpoint
|
||||
assertBreakLoc(infBreakLocVals.get(0), "[1.1]", main, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
"*main");
|
||||
CommonSet.SWX.kinds(), "*main");
|
||||
assertBreakLoc(infBreakLocVals.get(1), "[2.1]", main.add(10), 1,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE),
|
||||
"*main+10");
|
||||
CommonSet.HWX.kinds(), "*main+10");
|
||||
assertBreakLoc(infBreakLocVals.get(2), "[3.1]", main.add(20), 1,
|
||||
Set.of(TraceBreakpointKind.WRITE),
|
||||
"-location *((char*)(&main+20))");
|
||||
CommonSet.WRITE.kinds(), "-location *((char*)(&main+20))");
|
||||
assertBreakLoc(infBreakLocVals.get(3), "[4.1]", main.add(30), 8,
|
||||
Set.of(TraceBreakpointKind.READ),
|
||||
"-location *((char(*)[8])(&main+30))");
|
||||
CommonSet.READ.kinds(), "-location *((char(*)[8])(&main+30))");
|
||||
assertBreakLoc(infBreakLocVals.get(4), "[5.1]", main.add(40), 5,
|
||||
Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE),
|
||||
"-location *((char(*)[5])(&main+40))");
|
||||
CommonSet.ACCESS.kinds(), "-location *((char(*)[5])(&main+40))");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-21
@@ -43,7 +43,7 @@ import ghidra.pty.testutil.DummyProc;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.Lifespan;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.listing.TraceCodeSpace;
|
||||
import ghidra.trace.model.listing.TraceData;
|
||||
import ghidra.trace.model.memory.TraceMemoryRegion;
|
||||
@@ -146,20 +146,15 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {
|
||||
|
||||
// NB. starti avoid use of temporary main breakpoint
|
||||
assertBreakLoc(infBreakLocVals.get(0), "[1.1]", main, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
"*main");
|
||||
CommonSet.SWX.kinds(), "*main");
|
||||
assertBreakLoc(infBreakLocVals.get(1), "[2.1]", main.add(10), 1,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE),
|
||||
"*main+10");
|
||||
CommonSet.HWX.kinds(), "*main+10");
|
||||
assertBreakLoc(infBreakLocVals.get(2), "[3.1]", main.add(20), 1,
|
||||
Set.of(TraceBreakpointKind.WRITE),
|
||||
"-location *((char*)(&main+20))");
|
||||
CommonSet.WRITE.kinds(), "-location *((char*)(&main+20))");
|
||||
assertBreakLoc(infBreakLocVals.get(3), "[4.1]", main.add(30), 8,
|
||||
Set.of(TraceBreakpointKind.READ),
|
||||
"-location *((char(*)[8])(&main+30))");
|
||||
CommonSet.READ.kinds(), "-location *((char(*)[8])(&main+30))");
|
||||
assertBreakLoc(infBreakLocVals.get(4), "[5.1]", main.add(40), 5,
|
||||
Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE),
|
||||
"-location *((char(*)[5])(&main+40))");
|
||||
CommonSet.ACCESS.kinds(), "-location *((char(*)[5])(&main+40))");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,20 +197,15 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {
|
||||
|
||||
// NB. starti avoid use of temporary main breakpoint
|
||||
assertBreakLoc(infBreakLocVals.get(0), "[1.1]", main, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
"*main");
|
||||
CommonSet.SWX.kinds(), "*main");
|
||||
assertBreakLoc(infBreakLocVals.get(1), "[2.1]", main.add(10), 1,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE),
|
||||
"*main+10");
|
||||
CommonSet.HWX.kinds(), "*main+10");
|
||||
assertBreakLoc(infBreakLocVals.get(2), "[3.1]", main.add(20), 1,
|
||||
Set.of(TraceBreakpointKind.WRITE),
|
||||
"-location *((char*)(&main+20))");
|
||||
CommonSet.WRITE.kinds(), "-location *((char*)(&main+20))");
|
||||
assertBreakLoc(infBreakLocVals.get(3), "[4.1]", main.add(30), 8,
|
||||
Set.of(TraceBreakpointKind.READ),
|
||||
"-location *((char(*)[8])(&main+30))");
|
||||
CommonSet.READ.kinds(), "-location *((char(*)[8])(&main+30))");
|
||||
assertBreakLoc(infBreakLocVals.get(4), "[5.1]", main.add(40), 5,
|
||||
Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE),
|
||||
"-location *((char(*)[5])(&main+40))");
|
||||
CommonSet.ACCESS.kinds(), "-location *((char(*)[5])(&main+40))");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-8
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package agent.lldb.rmi;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
@@ -45,7 +46,7 @@ import ghidra.program.model.lang.RegisterValue;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.listing.TraceCodeSpace;
|
||||
import ghidra.trace.model.listing.TraceData;
|
||||
import ghidra.trace.model.memory.*;
|
||||
@@ -1075,11 +1076,9 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {
|
||||
Address main = rangeMain.getMinAddress();
|
||||
|
||||
assertBreakLoc(procBreakLocVals.get(0), "[1]", main, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
"main");
|
||||
CommonSet.SWX.kinds(), "main");
|
||||
assertBreakLoc(procBreakLocVals.get(1), "[1]", main, 1,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE),
|
||||
"main");
|
||||
CommonSet.HWX.kinds(), "main");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1121,11 +1120,11 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {
|
||||
Address main2 = rangeMain2.getMinAddress();
|
||||
|
||||
assertWatchLoc(procWatchLocVals.get(0), "[1]", main0, (int) rangeMain0.getLength(),
|
||||
Set.of(TraceBreakpointKind.WRITE), "main");
|
||||
CommonSet.WRITE.kinds(), "main");
|
||||
assertWatchLoc(procWatchLocVals.get(1), "[2]", main1, (int) rangeMain1.getLength(),
|
||||
Set.of(TraceBreakpointKind.READ), "main");
|
||||
CommonSet.READ.kinds(), "main");
|
||||
assertWatchLoc(procWatchLocVals.get(2), "[3]", main2, (int) rangeMain2.getLength(),
|
||||
Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE), "main");
|
||||
CommonSet.ACCESS.kinds(), "main");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-12
@@ -18,7 +18,7 @@ package agent.lldb.rmi;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -37,7 +37,7 @@ import ghidra.pty.testutil.DummyProc;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.Lifespan;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.memory.TraceMemoryRegion;
|
||||
import ghidra.trace.model.memory.TraceMemorySpace;
|
||||
import ghidra.trace.model.modules.TraceModule;
|
||||
@@ -129,11 +129,9 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {
|
||||
Address main = rangeMain.getMinAddress();
|
||||
|
||||
assertBreakLoc(procBreakLocVals.get(0), "[1]", main, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
"main");
|
||||
CommonSet.SWX.kinds(), "main");
|
||||
assertBreakLoc(procBreakLocVals.get(1), "[1]", main, 1,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE),
|
||||
"main");
|
||||
CommonSet.HWX.kinds(), "main");
|
||||
}
|
||||
conn.success();
|
||||
}
|
||||
@@ -176,14 +174,11 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {
|
||||
Address main2 = rangeMain2.getMinAddress();
|
||||
|
||||
assertWatchLoc(procWatchLocVals.get(0), "[1]", main0, (int) rangeMain0.getLength(),
|
||||
Set.of(TraceBreakpointKind.WRITE),
|
||||
"main");
|
||||
CommonSet.WRITE.kinds(), "main");
|
||||
assertWatchLoc(procWatchLocVals.get(1), "[2]", main1, (int) rangeMain1.getLength(),
|
||||
Set.of(TraceBreakpointKind.READ),
|
||||
"main+0x20");
|
||||
CommonSet.READ.kinds(), "main+0x20");
|
||||
assertWatchLoc(procWatchLocVals.get(2), "[3]", main2, (int) rangeMain1.getLength(),
|
||||
Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE),
|
||||
"main+0x30");
|
||||
CommonSet.ACCESS.kinds(), "main+0x30");
|
||||
}
|
||||
conn.success();
|
||||
}
|
||||
|
||||
+41
-51
@@ -62,7 +62,7 @@ import ghidra.program.model.symbol.SourceType;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointLocation;
|
||||
import ghidra.trace.model.program.TraceProgramView;
|
||||
import ghidra.util.SystemUtilities;
|
||||
@@ -83,7 +83,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
AbstractDisableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME);
|
||||
|
||||
protected static final Set<String> SET_ACTIONS =
|
||||
Set.of("SW_EXECUTE", "HW_EXECUTE", "READ,WRITE", "READ", "WRITE");
|
||||
Set.of("Execute (sw)", "Execute (hw)", "Access (hw)", "Read (hw)", "Write (hw)");
|
||||
|
||||
protected DebuggerBreakpointMarkerPlugin breakpointMarkerPlugin;
|
||||
protected DebuggerListingPlugin listingPlugin;
|
||||
@@ -201,7 +201,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
TaskMonitor.DUMMY, false);
|
||||
program.getBookmarkManager()
|
||||
.setBookmark(addr(program, 0x00400123), LogicalBreakpoint.ENABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1", "");
|
||||
"x;1", "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
DebuggerPlaceBreakpointDialog dialog =
|
||||
waitForDialogComponent(DebuggerPlaceBreakpointDialog.class);
|
||||
runSwing(() -> dialog.okCallback());
|
||||
handleSetBreakpointInvocation(TraceBreakpointKindSet.SW_EXECUTE, 0x55550123);
|
||||
handleSetBreakpointInvocation(CommonSet.SWX.kinds(), 0x55550123);
|
||||
waitForDomainObject(program);
|
||||
waitForDomainObject(tb.trace);
|
||||
waitOn(breakpointService.changesSettled());
|
||||
@@ -514,7 +514,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
LogicalBreakpoint lb = Unique.assertOne(breakpointService.getAllBreakpoints());
|
||||
assertEquals(State.ENABLED, lb.computeState());
|
||||
// TODO: Different cases for different expected default kinds?
|
||||
assertEquals(Set.of(TraceBreakpointKind.SW_EXECUTE), lb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), lb.getKinds());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -543,7 +543,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
DebuggerPlaceBreakpointDialog dialog =
|
||||
waitForDialogComponent(DebuggerPlaceBreakpointDialog.class);
|
||||
runSwing(() -> dialog.okCallback());
|
||||
handleSetBreakpointInvocation(TraceBreakpointKindSet.ACCESS, 0x55550123);
|
||||
handleSetBreakpointInvocation(CommonSet.ACCESS.kinds(), 0x55550123);
|
||||
waitForDomainObject(program);
|
||||
waitForDomainObject(tb.trace);
|
||||
waitOn(breakpointService.changesSettled());
|
||||
@@ -552,7 +552,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
LogicalBreakpoint lb = Unique.assertOne(breakpointService.getAllBreakpoints());
|
||||
assertEquals(State.ENABLED, lb.computeState());
|
||||
// TODO: Different cases for different expected default kinds?
|
||||
assertEquals(TraceBreakpointKindSet.ACCESS, lb.getKinds());
|
||||
assertEquals(CommonSet.ACCESS.kinds(), lb.getKinds());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -621,8 +621,8 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
waitForPass(() -> assertEquals(State.ENABLED, lb.computeStateForTrace(trace)));
|
||||
}
|
||||
|
||||
protected void testActionSetBreakpointProgram(DockingAction action,
|
||||
Set<TraceBreakpointKind> expectedKinds) throws Throwable {
|
||||
protected void testActionSetBreakpointProgram(CommonSet kind) throws Throwable {
|
||||
DockingAction action = breakpointMarkerPlugin.actionsSetBreakpoint.get(kind);
|
||||
addMappedBreakpointOpenAndWait(); // Adds an unneeded breakpoint. Aw well.
|
||||
|
||||
ProgramLocationActionContext ctx = staticCtx(addr(program, 0x0400321));
|
||||
@@ -635,19 +635,19 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
dialog.okCallback();
|
||||
});
|
||||
|
||||
handleSetBreakpointInvocation(expectedKinds, 0x55550321);
|
||||
handleSetBreakpointInvocation(kind.kinds(), 0x55550321);
|
||||
|
||||
waitForPass(() -> {
|
||||
LogicalBreakpoint lb = Unique.assertOne(
|
||||
breakpointService.getBreakpointsAt(program, addr(program, 0x00400321)));
|
||||
assertEquals(expectedKinds, lb.getKinds());
|
||||
assertEquals(kind.kinds(), lb.getKinds());
|
||||
assertEquals(State.ENABLED, lb.computeState());
|
||||
assertEquals("Test name", lb.getName());
|
||||
});
|
||||
}
|
||||
|
||||
protected void testActionSetBreakpointTrace(DockingAction action,
|
||||
Set<TraceBreakpointKind> expectedKinds) throws Throwable {
|
||||
protected void testActionSetBreakpointTrace(CommonSet kind) throws Throwable {
|
||||
DockingAction action = breakpointMarkerPlugin.actionsSetBreakpoint.get(kind);
|
||||
T t = addMappedBreakpointOpenAndWait(); // Adds an unneeded breakpoint. Aw well.
|
||||
Trace trace = getTrace(t);
|
||||
|
||||
@@ -657,12 +657,12 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
DebuggerPlaceBreakpointDialog dialog =
|
||||
waitForDialogComponent(DebuggerPlaceBreakpointDialog.class);
|
||||
runSwing(() -> dialog.okCallback());
|
||||
handleSetBreakpointInvocation(expectedKinds, 0x55550321);
|
||||
handleSetBreakpointInvocation(kind.kinds(), 0x55550321);
|
||||
|
||||
waitForPass(() -> {
|
||||
LogicalBreakpoint lb = Unique
|
||||
.assertOne(breakpointService.getBreakpointsAt(trace, addr(trace, 0x55550321)));
|
||||
assertEquals(expectedKinds, lb.getKinds());
|
||||
assertEquals(kind.kinds(), lb.getKinds());
|
||||
assertEquals(State.ENABLED, lb.computeStateForTrace(trace));
|
||||
});
|
||||
/**
|
||||
@@ -672,63 +672,53 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetSoftwareBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(breakpointMarkerPlugin.actionSetSoftwareBreakpoint,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE));
|
||||
public void testActionSetSwExecuteBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(CommonSet.SWX);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetSoftwareBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(breakpointMarkerPlugin.actionSetSoftwareBreakpoint,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE));
|
||||
public void testActionSetSwExecuteBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(CommonSet.SWX);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetExecuteBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(breakpointMarkerPlugin.actionSetExecuteBreakpoint,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE));
|
||||
public void testActionSetHwExecuteBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(CommonSet.HWX);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetExecuteBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(breakpointMarkerPlugin.actionSetExecuteBreakpoint,
|
||||
Set.of(TraceBreakpointKind.HW_EXECUTE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetReadWriteBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(breakpointMarkerPlugin.actionSetReadWriteBreakpoint,
|
||||
Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetReadWriteBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(breakpointMarkerPlugin.actionSetReadWriteBreakpoint,
|
||||
Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE));
|
||||
public void testActionSetHwExecuteBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(CommonSet.HWX);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetReadBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(breakpointMarkerPlugin.actionSetReadBreakpoint,
|
||||
Set.of(TraceBreakpointKind.READ));
|
||||
testActionSetBreakpointProgram(CommonSet.READ);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetReadBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(breakpointMarkerPlugin.actionSetReadBreakpoint,
|
||||
Set.of(TraceBreakpointKind.READ));
|
||||
testActionSetBreakpointTrace(CommonSet.READ);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetWriteBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(breakpointMarkerPlugin.actionSetWriteBreakpoint,
|
||||
Set.of(TraceBreakpointKind.WRITE));
|
||||
testActionSetBreakpointProgram(CommonSet.WRITE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetWriteBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(breakpointMarkerPlugin.actionSetWriteBreakpoint,
|
||||
Set.of(TraceBreakpointKind.WRITE));
|
||||
testActionSetBreakpointTrace(CommonSet.WRITE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetAccessBreakpointProgram() throws Throwable {
|
||||
testActionSetBreakpointProgram(CommonSet.ACCESS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionSetAccessBreakpointTrace() throws Throwable {
|
||||
testActionSetBreakpointTrace(CommonSet.ACCESS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -867,7 +857,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
waitForPass(() -> {
|
||||
LogicalBreakpoint lb = Unique.assertOne(breakpointService.getAllBreakpoints());
|
||||
assertEquals(State.INEFFECTIVE_ENABLED, lb.computeState());
|
||||
assertEquals(Set.of(TraceBreakpointKind.SW_EXECUTE), lb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), lb.getKinds());
|
||||
});
|
||||
|
||||
performEnabledAction(decompilerProvider, breakpointMarkerPlugin.actionToggleBreakpoint,
|
||||
@@ -875,7 +865,7 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
waitForPass(() -> {
|
||||
LogicalBreakpoint lb = Unique.assertOne(breakpointService.getAllBreakpoints());
|
||||
assertEquals(State.INEFFECTIVE_DISABLED, lb.computeState());
|
||||
assertEquals(Set.of(TraceBreakpointKind.SW_EXECUTE), lb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), lb.getKinds());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -891,9 +881,9 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
|
||||
runSwing(() -> decompilerProvider.getController().setDecompileData(mockData(results)));
|
||||
|
||||
waitOn(breakpointService.placeBreakpointAt(program, entry, 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), ""));
|
||||
CommonSet.SWX.kinds(), ""));
|
||||
waitOn(breakpointService.placeBreakpointAt(program, entry.add(2), 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), ""));
|
||||
CommonSet.SWX.kinds(), ""));
|
||||
waitForPass(() -> {
|
||||
assertEquals(2, breakpointService.getAllBreakpoints().size());
|
||||
});
|
||||
|
||||
+5
-5
@@ -50,7 +50,7 @@ import ghidra.program.model.mem.MemoryConflictException;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointLocation;
|
||||
import ghidra.trace.model.time.TraceSnapshot;
|
||||
import ghidra.util.SystemUtilities;
|
||||
@@ -107,7 +107,7 @@ public abstract class AbstractDebuggerBreakpointsProviderTest<T, P>
|
||||
TaskMonitor.DUMMY, false);
|
||||
program.getBookmarkManager()
|
||||
.setBookmark(addr(program, 0x00400123), LogicalBreakpoint.ENABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1", "");
|
||||
"x;1", "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public abstract class AbstractDebuggerBreakpointsProviderTest<T, P>
|
||||
Unique.assertOne(breakpointsProvider.breakpointTableModel.getModelData());
|
||||
assertEquals("55550123", row.getAddress().toString());
|
||||
assertEquals(trace, row.getDomainObject());
|
||||
assertEquals("SW_EXECUTE", row.getKinds());
|
||||
assertEquals("x", row.getKind());
|
||||
assertEquals(State.INCONSISTENT_ENABLED, row.getState());
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public abstract class AbstractDebuggerBreakpointsProviderTest<T, P>
|
||||
Unique.assertOne(breakpointsProvider.breakpointTableModel.getModelData());
|
||||
assertEquals("00400123", row.getAddress().toString());
|
||||
assertEquals(program, row.getDomainObject());
|
||||
assertEquals("SW_EXECUTE", row.getKinds());
|
||||
assertEquals("x", row.getKind());
|
||||
assertEquals(State.INEFFECTIVE_ENABLED, row.getState());
|
||||
}
|
||||
|
||||
@@ -534,7 +534,7 @@ public abstract class AbstractDebuggerBreakpointsProviderTest<T, P>
|
||||
});
|
||||
|
||||
performAction(breakpointsProvider.actionMakeBreakpointsEffective);
|
||||
handleSetBreakpointInvocation(TraceBreakpointKindSet.SW_EXECUTE, 0x55550123);
|
||||
handleSetBreakpointInvocation(CommonSet.SWX.kinds(), 0x55550123);
|
||||
|
||||
waitForPass(() -> {
|
||||
assertFalse(breakpointsProvider.actionMakeBreakpointsEffective.isEnabled());
|
||||
|
||||
+12
-13
@@ -29,7 +29,7 @@ import ghidra.trace.database.target.DBTraceObjectManager;
|
||||
import ghidra.trace.model.Lifespan;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointLocation;
|
||||
|
||||
@Category(NightlyCategory.class)
|
||||
@@ -76,8 +76,7 @@ public class DebuggerRmiBreakpointMarkerPluginTest
|
||||
try (Transaction tx = tb.startTransaction()) {
|
||||
DBTraceObjectManager objs = tb.trace.getObjectManager();
|
||||
addMemoryRegion(objs, zeroOn, tb.range(0x55550000, 0x55550fff), "bin:.text", "rx");
|
||||
addBreakpointAndLoc(objs, zeroOn, tb.range(0x55550123),
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE));
|
||||
addBreakpointAndLoc(objs, zeroOn, tb.range(0x55550123), CommonSet.SWX.kinds());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,46 +84,46 @@ public class DebuggerRmiBreakpointMarkerPluginTest
|
||||
protected void handleSetBreakpointInvocation(Set<TraceBreakpointKind> expectedKinds,
|
||||
long dynOffset) throws Throwable {
|
||||
Lifespan zeroOn = Lifespan.nowOn(0);
|
||||
if (TraceBreakpointKindSet.READ.equals(expectedKinds)) {
|
||||
if (CommonSet.READ.kinds().equals(expectedKinds)) {
|
||||
Map<String, Object> args = rmiMethodSetReadBreak.expect();
|
||||
addBreakpointAndLoc(tb.trace.getObjectManager(), zeroOn, tb.range(dynOffset),
|
||||
TraceBreakpointKindSet.READ);
|
||||
CommonSet.READ.kinds());
|
||||
rmiMethodSetReadBreak.result(null);
|
||||
assertEquals(Map.ofEntries(
|
||||
Map.entry("process", tb.obj("Processes[1]")),
|
||||
Map.entry("range", tb.range(dynOffset))), args);
|
||||
}
|
||||
else if (TraceBreakpointKindSet.WRITE.equals(expectedKinds)) {
|
||||
else if (CommonSet.WRITE.kinds().equals(expectedKinds)) {
|
||||
Map<String, Object> args = rmiMethodSetWriteBreak.expect();
|
||||
addBreakpointAndLoc(tb.trace.getObjectManager(), zeroOn, tb.range(dynOffset),
|
||||
TraceBreakpointKindSet.WRITE);
|
||||
CommonSet.WRITE.kinds());
|
||||
rmiMethodSetWriteBreak.result(null);
|
||||
assertEquals(Map.ofEntries(
|
||||
Map.entry("process", tb.obj("Processes[1]")),
|
||||
Map.entry("range", tb.range(dynOffset))), args);
|
||||
}
|
||||
else if (TraceBreakpointKindSet.ACCESS.equals(expectedKinds)) {
|
||||
else if (CommonSet.ACCESS.kinds().equals(expectedKinds)) {
|
||||
Map<String, Object> args = rmiMethodSetAccessBreak.expect();
|
||||
addBreakpointAndLoc(tb.trace.getObjectManager(), zeroOn, tb.range(dynOffset),
|
||||
TraceBreakpointKindSet.ACCESS);
|
||||
CommonSet.ACCESS.kinds());
|
||||
rmiMethodSetAccessBreak.result(null);
|
||||
assertEquals(Map.ofEntries(
|
||||
Map.entry("process", tb.obj("Processes[1]")),
|
||||
Map.entry("range", tb.range(dynOffset))), args);
|
||||
}
|
||||
else if (TraceBreakpointKindSet.SW_EXECUTE.equals(expectedKinds)) {
|
||||
else if (CommonSet.SWX.kinds().equals(expectedKinds)) {
|
||||
Map<String, Object> args = rmiMethodSetSwBreak.expect();
|
||||
addBreakpointAndLoc(tb.trace.getObjectManager(), zeroOn, tb.range(dynOffset),
|
||||
TraceBreakpointKindSet.SW_EXECUTE);
|
||||
CommonSet.SWX.kinds());
|
||||
rmiMethodSetSwBreak.result(null);
|
||||
assertEquals(Map.ofEntries(
|
||||
Map.entry("process", tb.obj("Processes[1]")),
|
||||
Map.entry("address", tb.addr(dynOffset))), args);
|
||||
}
|
||||
else if (TraceBreakpointKindSet.HW_EXECUTE.equals(expectedKinds)) {
|
||||
else if (CommonSet.HWX.kinds().equals(expectedKinds)) {
|
||||
Map<String, Object> args = rmiMethodSetHwBreak.expect();
|
||||
addBreakpointAndLoc(tb.trace.getObjectManager(), zeroOn, tb.range(dynOffset),
|
||||
TraceBreakpointKindSet.HW_EXECUTE);
|
||||
CommonSet.HWX.kinds());
|
||||
rmiMethodSetHwBreak.result(null);
|
||||
assertEquals(Map.ofEntries(
|
||||
Map.entry("process", tb.obj("Processes[1]")),
|
||||
|
||||
+4
-4
@@ -28,7 +28,7 @@ import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.Lifespan;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointLocation;
|
||||
import ghidra.trace.model.memory.TraceMemoryRegion;
|
||||
|
||||
@@ -117,7 +117,7 @@ public class DebuggerRmiBreakpointsProviderTest
|
||||
Trace trace = target.getTrace();
|
||||
try (Transaction tx = trace.openTransaction("Add breakpoint")) {
|
||||
addBreakpointAndLoc(trace.getObjectManager(), Lifespan.nowOn(0), tb.range(offset),
|
||||
TraceBreakpointKindSet.SW_EXECUTE);
|
||||
CommonSet.SWX.kinds());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,10 +125,10 @@ public class DebuggerRmiBreakpointsProviderTest
|
||||
protected void handleSetBreakpointInvocation(Set<TraceBreakpointKind> expectedKinds,
|
||||
long dynOffset) throws Throwable {
|
||||
Lifespan zeroOn = Lifespan.nowOn(0);
|
||||
if (TraceBreakpointKindSet.SW_EXECUTE.equals(expectedKinds)) {
|
||||
if (CommonSet.SWX.kinds().equals(expectedKinds)) {
|
||||
Map<String, Object> args = rmiMethodSetSwBreak.expect();
|
||||
addBreakpointAndLoc(tb.trace.getObjectManager(), zeroOn, tb.range(dynOffset),
|
||||
TraceBreakpointKindSet.SW_EXECUTE);
|
||||
CommonSet.SWX.kinds());
|
||||
rmiMethodSetSwBreak.result(null);
|
||||
assertEquals(Map.ofEntries(
|
||||
Map.entry("process", tb.obj("Processes[1]")),
|
||||
|
||||
+13
-14
@@ -42,6 +42,7 @@ import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.memory.TraceMemoryFlag;
|
||||
import ghidra.trace.model.memory.TraceMemoryRegion;
|
||||
import ghidra.trace.model.target.TraceObject.ConflictResolution;
|
||||
@@ -263,10 +264,10 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
try (Transaction tx = p.openTransaction("Create bookmarks")) {
|
||||
enBm = p.getBookmarkManager()
|
||||
.setBookmark(addr(p, 0x00400123), LogicalBreakpoint.ENABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1", "");
|
||||
"x;1", "");
|
||||
disBm = p.getBookmarkManager()
|
||||
.setBookmark(addr(p, 0x00400321), LogicalBreakpoint.DISABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1", "");
|
||||
"x;1", "");
|
||||
}
|
||||
waitForDomainObject(p);
|
||||
}
|
||||
@@ -274,11 +275,9 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
protected void refetchProgramBreakpoints(Program p) throws Throwable {
|
||||
// After a redo
|
||||
enBm = p.getBookmarkManager()
|
||||
.getBookmark(addr(p, 0x00400123), LogicalBreakpoint.ENABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1");
|
||||
.getBookmark(addr(p, 0x00400123), LogicalBreakpoint.ENABLED_BOOKMARK_TYPE, "x;1");
|
||||
disBm = p.getBookmarkManager()
|
||||
.getBookmark(addr(p, 0x00400321), LogicalBreakpoint.DISABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1");
|
||||
.getBookmark(addr(p, 0x00400321), LogicalBreakpoint.DISABLED_BOOKMARK_TYPE, "x;1");
|
||||
}
|
||||
|
||||
protected void removeProgramBreakpoints(Program p) throws Throwable {
|
||||
@@ -292,7 +291,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
protected void assertLogicalBreakpointForLoneAccessBreakpoint(Trace trace) {
|
||||
LogicalBreakpoint enLb = Unique.assertOne(breakpointService.getAllBreakpoints());
|
||||
assertNull(enLb.getProgramLocation());
|
||||
assertEquals(Set.of(TraceBreakpointKind.READ, TraceBreakpointKind.WRITE), enLb.getKinds());
|
||||
assertEquals(CommonSet.ACCESS.kinds(), enLb.getKinds());
|
||||
|
||||
TraceBreakpointLocation bpt =
|
||||
Unique.assertOne(trace.getBreakpointManager().getAllBreakpointLocations());
|
||||
@@ -314,7 +313,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
LogicalBreakpoint enLb =
|
||||
Unique.assertOne(breakpointService.getBreakpointsAt(trace, addr(trace, offset)));
|
||||
assertNull(enLb.getProgramLocation());
|
||||
assertEquals(Set.of(TraceBreakpointKind.SW_EXECUTE), enLb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), enLb.getKinds());
|
||||
|
||||
TraceBreakpointLocation bpt =
|
||||
Unique.assertOne(trace.getBreakpointManager().getAllBreakpointLocations());
|
||||
@@ -332,7 +331,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
.assertOne(breakpointService.getBreakpointsAt(program, addr(program, 0x00400123)));
|
||||
assertNotNull(enLb.getProgramBookmark()); // Created automatically when trace breakpoint set.
|
||||
assertEquals(State.ENABLED, enLb.computeStateForProgram(program));
|
||||
assertEquals(Set.of(TraceBreakpointKind.SW_EXECUTE), enLb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), enLb.getKinds());
|
||||
|
||||
TraceBreakpointLocation bpt =
|
||||
Unique.assertOne(trace.getBreakpointManager().getAllBreakpointLocations());
|
||||
@@ -353,7 +352,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
assertEquals(enBm, enLb.getProgramBookmark());
|
||||
assertTrue(enLb.getMappedTraces().isEmpty());
|
||||
assertEquals(State.INEFFECTIVE_ENABLED, enLb.computeStateForProgram(program));
|
||||
assertEquals(Set.of(TraceBreakpointKind.SW_EXECUTE), enLb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), enLb.getKinds());
|
||||
|
||||
LogicalBreakpoint disLb = Unique
|
||||
.assertOne(breakpointService.getBreakpointsAt(program, addr(program, 0x00400321)));
|
||||
@@ -362,7 +361,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
assertEquals(disBm, disLb.getProgramBookmark());
|
||||
assertTrue(disLb.getMappedTraces().isEmpty());
|
||||
assertEquals(State.INEFFECTIVE_DISABLED, disLb.computeStateForProgram(program));
|
||||
assertEquals(Set.of(TraceBreakpointKind.SW_EXECUTE), disLb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), disLb.getKinds());
|
||||
}
|
||||
|
||||
protected void assertLogicalBreakpointsForMappedBookmarks(Trace trace) {
|
||||
@@ -1509,7 +1508,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
try (Transaction tid = p.openTransaction("Create bookmark bp with sleigh")) {
|
||||
enBm = p.getBookmarkManager()
|
||||
.setBookmark(addr(p, 0x00400123), LogicalBreakpoint.ENABLED_BOOKMARK_TYPE,
|
||||
"SW_EXECUTE;1", "{sleigh: 'r0=0xbeef;'}");
|
||||
"x;1", "{sleigh: 'r0=0xbeef;'}");
|
||||
}
|
||||
waitForDomainObject(p);
|
||||
}
|
||||
@@ -1606,7 +1605,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
tb.createRootObject(SCHEMA_CTX);
|
||||
TraceBreakpointLocation bpt = tb.trace.getBreakpointManager()
|
||||
.addBreakpoint("Processes[1].Breakpoints[0][0]", Lifespan.nowOn(0),
|
||||
tb.addr(0x55550123), Set.of(), Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
tb.addr(0x55550123), Set.of(), CommonSet.SWX.kinds(),
|
||||
false /* emuEnabled defaults to true */, "");
|
||||
bpt.setEmuSleigh(0, "r0=0xbeef;");
|
||||
}
|
||||
@@ -1661,7 +1660,7 @@ public abstract class AbstractDebuggerLogicalBreakpointServiceTest<T, MR>
|
||||
TraceBreakpointLocation bpt = tb.trace.getBreakpointManager()
|
||||
.addBreakpoint("Processes[1].Breakpoints[0]", Lifespan.nowOn(0),
|
||||
tb.addr(0x55550123),
|
||||
Set.of(), Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
Set.of(), CommonSet.SWX.kinds(),
|
||||
false /* emuEnabled defaults to true */, "");
|
||||
bpt.setEmuSleigh(0, "r0=0xbeef;");
|
||||
waitForValue(() -> Unique.assertAtMostOne(
|
||||
|
||||
+8
-8
@@ -40,7 +40,7 @@ import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.trace.database.ToyDBTraceBuilder;
|
||||
import ghidra.trace.model.*;
|
||||
import ghidra.trace.model.breakpoint.*;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.memory.TraceMemoryRegion;
|
||||
import ghidra.trace.model.modules.TraceStaticMapping;
|
||||
import ghidra.trace.model.target.TraceObject;
|
||||
@@ -178,7 +178,7 @@ public class DebuggerRmiLogicalBreakpointServiceTest extends
|
||||
Trace trace = target.getTrace();
|
||||
try (Transaction tx = trace.openTransaction("Add access breakpoint")) {
|
||||
addBreakpointAndLoc(trace.getObjectManager(), Lifespan.nowOn(target.getSnap()),
|
||||
tb.range(min, min), TraceBreakpointKindSet.ACCESS);
|
||||
tb.range(min, min), CommonSet.ACCESS.kinds());
|
||||
}
|
||||
waitForDomainObject(trace);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public class DebuggerRmiLogicalBreakpointServiceTest extends
|
||||
Trace trace = target.getTrace();
|
||||
try (Transaction tx = trace.openTransaction("Add software breakpoint")) {
|
||||
addBreakpointAndLoc(trace.getObjectManager(), Lifespan.nowOn(target.getSnap()),
|
||||
tb.range(min, min), TraceBreakpointKindSet.SW_EXECUTE, id);
|
||||
tb.range(min, min), CommonSet.SWX.kinds(), id);
|
||||
}
|
||||
waitForDomainObject(trace);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ public class DebuggerRmiLogicalBreakpointServiceTest extends
|
||||
List<? extends TraceBreakpointLocation> locsToDel = trace.getBreakpointManager()
|
||||
.getAllBreakpointLocations()
|
||||
.stream()
|
||||
.filter(loc -> loc.getKinds(snap).equals(TraceBreakpointKindSet.SW_EXECUTE))
|
||||
.filter(loc -> loc.getKinds(snap).equals(CommonSet.SWX.kinds()))
|
||||
.toList();
|
||||
List<TraceBreakpointSpec> specsToDel =
|
||||
locsToDel.stream().map(bp -> bp.getSpecification()).distinct().toList();
|
||||
@@ -279,7 +279,7 @@ public class DebuggerRmiLogicalBreakpointServiceTest extends
|
||||
tb.createRootObject(SCHEMA_CTX);
|
||||
bpt = tb.trace.getBreakpointManager()
|
||||
.addBreakpoint("Processes[1].Breakpoints[0][0]", Lifespan.nowOn(0),
|
||||
tb.addr(0x55550123), Set.of(), Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
tb.addr(0x55550123), Set.of(), CommonSet.SWX.kinds(),
|
||||
false, "");
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
@@ -323,7 +323,7 @@ public class DebuggerRmiLogicalBreakpointServiceTest extends
|
||||
tb.createRootObject(SCHEMA_CTX);
|
||||
bpt = tb.trace.getBreakpointManager()
|
||||
.addBreakpoint("Processes[1].Breakpoints[0][0]", Lifespan.nowOn(0),
|
||||
tb.addr(0x55550123), Set.of(), Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
tb.addr(0x55550123), Set.of(), CommonSet.SWX.kinds(),
|
||||
false, "");
|
||||
}
|
||||
waitForDomainObject(tb.trace);
|
||||
@@ -379,7 +379,7 @@ public class DebuggerRmiLogicalBreakpointServiceTest extends
|
||||
tb.createRootObject(SCHEMA_CTX);
|
||||
bpt = tb.trace.getBreakpointManager()
|
||||
.addBreakpoint("Processes[1].Breakpoints[0][0]", Lifespan.nowOn(0),
|
||||
tb.addr(0x55550123), Set.of(), Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
tb.addr(0x55550123), Set.of(), CommonSet.SWX.kinds(),
|
||||
false, "");
|
||||
addTextMappingDead(0, program, tb);
|
||||
}
|
||||
@@ -431,7 +431,7 @@ public class DebuggerRmiLogicalBreakpointServiceTest extends
|
||||
tb.createRootObject(SCHEMA_CTX);
|
||||
bpt = tb.trace.getBreakpointManager()
|
||||
.addBreakpoint("Processes[1].Breakpoints[0][0]", Lifespan.nowOn(0),
|
||||
tb.addr(0x55550123), Set.of(), Set.of(TraceBreakpointKind.SW_EXECUTE),
|
||||
tb.addr(0x55550123), Set.of(), CommonSet.SWX.kinds(),
|
||||
false, "");
|
||||
addTextMappingDead(0, program, tb);
|
||||
}
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ import ghidra.trace.database.ToyDBTraceBuilder.ToySchemaBuilder;
|
||||
import ghidra.trace.database.memory.DBTraceMemoryManager;
|
||||
import ghidra.trace.database.memory.DBTraceMemorySpace;
|
||||
import ghidra.trace.model.Lifespan;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.memory.TraceMemoryFlag;
|
||||
import ghidra.trace.model.target.schema.SchemaContext;
|
||||
import ghidra.trace.model.thread.TraceThread;
|
||||
@@ -296,7 +296,7 @@ public abstract class AbstractFlatDebuggerAPITest<API extends FlatDebuggerAPI>
|
||||
|
||||
CompletableFuture<Void> changesSettled = breakpointService.changesSettled();
|
||||
waitOn(breakpointService.placeBreakpointAt(program, addr(program, 0x00400000), 1,
|
||||
Set.of(TraceBreakpointKind.SW_EXECUTE), "name"));
|
||||
CommonSet.SWX.kinds(), "name"));
|
||||
waitForSwing();
|
||||
waitOn(changesSettled);
|
||||
}
|
||||
|
||||
+6
-6
@@ -32,7 +32,7 @@ import ghidra.debug.api.breakpoint.LogicalBreakpoint.State;
|
||||
import ghidra.debug.api.tracemgr.DebuggerCoordinates;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;
|
||||
import ghidra.trace.model.breakpoint.TraceBreakpointKind.CommonSet;
|
||||
import ghidra.trace.model.stack.TraceStack;
|
||||
import ghidra.trace.model.thread.TraceThread;
|
||||
import ghidra.trace.model.time.schedule.TraceSchedule;
|
||||
@@ -460,7 +460,7 @@ public class DeadFlatDebuggerAPITest extends AbstractFlatDebuggerAPITest<FlatDeb
|
||||
LogicalBreakpoint lb = Unique.assertOne(
|
||||
api.breakpointSetSoftwareExecute(api.staticLocation("00400000"), "name"));
|
||||
assertEquals(addr(program, 0x00400000), lb.getAddress());
|
||||
assertEquals(TraceBreakpointKindSet.SW_EXECUTE, lb.getKinds());
|
||||
assertEquals(CommonSet.SWX.kinds(), lb.getKinds());
|
||||
assertEquals(1, lb.getLength());
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ public class DeadFlatDebuggerAPITest extends AbstractFlatDebuggerAPITest<FlatDeb
|
||||
LogicalBreakpoint lb = Unique.assertOne(
|
||||
api.breakpointSetHardwareExecute(api.staticLocation("00400000"), "name"));
|
||||
assertEquals(addr(program, 0x00400000), lb.getAddress());
|
||||
assertEquals(TraceBreakpointKindSet.HW_EXECUTE, lb.getKinds());
|
||||
assertEquals(CommonSet.HWX.kinds(), lb.getKinds());
|
||||
assertEquals(1, lb.getLength());
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ public class DeadFlatDebuggerAPITest extends AbstractFlatDebuggerAPITest<FlatDeb
|
||||
LogicalBreakpoint lb = Unique.assertOne(
|
||||
api.breakpointSetRead(api.staticLocation("00400000"), 4, "name"));
|
||||
assertEquals(addr(program, 0x00400000), lb.getAddress());
|
||||
assertEquals(TraceBreakpointKindSet.READ, lb.getKinds());
|
||||
assertEquals(CommonSet.READ.kinds(), lb.getKinds());
|
||||
assertEquals(4, lb.getLength());
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ public class DeadFlatDebuggerAPITest extends AbstractFlatDebuggerAPITest<FlatDeb
|
||||
LogicalBreakpoint lb = Unique.assertOne(
|
||||
api.breakpointSetWrite(api.staticLocation("00400000"), 4, "name"));
|
||||
assertEquals(addr(program, 0x00400000), lb.getAddress());
|
||||
assertEquals(TraceBreakpointKindSet.WRITE, lb.getKinds());
|
||||
assertEquals(CommonSet.WRITE.kinds(), lb.getKinds());
|
||||
assertEquals(4, lb.getLength());
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ public class DeadFlatDebuggerAPITest extends AbstractFlatDebuggerAPITest<FlatDeb
|
||||
LogicalBreakpoint lb = Unique.assertOne(
|
||||
api.breakpointSetAccess(api.staticLocation("00400000"), 4, "name"));
|
||||
assertEquals(addr(program, 0x00400000), lb.getAddress());
|
||||
assertEquals(TraceBreakpointKindSet.ACCESS, lb.getKinds());
|
||||
assertEquals(CommonSet.ACCESS.kinds(), lb.getKinds());
|
||||
assertEquals(4, lb.getLength());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user