Merge remote-tracking branch 'origin/Ghidra_11.3'

This commit is contained in:
Ryan Kurtz 2025-01-21 10:18:58 -05:00
commit 34e38c3d48
5 changed files with 20 additions and 20 deletions

View file

@ -287,7 +287,7 @@ def refresh_processes(node: sch.Schema('ProcessContainer')):
@REGISTRY.method(action='refresh', display="Refresh Breakpoints") @REGISTRY.method(action='refresh', display="Refresh Breakpoints")
def refresh_proc_breakpoints(node: sch.Schema('BreakpointLocationContainer')): def refresh_proc_breakpoints(node: sch.Schema('BreakpointContainer')):
""" """
Refresh the breakpoints for the process. Refresh the breakpoints for the process.
""" """

View file

@ -15,12 +15,12 @@
*/ */
package ghidra.dbg.target.schema; package ghidra.dbg.target.schema;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import java.io.IOException; import java.io.IOException;
import org.jdom.JDOMException; import org.jdom.JDOMException;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import ghidra.trace.model.breakpoint.TraceObjectBreakpointLocation; import ghidra.trace.model.breakpoint.TraceObjectBreakpointLocation;
@ -80,6 +80,7 @@ public class XmlTargetObjectSchemaTest {
} }
@Test @Test
@Ignore("Actually, null is what's intended, but that design needs fixing.")
public void testSearchWithMultipleImpls() throws Exception { public void testSearchWithMultipleImpls() throws Exception {
SchemaContext ctx = XmlSchemaContext.deserialize(""" SchemaContext ctx = XmlSchemaContext.deserialize("""
<context> <context>

View file

@ -49,7 +49,8 @@ import ghidra.trace.model.listing.TraceCodeSpace;
import ghidra.trace.model.listing.TraceData; import ghidra.trace.model.listing.TraceData;
import ghidra.trace.model.memory.*; import ghidra.trace.model.memory.*;
import ghidra.trace.model.modules.TraceModule; import ghidra.trace.model.modules.TraceModule;
import ghidra.trace.model.target.*; import ghidra.trace.model.target.TraceObject;
import ghidra.trace.model.target.TraceObjectValue;
import ghidra.trace.model.target.path.KeyPath; import ghidra.trace.model.target.path.KeyPath;
import ghidra.trace.model.target.path.PathFilter; import ghidra.trace.model.target.path.PathFilter;
import ghidra.trace.model.time.TraceSnapshot; import ghidra.trace.model.time.TraceSnapshot;
@ -1040,7 +1041,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {
tb = new ToyDBTraceBuilder((Trace) mdo.get()); tb = new ToyDBTraceBuilder((Trace) mdo.get());
List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager() List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager()
.getValuePaths(Lifespan.at(0), .getValuePaths(Lifespan.at(0),
PathFilter.parse("Processes[].Breakpoints[]")) PathFilter.parse("Processes[].Breakpoints[][1]"))
.map(p -> p.getLastEntry()) .map(p -> p.getLastEntry())
.sorted(Comparator.comparing(TraceObjectValue::getEntryKey)) .sorted(Comparator.comparing(TraceObjectValue::getEntryKey))
.toList(); .toList();
@ -1049,10 +1050,10 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {
procBreakLocVals.get(0).getChild().getValue(0, "_range").castValue(); procBreakLocVals.get(0).getChild().getValue(0, "_range").castValue();
Address main = rangeMain.getMinAddress(); Address main = rangeMain.getMinAddress();
assertBreakLoc(procBreakLocVals.get(0), "[1.1]", main, 1, assertBreakLoc(procBreakLocVals.get(0), "[1]", main, 1,
Set.of(TraceBreakpointKind.SW_EXECUTE), Set.of(TraceBreakpointKind.SW_EXECUTE),
"main"); "main");
assertBreakLoc(procBreakLocVals.get(1), "[2.1]", main, 1, assertBreakLoc(procBreakLocVals.get(1), "[1]", main, 1,
Set.of(TraceBreakpointKind.HW_EXECUTE), Set.of(TraceBreakpointKind.HW_EXECUTE),
"main"); "main");
} }

View file

@ -15,8 +15,7 @@
*/ */
package agent.lldb.rmi; package agent.lldb.rmi;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -347,13 +346,13 @@ public class LldbHooksTest extends AbstractLldbTraceRmiTest {
public void testOnBreakpointModified() throws Exception { public void testOnBreakpointModified() throws Exception {
try (LldbAndTrace conn = startAndSyncLldb()) { try (LldbAndTrace conn = startAndSyncLldb()) {
start(conn, getSpecimenPrint()); start(conn, getSpecimenPrint());
assertEquals(0, tb.objValues(lastSnap(conn), "Breakpoints[]").size()); assertEquals(0, tb.objValues(lastSnap(conn), "Processes[].Breakpoints[]").size());
//conn.execute("script lldb.debugger.SetAsync(False)"); //conn.execute("script lldb.debugger.SetAsync(False)");
conn.execute("breakpoint set -n main"); conn.execute("breakpoint set -n main");
conn.execute("stepi"); conn.execute("stepi");
TraceObject brk = waitForPass(() -> { TraceObject brk = waitForPass(() -> {
List<Object> brks = tb.objValues(lastSnap(conn), "Breakpoints[]"); List<Object> brks = tb.objValues(lastSnap(conn), "Processes[].Breakpoints[]");
assertEquals(1, brks.size()); assertEquals(1, brks.size());
return (TraceObject) brks.get(0); return (TraceObject) brks.get(0);
}); });

View file

@ -15,10 +15,9 @@
*/ */
package agent.lldb.rmi; package agent.lldb.rmi;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue; import static org.junit.Assume.*;
import java.util.*; import java.util.*;
@ -152,7 +151,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {
List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager() List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager()
.getValuePaths(Lifespan.at(0), .getValuePaths(Lifespan.at(0),
PathFilter.parse("Processes[].Breakpoints[]")) PathFilter.parse("Processes[].Breakpoints[][1]"))
.map(p -> p.getLastEntry()) .map(p -> p.getLastEntry())
.sorted(Comparator.comparing(TraceObjectValue::getEntryKey)) .sorted(Comparator.comparing(TraceObjectValue::getEntryKey))
.toList(); .toList();
@ -161,10 +160,10 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {
procBreakLocVals.get(0).getChild().getValue(0, "_range").castValue(); procBreakLocVals.get(0).getChild().getValue(0, "_range").castValue();
Address main = rangeMain.getMinAddress(); Address main = rangeMain.getMinAddress();
assertBreakLoc(procBreakLocVals.get(0), "[1.1]", main, 1, assertBreakLoc(procBreakLocVals.get(0), "[1]", main, 1,
Set.of(TraceBreakpointKind.SW_EXECUTE), Set.of(TraceBreakpointKind.SW_EXECUTE),
"main"); "main");
assertBreakLoc(procBreakLocVals.get(1), "[2.1]", main, 1, assertBreakLoc(procBreakLocVals.get(1), "[1]", main, 1,
Set.of(TraceBreakpointKind.HW_EXECUTE), Set.of(TraceBreakpointKind.HW_EXECUTE),
"main"); "main");
} }
@ -1063,7 +1062,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {
conn.execute("breakpoint set -n main"); conn.execute("breakpoint set -n main");
txPut(conn, "breakpoints"); txPut(conn, "breakpoints");
TraceObject bpt = Objects.requireNonNull(tb.objAny0("Breakpoints[]")); TraceObject bpt = Objects.requireNonNull(tb.objAny0("Processes[].Breakpoints[]"));
toggleBreakpoint.invoke(Map.of("breakpoint", bpt, "enabled", false)); toggleBreakpoint.invoke(Map.of("breakpoint", bpt, "enabled", false));
@ -1087,7 +1086,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {
conn.execute("breakpoint set -n main"); conn.execute("breakpoint set -n main");
txPut(conn, "breakpoints"); txPut(conn, "breakpoints");
TraceObject loc = Objects.requireNonNull(tb.objAny0("Breakpoints[][]")); TraceObject loc = Objects.requireNonNull(tb.objAny0("Processes[].Breakpoints[][]"));
toggleBreakpointLocation.invoke(Map.of("location", loc, "enabled", false)); toggleBreakpointLocation.invoke(Map.of("location", loc, "enabled", false));
@ -1110,7 +1109,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {
conn.execute("breakpoint set -n main"); conn.execute("breakpoint set -n main");
txPut(conn, "breakpoints"); txPut(conn, "breakpoints");
TraceObject bpt = Objects.requireNonNull(tb.objAny0("Breakpoints[]")); TraceObject bpt = Objects.requireNonNull(tb.objAny0("Processes[].Breakpoints[]"));
deleteBreakpoint.invoke(Map.of("breakpoint", bpt)); deleteBreakpoint.invoke(Map.of("breakpoint", bpt));