Ghidra is a software reverse engineering (SRE) framework
GP-1978: Delete Framework-Debugging. Merge needed parts into TraceModeling.
Danf5a93c307211
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.pyindex 3af23dafad..697329d1b7 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/commands.py@@ -32,7 +32,8 @@ from pybag.dbgeng.win32.kernel32 import STILL_ACTIVEfrom . import util, arch, methods, hooksfrom .dbgmodel.imodelobject import ModelObjectKind-from .exdi import exdi_commands, exdi_methods+if util.is_exdi():+ from .exdi import exdi_commands, exdi_methodsPAGE_SIZE = 4096diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/methods.py b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/methods.pyindex fd0eee45d3..5326cc5be5 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/methods.py+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/methods.py@@ -243,18 +243,6 @@ def refresh_processes(node: sch.Schema('ProcessContainer')):commands.ghidra_trace_put_processes()[email protected](action='refresh', display='Refresh Breakpoint Locations')-def refresh_proc_breakpoints(node: sch.Schema('BreakpointLocationContainer')):- """- Refresh the breakpoint locations for the process.-- In the course of refreshing the locations, the breakpoint list will also be- refreshed.- """- with commands.open_tracked_tx('Refresh Breakpoint Locations'):- commands.ghidra_trace_put_breakpoints()--@REGISTRY.method(action='refresh', display='Refresh Environment')def refresh_environment(node: sch.Schema('Environment')):"""Refresh the environment descriptors (arch, os, endian)."""diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema.xml b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema.xmlindex be20b61edd..872d38b53d 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema.xml+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema.xml@@ -1,6 +1,5 @@<context><schema name="DbgRoot" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><attribute name="Sessions" schema="SessionContainer" required="yes" fixed="yes" /><attribute name="Settings" schema="ANY" /><attribute name="State" schema="ANY" />@@ -11,19 +10,12 @@<attribute schema="ANY"/></schema><schema name="SessionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Session" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY"/></schema><schema name="Session" elementResync="NEVER" attributeResync="NEVER"><interface name="Activatable" />- <interface name="Access" />- <interface name="Attacher" />- <interface name="Interpreter" />- <interface name="Interruptible" />- <interface name="Launcher" />- <interface name="ActiveScope" /><interface name="EventScope" /><interface name="FocusScope" /><interface name="Aggregate" />@@ -49,20 +41,16 @@<attribute schema="VOID" /></schema><schema name="BreakpointContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" />- <interface name="BreakpointSpecContainer" /><element schema="BreakpointSpec" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" /></schema><schema name="AvailableContainer" canonical="yes" elementResync="ALWAYS" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Attachable" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="ProcessContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Process" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" />@@ -70,12 +58,11 @@<schema name="BreakpointSpec" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="BreakpointSpec" /><interface name="BreakpointLocation" />- <interface name="Deletable" /><interface name="Togglable" /><element schema="VOID" /><attribute name="Expression" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_expression" to="Expression" />- <attribute name="Kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />+ <attribute name="Kinds" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_kinds" to="Kinds" /><attribute name="_order" schema="INT" hidden="yes" /><attribute name="Range" schema="RANGE" />@@ -92,7 +79,6 @@<attribute schema="VOID" /></schema><schema name="Attachable" elementResync="NEVER" attributeResync="NEVER">- <interface name="Attachable" /><element schema="VOID" /><attribute name="PID" schema="LONG" /><attribute-alias from="_pid" to="PID" />@@ -105,18 +91,9 @@<interface name="Process" /><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Attacher" />- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Launcher" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="Threads" schema="ThreadContainer" required="yes" fixed="yes" /><attribute name="Debug" schema="DebugBreakpointContainer" required="yes" fixed="yes" />- <!-- attribute name="Breakpoints" schema="BreakpointLocationContainer" required="yes" fixed="yes" /--><attribute name="Exit Code" schema="LONG" /><attribute-alias from="_exit_code" to="Exit Code" /><attribute name="Environment" schema="Environment" required="yes" fixed="yes" />@@ -128,7 +105,6 @@<attribute-alias from="_pid" to="PID" /><attribute name="State" schema="EXECUTION_STATE" required="yes" hidden="yes" /><attribute-alias from="_state" to="State" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_short_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -149,7 +125,6 @@<attribute schema="VOID" /></schema><schema name="ModuleContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="ModuleContainer" /><element schema="Module" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" />@@ -160,22 +135,7 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>- <schema name="BreakpointLocation" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocation" />- <element schema="VOID" />- <attribute name="Range" schema="RANGE" />- <attribute-alias from="_range" to="Range" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema>- <schema name="BreakpointLocationContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" />- <element schema="BreakpointLocation" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema><schema name="ThreadContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Thread" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" />@@ -192,7 +152,6 @@<interface name="Activatable" /><interface name="Thread" /><interface name="ExecutionStateful" />- <interface name="Steppable" /><interface name="Aggregate" /><element schema="VOID" /><attribute name="Stack" schema="StackFramesContainer" required="yes" fixed="yes" />@@ -238,7 +197,6 @@<attribute schema="VOID" /></schema><schema name="SectionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Section" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -258,13 +216,11 @@<attribute schema="ANY" /></schema><schema name="SymbolContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="SymbolNamespace" /><element schema="Symbol" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="Symbol" elementResync="NEVER" attributeResync="NEVER">- <interface name="Symbol" /><element schema="VOID" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -298,7 +254,6 @@</schema><schema name="RegisterValueContainer" attributeResync="ONCE"><interface name="RegisterContainer" />- <interface name="RegisterBank" /><attribute name="General Purpose Registers" schema="RegisterBank" /><attribute name="Floating Point Registers" schema="RegisterBank" /><attribute name="Advanced Vector Extensions" schema="RegisterBank" />@@ -310,7 +265,6 @@<attribute schema="VOID" /></schema><schema name="RegisterBank" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="RegisterBank" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema_exdi.xml b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema_exdi.xmlindex 66c1b27d30..e6fdfae081 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema_exdi.xml+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/schema_exdi.xml@@ -1,6 +1,5 @@<context><schema name="DbgRoot" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><attribute name="Sessions" schema="SessionContainer" required="yes" fixed="yes" /><attribute name="Settings" schema="ANY" /><attribute name="State" schema="ANY" />@@ -11,19 +10,12 @@<attribute schema="ANY"/></schema><schema name="SessionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Session" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY"/></schema><schema name="Session" elementResync="NEVER" attributeResync="NEVER"><interface name="Activatable" />- <interface name="Access" />- <interface name="Attacher" />- <interface name="Interpreter" />- <interface name="Interruptible" />- <interface name="Launcher" />- <interface name="ActiveScope" /><interface name="EventScope" /><interface name="FocusScope" /><interface name="Aggregate" />@@ -52,20 +44,16 @@<attribute schema="VOID" /></schema><schema name="BreakpointContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" />- <interface name="BreakpointSpecContainer" /><element schema="BreakpointSpec" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" /></schema><schema name="AvailableContainer" canonical="yes" elementResync="ALWAYS" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Attachable" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="ProcessContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Process" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" />@@ -73,12 +61,11 @@<schema name="BreakpointSpec" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="BreakpointSpec" /><interface name="BreakpointLocation" />- <interface name="Deletable" /><interface name="Togglable" /><element schema="VOID" /><attribute name="Expression" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_expression" to="Expression" />- <attribute name="Kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />+ <attribute name="Kinds" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_kinds" to="Kinds" /><attribute name="_order" schema="INT" hidden="yes" /><attribute name="Range" schema="RANGE" />@@ -95,7 +82,6 @@<attribute schema="VOID" /></schema><schema name="Attachable" elementResync="NEVER" attributeResync="NEVER">- <interface name="Attachable" /><element schema="VOID" /><attribute name="PID" schema="LONG" /><attribute-alias from="_pid" to="PID" />@@ -108,18 +94,9 @@<interface name="Process" /><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Attacher" />- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Launcher" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="Threads" schema="ThreadContainer" required="yes" fixed="yes" /><attribute name="Debug" schema="DebugBreakpointContainer" required="yes" fixed="yes" />- <!-- attribute name="Breakpoints" schema="BreakpointLocationContainer" required="yes" fixed="yes" /--><attribute name="Exit Code" schema="LONG" /><attribute-alias from="_exit_code" to="Exit Code" /><attribute name="Environment" schema="Environment" required="yes" fixed="yes" />@@ -131,7 +108,6 @@<attribute-alias from="_pid" to="PID" /><attribute name="State" schema="EXECUTION_STATE" required="yes" hidden="yes" /><attribute-alias from="_state" to="State" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_short_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -163,22 +139,7 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>- <schema name="BreakpointLocation" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocation" />- <element schema="VOID" />- <attribute name="Range" schema="RANGE" />- <attribute-alias from="_range" to="Range" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema>- <schema name="BreakpointLocationContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" />- <element schema="BreakpointLocation" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema><schema name="ThreadContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Thread" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" />@@ -195,7 +156,6 @@<interface name="Activatable" /><interface name="Thread" /><interface name="ExecutionStateful" />- <interface name="Steppable" /><interface name="Aggregate" /><element schema="VOID" /><attribute name="Stack" schema="StackFramesContainer" required="yes" fixed="yes" />@@ -241,7 +201,6 @@<attribute schema="VOID" /></schema><schema name="SectionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Section" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -261,13 +220,11 @@<attribute schema="ANY" /></schema><schema name="SymbolContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="SymbolNamespace" /><element schema="Symbol" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="Symbol" elementResync="NEVER" attributeResync="NEVER">- <interface name="Symbol" /><element schema="VOID" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -301,7 +258,6 @@</schema><schema name="RegisterValueContainer" attributeResync="ONCE"><interface name="RegisterContainer" />- <interface name="RegisterBank" /><attribute name="General Purpose Registers" schema="RegisterBank" /><attribute name="Floating Point Registers" schema="RegisterBank" /><attribute name="Advanced Vector Extensions" schema="RegisterBank" />@@ -313,7 +269,6 @@<attribute schema="VOID" /></schema><schema name="RegisterBank" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="RegisterBank" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>@@ -328,14 +283,6 @@<interface name="Process" /><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Attacher" />- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Launcher" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="Threads" schema="ExdiThreadContainer" required="yes" fixed="yes" /><!-- attribute name="Modules" schema="ModuleContainer" required="yes" fixed="yes" /-->@@ -343,7 +290,6 @@<attribute-alias from="_pid" to="PID" /><attribute name="State" schema="EXECUTION_STATE" required="yes" hidden="yes" /><attribute-alias from="_state" to="State" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_short_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -375,7 +321,6 @@<schema name="ExdiThread" elementResync="NEVER" attributeResync="NEVER"><interface name="Thread" /><interface name="ExecutionStateful" />- <interface name="Steppable" /><interface name="Aggregate" /><element schema="VOID" /><attribute name="TID" schema="LONG" />diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/methods.py b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/methods.pyindex 51c445ddca..7ed486285b 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/methods.py+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/methods.py@@ -228,19 +228,6 @@ def refresh_processes(node: sch.Schema('ProcessContainer')):commands.ghidra_trace_put_threads()[email protected](action='refresh')-def refresh_proc_breakpoints(node: sch.Schema('BreakpointLocationContainer')):- """- Refresh the breakpoint locations for the process.-- In the course of refreshing the locations, the breakpoint list will also be- refreshed.- """- with commands.open_tracked_tx('Refresh Breakpoint Locations'):- commands.ghidra_trace_put_breakpoints()--[email protected](action='refresh')def refresh_environment(node: sch.Schema('Environment')):"""Refresh the environment descriptors (arch, os, endian)."""with commands.open_tracked_tx('Refresh Environment'):diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/schema.xml b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/schema.xmlindex 4298c97ce1..b9682f17e8 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/schema.xml+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidrattd/schema.xml@@ -1,11 +1,5 @@<context><schema name="TTDSession" elementResync="NEVER" attributeResync="NEVER">- <interface name="Access" />- <interface name="Attacher" />- <interface name="Interpreter" />- <interface name="Interruptible" />- <interface name="Launcher" />- <interface name="ActiveScope" /><interface name="EventScope" /><interface name="FocusScope" /><interface name="Aggregate" />@@ -24,20 +18,16 @@<attribute schema="VOID" /></schema><schema name="BreakpointContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" />- <interface name="BreakpointSpecContainer" /><element schema="BreakpointSpec" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="AvailableContainer" canonical="yes" elementResync="ALWAYS" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Attachable" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="ProcessContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Process" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -45,12 +35,11 @@<schema name="BreakpointSpec" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="BreakpointSpec" /><interface name="BreakpointLocation" />- <interface name="Deletable" /><interface name="Togglable" /><element schema="VOID" /><attribute name="Expression" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_expression" to="Expression" />- <attribute name="Kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />+ <attribute name="Kinds" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_kinds" to="Kinds" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -67,7 +56,6 @@<attribute schema="VOID" /></schema><schema name="Attachable" elementResync="NEVER" attributeResync="NEVER">- <interface name="Attachable" /><element schema="VOID" /><attribute name="PID" schema="LONG" /><attribute-alias from="_pid" to="PID" />@@ -80,18 +68,9 @@<interface name="Process" /><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Attacher" />- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Launcher" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="Threads" schema="ThreadContainer" required="yes" fixed="yes" /><attribute name="Breakpoints" schema="BreakpointContainer" required="yes" fixed="yes" />- <!-- attribute name="Breakpoints" schema="BreakpointLocationContainer" required="yes" fixed="yes" /--><attribute name="Exit Code" schema="LONG" /><attribute-alias from="_exit_code" to="Exit Code" /><attribute name="Environment" schema="Environment" required="yes" fixed="yes" />@@ -101,7 +80,6 @@<attribute-alias from="_pid" to="PID" /><attribute name="State" schema="EXECUTION_STATE" required="yes" hidden="yes" /><attribute-alias from="_state" to="State" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_short_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -122,7 +100,6 @@<attribute schema="VOID" /></schema><schema name="ModuleContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="ModuleContainer" /><element schema="Module" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -133,23 +110,7 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>- <schema name="BreakpointLocation" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocation" />- <element schema="VOID" />- <attribute name="Range" schema="RANGE" />- <attribute-alias from="_range" to="Range" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema>- <schema name="BreakpointLocationContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" />- <element schema="BreakpointLocation" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema><schema name="ThreadContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Thread" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -166,7 +127,6 @@<interface name="Activatable" /><interface name="Thread" /><interface name="ExecutionStateful" />- <interface name="Steppable" /><interface name="Aggregate" /><element schema="VOID" /><attribute name="Stack" schema="Stack" required="yes" fixed="yes" />@@ -209,7 +169,6 @@<attribute schema="VOID" /></schema><schema name="SectionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Section" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -221,13 +180,11 @@<attribute schema="VOID" /></schema><schema name="SymbolContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="SymbolNamespace" /><element schema="Symbol" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="Symbol" elementResync="NEVER" attributeResync="NEVER">- <interface name="Symbol" /><element schema="VOID" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -262,7 +219,6 @@</schema><schema name="RegisterValueContainer" attributeResync="ONCE"><interface name="RegisterContainer" />- <interface name="RegisterBank" /><attribute name="General Purpose Registers" schema="RegisterBank" /><attribute name="Floating Point Registers" schema="RegisterBank" /><attribute name="Advanced Vector Extensions" schema="RegisterBank" />@@ -271,7 +227,6 @@<attribute schema="VOID" /></schema><schema name="RegisterBank" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="RegisterBank" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/schema.xml b/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/schema.xmlindex 4266916d75..b87c0546c7 100644--- a/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/schema.xml+++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/schema.xml@@ -1,11 +1,5 @@<context><schema name="GdbSession" elementResync="NEVER" attributeResync="NEVER">- <interface name="Access" />- <interface name="Attacher" />- <interface name="Interpreter" />- <interface name="Interruptible" />- <interface name="Launcher" />- <interface name="ActiveScope" /><interface name="EventScope" /><interface name="FocusScope" /><interface name="Aggregate" />@@ -25,31 +19,27 @@<attribute schema="VOID" /></schema><schema name="BreakpointContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointSpecContainer" /><element schema="BreakpointSpec" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="AvailableContainer" canonical="yes" elementResync="ALWAYS" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Attachable" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="InferiorContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Inferior" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="BreakpointSpec" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="BreakpointSpec" />- <interface name="Deletable" /><interface name="Togglable" /><element schema="BreakpointLocation" /><attribute name="Expression" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_expression" to="Expression" />- <attribute name="Kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />+ <attribute name="Kinds" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_kinds" to="Kinds" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -65,7 +55,6 @@<attribute schema="VOID" /></schema><schema name="Attachable" elementResync="NEVER" attributeResync="NEVER">- <interface name="Attachable" /><element schema="VOID" /><attribute name="PID" schema="LONG" /><attribute-alias from="_pid" to="PID" />@@ -78,14 +67,6 @@<interface name="Process" /><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Attacher" />- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Launcher" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="Threads" schema="ThreadContainer" required="yes" fixed="yes" /><attribute name="Breakpoints" schema="BreakpointLocationContainer" required="yes" fixed="yes" />@@ -98,7 +79,6 @@<attribute-alias from="_pid" to="PID" /><attribute name="State" schema="EXECUTION_STATE" required="yes" hidden="yes" /><attribute-alias from="_state" to="State" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_short_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -119,7 +99,6 @@<attribute schema="VOID" /></schema><schema name="ModuleContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="ModuleContainer" /><element schema="Module" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -142,30 +121,19 @@<attribute schema="VOID" /></schema><schema name="BreakpointLocationContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" /><element schema="BreakpointLocation" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="ThreadContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Thread" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>- <schema name="Method" elementResync="NEVER" attributeResync="NEVER">- <interface name="Method" />- <element schema="VOID" />- <attribute name="_display" schema="STRING" required="yes" fixed="yes" hidden="yes" />- <attribute name="_return_type" schema="TYPE" required="yes" fixed="yes" hidden="yes" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" />- <attribute schema="VOID" fixed="yes" hidden="yes" />- </schema><schema name="Thread" elementResync="NEVER" attributeResync="NEVER"><interface name="Activatable" /><interface name="Thread" /><interface name="ExecutionStateful" />- <interface name="Steppable" /><interface name="Aggregate" /><element schema="VOID" /><attribute name="Stack" schema="Stack" required="yes" fixed="yes" />@@ -208,7 +176,6 @@<attribute schema="VOID" /></schema><schema name="SectionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Section" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -220,13 +187,11 @@<attribute schema="VOID" /></schema><schema name="SymbolContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="SymbolNamespace" /><element schema="Symbol" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="Symbol" elementResync="NEVER" attributeResync="NEVER">- <interface name="Symbol" /><element schema="VOID" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -259,7 +224,6 @@</schema><schema name="RegisterValueContainer" attributeResync="NEVER"><interface name="RegisterContainer" />- <interface name="RegisterBank" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>diff --git a/Ghidra/Debug/Debugger-agent-lldb/certification.manifest b/Ghidra/Debug/Debugger-agent-lldb/certification.manifestindex e1976e0e7e..622c4707b7 100644--- a/Ghidra/Debug/Debugger-agent-lldb/certification.manifest+++ b/Ghidra/Debug/Debugger-agent-lldb/certification.manifest@@ -5,8 +5,6 @@ Module.manifest||GHIDRA||||END|README.md||GHIDRA||||END|build.gradle||GHIDRA||||END|data/debugger-launchers/local-lldb.bat||GHIDRA||||END|-src/llvm-project/lldb/bindings/java/java-typemaps.swig||Apache License 2.0 with LLVM Exceptions||||END|-src/llvm-project/lldb/bindings/java/java.swig||Apache License 2.0 with LLVM Exceptions||||END|src/main/py/LICENSE||GHIDRA||||END|src/main/py/MANIFEST.in||GHIDRA||||END|src/main/py/README.md||GHIDRA||||END|diff --git a/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/schema.xml b/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/schema.xmlindex e4fe8a3fef..01f25e6314 100644--- a/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/schema.xml+++ b/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/schema.xml@@ -1,11 +1,5 @@<context><schema name="LldbSession" elementResync="NEVER" attributeResync="NEVER">- <interface name="Access" />- <interface name="Attacher" />- <interface name="Interpreter" />- <interface name="Interruptible" />- <interface name="Launcher" />- <interface name="ActiveScope" /><interface name="EventScope" /><interface name="FocusScope" /><interface name="Aggregate" />@@ -26,7 +20,6 @@<attribute schema="VOID" /></schema><schema name="BreakpointContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointSpecContainer" /><element schema="BreakpointSpec" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -37,25 +30,22 @@<attribute schema="VOID" /></schema><schema name="AvailableContainer" canonical="yes" elementResync="ALWAYS" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Attachable" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="ProcessContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Process" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="BreakpointSpec" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="BreakpointSpec" />- <interface name="Deletable" /><interface name="Togglable" /><element schema="BreakpointLocation" /><attribute name="Expression" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_expression" to="Expression" />- <attribute name="Kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />+ <attribute name="Kinds" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_kinds" to="Kinds" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -72,11 +62,10 @@</schema><schema name="WatchpointSpec" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="BreakpointSpec" />- <interface name="Deletable" /><interface name="Togglable" /><attribute name="Expression" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_expression" to="Expression" />- <attribute name="Kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />+ <attribute name="Kinds" schema="STRING" required="yes" hidden="yes" /><attribute-alias from="_kinds" to="Kinds" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -90,7 +79,6 @@<attribute schema="VOID" /></schema><schema name="Attachable" elementResync="NEVER" attributeResync="NEVER">- <interface name="Attachable" /><element schema="VOID" /><attribute name="PID" schema="LONG" /><attribute-alias from="_pid" to="PID" />@@ -103,14 +91,6 @@<interface name="Process" /><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Attacher" />- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Launcher" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="Threads" schema="ThreadContainer" required="yes" fixed="yes" /><attribute name="Breakpoints" schema="BreakpointLocationContainer" required="yes" fixed="yes" />@@ -124,7 +104,6 @@<attribute-alias from="_pid" to="PID" /><attribute name="State" schema="EXECUTION_STATE" required="yes" hidden="yes" /><attribute-alias from="_state" to="State" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_short_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -146,7 +125,6 @@<attribute schema="VOID" /></schema><schema name="ModuleContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="ModuleContainer" /><element schema="Module" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -168,30 +146,19 @@<attribute schema="VOID" /></schema><schema name="BreakpointLocationContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" /><element schema="BreakpointLocation" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="ThreadContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Configurable" /><element schema="Thread" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>- <schema name="Method" elementResync="NEVER" attributeResync="NEVER">- <interface name="Method" />- <element schema="VOID" />- <attribute name="_display" schema="STRING" required="yes" fixed="yes" hidden="yes" />- <attribute name="_return_type" schema="TYPE" required="yes" fixed="yes" hidden="yes" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" />- <attribute schema="VOID" fixed="yes" hidden="yes" />- </schema><schema name="Thread" elementResync="NEVER" attributeResync="NEVER"><interface name="Activatable" /><interface name="Thread" /><interface name="ExecutionStateful" />- <interface name="Steppable" /><interface name="Aggregate" /><element schema="VOID" /><attribute name="Stack" schema="Stack" required="yes" fixed="yes" />@@ -203,7 +170,6 @@<attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_short_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />- <attribute name="Advance" schema="Method" required="yes" fixed="yes" hidden="yes" /><attribute schema="VOID" /></schema><schema name="Module" elementResync="NEVER" attributeResync="NEVER">@@ -234,7 +200,6 @@<attribute schema="VOID" /></schema><schema name="SectionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Section" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" />@@ -246,13 +211,11 @@<attribute schema="VOID" /></schema><schema name="SymbolContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="SymbolNamespace" /><element schema="Symbol" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema><schema name="Symbol" elementResync="NEVER" attributeResync="NEVER">- <interface name="Symbol" /><element schema="VOID" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_order" schema="INT" hidden="yes" />@@ -286,7 +249,6 @@</schema><schema name="RegisterValueContainer" attributeResync="ONCE"><interface name="RegisterContainer" />- <interface name="RegisterBank" /><attribute name="General Purpose Registers" schema="RegisterBank" /><attribute name="Floating Point Registers" schema="RegisterBank" /><attribute name="Advanced Vector Extensions" schema="RegisterBank" />@@ -298,7 +260,6 @@<attribute schema="VOID" /></schema><schema name="RegisterBank" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="RegisterBank" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerTraceManagerService.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerTraceManagerService.javaindex 6e5f7be7f1..2b92ad15b4 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerTraceManagerService.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/app/services/DebuggerTraceManagerService.java@@ -28,7 +28,7 @@ import ghidra.trace.model.Trace;import ghidra.trace.model.guest.TracePlatform;import ghidra.trace.model.program.TraceProgramView;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.schedule.TraceSchedule;import ghidra.util.TriConsumer;@@ -467,14 +467,14 @@ public interface DebuggerTraceManagerService {* @param path the path* @return the best coordinates*/- DebuggerCoordinates resolvePath(TraceObjectKeyPath path);+ DebuggerCoordinates resolvePath(KeyPath path);/*** Activate the given canonical object path** @param path the desired path*/- default void activatePath(TraceObjectKeyPath path) {+ default void activatePath(KeyPath path) {activate(resolvePath(path));}diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/control/ControlMode.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/control/ControlMode.javaindex ee6966b4ed..d65e56f1ce 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/control/ControlMode.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/control/ControlMode.java@@ -27,7 +27,6 @@ import generic.theme.GIcon;import ghidra.app.services.DebuggerEmulationService;import ghidra.app.services.DebuggerTraceManagerService;import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;-import ghidra.async.AsyncUtils;import ghidra.debug.api.target.Target;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.framework.plugintool.PluginTool;@@ -258,7 +257,7 @@ public enum ControlMode {return CompletableFuture.failedFuture(new MemoryAccessException());}}- return AsyncUtils.nil();+ return CompletableFuture.completedFuture(null);}@Overridediff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/model/DebuggerSingleObjectPathActionContext.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/model/DebuggerSingleObjectPathActionContext.javaindex 251a27ad0e..791d71c5d8 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/model/DebuggerSingleObjectPathActionContext.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/model/DebuggerSingleObjectPathActionContext.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,19 +16,19 @@package ghidra.debug.api.model;import docking.DefaultActionContext;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;/*** Really just used by scripts to get a path into an action context*/public class DebuggerSingleObjectPathActionContext extends DefaultActionContext {- private final TraceObjectKeyPath path;+ private final KeyPath path;- public DebuggerSingleObjectPathActionContext(TraceObjectKeyPath path) {+ public DebuggerSingleObjectPathActionContext(KeyPath path) {this.path = path;}- public TraceObjectKeyPath getPath() {+ public KeyPath getPath() {return path;}}diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/target/Target.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/target/Target.javaindex a31aaa82f6..133f186892 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/target/Target.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/target/Target.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -22,18 +22,18 @@ import java.util.function.BooleanSupplier;import java.util.function.Function;import docking.ActionContext;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.program.model.address.*;import ghidra.program.model.lang.Register;import ghidra.program.model.lang.RegisterValue;+import ghidra.trace.model.TraceExecutionState;import ghidra.trace.model.Trace;import ghidra.trace.model.breakpoint.TraceBreakpoint;import ghidra.trace.model.breakpoint.TraceBreakpointKind;import ghidra.trace.model.guest.TracePlatform;import ghidra.trace.model.memory.TraceMemoryState;import ghidra.trace.model.stack.TraceStackFrame;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceThread;import ghidra.util.Swing;import ghidra.util.exception.CancelledException;@@ -196,7 +196,7 @@ public interface Target {* @param path the path of the object* @return the thread, or null*/- TraceThread getThreadForSuccessor(TraceObjectKeyPath path);+ TraceThread getThreadForSuccessor(KeyPath path);/*** Get the execution state of the given thread@@ -204,7 +204,7 @@ public interface Target {* @param thread the thread* @return the state*/- TargetExecutionState getThreadExecutionState(TraceThread thread);+ TraceExecutionState getThreadExecutionState(TraceThread thread);/*** Get the trace stack frame that contains the given object@@ -212,7 +212,7 @@ public interface Target {* @param path the path of the object* @return the stack frame, or null*/- TraceStackFrame getStackFrameForSuccessor(TraceObjectKeyPath path);+ TraceStackFrame getStackFrameForSuccessor(KeyPath path);/*** Check if the target supports synchronizing focus@@ -226,7 +226,7 @@ public interface Target {** @return the focused object's path, or null*/- TraceObjectKeyPath getFocus();+ KeyPath getFocus();/*** @see #activate(DebuggerCoordinates, DebuggerCoordinates)diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracemgr/DebuggerCoordinates.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracemgr/DebuggerCoordinates.javaindex 1f63cff305..89ef6ef085 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracemgr/DebuggerCoordinates.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracemgr/DebuggerCoordinates.java@@ -21,7 +21,6 @@ import java.util.*;import org.jdom.Element;import ghidra.app.services.DebuggerTraceManagerService;-import ghidra.dbg.target.TargetObject;import ghidra.debug.api.target.Target;import ghidra.framework.data.DefaultProjectData;import ghidra.framework.model.*;@@ -35,7 +34,7 @@ import ghidra.trace.model.guest.TracePlatform;import ghidra.trace.model.program.TraceProgramView;import ghidra.trace.model.stack.*;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.TraceSnapshot;@@ -98,7 +97,7 @@ public class DebuggerCoordinates {private final TraceProgramView view;private final TraceSchedule time;private final Integer frame;- private final TraceObjectKeyPath path;+ private final KeyPath path;private final int hash;@@ -107,7 +106,7 @@ public class DebuggerCoordinates {private TraceObject registerContainer;DebuggerCoordinates(Trace trace, TracePlatform platform, Target target, TraceThread thread,- TraceProgramView view, TraceSchedule time, Integer frame, TraceObjectKeyPath path) {+ TraceProgramView view, TraceSchedule time, Integer frame, KeyPath path) {this.trace = trace;this.platform = platform;this.target = target;@@ -182,13 +181,13 @@ public class DebuggerCoordinates {return resolveThread(trace, TraceSchedule.ZERO);}- private static TraceObjectKeyPath resolvePath(Trace trace, TraceThread thread, Integer frame,+ private static KeyPath resolvePath(Trace trace, TraceThread thread, Integer frame,TraceSchedule time) {- TraceObjectKeyPath path = resolvePath(thread, frame, time);+ KeyPath path = resolvePath(thread, frame, time);if (path != null) {return path;}- return TraceObjectKeyPath.of();+ return KeyPath.of();}private static TraceProgramView resolveView(Trace trace, TraceSchedule time) {@@ -214,7 +213,7 @@ public class DebuggerCoordinates {TraceProgramView newView = resolveView(newTrace);TraceSchedule newTime = null; // Allow later resolutionInteger newFrame = resolveFrame(newThread, newTime);- TraceObjectKeyPath newPath = resolvePath(newTrace, newThread, newFrame, newTime);+ KeyPath newPath = resolvePath(newTrace, newThread, newFrame, newTime);return new DebuggerCoordinates(newTrace, newPlatform, null, newThread, newView, newTime,newFrame, newPath);}@@ -248,7 +247,7 @@ public class DebuggerCoordinates {return resolveFrame(target, target.getFocus());}- private static TraceObjectKeyPath resolvePath(Target target, TraceThread thread,+ private static KeyPath resolvePath(Target target, TraceThread thread,Integer frame, TraceSchedule time) {if (target.getSnap() != time.getSnap() || !target.isSupportsFocus()) {return resolvePath(target.getTrace(), thread, frame, time);@@ -273,7 +272,7 @@ public class DebuggerCoordinates {TraceProgramView newView = resolveView(newTrace);TraceSchedule newTime = null; // Allow later resolutionInteger newFrame = resolveFrame(newThread, newTime);- TraceObjectKeyPath newPath = resolvePath(newTrace, newThread, newFrame, newTime);+ KeyPath newPath = resolvePath(newTrace, newThread, newFrame, newTime);return new DebuggerCoordinates(newTrace, newPlatform, null, newThread, newView, newTime,newFrame, newPath);}@@ -300,8 +299,8 @@ public class DebuggerCoordinates {TraceThread newThread = thread != null ? thread : resolveThread(newTarget, newTime);TraceProgramView newView = view != null ? view : resolveView(newTrace, newTime);Integer newFrame = frame != null ? frame : resolveFrame(newTarget, newThread, newTime);- TraceObjectKeyPath threadOrFramePath = resolvePath(newTarget, newThread, newFrame, newTime);- TraceObjectKeyPath newPath = choose(path, threadOrFramePath);+ KeyPath threadOrFramePath = resolvePath(newTarget, newThread, newFrame, newTime);+ KeyPath newPath = choose(path, threadOrFramePath);return new DebuggerCoordinates(newTrace, newPlatform, newTarget, newThread, newView,newTime, newFrame, newPath);}@@ -313,7 +312,7 @@ public class DebuggerCoordinates {return thread(trace.getThreadManager().getThread(thread.getKey()));}- private static TraceObjectKeyPath resolvePath(TraceThread thread, Integer frameLevel,+ private static KeyPath resolvePath(TraceThread thread, Integer frameLevel,TraceSchedule time) {if (thread instanceof TraceObjectThread tot) {TraceObject objThread = tot.getObject();@@ -340,8 +339,8 @@ public class DebuggerCoordinates {return null;}- private static TraceObjectKeyPath choose(TraceObjectKeyPath curPath,- TraceObjectKeyPath newPath) {+ private static KeyPath choose(KeyPath curPath,+ KeyPath newPath) {if (curPath == null) {return newPath;}@@ -371,8 +370,8 @@ public class DebuggerCoordinates {// Yes, override frame with 0 on thread changes, unless target says otherwiseInteger newFrame = resolveFrame(target, newThread, newTime);// Yes, forced frame change may also force object change- TraceObjectKeyPath threadOrFramePath = resolvePath(newThread, newFrame, newTime);- TraceObjectKeyPath newPath = choose(path, threadOrFramePath);+ KeyPath threadOrFramePath = resolvePath(newThread, newFrame, newTime);+ KeyPath newPath = choose(path, threadOrFramePath);return new DebuggerCoordinates(newTrace, newPlatform, target, newThread, newView, newTime,newFrame, newPath);}@@ -412,8 +411,8 @@ public class DebuggerCoordinates {: resolveThread(trace, target, newTime);// This will cause the frame to reset to 0 on every snap change. That's fair....Integer newFrame = resolveFrame(newThread, newTime);- TraceObjectKeyPath threadOrFramePath = resolvePath(newThread, newFrame, newTime);- TraceObjectKeyPath newPath = choose(path, threadOrFramePath);+ KeyPath threadOrFramePath = resolvePath(newThread, newFrame, newTime);+ KeyPath newPath = choose(path, threadOrFramePath);return new DebuggerCoordinates(trace, platform, target, newThread, view, newTime,newFrame, newPath);}@@ -425,8 +424,8 @@ public class DebuggerCoordinates {if (Objects.equals(frame, newFrame)) {return this;}- TraceObjectKeyPath threadOrFramePath = resolvePath(thread, newFrame, getTime());- TraceObjectKeyPath newPath = choose(path, threadOrFramePath);+ KeyPath threadOrFramePath = resolvePath(thread, newFrame, getTime());+ KeyPath newPath = choose(path, threadOrFramePath);return new DebuggerCoordinates(trace, platform, target, thread, view, time, newFrame,newPath);}@@ -480,7 +479,7 @@ public class DebuggerCoordinates {return time(resolveTime(newView)).replaceView(newView);}- private static TraceThread resolveThread(Trace trace, TraceObjectKeyPath path) {+ private static TraceThread resolveThread(Trace trace, KeyPath path) {TraceObject object = trace.getObjectManager().getObjectByCanonicalPath(path);if (object == null) {return null;@@ -490,7 +489,7 @@ public class DebuggerCoordinates {.orElse(null);}- private static Integer resolveFrame(Trace trace, TraceObjectKeyPath path) {+ private static Integer resolveFrame(Trace trace, KeyPath path) {TraceObject object = trace.getObjectManager().getObjectByCanonicalPath(path);if (object == null) {return null;@@ -502,7 +501,7 @@ public class DebuggerCoordinates {return frame == null ? null : frame.getLevel();}- public DebuggerCoordinates path(TraceObjectKeyPath newPath) {+ public DebuggerCoordinates path(KeyPath newPath) {if (trace == null && newPath == null) {return NOWHERE;}@@ -524,7 +523,7 @@ public class DebuggerCoordinates {newFrame, newPath);}- public DebuggerCoordinates pathNonCanonical(TraceObjectKeyPath newPath) {+ public DebuggerCoordinates pathNonCanonical(KeyPath newPath) {if (trace == null && newPath == null) {return NOWHERE;}@@ -549,19 +548,15 @@ public class DebuggerCoordinates {throw new IllegalArgumentException("No such object at path " + newPath);}- protected static TraceThread resolveThread(Target target, TraceObjectKeyPath objectPath) {+ protected static TraceThread resolveThread(Target target, KeyPath objectPath) {return target.getThreadForSuccessor(objectPath);}- protected static Integer resolveFrame(Target target, TraceObjectKeyPath objectPath) {+ protected static Integer resolveFrame(Target target, KeyPath objectPath) {TraceStackFrame frame = target.getStackFrameForSuccessor(objectPath);return frame == null ? null : frame.getLevel();}- public DebuggerCoordinates object(TargetObject targetObject) {- return path(TraceObjectKeyPath.of(targetObject.getPath()));- }-public DebuggerCoordinates object(TraceObject newObject) {if (newObject == null) {return path(null);@@ -604,7 +599,7 @@ public class DebuggerCoordinates {return frame == null ? 0 : frame;}- public TraceObjectKeyPath getPath() {+ public KeyPath getPath() {return path;}@@ -626,7 +621,7 @@ public class DebuggerCoordinates {if (registerContainer != null) {return registerContainer;}- return registerContainer = getObject().queryRegisterContainer(getFrame());+ return registerContainer = getObject().findRegisterContainer(getFrame());}public synchronized long getViewSnap() {@@ -761,7 +756,7 @@ public class DebuggerCoordinates {if (trace != null && coordState.hasValue(KEY_OBJ_PATH)) {String pathString = coordState.getString(KEY_OBJ_PATH, "");try {- TraceObjectKeyPath path = TraceObjectKeyPath.parse(pathString);+ KeyPath path = KeyPath.parse(pathString);object = trace.getObjectManager().getObjectByCanonicalPath(path);}catch (Exception e) {diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteMethod.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteMethod.javaindex ee194ce296..4838df5716 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteMethod.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteMethod.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -21,12 +21,11 @@ import java.util.concurrent.ExecutionException;import java.util.function.Function;import ghidra.async.AsyncUtils;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.debug.api.target.ActionName;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;/*** A remote method registered by the back-end debugger.@@ -102,7 +101,7 @@ public interface RemoteMethod {* Check the type of an argument.** <p>- * This is a hack, because {@link TargetObjectSchema} expects {@link TargetObject}, or a+ * This is a hack, because {@link TraceObjectSchema} expects {@link TargetObject}, or a* primitive. We instead need {@link TraceObject}. I'd add the method to the schema, except that* trace stuff is not in its dependencies.*@@ -111,17 +110,17 @@ public interface RemoteMethod {* @param sch the type of the parameter* @param arg the argument*/- static void checkType(String paramName, SchemaName schName, TargetObjectSchema sch,+ static void checkType(String paramName, SchemaName schName, TraceObjectSchema sch,Object arg) {// if sch is null, it was definitely an object-type schema without contextif (sch != null) {- if (sch.getType() != TargetObject.class) {+ if (sch.getType() != TraceObject.class) {if (sch.getType().isInstance(arg)) {return;}}else if (arg instanceof TraceObject obj) {- if (sch.isAssignableFrom(obj.getTargetSchema())) {+ if (sch.isAssignableFrom(obj.getSchema())) {return;}}@@ -144,7 +143,7 @@ public interface RemoteMethod {*/default Trace validate(Map<String, Object> arguments) {Trace trace = null;- SchemaContext ctx = EnumerableTargetObjectSchema.MinimalSchemaContext.INSTANCE;+ SchemaContext ctx = PrimitiveTraceObjectSchema.MinimalSchemaContext.INSTANCE;for (Map.Entry<String, RemoteParameter> ent : parameters().entrySet()) {if (!arguments.containsKey(ent.getKey())) {if (ent.getValue().required()) {@@ -165,7 +164,7 @@ public interface RemoteMethod {}}SchemaName schName = ent.getValue().type();- TargetObjectSchema sch = ctx.getSchemaOrNull(schName);+ TraceObjectSchema sch = ctx.getSchemaOrNull(schName);checkType(ent.getKey(), schName, sch, arg);}for (Map.Entry<String, Object> ent : arguments.entrySet()) {diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteParameter.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteParameter.javaindex fcee4d4b3d..77ceb22bc4 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteParameter.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteParameter.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,7 +15,7 @@*/package ghidra.debug.api.tracermi;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public interface RemoteParameter {String name();diff --git a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.javaindex 3368eb1874..d36d03eab5 100644--- a/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java+++ b/Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/flatapi/FlatDebuggerAPI.java@@ -27,7 +27,6 @@ import ghidra.app.script.GhidraScript;import ghidra.app.script.GhidraState;import ghidra.app.services.*;import ghidra.app.services.DebuggerControlService.StateEditor;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;import ghidra.debug.api.breakpoint.LogicalBreakpoint;import ghidra.debug.api.control.ControlMode;import ghidra.debug.api.model.DebuggerObjectActionContext;@@ -51,6 +50,7 @@ import ghidra.trace.model.memory.TraceMemoryOperations;import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.program.TraceProgramView;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.schedule.TraceSchedule;@@ -1452,13 +1452,13 @@ public interface FlatDebuggerAPI {return createContext(objThread.getObject());}return new DebuggerSingleObjectPathActionContext(- TraceObjectKeyPath.parse(thread.getPath()));+ KeyPath.parse(thread.getPath()));}default ActionContext createContext(Trace trace) {DebuggerCoordinates coords = getTraceManager().getCurrentFor(trace);if (coords == null) {- return new DebuggerSingleObjectPathActionContext(TraceObjectKeyPath.of());+ return new DebuggerSingleObjectPathActionContext(KeyPath.of());}if (coords.getObject() != null) {return createContext(coords.getObject());@@ -1466,7 +1466,7 @@ public interface FlatDebuggerAPI {if (coords.getPath() != null) {return new DebuggerSingleObjectPathActionContext(coords.getPath());}- return new DebuggerSingleObjectPathActionContext(TraceObjectKeyPath.of());+ return new DebuggerSingleObjectPathActionContext(KeyPath.of());}default ActionEntry findAction(Target target, ActionName action, ActionContext context) {@@ -1688,25 +1688,25 @@ public interface FlatDebuggerAPI {** <p>* If the trace does not have a live target, it is considered- * {@link TargetExecutionState#TERMINATED} (even if the trace <em>never</em> technically had a+ * {@link TraceExecutionState#TERMINATED} (even if the trace <em>never</em> technically had a* live target.) Otherwise, this gets the state of that live target. <b>NOTE:</b> This does not* consider the current snap. It only considers a live target in the present.** @param trace the trace* @return the trace's execution state*/- default TargetExecutionState getExecutionState(Trace trace) {+ default TraceExecutionState getExecutionState(Trace trace) {Target target = getTargetService().getTarget(trace);if (target == null) {- return TargetExecutionState.TERMINATED;+ return TraceExecutionState.TERMINATED;}// Use resume action's enablement as a proxy for state// This should work for recorder or rmi targetsActionEntry action = findAction(target, ActionName.RESUME, createContext(trace));if (action == null) {- return TargetExecutionState.ALIVE;+ return TraceExecutionState.ALIVE;}- return action.isEnabled() ? TargetExecutionState.STOPPED : TargetExecutionState.RUNNING;+ return action.isEnabled() ? TraceExecutionState.STOPPED : TraceExecutionState.RUNNING;}/**@@ -1714,7 +1714,7 @@ public interface FlatDebuggerAPI {** <p>* If the thread does not have a corresponding live target thread, it is considered- * {@link TargetExecutionState#TERMINATED} (even if the thread <em>never</em> technically had a+ * {@link TraceExecutionState#TERMINATED} (even if the thread <em>never</em> technically had a* live target thread.) Otherwise, this gets the state of that live target thread. <b>NOTE:</b>* This does not consider the current snap. It only considers a live target thread in the* present. In other words, if the user rewinds trace history to a point where the thread was@@ -1725,10 +1725,10 @@ public interface FlatDebuggerAPI {* @param thread* @return the thread's execution state*/- default TargetExecutionState getExecutionState(TraceThread thread) {+ default TraceExecutionState getExecutionState(TraceThread thread) {DebuggerCoordinates coords = getTraceManager().getCurrentFor(thread.getTrace());if (!coords.isAlive()) {- return TargetExecutionState.TERMINATED;+ return TraceExecutionState.TERMINATED;}return coords.getTarget().getThreadExecutionState(thread);}diff --git a/Ghidra/Debug/Debugger-isf/build.gradle b/Ghidra/Debug/Debugger-isf/build.gradleindex 126f93ad7d..f6c8464405 100644--- a/Ghidra/Debug/Debugger-isf/build.gradle+++ b/Ghidra/Debug/Debugger-isf/build.gradle@@ -25,9 +25,7 @@ eclipse.project.name = 'Debug Debugger-isf'dependencies {api project(':Framework-AsyncComm')- api project(':Framework-Debugging')api project(':ProposedUtils')testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')- testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts')}diff --git a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiConsoleOutputListener.java b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiConsoleOutputListener.javaindex 14ac16a6ac..9aae3ec720 100644--- a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiConsoleOutputListener.java+++ b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/manager/JdiConsoleOutputListener.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,9 +15,14 @@*/package ghidra.dbg.jdi.manager;-import ghidra.dbg.target.TargetConsole.Channel;-public interface JdiConsoleOutputListener {+ /**+ * For console output notifications, indicates whether it is normal or error output+ */+ public static enum Channel {+ STDOUT, STDERR;+ }+/*** JDI outputted some text*diff --git a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiArguments.java b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiArguments.javaindex 01073ca7eb..64eceb37ae 100644--- a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiArguments.java+++ b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiArguments.java@@ -22,7 +22,7 @@ import com.sun.jdi.connect.AttachingConnector;import com.sun.jdi.connect.Connector;import com.sun.jdi.connect.Connector.Argument;-import ghidra.dbg.util.ShellUtils;+import ghidra.pty.ShellUtils;public class JdiArguments {enum Mode {diff --git a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiConnector.java b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiConnector.javaindex 3870d47e28..c7fce87c50 100644--- a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiConnector.java+++ b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiConnector.java@@ -24,9 +24,9 @@ import ghidra.app.plugin.core.debug.client.tracermi.*;import ghidra.app.plugin.core.debug.client.tracermi.RmiMethodRegistry.TraceMethod;import ghidra.dbg.jdi.manager.impl.DebugStatus;import ghidra.dbg.jdi.manager.impl.JdiManagerImpl;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.program.model.address.*;+import ghidra.trace.model.target.schema.PrimitiveTraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.util.Msg;public class JdiConnector {@@ -92,7 +92,7 @@ public class JdiConnector {private final Map<ReferenceType, AddressRange> cpAddressRangeByClass = new HashMap<>();private final Map<String, DebugStatus> returnStatusMap = new HashMap<>();- final TargetObjectSchema rootSchema;+ final TraceObjectSchema rootSchema;private Map<String, String> env;public JdiConnector(JdiManagerImpl manager, Map<String, String> env) {@@ -166,7 +166,7 @@ public class JdiConnector {* TODO: The return type should be reflected from the method; however, none of the parameter* collection routines currently use the return type, so just use ANY for now.*/- TargetObjectSchema schema = EnumerableTargetObjectSchema.ANY;+ TraceObjectSchema schema = PrimitiveTraceObjectSchema.ANY;RmiRemoteMethod method = new RmiRemoteMethod(rootSchema.getContext(), name, action, display,description, schema, methods, m);remoteMethodRegistry.putMethod(name, method);diff --git a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiMethods.java b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiMethods.javaindex 5986604c6b..1b2a38881c 100644--- a/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiMethods.java+++ b/Ghidra/Debug/Debugger-jpda/src/main/java/ghidra/dbg/jdi/rmi/jpda/JdiMethods.java@@ -25,10 +25,10 @@ import com.sun.jdi.request.*;import ghidra.app.plugin.core.debug.client.tracermi.*;import ghidra.app.plugin.core.debug.client.tracermi.RmiMethodRegistry.TraceMethod;-import ghidra.dbg.target.TargetMethod.Param;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;import ghidra.rmi.trace.TraceRmi.MemoryState;+import ghidra.trace.model.target.iface.TraceObjectMethod.Param;import ghidra.util.Msg;public class JdiMethods implements RmiMethods {@@ -343,7 +343,7 @@ public class JdiMethods implements RmiMethods {name = "find") String targetClass) {return find_class(obj, targetClass);}-+@TraceMethod(display = "Load class")public boolean find_class(@Param(@@ -377,10 +377,12 @@ public class JdiMethods implements RmiMethods {@TraceMethod(display = "Refresh reference types")public void refresh_canonical_reference_types(- @Param(schema = "CanonicalReferenceTypeContainer", name = "container") RmiTraceObject obj) {+ @Param(+ schema = "CanonicalReferenceTypeContainer",+ name = "container") RmiTraceObject obj) {refresh_reference_types(obj);}-+/*** NB. Did not assign action="refresh" because this method is expensive. Assigning that action* name will cause the UI to do it upon expanding the node, which we <em>do not</em> want.diff --git a/Ghidra/Debug/Debugger-jpda/src/main/resources/ghidra/app/plugin/core/debug/client/tracermi/jdi_schema.xml b/Ghidra/Debug/Debugger-jpda/src/main/resources/ghidra/app/plugin/core/debug/client/tracermi/jdi_schema.xmlindex b17969eb38..151b5a1694 100644--- a/Ghidra/Debug/Debugger-jpda/src/main/resources/ghidra/app/plugin/core/debug/client/tracermi/jdi_schema.xml+++ b/Ghidra/Debug/Debugger-jpda/src/main/resources/ghidra/app/plugin/core/debug/client/tracermi/jdi_schema.xml@@ -1,11 +1,7 @@<?xml version="1.0"?><context><schema name="Debugger" elementResync="NEVER" attributeResync="ALWAYS">- <interface name="Access" />- <interface name="Attacher" /><interface name="EventScope" />- <interface name="Launcher" />- <interface name="ActiveScope" /><interface name="FocusScope" /><interface name="Aggregate" /><element schema="VOID" />@@ -20,7 +16,6 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute name="_event_process" schema="OBJECT" hidden="yes" /><attribute name="_event_thread" schema="OBJECT" hidden="yes" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" hidden="yes" /><attribute name="_focus" schema="OBJECT" required="no" hidden="yes" /><attribute name="_system" schema="OBJECT" hidden="no" /><attribute name="Available" schema="AvailableContainer" fixed="yes" />@@ -73,9 +68,7 @@<attribute schema="VOID" /></schema><schema name="KernelConnector" elementResync="NEVER" attributeResync="NEVER">- <interface name="Launcher" /><element schema="VOID" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />@@ -87,9 +80,7 @@<attribute schema="VOID" /></schema><schema name="ProcessAttachConnector" elementResync="NEVER" attributeResync="NEVER">- <interface name="Launcher" /><element schema="VOID" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />@@ -101,9 +92,7 @@<attribute schema="VOID" /></schema><schema name="ProcessLaunchConnector" elementResync="NEVER" attributeResync="NEVER">- <interface name="Launcher" /><element schema="VOID" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />@@ -115,9 +104,7 @@<attribute schema="VOID" /></schema><schema name="TraceOrDumpConnector" elementResync="NEVER" attributeResync="NEVER">- <interface name="Launcher" /><element schema="VOID" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />@@ -131,17 +118,8 @@<schema name="VirtualMachine" elementResync="NEVER" attributeResync="ONCE"><interface name="Process" /><interface name="Aggregate" />- <interface name="Access" /><interface name="Activatable" /><interface name="ExecutionStateful" />- <interface name="Interpreter" />- <interface name="Interruptible" />- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="_accessible" schema="BOOL" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" />@@ -168,7 +146,6 @@<attribute schema="ANY" /></schema><schema name="Available" elementResync="NEVER" attributeResync="NEVER">- <interface name="Attachable" /><element schema="VOID" /><attribute name="_pid" schema="LONG" hidden="yes" required="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" />@@ -236,16 +213,6 @@<interface name="Activatable" /><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Access" />- <interface name="Attacher" />- <interface name="Attachable" />- <!-- interface name="Launcher" / -->- <interface name="Deletable" />- <interface name="Detachable" />- <interface name="Killable" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="_pid" schema="LONG" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" />@@ -258,8 +225,6 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute name="_state" schema="EXECUTION_STATE" required="no" hidden="yes" /><attribute name="_accessible" schema="BOOL" required="yes" hidden="yes" />- <attribute name="_supported_attach_kinds" schema="SET_ATTACH_KIND" required="yes" hidden="yes" />- <attribute name="_supported_step_kinds" schema="SET_STEP_KIND" required="yes" fixed="yes" hidden="yes" /><attribute schema="ANY" /></schema><schema name="Memory" canonical="yes" elementResync="NEVER" attributeResync="NEVER">@@ -296,25 +261,8 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute schema="VOID" /></schema>- <schema name="DebugContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Aggregate" />- <element schema="OBJECT" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_update_mode" schema="UPDATE_MODE" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="Breakpoints" schema="BreakpointContainer" required="yes" fixed="no" />- <attribute schema="ANY" />- </schema><schema name="BreakpointContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointLocationContainer" />- <interface name="BreakpointSpecContainer" /><element schema="BreakpointSpec" />- <attribute name="_supported_breakpoint_kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" /><attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />@@ -328,12 +276,9 @@<schema name="BreakpointSpec" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="BreakpointSpec" /><interface name="BreakpointLocation" />- <interface name="Deletable" /><element schema="OBJECT" /><attribute name="_expression" schema="STRING" required="yes" hidden="yes" />- <attribute name="_kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />- <attribute name="_container" schema="BreakpointContainer" />- <attribute name="_affects" schema="LIST_OBJECT" hidden="yes" />+ <attribute name="_kinds" schema="STRING" required="yes" hidden="yes" /><attribute name="_spec" schema="BreakpointSpec" /><attribute name="_modified" schema="BOOL" hidden="yes" /><attribute name="_display" schema="STRING" hidden="yes" />@@ -362,7 +307,6 @@<attribute schema="ANY" /></schema><schema name="Event" elementResync="NEVER" attributeResync="NEVER">- <interface name="Deletable" /><element schema="OBJECT" /><attribute name="_enabled" schema="BOOL" required="yes" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" />@@ -375,57 +319,12 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" /></schema>- <schema name="SymbolContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="SymbolNamespace" />- <element schema="Symbol" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_update_mode" schema="UPDATE_MODE" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="Symbol" elementResync="NEVER" attributeResync="NEVER">- <interface name="Symbol" />- <element schema="VOID" />- <attribute name="_namespace" schema="SymbolContainer" />- <attribute name="_data_type" schema="DATA_TYPE" fixed="yes" hidden="yes" />- <attribute name="_size" schema="LONG" fixed="yes" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_update_mode" schema="UPDATE_MODE" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ADDRESS" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema><schema name="RegisterContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="RegisterContainer" />- <interface name="RegisterBank" /><element schema="VOID" /><attribute name="_order" schema="INT" hidden="yes" /><attribute schema="ANY" /></schema>- <schema name="RegisterDescriptor" elementResync="NEVER" attributeResync="NEVER">- <interface name="Register" />- <element schema="VOID" />- <attribute name="_length" schema="INT" fixed="yes" hidden="yes" />- <attribute name="_container" schema="RegisterContainer" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_update_mode" schema="UPDATE_MODE" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" required="yes" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema><schema name="Stack" canonical="yes" elementResync="NEVER" attributeResync="NEVER"><interface name="Stack" /><element schema="StackFrame" />@@ -553,17 +452,14 @@<attribute schema="ANY" /></schema><schema name="CanonicalMethodContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Method" /><attribute schema="ANY" /></schema><schema name="MethodContainer" canonical="no" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Method" /><attribute schema="ANY" /></schema><schema name="MethodProxy" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" /><element schema="Method" /></schema><schema name="Method" elementResync="NEVER" attributeResync="NEVER">@@ -701,13 +597,13 @@<attribute name="Type" schema="Type" /><attribute schema="ANY" /></schema>- <schema name="ClassObjecReferenceContainer" elementResync="NEVER" attributeResync="NEVER">- <element schema="ClassObjecReference" />+ <schema name="ClassObjectReferenceContainer" elementResync="NEVER" attributeResync="NEVER">+ <element schema="ClassObjectReference" /></schema>- <schema name="ClassObjecReferenceProxy" elementResync="NEVER" attributeResync="NEVER">- <element schema="ClassObjecReference" />+ <schema name="ClassObjectReferenceProxy" elementResync="NEVER" attributeResync="NEVER">+ <element schema="ClassObjectReference" /></schema>- <schema name="ClassObjecReference" elementResync="NEVER" attributeResync="NEVER">+ <schema name="ClassObjectReference" elementResync="NEVER" attributeResync="NEVER"><element schema="ANY" /><attribute name="ReflectedType" schema="ReferenceTypeProxy" /><attribute name="Relations" schema="ObjectRelations" required="no" fixed="yes" />@@ -750,7 +646,6 @@<schema name="ThreadGroupReference" elementResync="NEVER" attributeResync="NEVER"><interface name="Aggregate" /><interface name="ExecutionStateful" />- <interface name="Steppable" /><element schema="ANY" /><attribute name="Parent" schema="ThreadGroupReferenceProxy" /><attribute name="Relations" schema="ObjectRelations" required="no" fixed="yes" />@@ -775,12 +670,8 @@<schema name="Thread" elementResync="NEVER" attributeResync="NEVER"><interface name="Thread" /><interface name="Aggregate" />- <interface name="Access" /><interface name="Activatable" /><interface name="ExecutionStateful" />- <interface name="Resumable" />- <interface name="Steppable" />- <interface name="Interruptible" /><element schema="VOID" /><attribute name="_tid" schema="INT" hidden="yes" /><attribute name="_modified" schema="BOOL" hidden="yes" />@@ -793,7 +684,6 @@<attribute name="_order" schema="INT" hidden="yes" /><attribute name="_accessible" schema="BOOL" required="yes" hidden="yes" /><attribute name="_state" schema="EXECUTION_STATE" required="no" hidden="yes" />- <attribute name="_supported_step_kinds" schema="SET_STEP_KIND" required="yes" fixed="yes" hidden="yes" /><attribute name="Stack" schema="Stack" required="yes" fixed="yes" /><attribute name="Id" schema="OBJECT" /><attribute name="Name" schema="OBJECT" />diff --git a/Ghidra/Debug/Debugger-rmi-trace/build.gradle b/Ghidra/Debug/Debugger-rmi-trace/build.gradleindex af516f96e7..8b6589f035 100644--- a/Ghidra/Debug/Debugger-rmi-trace/build.gradle+++ b/Ghidra/Debug/Debugger-rmi-trace/build.gradle@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -33,7 +33,6 @@ dependencies {testImplementation project(path: ':Generic', configuration: 'testArtifacts')testImplementation project(path: ':Debugger', configuration: 'testArtifacts')testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')- testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts')testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')}diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiClient.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiClient.javaindex 66f2327afa..405b35c3fc 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiClient.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiClient.java@@ -27,8 +27,6 @@ import org.jdom.JDOMException;import com.google.protobuf.ByteString;import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiHandler;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.program.model.address.*;import ghidra.program.model.lang.*;import ghidra.rmi.trace.TraceRmi;@@ -36,6 +34,8 @@ import ghidra.rmi.trace.TraceRmi.*;import ghidra.rmi.trace.TraceRmi.Language;import ghidra.rmi.trace.TraceRmi.Value.Builder;import ghidra.trace.model.Lifespan;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.util.Msg;import ghidra.util.Swing;@@ -83,7 +83,7 @@ public class RmiClient {private static RmiMethodRegistry methodRegistry;private Deque<RequestResult> requests = new LinkedList<>();- public static TargetObjectSchema loadSchema(String resourceName, String rootName) {+ public static TraceObjectSchema loadSchema(String resourceName, String rootName) {XmlSchemaContext schemaContext;try {@@ -820,7 +820,7 @@ public class RmiClient {}}- public TargetObjectSchema getSchema(String schema) {+ public TraceObjectSchema getSchema(String schema) {return schemaContext.getSchema(new SchemaName(schema));}diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethod.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethod.javaindex 9ee4b6efcb..54e1034c35 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethod.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethod.java@@ -18,10 +18,9 @@ package ghidra.app.plugin.core.debug.client.tracermi;import java.lang.reflect.Method;import java.lang.reflect.Parameter;-import ghidra.dbg.target.TargetMethod;-import ghidra.dbg.target.TargetMethod.ParameterDescription;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;+import ghidra.trace.model.target.iface.TraceObjectMethod.ParameterDescription;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class RmiRemoteMethod {@@ -31,12 +30,12 @@ public class RmiRemoteMethod {private String display;private String description;private RmiRemoteMethodParameter[] params;- private TargetObjectSchema schema;+ private TraceObjectSchema schema;private RmiMethods instance;private Method m;public RmiRemoteMethod(SchemaContext schemaContext, String name, String action, String display,- String description, TargetObjectSchema schema, RmiMethods instance, Method m) {+ String description, TraceObjectSchema schema, RmiMethods instance, Method m) {this.schemaContext = schemaContext;this.name = name;this.action = action;@@ -49,10 +48,10 @@ public class RmiRemoteMethod {int i = 0;for (Parameter p : m.getParameters()) {- ParameterDescription<?> desc = TargetMethod.ParameterDescription.annotated(p);- TargetObjectSchema pschema;+ ParameterDescription<?> desc = ParameterDescription.annotated(p);+ TraceObjectSchema pschema;if (desc.type != RmiTraceObject.class) {- pschema = EnumerableTargetObjectSchema.schemaForPrimitive(desc.type);+ pschema = PrimitiveTraceObjectSchema.schemaForPrimitive(desc.type);}else {pschema = schemaContext.getSchema(new SchemaName(desc.schema));@@ -86,7 +85,7 @@ public class RmiRemoteMethod {return m;}- public TargetObjectSchema getSchema() {+ public TraceObjectSchema getSchema() {return schema;}diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethodParameter.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethodParameter.javaindex 2dc3d77f4e..20d330eb41 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethodParameter.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiRemoteMethodParameter.java@@ -15,19 +15,19 @@*/package ghidra.app.plugin.core.debug.client.tracermi;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.rmi.trace.TraceRmi.*;+import ghidra.trace.model.target.schema.TraceObjectSchema;public class RmiRemoteMethodParameter {private final String name;- private final TargetObjectSchema schema;+ private final TraceObjectSchema schema;private final boolean required;private final Object defaultValue;private final String display;private final String description;- public RmiRemoteMethodParameter(String name, TargetObjectSchema schema, boolean required,+ public RmiRemoteMethodParameter(String name, TraceObjectSchema schema, boolean required,Object defaultValue, String display, String description) {this.name = name;this.schema = schema;diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTrace.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTrace.javaindex a4f2dabafc..73904c9812 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTrace.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTrace.java@@ -21,12 +21,12 @@ import java.util.concurrent.locks.ReadWriteLock;import java.util.concurrent.locks.ReentrantReadWriteLock;import ghidra.app.plugin.core.debug.client.tracermi.RmiClient.RequestResult;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.program.model.address.*;import ghidra.program.model.lang.RegisterValue;import ghidra.rmi.trace.TraceRmi.*;import ghidra.trace.model.Lifespan;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.util.LockHold;import ghidra.util.Msg;@@ -181,7 +181,7 @@ public class RmiTrace {RmiTraceObject parent = proxyObject(d.getParent());Lifespan span = Lifespan.span(d.getSpan().getMin(), d.getSpan().getMax());Object value = client.argToObject(id, d.getValue());- TargetObjectSchema schema = client.getSchema(client.argToType(d.getValue()));+ TraceObjectSchema schema = client.getSchema(client.argToType(d.getValue()));result.add(new RmiTraceObjectValue(parent, span, d.getKey(), value, schema));}return result;diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTraceObjectValue.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTraceObjectValue.javaindex fcc483ff42..72c17a70e6 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTraceObjectValue.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/client/tracermi/RmiTraceObjectValue.java@@ -15,8 +15,8 @@*/package ghidra.app.plugin.core.debug.client.tracermi;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.trace.model.Lifespan;+import ghidra.trace.model.target.schema.TraceObjectSchema;public record RmiTraceObjectValue(RmiTraceObject parent, Lifespan span, String key, Object value,- TargetObjectSchema schema) {}+ TraceObjectSchema schema) {}diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.javaindex 9001ed2c5a..2c4af6ab74 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialog.java@@ -24,14 +24,13 @@ import javax.swing.JLabel;import ghidra.app.plugin.core.debug.gui.AbstractDebuggerParameterDialog;import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiTarget.Missing;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.SchemaContext;import ghidra.debug.api.ValStr;import ghidra.debug.api.tracermi.RemoteParameter;import ghidra.framework.options.SaveState;import ghidra.framework.plugintool.AutoConfigState.ConfigStateField;import ghidra.framework.plugintool.PluginTool;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.schema.SchemaContext;public class RemoteMethodInvocationDialog extends AbstractDebuggerParameterDialog<RemoteParameter> {@@ -84,11 +83,7 @@ public class RemoteMethodInvocationDialog extends AbstractDebuggerParameterDialo@Overrideprotected Class<?> parameterType(RemoteParameter parameter) {- Class<?> type = ctx.getSchema(parameter.type()).getType();- if (TargetObject.class.isAssignableFrom(type)) {- return TraceObject.class;- }- return type;+ return ctx.getSchema(parameter.type()).getType();}@Overridediff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.javaindex eac9ff551a..c45521e356 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/AbstractTraceRmiLaunchOffer.java@@ -36,7 +36,6 @@ import ghidra.app.plugin.core.terminal.TerminalListener;import ghidra.app.services.*;import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;import ghidra.async.AsyncUtils;-import ghidra.dbg.util.ShellUtils;import ghidra.debug.api.ValStr;import ghidra.debug.api.action.AutoMapSpec;import ghidra.debug.api.modules.DebuggerMissingProgramActionContext;diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.javaindex 98bec883e6..45bcf89f45 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java@@ -27,12 +27,12 @@ import javax.swing.Icon;import generic.theme.GIcon;import generic.theme.Gui;-import ghidra.dbg.util.ShellUtils;import ghidra.debug.api.ValStr;import ghidra.debug.api.tracermi.LaunchParameter;import ghidra.framework.Application;import ghidra.framework.plugintool.AutoConfigState.PathIsDir;import ghidra.framework.plugintool.AutoConfigState.PathIsFile;+import ghidra.pty.ShellUtils;import ghidra.util.*;/**diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteMethod.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteMethod.javaindex f155a67427..ae57681c30 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteMethod.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteMethod.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,10 +17,10 @@ package ghidra.app.plugin.core.debug.service.tracermi;import java.util.Map;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.debug.api.target.ActionName;import ghidra.debug.api.tracermi.*;import ghidra.trace.model.Trace;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public record RecordRemoteMethod(TraceRmiHandler handler, String name, ActionName action,String display, String description, Map<String, RemoteParameter> parameters,diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteParameter.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteParameter.javaindex d45971bc94..f785d4befe 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteParameter.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/RecordRemoteParameter.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,10 +15,10 @@*/package ghidra.app.plugin.core.debug.service.tracermi;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.debug.api.tracermi.RemoteParameter;import ghidra.program.model.address.AddressOverflowException;import ghidra.trace.model.Trace;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public record RecordRemoteParameter(TraceRmiHandler handler, String name, SchemaName type,boolean required, ValueSupplier defaultValue, String display, String description)diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiHandler.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiHandler.javaindex 9296c0dfff..43fb1f25e1 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiHandler.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiHandler.java@@ -35,10 +35,6 @@ import ghidra.app.plugin.core.debug.disassemble.DebuggerDisassemblerPlugin;import ghidra.app.plugin.core.debug.disassemble.TraceDisassembleCommand;import ghidra.app.services.DebuggerControlService;import ghidra.app.services.DebuggerTraceManagerService;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathUtils;import ghidra.debug.api.progress.CloseableTaskMonitor;import ghidra.debug.api.target.ActionName;import ghidra.debug.api.target.Target;@@ -60,6 +56,9 @@ import ghidra.trace.model.guest.TracePlatform;import ghidra.trace.model.memory.*;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.trace.model.time.TraceSnapshot;import ghidra.util.*;import ghidra.util.exception.CancelledException;@@ -652,12 +651,12 @@ public class TraceRmiHandler extends AbstractTraceRmiConnection {.getCompilerSpecByID(new CompilerSpecID(compiler.getId()));}- protected static TraceObjectKeyPath toKeyPath(ObjPath path) {- return TraceObjectKeyPath.parse(path.getPath());+ protected static KeyPath toKeyPath(ObjPath path) {+ return KeyPath.parse(path.getPath());}protected static PathPattern toPathPattern(ObjPath path) {- return new PathPattern(PathUtils.parse(path.getPath()));+ return PathFilter.parse(path.getPath());}protected static Lifespan toLifespan(Span span) {@@ -686,7 +685,7 @@ public class TraceRmiHandler extends AbstractTraceRmiConnection {return ObjSpec.newBuilder().setId(object.getKey()).build();}- protected static ObjPath makeObjPath(TraceObjectKeyPath path) {+ protected static ObjPath makeObjPath(KeyPath path) {return ObjPath.newBuilder().setPath(path.toString()).build();}diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiTarget.java b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiTarget.javaindex 656c32cacb..93547415a1 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiTarget.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiTarget.java@@ -30,13 +30,6 @@ import ghidra.app.plugin.core.debug.service.target.AbstractTarget;import ghidra.app.services.DebuggerConsoleService;import ghidra.app.services.DebuggerTraceManagerService;import ghidra.async.*;-import ghidra.dbg.target.*;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.util.PathMatcher;-import ghidra.dbg.util.PathPredicates;-import ghidra.dbg.util.PathPredicates.Align;import ghidra.debug.api.ValStr;import ghidra.debug.api.model.DebuggerObjectActionContext;import ghidra.debug.api.model.DebuggerSingleObjectPathActionContext;@@ -48,17 +41,20 @@ import ghidra.pcode.utils.Utils;import ghidra.program.model.address.*;import ghidra.program.model.lang.Register;import ghidra.program.model.lang.RegisterValue;-import ghidra.trace.model.Lifespan;-import ghidra.trace.model.Trace;+import ghidra.trace.model.*;import ghidra.trace.model.breakpoint.*;import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;import ghidra.trace.model.guest.TracePlatform;-import ghidra.trace.model.memory.TraceMemoryRegion;-import ghidra.trace.model.memory.TraceObjectMemoryRegion;+import ghidra.trace.model.memory.*;import ghidra.trace.model.stack.*;import ghidra.trace.model.target.*;-import ghidra.trace.model.thread.TraceObjectThread;-import ghidra.trace.model.thread.TraceThread;+import ghidra.trace.model.target.iface.*;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.path.PathFilter.Align;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.thread.*;import ghidra.util.Msg;import ghidra.util.task.TaskMonitor;@@ -110,16 +106,16 @@ public class TraceRmiTarget extends AbstractTarget {}@Override- public TargetExecutionState getThreadExecutionState(TraceThread thread) {+ public TraceExecutionState getThreadExecutionState(TraceThread thread) {if (!(thread instanceof TraceObjectThread tot)) {Msg.error(this, "Non-object thread with Trace RMI!");- return TargetExecutionState.ALIVE;+ return TraceExecutionState.ALIVE;}return tot.getObject().getExecutionState(getSnap());}@Override- public TraceThread getThreadForSuccessor(TraceObjectKeyPath path) {+ public TraceThread getThreadForSuccessor(KeyPath path) {TraceObject object = trace.getObjectManager().getObjectByCanonicalPath(path);if (object == null) {return null;@@ -130,7 +126,7 @@ public class TraceRmiTarget extends AbstractTarget {}@Override- public TraceStackFrame getStackFrameForSuccessor(TraceObjectKeyPath path) {+ public TraceStackFrame getStackFrameForSuccessor(KeyPath path) {TraceObject object = trace.getObjectManager().getObjectByCanonicalPath(path);if (object == null) {return null;@@ -203,15 +199,15 @@ public class TraceRmiTarget extends AbstractTarget {return null;}TraceObjectValue attrEnabled =- object.getAttribute(getSnap(), TargetTogglable.ENABLED_ATTRIBUTE_NAME);+ object.getAttribute(getSnap(), TraceObjectTogglable.KEY_ENABLED);boolean enabled = attrEnabled != null && attrEnabled.getValue() instanceof Boolean b && b;return !enabled;}protected Object findArgumentForSchema(ActionName action, ActionContext context,- TargetObjectSchema schema, boolean allowContextObject, boolean allowCoordsObject,+ TraceObjectSchema schema, boolean allowContextObject, boolean allowCoordsObject,boolean allowSuitableObject) {- if (schema instanceof EnumerableTargetObjectSchema prim) {+ if (schema instanceof PrimitiveTraceObjectSchema prim) {return switch (prim) {case OBJECT -> findObject(context, allowContextObject, allowCoordsObject);case ADDRESS -> findAddress(context);@@ -225,9 +221,9 @@ public class TraceRmiTarget extends AbstractTarget {return null;}if (allowSuitableObject) {- return object.querySuitableSchema(schema);+ return object.findSuitableSchema(schema);}- if (object.getTargetSchema() == schema) {+ if (object.getSchema() == schema) {return object;}return null;@@ -246,7 +242,7 @@ public class TraceRmiTarget extends AbstractTarget {Msg.trace(this, "No root schema, yet: " + trace);return null;}- TargetObjectSchema schema = ctx.getSchemaOrNull(type);+ TraceObjectSchema schema = ctx.getSchemaOrNull(type);if (schema == null) {Msg.error(this, "Schema " + type + " not in trace! " + trace);return null;@@ -275,19 +271,19 @@ public class TraceRmiTarget extends AbstractTarget {return args;}- private TargetExecutionState getStateOf(TraceObject object) {+ private TraceExecutionState getStateOf(TraceObject object) {try {return object.getExecutionState(getSnap());}catch (NoSuchElementException e) {- return TargetExecutionState.TERMINATED;+ return TraceExecutionState.TERMINATED;}}private boolean whenState(TraceObject object,- Predicate<TargetExecutionState> predicate) {+ Predicate<TraceExecutionState> predicate) {try {- TargetExecutionState state = getStateOf(object);+ TraceExecutionState state = getStateOf(object);return state == null || predicate.test(state);}catch (Exception e) {@@ -300,7 +296,7 @@ public class TraceRmiTarget extends AbstractTarget {long score = 0;for (Object o : args.values()) {if (o instanceof TraceObject obj) {- score += obj.getCanonicalPath().getKeyList().size();+ score += obj.getCanonicalPath().size();}}return score;@@ -315,7 +311,8 @@ public class TraceRmiTarget extends AbstractTarget {RemoteParameter firstParam = method.parameters().values().stream()- .filter(p -> TargetObject.class.isAssignableFrom(ctx.getSchema(p.type()).getType()))+ .filter(+ p -> TraceObjectInterfaceUtils.isTraceObject(ctx.getSchema(p.type()).getType())).findFirst().orElse(null);if (firstParam == null) {@@ -405,7 +402,7 @@ public class TraceRmiTarget extends AbstractTarget {.values().stream().filter(p -> {- TargetObjectSchema schema = ctx.getSchemaOrNull(p.type());+ TraceObjectSchema schema = ctx.getSchemaOrNull(p.type());if (schema == null) {Msg.error(this,"Method " + method + " refers to invalid schema name: " + p.type());@@ -489,22 +486,22 @@ public class TraceRmiTarget extends AbstractTarget {@Overridepublic boolean isSupportsFocus() {- TargetObjectSchema schema = trace.getObjectManager().getRootSchema();+ TraceObjectSchema schema = trace.getObjectManager().getRootSchema();if (schema == null) {Msg.trace(this, "Checked for focus support before root schema is available");return false;}return schema.getInterfaces()- .contains(TargetFocusScope.class) &&+ .contains(TraceObjectFocusScope.class) &&!connection.getMethods().getByAction(ActionName.ACTIVATE).isEmpty();}@Override- public TraceObjectKeyPath getFocus() {+ public KeyPath getFocus() {TraceObjectValue focusVal = trace.getObjectManager().getRootObject()- .getAttribute(getSnap(), TargetFocusScope.FOCUS_ATTRIBUTE_NAME);+ .getAttribute(getSnap(), TraceObjectFocusScope.KEY_FOCUS);if (focusVal == null || !focusVal.isObject()) {return null;}@@ -552,17 +549,17 @@ public class TraceRmiTarget extends AbstractTarget {protected static boolean typeMatches(RemoteMethod method, RemoteParameter param,SchemaContext ctx, Class<?> type) {- TargetObjectSchema sch = ctx.getSchemaOrNull(param.type());+ TraceObjectSchema sch = ctx.getSchemaOrNull(param.type());if (sch == null) {throw new RuntimeException("The parameter '%s' of method '%s' refers to a non-existent schema '%s'".formatted(param.name(), method.name(), param.type()));}- if (type == TargetObject.class) {+ if (type == TraceObject.class) {// The method cannot impose any further restriction. It must accept any object.- return sch == EnumerableTargetObjectSchema.OBJECT;+ return sch == PrimitiveTraceObjectSchema.OBJECT;}- else if (TargetObject.class.isAssignableFrom(type)) {+ else if (TraceObjectInterface.class.isAssignableFrom(type)) {return sch.getInterfaces().contains(type);}else {@@ -651,14 +648,13 @@ public class TraceRmiTarget extends AbstractTarget {return matchers(hasFocusTime, hasFocusSnap, hasFocus);}- static List<ActivateMatcher> makeBySpecificity(TargetObjectSchema rootSchema,- TraceObjectKeyPath path) {+ static List<ActivateMatcher> makeBySpecificity(TraceObjectSchema rootSchema,+ KeyPath path) {List<ActivateMatcher> result = new ArrayList<>();- List<String> keyList = path.getKeyList();- result.addAll(makeAllFor((keyList.size() + 1) * 3,- new TypeParamSpec("focus", TargetObject.class)));- List<TargetObjectSchema> schemas = rootSchema.getSuccessorSchemas(keyList);- for (int i = keyList.size(); i > 0; i--) { // Inclusive on both ends+ result.addAll(makeAllFor((path.size() + 1) * 3,+ new TypeParamSpec("focus", TraceObject.class)));+ List<TraceObjectSchema> schemas = rootSchema.getSuccessorSchemas(path);+ for (int i = path.size(); i > 0; i--) { // Inclusive on both endsresult.addAll(makeAllFor(i * 3, new SchemaParamSpec("focus", schemas.get(i).getName())));}@@ -675,7 +671,7 @@ public class TraceRmiTarget extends AbstractTarget {record ReadMemMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final ReadMemMatcher HAS_PROC_RANGE = new ReadMemMatcher(2, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("range", AddressRange.class)));static final ReadMemMatcher HAS_RANGE = new ReadMemMatcher(1, List.of(new TypeParamSpec("range", AddressRange.class)));@@ -684,7 +680,7 @@ public class TraceRmiTarget extends AbstractTarget {record WriteMemMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final WriteMemMatcher HAS_PROC_START_DATA = new WriteMemMatcher(2, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("start", Address.class),new TypeParamSpec("data", byte[].class)));static final WriteMemMatcher HAS_START_DATA = new WriteMemMatcher(1, List.of(@@ -695,45 +691,43 @@ public class TraceRmiTarget extends AbstractTarget {record ReadRegsMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final ReadRegsMatcher HAS_CONTAINER = new ReadRegsMatcher(3, List.of(- new TypeParamSpec("container", TargetRegisterContainer.class)));- static final ReadRegsMatcher HAS_BANK = new ReadRegsMatcher(2, List.of(- new TypeParamSpec("bank", TargetRegisterBank.class)));+ new TypeParamSpec("container", TraceObjectRegisterContainer.class)));static final ReadRegsMatcher HAS_REGISTER = new ReadRegsMatcher(1, List.of(- new TypeParamSpec("register", TargetRegister.class)));- static final List<ReadRegsMatcher> ALL = matchers(HAS_CONTAINER, HAS_BANK, HAS_REGISTER);+ new TypeParamSpec("register", TraceObjectRegister.class)));+ static final List<ReadRegsMatcher> ALL = matchers(HAS_CONTAINER, HAS_REGISTER);}record WriteRegMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final WriteRegMatcher HAS_FRAME_NAME_VALUE = new WriteRegMatcher(3, List.of(- new TypeParamSpec("frame", TargetStackFrame.class),+ new TypeParamSpec("frame", TraceObjectStackFrame.class),new TypeParamSpec("name", String.class),new TypeParamSpec("value", byte[].class)));static final WriteRegMatcher HAS_THREAD_NAME_VALUE = new WriteRegMatcher(2, List.of(- new TypeParamSpec("thread", TargetThread.class),+ new TypeParamSpec("thread", TraceObjectThread.class),new TypeParamSpec("name", String.class),new TypeParamSpec("value", byte[].class)));static final WriteRegMatcher HAS_REG_VALUE = new WriteRegMatcher(1, List.of(- new TypeParamSpec("register", TargetRegister.class),+ new TypeParamSpec("register", TraceObjectRegister.class),new TypeParamSpec("value", byte[].class)));static final List<WriteRegMatcher> ALL = matchers(HAS_FRAME_NAME_VALUE, HAS_REG_VALUE);}record BreakExecMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final BreakExecMatcher HAS_PROC_ADDR_COND_CMDS = new BreakExecMatcher(8, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("address", Address.class),new NameParamSpec("condition", String.class),new NameParamSpec("commands", String.class)));static final BreakExecMatcher HAS_PROC_ADDR_COND = new BreakExecMatcher(7, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("address", Address.class),new NameParamSpec("condition", String.class)));static final BreakExecMatcher HAS_PROC_ADDR_CMDS = new BreakExecMatcher(6, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("address", Address.class),new NameParamSpec("commands", String.class)));static final BreakExecMatcher HAS_PROC_ADDR = new BreakExecMatcher(5, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("address", Address.class)));static final BreakExecMatcher HAS_ADDR_COND_CMDS = new BreakExecMatcher(4, List.of(new TypeParamSpec("address", Address.class),@@ -755,20 +749,20 @@ public class TraceRmiTarget extends AbstractTarget {// TODO: Probably need a better way to deal with optional requirementsrecord BreakAccMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final BreakAccMatcher HAS_PROC_RNG_COND_CMDS = new BreakAccMatcher(8, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("range", AddressRange.class),new NameParamSpec("condition", String.class),new NameParamSpec("commands", String.class)));static final BreakAccMatcher HAS_PROC_RNG_COND = new BreakAccMatcher(7, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("range", AddressRange.class),new NameParamSpec("condition", String.class)));static final BreakAccMatcher HAS_PROC_RNG_CMDS = new BreakAccMatcher(6, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("range", AddressRange.class),new NameParamSpec("commands", String.class)));static final BreakAccMatcher HAS_PROC_RNG = new BreakAccMatcher(5, List.of(- new TypeParamSpec("process", TargetProcess.class),+ new TypeParamSpec("process", TraceObjectProcess.class),new TypeParamSpec("range", AddressRange.class)));static final BreakAccMatcher HAS_RNG_COND_CMDS = new BreakAccMatcher(4, List.of(new TypeParamSpec("range", AddressRange.class),@@ -789,19 +783,19 @@ public class TraceRmiTarget extends AbstractTarget {record DelBreakMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final DelBreakMatcher HAS_LOC = new DelBreakMatcher(2, List.of(- new TypeParamSpec("location", TargetBreakpointLocation.class)));+ new TypeParamSpec("location", TraceObjectBreakpointLocation.class)));static final DelBreakMatcher HAS_SPEC = new DelBreakMatcher(1, List.of(- new TypeParamSpec("specification", TargetBreakpointSpec.class)));+ new TypeParamSpec("specification", TraceObjectBreakpointSpec.class)));static final List<DelBreakMatcher> ALL = matchers(HAS_LOC, HAS_SPEC);static final List<DelBreakMatcher> SPEC = matchers(HAS_SPEC);}record ToggleBreakMatcher(int score, List<ParamSpec> spec) implements MethodMatcher {static final ToggleBreakMatcher HAS_LOC = new ToggleBreakMatcher(2, List.of(- new TypeParamSpec("location", TargetBreakpointLocation.class),+ new TypeParamSpec("location", TraceObjectBreakpointLocation.class),new TypeParamSpec("enabled", Boolean.class)));static final ToggleBreakMatcher HAS_SPEC = new ToggleBreakMatcher(1, List.of(- new TypeParamSpec("specification", TargetBreakpointSpec.class),+ new TypeParamSpec("specification", TraceObjectBreakpointSpec.class),new TypeParamSpec("enabled", Boolean.class)));static final List<ToggleBreakMatcher> ALL = matchers(HAS_LOC, HAS_SPEC);static final List<ToggleBreakMatcher> SPEC = matchers(HAS_SPEC);@@ -928,7 +922,7 @@ public class TraceRmiTarget extends AbstractTarget {return AsyncUtils.nil();}- SchemaName name = object.getTargetSchema().getName();+ SchemaName name = object.getSchema().getName();MatchedMethod activate = matches.getBest("activate_" + name, ActionName.ACTIVATE,() -> ActivateMatcher.makeBySpecificity(trace.getObjectManager().getRootSchema(),object.getCanonicalPath()));@@ -939,7 +933,7 @@ public class TraceRmiTarget extends AbstractTarget {Map<String, Object> args = new HashMap<>();RemoteParameter paramFocus = activate.params.get("focus");args.put(paramFocus.name(),- object.querySuitableSchema(getSchemaContext().getSchema(paramFocus.type())));+ object.findSuitableSchema(getSchemaContext().getSchema(paramFocus.type())));RemoteParameter paramTime = activate.params.get("time");if (paramTime != null) {args.put(paramTime.name(), coords.getTime().toString());@@ -974,7 +968,7 @@ public class TraceRmiTarget extends AbstractTarget {}protected SchemaContext getSchemaContext() {- TargetObjectSchema rootSchema = trace.getObjectManager().getRootSchema();+ TraceObjectSchema rootSchema = trace.getObjectManager().getRootSchema();if (rootSchema == null) {return null;}@@ -987,7 +981,7 @@ public class TraceRmiTarget extends AbstractTarget {Lifespan.at(getSnap()),new AddressRangeImpl(space.getMinAddress(), space.getMaxAddress()))) {TraceObject obj = ((TraceObjectMemoryRegion) region).getObject();- return obj.queryCanonicalAncestorsTargetInterface(TargetProcess.class)+ return obj.findCanonicalAncestorsInterface(TraceObjectProcess.class).findFirst().orElse(null);}@@ -1092,7 +1086,7 @@ public class TraceRmiTarget extends AbstractTarget {Msg.error(this, "Non-object trace with TraceRmi!");return AsyncUtils.nil();}- TraceObject container = tot.getObject().queryRegisterContainer(frame);+ TraceObject container = tot.getObject().findRegisterContainer(frame);if (container == null) {Msg.error(this,"Cannot find register container for thread,frame: " + thread + "," + frame);@@ -1110,25 +1104,11 @@ public class TraceRmiTarget extends AbstractTarget {keys.add("[" + lower + "]");}Set<TraceObject> regs = container- .querySuccessorsTargetInterface(Lifespan.at(getSnap()), TargetRegister.class,+ .findSuccessorsInterface(Lifespan.at(getSnap()), TraceObjectRegister.class,true).filter(p -> keys.contains(p.getLastEntry().getEntryKey().toLowerCase())).map(r -> r.getDestination(null)).collect(Collectors.toSet());- RemoteParameter paramBank = readRegs.params.get("bank");- if (paramBank != null) {- Set<TraceObject> banks = regs.stream()- .flatMap(r -> r.queryCanonicalAncestorsTargetInterface(TargetRegisterBank.class)- .findFirst()- .stream())- .collect(Collectors.toSet());- AsyncFence fence = new AsyncFence();- banks.stream().forEach(b -> {- fence.include(requestCaches.readRegs(b, readRegs.method, Map.of(- paramBank.name(), b)));- });- return fence.ready();- }RemoteParameter paramRegister = readRegs.params.get("register");if (paramRegister != null) {AsyncFence fence = new AsyncFence();@@ -1142,17 +1122,18 @@ public class TraceRmiTarget extends AbstractTarget {}protected TraceObject findRegisterObject(TraceObjectThread thread, int frame, String name) {- TraceObject container = thread.getObject().queryRegisterContainer(frame);+ TraceObject container = thread.getObject().findRegisterContainer(frame);if (container == null) {Msg.error(this, "No register container for thread=" + thread + ",frame=" + frame);return null;}- PathMatcher matcher = container.getTargetSchema().searchFor(TargetRegister.class, true);- PathPredicates pred = matcher.applyKeys(Align.RIGHT, name)+ PathMatcher matcher =+ container.getSchema().searchFor(TraceObjectRegister.class, true);+ PathFilter filter = matcher.applyKeys(Align.RIGHT, name).or(matcher.applyKeys(Align.RIGHT, name.toLowerCase())).or(matcher.applyKeys(Align.RIGHT, name.toUpperCase()));TraceObjectValPath regValPath =- container.getCanonicalSuccessors(pred).findFirst().orElse(null);+ container.getCanonicalSuccessors(filter).findFirst().orElse(null);if (regValPath == null) {Msg.error(this, "Cannot find register object for " + name + " in " + container);return null;diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialogTest.java b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialogTest.javaindex 7f870a417f..eee570535e 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialogTest.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/RemoteMethodInvocationDialogTest.java@@ -32,15 +32,15 @@ import ghidra.app.plugin.core.debug.gui.InvocationDialogHelper;import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiConnection.TestRemoteMethod;import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiConnection.TestRemoteParameter;import ghidra.async.SwingExecutorService;-import ghidra.dbg.target.TargetMethod.Param;-import ghidra.dbg.target.TargetMethod.ParameterDescription;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema.MinimalSchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.debug.api.ValStr;import ghidra.debug.api.tracermi.RemoteMethod;import ghidra.debug.api.tracermi.RemoteParameter;import ghidra.framework.options.PropertyBoolean;+import ghidra.trace.model.target.iface.TraceObjectMethod.Param;+import ghidra.trace.model.target.iface.TraceObjectMethod.ParameterDescription;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.PrimitiveTraceObjectSchema.MinimalSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class RemoteMethodInvocationDialogTest extends AbstractGhidraHeadedDebuggerTest {@@ -53,14 +53,14 @@ public class RemoteMethodInvocationDialogTest extends AbstractGhidraHeadedDebuggparams.put(parameter.name(), parameter);}return new TestRemoteMethod(m.getName(), null, "Test", "A test method", params,- EnumerableTargetObjectSchema.schemaForPrimitive(m.getReturnType()));+ PrimitiveTraceObjectSchema.schemaForPrimitive(m.getReturnType()));}public static TestRemoteParameter createParameter(Parameter p) {ParameterDescription<?> desc = ParameterDescription.annotated(p);- TargetObjectSchema schema = EnumerableTargetObjectSchema.schemaForPrimitive(desc.type);- if (schema == EnumerableTargetObjectSchema.OBJECT ||- schema == EnumerableTargetObjectSchema.ANY) {+ TraceObjectSchema schema = PrimitiveTraceObjectSchema.schemaForPrimitive(desc.type);+ if (schema == PrimitiveTraceObjectSchema.OBJECT ||+ schema == PrimitiveTraceObjectSchema.ANY) {schema = CTX.getSchema(new SchemaName(desc.schema));}return new TestRemoteParameter(desc.name, schema, desc.required, desc.defaultValue,diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/connection/TraceRmiConnectionManagerProviderTest.java b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/connection/TraceRmiConnectionManagerProviderTest.javaindex 145fde579c..5eb10dec21 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/connection/TraceRmiConnectionManagerProviderTest.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/gui/tracermi/connection/TraceRmiConnectionManagerProviderTest.java@@ -38,13 +38,13 @@ import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiClient.Tx;import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiPlugin;import ghidra.app.services.DebuggerControlService;import ghidra.app.services.TraceRmiService;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.control.ControlMode;import ghidra.debug.api.target.Target;import ghidra.debug.api.tracermi.TraceRmiAcceptor;import ghidra.debug.api.tracermi.TraceRmiConnection;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.util.exception.CancelledException;public class TraceRmiConnectionManagerProviderTest extends AbstractGhidraHeadedDebuggerTest {diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/RemoteMethodTest.java b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/RemoteMethodTest.javaindex 79c12aebe8..b8eaa38773 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/RemoteMethodTest.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/RemoteMethodTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -25,20 +25,21 @@ import db.Transaction;import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiConnection.TestRemoteMethod;import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiConnection.TestRemoteParameter;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.debug.api.target.ActionName;import ghidra.debug.api.tracermi.RemoteMethod;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.PrimitiveTraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Testpublic void testRemoteMethodValidateObjectGivenObject() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("obj", EnumerableTargetObjectSchema.OBJECT.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("obj", PrimitiveTraceObjectSchema.OBJECT.getName(), true,null, "Arg1", "An argument"));createTrace();@@ -56,8 +57,8 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Testpublic void testRemoteMethodValidateObjectGivenProcess() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("obj", EnumerableTargetObjectSchema.OBJECT.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("obj", PrimitiveTraceObjectSchema.OBJECT.getName(), true,null, "Arg1", "An argument"));createTrace();@@ -66,7 +67,7 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {try (Transaction tx = tb.startTransaction()) {tb.trace.getObjectManager().createRootObject(CTX.getSchema(new SchemaName("Session")));process =- tb.trace.getObjectManager().createObject(TraceObjectKeyPath.parse("Processes[0]"));+ tb.trace.getObjectManager().createObject(KeyPath.parse("Processes[0]"));process.insert(Lifespan.nowOn(0), ConflictResolution.DENY);}@@ -76,8 +77,8 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Test(expected = IllegalArgumentException.class)public void testRemoteMethodValidateObjectGivenInt() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("obj", EnumerableTargetObjectSchema.OBJECT.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("obj", PrimitiveTraceObjectSchema.OBJECT.getName(), true,null, "Arg1", "An argument"));method.validate(Map.of("obj", 1));@@ -86,7 +87,7 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Testpublic void testRemoteMethodValidateProcessGivenProcess() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),new TestRemoteParameter("proc", new SchemaName("Process"), true,null, "Proc1", "A Process argument"));@@ -96,7 +97,7 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {try (Transaction tx = tb.startTransaction()) {tb.trace.getObjectManager().createRootObject(CTX.getSchema(new SchemaName("Session")));process =- tb.trace.getObjectManager().createObject(TraceObjectKeyPath.parse("Processes[0]"));+ tb.trace.getObjectManager().createObject(KeyPath.parse("Processes[0]"));process.insert(Lifespan.nowOn(0), ConflictResolution.DENY);}@@ -106,7 +107,7 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Test(expected = IllegalArgumentException.class)public void testRemoteMethodValidateProcessGivenInt() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),new TestRemoteParameter("proc", new SchemaName("Process"), true,null, "Proc1", "A Process argument"));@@ -122,8 +123,8 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Testpublic void testRemoteMethodValidateAnyGivenInteger() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("arg", EnumerableTargetObjectSchema.ANY.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("arg", PrimitiveTraceObjectSchema.ANY.getName(), true,null, "Arg1", "An argument"));method.validate(Map.of("arg", 1));@@ -132,8 +133,8 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Testpublic void testRemoteMethodValidateAnyGivenObject() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("arg", EnumerableTargetObjectSchema.ANY.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("arg", PrimitiveTraceObjectSchema.ANY.getName(), true,null, "Arg1", "An argument"));createTrace();@@ -151,8 +152,8 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Testpublic void testRemoteMethodValidateAnyGivenProcess() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("arg", EnumerableTargetObjectSchema.ANY.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("arg", PrimitiveTraceObjectSchema.ANY.getName(), true,null, "Arg1", "An argument"));createTrace();@@ -161,7 +162,7 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {try (Transaction tx = tb.startTransaction()) {tb.trace.getObjectManager().createRootObject(CTX.getSchema(new SchemaName("Session")));process =- tb.trace.getObjectManager().createObject(TraceObjectKeyPath.parse("Processes[0]"));+ tb.trace.getObjectManager().createObject(KeyPath.parse("Processes[0]"));process.insert(Lifespan.nowOn(0), ConflictResolution.DENY);}@@ -171,8 +172,8 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Testpublic void testRemoteMethodValidateIntegerGivenInteger() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("arg", EnumerableTargetObjectSchema.INT.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("arg", PrimitiveTraceObjectSchema.INT.getName(), true,null, "Arg1", "An argument"));method.validate(Map.of("arg", 1));@@ -181,8 +182,8 @@ public class RemoteMethodTest extends AbstractGhidraHeadedDebuggerTest {@Test(expected = IllegalArgumentException.class)public void testRemoteMethodValidateIntegerGivenLong() throws Throwable {RemoteMethod method = new TestRemoteMethod("test", ActionName.name("test"), "Test",- "A test method", EnumerableTargetObjectSchema.VOID.getName(),- new TestRemoteParameter("arg", EnumerableTargetObjectSchema.INT.getName(), true,+ "A test method", PrimitiveTraceObjectSchema.VOID.getName(),+ new TestRemoteParameter("arg", PrimitiveTraceObjectSchema.INT.getName(), true,null, "Arg1", "An argument"));method.validate(Map.of("arg", 1L));diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiClient.java b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiClient.javaindex 2a6bdac2ae..76cdf4b014 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiClient.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiClient.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -20,11 +20,11 @@ import static org.junit.Assert.assertEquals;import java.io.IOException;import java.nio.channels.SocketChannel;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.framework.Application;import ghidra.rmi.trace.TraceRmi.*;import ghidra.rmi.trace.TraceRmi.Compiler;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.target.schema.XmlSchemaContext;public class TestTraceRmiClient {final ProtobufSocket<RootMessage> socket;@@ -128,7 +128,7 @@ public class TestTraceRmiClient {socket.recv());}- public void createRootObject(int traceId, TargetObjectSchema schema) throws IOException {+ public void createRootObject(int traceId, TraceObjectSchema schema) throws IOException {String xmlCtx = XmlSchemaContext.serialize(schema.getContext());socket.send(RootMessage.newBuilder().setRequestCreateRootObject(RequestCreateRootObject.newBuilder()diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiConnection.java b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiConnection.javaindex 0cda9dd218..12901a480a 100644--- a/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiConnection.java+++ b/Ghidra/Debug/Debugger-rmi-trace/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TestTraceRmiConnection.java@@ -27,14 +27,14 @@ import java.util.stream.Stream;import db.Transaction;import ghidra.app.services.DebuggerTargetService;import ghidra.async.*;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.debug.api.target.ActionName;import ghidra.debug.api.target.Target;import ghidra.debug.api.tracermi.*;import ghidra.framework.plugintool.PluginTool;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.time.TraceSnapshot;public abstract class TestTraceRmiConnection extends AbstractTraceRmiConnection {@@ -70,13 +70,13 @@ public abstract class TestTraceRmiConnection extends AbstractTraceRmiConnection}public TestRemoteMethod(String name, ActionName action, String display, String description,- Map<String, RemoteParameter> parameters, TargetObjectSchema retType) {+ Map<String, RemoteParameter> parameters, TraceObjectSchema retType) {this(name, action, display, description, parameters, retType.getName(),new AsyncPairingQueue<>(), new AsyncPairingQueue<>());}public TestRemoteMethod(String name, ActionName action, String display, String description,- TargetObjectSchema retType, RemoteParameter... parameters) {+ TraceObjectSchema retType, RemoteParameter... parameters) {this(name, action, display, description, Stream.of(parameters).collect(Collectors.toMap(RemoteParameter::name, p -> p)),retType);@@ -110,7 +110,7 @@ public abstract class TestTraceRmiConnection extends AbstractTraceRmiConnectionpublic record TestRemoteParameter(String name, SchemaName type, boolean required,Object defaultValue, String display, String description) implements RemoteParameter {- public TestRemoteParameter(String name, TargetObjectSchema type, boolean required,+ public TestRemoteParameter(String name, TraceObjectSchema type, boolean required,Object defaultValue, String display, String description) {this(name, type.getName(), required, defaultValue, display, description);}diff --git a/Ghidra/Debug/Debugger/build.gradle b/Ghidra/Debug/Debugger/build.gradleindex 1e60998a31..e2ca5133a6 100644--- a/Ghidra/Debug/Debugger/build.gradle+++ b/Ghidra/Debug/Debugger/build.gradle@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -25,7 +25,6 @@ eclipse.project.name = 'Debug Debugger'dependencies {api project(':Debugger-api')api project(':Framework-AsyncComm')- api project(':Framework-Debugging')api project(':Framework-TraceModeling')api project(':Base')api project(':ByteViewer')@@ -36,7 +35,6 @@ dependencies {testImplementation project(path: ':Generic', configuration: 'testArtifacts')testImplementation project(path: ':Base', configuration: 'testArtifacts')testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')- testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts')testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')testImplementation project(path: ':Project', configuration: 'testArtifacts')}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/event/ModelActivatedPluginEvent.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/event/ModelActivatedPluginEvent.javadeleted file mode 100644index 478c9a8889..0000000000--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/event/ModelActivatedPluginEvent.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.app.plugin.core.debug.event;--import java.lang.ref.WeakReference;--import ghidra.dbg.DebuggerObjectModel;-import ghidra.framework.plugintool.PluginEvent;--public class ModelActivatedPluginEvent extends PluginEvent {- static final String NAME = "Model Focus";-- private final WeakReference<DebuggerObjectModel> newModelRef;-- public ModelActivatedPluginEvent(String source, DebuggerObjectModel model) {- super(source, NAME);- this.newModelRef = new WeakReference<>(model);- }-- public DebuggerObjectModel getActiveModel() {- return newModelRef.get();- }-}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerAddRegionDialog.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerAddRegionDialog.javaindex 2b8eae7b3d..41695aa72d 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerAddRegionDialog.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerAddRegionDialog.java@@ -16,7 +16,6 @@package ghidra.app.plugin.core.debug.gui.memory;import java.awt.Font;-import java.util.List;import java.util.Set;import javax.swing.*;@@ -27,15 +26,15 @@ import docking.ReusableDialogComponentProvider;import docking.widgets.model.GAddressRangeField;import docking.widgets.model.GSpanField;import ghidra.app.plugin.core.debug.utils.MiscellaneousUtils;-import ghidra.dbg.target.TargetMemoryRegion;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.framework.plugintool.PluginTool;import ghidra.program.model.address.*;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.memory.TraceMemoryFlag;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.memory.TraceObjectMemoryRegion;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.util.layout.PairLayout;public class DebuggerAddRegionDialog extends ReusableDialogComponentProvider {@@ -155,17 +154,17 @@ public class DebuggerAddRegionDialog extends ReusableDialogComponentProvider {}protected String computeDefaultPath(DebuggerCoordinates current) {- TargetObjectSchema rootSchema = trace.getObjectManager().getRootSchema();+ TraceObjectSchema rootSchema = trace.getObjectManager().getRootSchema();if (rootSchema == null) {return "";}- List<String> suitable = rootSchema.searchForSuitableContainer(TargetMemoryRegion.class,- current.getPath().getKeyList());+ KeyPath suitable = rootSchema.searchForSuitableContainer(TraceObjectMemoryRegion.class,+ current.getPath());if (suitable == null) {return "";}- return TraceObjectKeyPath.of(suitable).index("New").toString();+ return suitable.index("New").toString();}protected void setValues(DebuggerCoordinates current) {diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPanel.javaindex bcb7db67b0..4f2a727891 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPanel.java@@ -15,7 +15,6 @@*/package ghidra.app.plugin.core.debug.gui.memory;-import java.util.List;import java.util.Set;import java.util.stream.Collectors;@@ -23,8 +22,6 @@ import docking.widgets.table.TableColumnDescriptor;import ghidra.app.plugin.core.debug.gui.model.*;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;import ghidra.app.plugin.core.debug.gui.model.columns.*;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.debug.api.model.DebuggerObjectActionContext;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.Plugin;@@ -32,9 +29,11 @@ import ghidra.framework.plugintool.ServiceProvider;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;import ghidra.trace.model.Trace;-import ghidra.trace.model.memory.TraceMemoryRegion;-import ghidra.trace.model.memory.TraceObjectMemoryRegion;+import ghidra.trace.model.memory.*;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.thread.TraceObjectProcess;public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceObjectMemoryRegion> {@@ -67,7 +66,7 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceObprivate static class RegionStartColumn extends AbstractTraceValueObjectAddressColumn {public RegionStartColumn() {- super(TargetMemoryRegion.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectMemoryRegion.KEY_RANGE);}@Override@@ -83,7 +82,7 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceObprivate static class RegionEndColumn extends AbstractTraceValueObjectAddressColumn {public RegionEndColumn() {- super(TargetMemoryRegion.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectMemoryRegion.KEY_RANGE);}@Override@@ -99,7 +98,7 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceObprivate static class RegionLengthColumn extends AbstractTraceValueObjectLengthColumn {public RegionLengthColumn() {- super(TargetMemoryRegion.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectMemoryRegion.KEY_RANGE);}@Override@@ -121,7 +120,7 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceObpublic static class RegionReadColumn extends RegionFlagColumn {public RegionReadColumn() {- super(TargetMemoryRegion.READABLE_ATTRIBUTE_NAME);+ super(TraceObjectMemoryRegion.KEY_READABLE);}@Override@@ -132,7 +131,7 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceObpublic static class RegionWriteColumn extends RegionFlagColumn {public RegionWriteColumn() {- super(TargetMemoryRegion.WRITABLE_ATTRIBUTE_NAME);+ super(TraceObjectMemoryRegion.KEY_WRITABLE);}@Override@@ -143,7 +142,7 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceObpublic static class RegionExecuteColumn extends RegionFlagColumn {public RegionExecuteColumn() {- super(TargetMemoryRegion.EXECUTABLE_ATTRIBUTE_NAME);+ super(TraceObjectMemoryRegion.KEY_EXECUTABLE);}@Override@@ -173,9 +172,9 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceOb}}- protected static ModelQuery successorRegions(TargetObjectSchema rootSchema, List<String> path) {- TargetObjectSchema schema = rootSchema.getSuccessorSchema(path);- return new ModelQuery(schema.searchFor(TargetMemoryRegion.class, path, true));+ protected static ModelQuery successorRegions(TraceObjectSchema rootSchema, KeyPath path) {+ TraceObjectSchema schema = rootSchema.getSuccessorSchema(path);+ return new ModelQuery(schema.searchFor(TraceObjectMemoryRegion.class, path, true));}protected Set<TraceMemoryRegion> getSelectedRegions(DebuggerObjectActionContext ctx) {@@ -193,23 +192,23 @@ public class DebuggerRegionsPanel extends AbstractObjectsTableBasedPanel<TraceOb@Overrideprotected ModelQuery computeQuery(TraceObject object) {- TargetObjectSchema rootSchema = object.getRoot().getTargetSchema();- List<String> seedPath = object.getCanonicalPath().getKeyList();- List<String> processPath = rootSchema.searchForAncestor(TargetProcess.class, seedPath);+ TraceObjectSchema rootSchema = object.getRoot().getSchema();+ KeyPath seedPath = object.getCanonicalPath();+ KeyPath processPath = rootSchema.searchForAncestor(TraceObjectProcess.class, seedPath);if (processPath != null) {ModelQuery result = successorRegions(rootSchema, processPath);if (!result.isEmpty()) {return result;}}- List<String> memoryPath = rootSchema.searchForSuitable(TargetMemory.class, seedPath);+ KeyPath memoryPath = rootSchema.searchForSuitable(TraceObjectMemory.class, seedPath);if (memoryPath != null) {ModelQuery result = successorRegions(rootSchema, memoryPath);if (!result.isEmpty()) {return result;}}- return successorRegions(rootSchema, List.of());+ return successorRegions(rootSchema, KeyPath.ROOT);}public void setSelectedRegions(Set<TraceMemoryRegion> sel) {diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/AbstractObjectsTableBasedPanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/AbstractObjectsTableBasedPanel.javaindex 11539ac751..8dc9f7d95d 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/AbstractObjectsTableBasedPanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/AbstractObjectsTableBasedPanel.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -35,6 +35,8 @@ import ghidra.framework.plugintool.*;import ghidra.framework.plugintool.annotation.AutoServiceConsumed;import ghidra.trace.model.Trace;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.KeyPath;public abstract class AbstractObjectsTableBasedPanel<U extends TraceObjectInterface>extends ObjectsTablePanel@@ -136,7 +138,7 @@ public abstract class AbstractObjectsTableBasedPanel<U extends TraceObjectInterf}@Override- public void activatePath(TraceObjectKeyPath path) {+ public void activatePath(KeyPath path) {if (current.getTrace() == null) {return;}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProvider.javaindex b5ac9ef349..ce85513c92 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProvider.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelProvider.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -63,6 +63,7 @@ import ghidra.framework.plugintool.annotation.AutoServiceConsumed;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.HelpLocation;import ghidra.util.Msg;@@ -229,7 +230,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveableprotected PathsTablePanel attributesTablePanel;/*testing*/ DebuggerCoordinates current = DebuggerCoordinates.NOWHERE;- /*testing*/ TraceObjectKeyPath path = TraceObjectKeyPath.of();+ /*testing*/ KeyPath path = KeyPath.of();@AutoServiceConsumedprotected DebuggerTraceManagerService traceManager;@@ -433,7 +434,7 @@ public class DebuggerModelProvider extends ComponentProvider implements SaveablemainPanel.revalidate();}- protected void activatePath(TraceObjectKeyPath path) {+ protected void activatePath(KeyPath path) {if (current.getTrace() == null) {return;}@@ -457,7 +458,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveable}@Override- public void activatePath(TraceObjectKeyPath path) {+ public void activatePath(KeyPath path) {DebuggerModelProvider.this.activatePath(path);}}@@ -510,7 +511,7 @@ public class DebuggerModelProvider extends ComponentProvider implements SaveableList<AbstractNode> sel = objectsTreePanel.getSelectedItems();if (sel.size() == 1) {TraceObjectValue value = sel.get(0).getValue();- setPath(value == null ? TraceObjectKeyPath.of() : value.getCanonicalPath(),+ setPath(value == null ? KeyPath.of() : value.getCanonicalPath(),objectsTreePanel, EventOrigin.INTERNAL_GENERATED);}}@@ -674,7 +675,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveable@Overridepublic boolean verify(JComponent input) {try {- TraceObjectKeyPath path = TraceObjectKeyPath.parse(pathField.getText());+ KeyPath path = KeyPath.parse(pathField.getText());setPath(path, null, EventOrigin.USER_GENERATED);return true;}@@ -687,7 +688,7 @@ public class DebuggerModelProvider extends ComponentProvider implements SaveablegoButton = new JButton("Go");ActionListener gotoPath = evt -> {try {- TraceObjectKeyPath path = TraceObjectKeyPath.parse(pathField.getText());+ KeyPath path = KeyPath.parse(pathField.getText());activatePath(path);KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();}@@ -854,7 +855,7 @@ public class DebuggerModelProvider extends ComponentProvider implements SaveableSaveState dataState = new SaveState();this.writeDataState(dataState);// Selection is not saved to the tool state- Set<TraceObjectKeyPath> selection = this.objectsTreePanel.getSelectedKeyPaths();+ Set<KeyPath> selection = this.objectsTreePanel.getSelectedKeyPaths();// coords are omitted by main window// also, cannot save unless trace is in a projectclone.coordinatesActivated(current);@@ -908,7 +909,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveableif (values.size() != 1) {return;}- TraceObjectKeyPath canonicalPath = values.get(0).getChild().getCanonicalPath();+ KeyPath canonicalPath = values.get(0).getChild().getCanonicalPath();setPath(canonicalPath);}@@ -917,12 +918,12 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveablereturn mainPanel;}- protected TraceObjectKeyPath findAsSibling(TraceObject object) {+ protected KeyPath findAsSibling(TraceObject object) {Trace trace = current.getTrace();if (trace == null) {return null;}- TraceObjectKeyPath parentPath = path.parent();+ KeyPath parentPath = path.parent();if (parentPath == null) {return null;}@@ -940,7 +941,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveablereturn null;}- protected TraceObjectKeyPath findAsParent(TraceObject object) {+ protected KeyPath findAsParent(TraceObject object) {Trace trace = current.getTrace();if (trace == null) {return null;@@ -953,7 +954,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveableif (sel == null) {return null;}- for (TraceObjectKeyPath p = sel.getCanonicalPath(); p != null; p = p.parent()) {+ for (KeyPath p = sel.getCanonicalPath(); p != null; p = p.parent()) {if (objectManager.getObjectByCanonicalPath(p) == object) {return p;}@@ -985,7 +986,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveableif (findAsParent(object) != null) {return;}- TraceObjectKeyPath sibling = findAsSibling(object);+ KeyPath sibling = findAsSibling(object);if (sibling != null) {objectsTreePanel.setSelectedKeyPaths(List.of(sibling));setPath(sibling);@@ -1002,7 +1003,7 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveable}}- protected void setPath(TraceObjectKeyPath path, JComponent source, EventOrigin origin) {+ protected void setPath(KeyPath path, JComponent source, EventOrigin origin) {if (Objects.equals(this.path, path) && getTreeSelection() != null) {return;}@@ -1018,11 +1019,11 @@ public class DebuggerModelProvider extends ComponentProvider implements SaveableattributesTablePanel.setQuery(ModelQuery.attributesOf(path));}- public void setPath(TraceObjectKeyPath path) {+ public void setPath(KeyPath path) {setPath(path, null, EventOrigin.API_GENERATED);}- public TraceObjectKeyPath getPath() {+ public KeyPath getPath() {return path;}@@ -1137,11 +1138,11 @@ public class DebuggerModelProvider extends ComponentProvider implements Saveablereturn showMethodsInTree;}- protected void setTreeSelection(TraceObjectKeyPath path, EventOrigin origin) {+ protected void setTreeSelection(KeyPath path, EventOrigin origin) {objectsTreePanel.setSelectedKeyPaths(List.of(path), origin);}- protected void setTreeSelection(TraceObjectKeyPath path) {+ protected void setTreeSelection(KeyPath path) {setTreeSelection(path, EventOrigin.API_GENERATED);}@@ -1189,6 +1190,6 @@ public class DebuggerModelProvider extends ComponentProvider implements SaveablecoordinatesActivated(coords);}}- setPath(TraceObjectKeyPath.parse(saveState.getString(KEY_PATH, "")));+ setPath(KeyPath.parse(saveState.getString(KEY_PATH, "")));}}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysModified.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysModified.javaindex f33628fd6d..7e28f9a6d9 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysModified.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysModified.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,11 +17,11 @@ package ghidra.app.plugin.core.debug.gui.model;import java.util.Objects;-import ghidra.dbg.util.PathPredicates;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.path.PathFilter;public interface DisplaysModified {/**@@ -140,8 +140,7 @@ public interface DisplaysModified {return isEdgesDiffer(newContains ? value : null, diffEdge);}TraceObjectValue diffEdge = diffTrace.getObjectManager()- .getValuePaths(Lifespan.at(diffSnap),- PathPredicates.pattern(value.getCanonicalPath().getKeyList()))+ .getValuePaths(Lifespan.at(diffSnap), PathFilter.pattern(value.getCanonicalPath())).findAny().map(p -> p.getLastEntry()).orElse(null);diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysObjectValues.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysObjectValues.javaindex 008e216a1d..b07cf6a79f 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysObjectValues.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/DisplaysObjectValues.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -19,9 +19,9 @@ import java.util.stream.*;import org.apache.commons.lang3.ArrayUtils;-import ghidra.dbg.target.TargetObject;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.iface.TraceObjectInterface;import ghidra.util.HTMLUtilities;import ghidra.util.NumericUtilities;@@ -114,7 +114,7 @@ public interface DisplaysObjectValues {default String getObjectType(TraceObjectValue edge) {TraceObject object = edge.getChild();- return object.getTargetSchema().getName().toString();+ return object.getSchema().getName().toString();}default String getObjectLinkToolTip(TraceObjectValue edge) {@@ -132,7 +132,7 @@ public interface DisplaysObjectValues {default String getObjectDisplay(TraceObjectValue edge) {TraceObject object = edge.getChild();TraceObjectValue displayAttr =- object.getAttribute(getSnap(), TargetObject.DISPLAY_ATTRIBUTE_NAME);+ object.getAttribute(getSnap(), TraceObjectInterface.KEY_DISPLAY);if (displayAttr != null) {return displayAttr.getValue().toString();}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ModelQuery.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ModelQuery.javaindex 3379626584..1395122774 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ModelQuery.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ModelQuery.java@@ -15,50 +15,51 @@*/package ghidra.app.plugin.core.debug.gui.model;-import java.util.*;+import java.util.List;+import java.util.Objects;import java.util.stream.Collectors;import java.util.stream.Stream;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.AttributeSchema;-import ghidra.dbg.util.*;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.PrimitiveTraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.AttributeSchema;public class ModelQuery {- public static final ModelQuery EMPTY = new ModelQuery(PathPredicates.EMPTY);+ public static final ModelQuery EMPTY = new ModelQuery(PathFilter.NONE);// TODO: A more capable query language, e.g., with WHERE clauses.// Could also want math expressions for the conditionals... Hmm.// They need to be user enterable, so just a Java API won't suffice.public static ModelQuery parse(String queryString) {- return new ModelQuery(PathPredicates.parse(queryString));+ return new ModelQuery(PathFilter.parse(queryString));}- public static ModelQuery elementsOf(TraceObjectKeyPath path) {- return new ModelQuery(new PathPattern(PathUtils.extend(path.getKeyList(), "[]")));+ public static ModelQuery elementsOf(KeyPath path) {+ return new ModelQuery(new PathPattern(path.index("")));}- public static ModelQuery attributesOf(TraceObjectKeyPath path) {- return new ModelQuery(new PathPattern(PathUtils.extend(path.getKeyList(), "")));+ public static ModelQuery attributesOf(KeyPath path) {+ return new ModelQuery(new PathPattern(path.key("")));}- private final PathPredicates predicates;+ private final PathFilter filter;/*** TODO: This should probably be more capable, but for now, just support simple path patterns*- * @param predicates the patterns+ * @param filter the filter*/- public ModelQuery(PathPredicates predicates) {- this.predicates = predicates;+ public ModelQuery(PathFilter filter) {+ this.filter = filter;}@Overridepublic String toString() {- return "<ModelQuery: " + predicates.toString() + ">";+ return "<ModelQuery: " + filter.toString() + ">";}@Override@@ -70,7 +71,7 @@ public class ModelQuery {return false;}ModelQuery that = (ModelQuery) obj;- if (!Objects.equals(this.predicates, that.predicates)) {+ if (!Objects.equals(this.filter, that.filter)) {return false;}return true;@@ -82,7 +83,7 @@ public class ModelQuery {* @return the string*/public String toQueryString() {- return predicates.getSingletonPattern().toPatternString();+ return filter.getSingletonPattern().toPatternString();}/**@@ -95,7 +96,7 @@ public class ModelQuery {public Stream<TraceObject> streamObjects(Trace trace, Lifespan span) {TraceObjectManager objects = trace.getObjectManager();TraceObject root = objects.getRootObject();- return objects.getValuePaths(span, predicates)+ return objects.getValuePaths(span, filter).map(p -> p.getDestinationValue(root)).filter(v -> v instanceof TraceObject).map(v -> (TraceObject) v);@@ -103,32 +104,32 @@ public class ModelQuery {public Stream<TraceObjectValue> streamValues(Trace trace, Lifespan span) {TraceObjectManager objects = trace.getObjectManager();- return objects.getValuePaths(span, predicates).map(p -> {+ return objects.getValuePaths(span, filter).map(p -> {TraceObjectValue last = p.getLastEntry();return last == null ? objects.getRootObject().getCanonicalParent(0) : last;});}public Stream<TraceObjectValPath> streamPaths(Trace trace, Lifespan span) {- return trace.getObjectManager().getValuePaths(span, predicates).map(p -> p);+ return trace.getObjectManager().getValuePaths(span, filter).map(p -> p);}- public List<TargetObjectSchema> computeSchemas(Trace trace) {- TargetObjectSchema rootSchema = trace.getObjectManager().getRootSchema();+ public List<TraceObjectSchema> computeSchemas(Trace trace) {+ TraceObjectSchema rootSchema = trace.getObjectManager().getRootSchema();if (rootSchema == null) {return List.of();}- return predicates.getPatterns()+ return filter.getPatterns().stream().map(p -> rootSchema.getSuccessorSchema(p.asPath())).distinct().collect(Collectors.toList());}- public TargetObjectSchema computeSingleSchema(Trace trace) {- List<TargetObjectSchema> schemas = computeSchemas(trace);+ public TraceObjectSchema computeSingleSchema(Trace trace) {+ List<TraceObjectSchema> schemas = computeSchemas(trace);if (schemas.size() != 1) {- return EnumerableTargetObjectSchema.OBJECT;+ return PrimitiveTraceObjectSchema.OBJECT;}return schemas.get(0);}@@ -143,7 +144,7 @@ public class ModelQuery {* @return the list of attributes*/public Stream<AttributeSchema> computeAttributes(Trace trace) {- TargetObjectSchema schema = computeSingleSchema(trace);+ TraceObjectSchema schema = computeSingleSchema(trace);return schema.getAttributeSchemas().entrySet().stream()@@ -155,12 +156,12 @@ public class ModelQuery {}protected static boolean includes(Lifespan span, PathPattern pattern, TraceObjectValue value) {- List<String> asPath = pattern.asPath();- if (asPath.isEmpty()) {+ KeyPath asPath = pattern.asPath();+ if (asPath.isRoot()) {// If the pattern is the root, then only match the "root value"return value.getParent() == null;}- if (!PathPredicates.keyMatches(PathUtils.getKey(asPath), value.getEntryKey())) {+ if (!PathFilter.keyMatches(asPath.key(), value.getEntryKey())) {return false;}TraceObject parent = value.getParent();@@ -188,7 +189,7 @@ public class ModelQuery {if (!span.intersects(value.getLifespan())) {return false;}- for (PathPattern pattern : predicates.getPatterns()) {+ for (PathPattern pattern : filter.getPatterns()) {if (includes(span, pattern, value)) {return true;}@@ -204,16 +205,16 @@ public class ModelQuery {}// Check if any of the value's paths could be an ancestor of a result- List<String> asPath = new ArrayList<>(pattern.asPath());+ KeyPath asPath = pattern.asPath();// Destroy the pattern from the right, thus iterating each ancestor- while (!asPath.isEmpty()) {+ while (!asPath.isRoot()) {// The value's key much match somewhere in the pattern to be involved- if (!PathPredicates.keyMatches(PathUtils.getKey(asPath), value.getEntryKey())) {- asPath.remove(asPath.size() - 1);+ if (!PathFilter.keyMatches(asPath.key(), value.getEntryKey())) {+ asPath = asPath.parent();continue;}// If it does, then check if any path to the value's parent matches the rest- asPath.remove(asPath.size() - 1);+ asPath = asPath.parent();if (parent.getAncestors(span, new PathPattern(asPath)).anyMatch(v -> v.getSource(parent).isRoot())) {return true;@@ -233,15 +234,15 @@ public class ModelQuery {if (!span.intersects(value.getLifespan())) {return false;}- for (PathPattern pattern : predicates.getPatterns()) {+ for (PathPattern pattern : filter.getPatterns()) {if (involves(span, pattern, value)) {return true;}}return false;}-+public boolean isEmpty() {- return predicates.isEmpty();+ return filter.isNone();}}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectDefaultActionsMixin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectDefaultActionsMixin.javaindex 81f4279316..d30c495253 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectDefaultActionsMixin.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectDefaultActionsMixin.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -24,7 +24,6 @@ import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueProperty;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;import ghidra.app.plugin.core.debug.gui.model.PathTableModel.PathRow;import ghidra.app.services.DebuggerListingService;-import ghidra.dbg.target.*;import ghidra.debug.api.model.DebuggerSingleObjectPathActionContext;import ghidra.debug.api.target.ActionName;import ghidra.debug.api.target.Target;@@ -36,6 +35,8 @@ import ghidra.program.model.address.AddressRange;import ghidra.program.util.ProgramLocation;import ghidra.program.util.ProgramSelection;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.iface.*;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.Msg;public interface ObjectDefaultActionsMixin {@@ -44,7 +45,7 @@ public interface ObjectDefaultActionsMixin {DebuggerCoordinates getCurrent();- void activatePath(TraceObjectKeyPath path);+ void activatePath(KeyPath path);default void toggleObject(TraceObject object) {if (!getCurrent().isAliveAndPresent()) {@@ -124,8 +125,9 @@ public interface ObjectDefaultActionsMixin {}default boolean performDefaultAction(TraceObject object) {- Set<Class<? extends TargetObject>> interfaces = object.getTargetSchema().getInterfaces();- if (interfaces.contains(TargetActivatable.class)) {+ Set<Class<? extends TraceObjectInterface>> interfaces =+ object.getSchema().getInterfaces();+ if (interfaces.contains(TraceObjectActivatable.class)) {activatePath(object.getCanonicalPath());return true;}@@ -133,7 +135,7 @@ public interface ObjectDefaultActionsMixin {* Should I check aliveAndPresent() here? If I do, behavior changes when target is dead,* which might be unexpected.*/- if (interfaces.contains(TargetTogglable.class)) {+ if (interfaces.contains(TraceObjectTogglable.class)) {toggleObject(object);return true;}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTableModel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTableModel.javaindex f9bb8d6624..7db56ed456 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTableModel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTableModel.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -26,9 +26,6 @@ import docking.widgets.table.RangeCursorTableHeaderRenderer.SeekListener;import docking.widgets.table.TableColumnDescriptor;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;import ghidra.app.plugin.core.debug.gui.model.columns.*;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.AttributeSchema;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.Plugin;import ghidra.framework.plugintool.ServiceProvider;@@ -38,6 +35,9 @@ import ghidra.trace.model.Lifespan.*;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.AttributeSchema;import ghidra.util.HTMLUtilities;import ghidra.util.NumericUtilities;import ghidra.util.datastruct.ListenerSet;@@ -444,7 +444,7 @@ public class ObjectTableModel extends AbstractQueryTableModel<ValueRow> {AttributeSchema attributeSchema) {String name = attributeSchema.getName();Class<?> type = computeAttributeType(ctx, attributeSchema);- return new AutoAttributeColumn<>(name, type, attributeSchema.isHidden());+ return new AutoAttributeColumn<>(name, type, attributeSchema.isHidden(name));}final boolean hidden;@@ -528,7 +528,7 @@ public class ObjectTableModel extends AbstractQueryTableModel<ValueRow> {if (trace == null || query == null) {return List.of();}- TargetObjectSchema rootSchema = trace.getObjectManager().getRootSchema();+ TraceObjectSchema rootSchema = trace.getObjectManager().getRootSchema();if (rootSchema == null) {return List.of();}@@ -563,7 +563,7 @@ public class ObjectTableModel extends AbstractQueryTableModel<ValueRow> {if (trace == null) {return;}- TargetObjectSchema rootSchema = trace.getObjectManager().getRootSchema();+ TraceObjectSchema rootSchema = trace.getObjectManager().getRootSchema();if (rootSchema == null) {return;}@@ -573,7 +573,7 @@ public class ObjectTableModel extends AbstractQueryTableModel<ValueRow> {TraceValueObjectAttributeColumn<?> column =columnCache.computeIfAbsent(ColKey.fromSchema(ctx, as),ck -> AutoAttributeColumn.fromSchema(ctx, as));- if (as.isHidden()) {+ if (as.isHidden(as.getName())) {descriptor.addHiddenColumn(column);}else {diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTreeModel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTreeModel.javaindex d1216b9771..cca4e5aa38 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTreeModel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectTreeModel.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -24,11 +24,15 @@ import docking.widgets.tree.GTreeLazyNode;import docking.widgets.tree.GTreeNode;import generic.theme.GIcon;import ghidra.app.plugin.core.debug.gui.DebuggerResources;-import ghidra.dbg.target.*;-import ghidra.dbg.util.PathUtils.TargetObjectKeyComparator;import ghidra.framework.model.*;import ghidra.trace.model.*;-import ghidra.trace.model.target.*;+import ghidra.trace.model.breakpoint.TraceObjectBreakpointLocation;+import ghidra.trace.model.breakpoint.TraceObjectBreakpointSpec;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.iface.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.KeyPath.KeyComparator;import ghidra.trace.util.TraceEvents;import ghidra.util.HTMLUtilities;import ghidra.util.LockHold;@@ -59,25 +63,26 @@ public class ObjectTreeModel implements DisplaysModified {protected boolean isEventValue(TraceObjectValue value) {if (!value.getParent()- .getTargetSchema()+ .getSchema().getInterfaces()- .contains(TargetEventScope.class)) {+ .contains(TraceObjectEventScope.class)) {return false;}- if (!TargetEventScope.EVENT_OBJECT_ATTRIBUTE_NAME.equals(value.getEntryKey())) {+ if (!TraceObjectEventScope.KEY_EVENT_THREAD.equals(value.getEntryKey())) {return false;}return true;}protected boolean isEnabledValue(TraceObjectValue value) {- Set<Class<? extends TargetObject>> interfaces =- value.getParent().getTargetSchema().getInterfaces();- if (!interfaces.contains(TargetBreakpointSpec.class) &&- !interfaces.contains(TargetBreakpointLocation.class)) {+ Set<Class<? extends TraceObjectInterface>> interfaces =+ value.getParent().getSchema().getInterfaces();+ if (!interfaces.contains(TraceObjectBreakpointSpec.class) &&+ !interfaces.contains(TraceObjectBreakpointLocation.class) &&+ !interfaces.contains(TraceObjectTogglable.class)) {return false;}- if (!TargetBreakpointSpec.ENABLED_ATTRIBUTE_NAME.equals(value.getEntryKey())) {+ if (!TraceObjectTogglable.KEY_ENABLED.equals(value.getEntryKey())) {return false;}return true;@@ -257,7 +262,7 @@ public class ObjectTreeModel implements DisplaysModified {return -1;}int c;- c = TargetObjectKeyComparator.CHILD.compare(this.getValue().getEntryKey(),+ c = KeyComparator.CHILD.compare(this.getValue().getEntryKey(),that.getValue().getEntryKey());if (c != 0) {return c;@@ -297,11 +302,11 @@ public class ObjectTreeModel implements DisplaysModified {}}- protected AbstractNode getNode(TraceObjectKeyPath p, int pos) {- if (pos >= p.getKeyList().size()) {+ protected AbstractNode getNode(KeyPath p, int pos) {+ if (pos >= p.size()) {return this;}- String key = p.getKeyList().get(pos);+ String key = p.key(pos);AbstractNode matched = children().stream().map(c -> (AbstractNode) c).filter(c -> key.equals(c.getValue().getEntryKey()))@@ -313,7 +318,7 @@ public class ObjectTreeModel implements DisplaysModified {return matched.getNode(p, pos + 1);}- public AbstractNode getNode(TraceObjectKeyPath p) {+ public AbstractNode getNode(KeyPath p) {return getNode(p, 0);}@@ -575,7 +580,7 @@ public class ObjectTreeModel implements DisplaysModified {if (parentValue == null) {return super.getIcon(expanded);}- if (!parentValue.getParent().getTargetSchema().isCanonicalContainer()) {+ if (!parentValue.getParent().getSchema().isCanonicalContainer()) {return super.getIcon(expanded);}if (!isOnEventPath(object)) {@@ -661,7 +666,8 @@ public class ObjectTreeModel implements DisplaysModified {}protected TraceObject getEventObject(TraceObject object) {- TraceObject scope = object.queryCanonicalAncestorsTargetInterface(TargetEventScope.class)+ TraceObject scope = object+ .findCanonicalAncestorsInterface(TraceObjectEventScope.class).findFirst().orElse(null);if (scope == null) {@@ -671,7 +677,7 @@ public class ObjectTreeModel implements DisplaysModified {return null;}TraceObjectValue eventValue =- scope.getAttribute(snap, TargetEventScope.EVENT_OBJECT_ATTRIBUTE_NAME);+ scope.getAttribute(snap, TraceObjectEventScope.KEY_EVENT_THREAD);if (eventValue == null || !eventValue.isObject()) {return null;}@@ -698,7 +704,7 @@ public class ObjectTreeModel implements DisplaysModified {if (type.contains("Breakpoint")) {TraceObject object = edge.getChild();TraceObjectValue en =- object.getAttribute(snap, TargetBreakpointSpec.ENABLED_ATTRIBUTE_NAME);+ object.getAttribute(snap, TraceObjectTogglable.KEY_ENABLED);// includes true or non-boolean valuesif (en == null || !Objects.equals(false, en.getValue())) {return DebuggerResources.ICON_SET_BREAKPOINT;@@ -941,7 +947,7 @@ public class ObjectTreeModel implements DisplaysModified {return showMethods;}- public AbstractNode getNode(TraceObjectKeyPath p) {+ public AbstractNode getNode(KeyPath p) {return root.getNode(p);}}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTablePanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTablePanel.javaindex f884775a31..6d0778aa07 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTablePanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTablePanel.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -26,10 +26,10 @@ import javax.swing.table.TableColumn;import docking.widgets.table.GTableColumnModel;import docking.widgets.table.GTableTextCellEditor;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.*;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.framework.plugintool.Plugin;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.schema.TraceObjectSchema;public class ObjectsTablePanel extends AbstractQueryTablePanel<ValueRow, ObjectTableModel> {@@ -91,11 +91,11 @@ public class ObjectsTablePanel extends AbstractQueryTablePanel<ValueRow, ObjectTif (query == null) {return DEFAULT_PREF_KEY;}- List<TargetObjectSchema> schemas = query.computeSchemas(trace);+ List<TraceObjectSchema> schemas = query.computeSchemas(trace);if (schemas.isEmpty()) {return DEFAULT_PREF_KEY;}- TargetObjectSchema rootSchema = trace.getObjectManager().getRootSchema();+ TraceObjectSchema rootSchema = trace.getObjectManager().getRootSchema();if (rootSchema == null) {return DEFAULT_PREF_KEY;}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTreePanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTreePanel.javaindex b66b1f8e22..7a95c7af64 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTreePanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/ObjectsTreePanel.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -37,6 +37,7 @@ import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.Swing;public class ObjectsTreePanel extends JPanel {@@ -173,7 +174,7 @@ public class ObjectsTreePanel extends JPanel {protected final ObjectGTree tree;protected boolean showing = false;- protected Set<TraceObjectKeyPath> savedSelection = null;+ protected Set<KeyPath> savedSelection = null;protected DebuggerCoordinates current = DebuggerCoordinates.NOWHERE;protected DebuggerCoordinates previous = DebuggerCoordinates.NOWHERE;protected boolean limitToSnap = true;@@ -264,13 +265,13 @@ public class ObjectsTreePanel extends JPanel {// Repaint for bold current path is already going to happen// Repaint is not enough, as node sizes may change- for (TraceObjectKeyPath path = current.getPath(); path != null; path = path.parent()) {+ for (KeyPath path = current.getPath(); path != null; path = path.parent()) {AbstractNode node = treeModel.getNode(path);if (node != null) {node.fireNodeChanged();}}- for (TraceObjectKeyPath path = previous.getPath(); path != null; path = path.parent()) {+ for (KeyPath path = previous.getPath(); path != null; path = path.parent()) {AbstractNode node = treeModel.getNode(path);if (node != null) {node.fireNodeChanged();@@ -421,14 +422,14 @@ public class ObjectsTreePanel extends JPanel {return getItemFromPath(tree.getSelectionPath());}- public AbstractNode getNode(TraceObjectKeyPath path) {+ public AbstractNode getNode(KeyPath path) {return treeModel.getNode(path);}- public void setSelectedKeyPaths(Collection<TraceObjectKeyPath> keyPaths, EventOrigin origin) {- savedSelection = keyPaths instanceof Set<TraceObjectKeyPath> s ? s : Set.copyOf(keyPaths);+ public void setSelectedKeyPaths(Collection<KeyPath> keyPaths, EventOrigin origin) {+ savedSelection = keyPaths instanceof Set<KeyPath> s ? s : Set.copyOf(keyPaths);List<TreePath> treePaths = new ArrayList<>();- for (TraceObjectKeyPath path : keyPaths) {+ for (KeyPath path : keyPaths) {AbstractNode node = getNode(path);if (node != null) {treePaths.add(node.getTreePath());@@ -437,12 +438,12 @@ public class ObjectsTreePanel extends JPanel {tree.setSelectionPaths(treePaths.toArray(TreePath[]::new), origin);}- public Set<TraceObjectKeyPath> getSelectedKeyPaths() {- Set<TraceObjectKeyPath> result = new HashSet<>();+ public Set<KeyPath> getSelectedKeyPaths() {+ Set<KeyPath> result = new HashSet<>();for (AbstractNode node : getSelectedItems()) {TraceObjectValue value = node.getValue();if (value == null) {- result.add(TraceObjectKeyPath.of());+ result.add(KeyPath.of());}else {result.add(value.getCanonicalPath());@@ -451,7 +452,7 @@ public class ObjectsTreePanel extends JPanel {return result;}- public void setSelectedKeyPaths(Collection<TraceObjectKeyPath> keyPaths) {+ public void setSelectedKeyPaths(Collection<KeyPath> keyPaths) {setSelectedKeyPaths(keyPaths, EventOrigin.API_GENERATED);}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/PathTableModel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/PathTableModel.javaindex 2fd05a747e..5ec0a99f73 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/PathTableModel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/PathTableModel.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,7 +16,8 @@package ghidra.app.plugin.core.debug.gui.model;import java.awt.Color;-import java.util.*;+import java.util.HashSet;+import java.util.Set;import java.util.stream.Stream;import docking.widgets.table.RangeCursorTableHeaderRenderer.SeekListener;@@ -27,12 +28,13 @@ import ghidra.framework.plugintool.Plugin;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;public class PathTableModel extends AbstractQueryTableModel<PathRow> {- record Seen(List<String> path, long minSnap) {- static Seen forPath(TraceObjectValPath path) {- TraceObjectValue last = path.getLastEntry();- return new Seen(path.getKeyList(), last == null ? 0 : last.getMinSnap());+ record Seen(KeyPath path, long minSnap) {+ static Seen forPath(TraceObjectValPath valPath) {+ TraceObjectValue last = valPath.getLastEntry();+ return new Seen(valPath.getPath(), last == null ? 0 : last.getMinSnap());}}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TracePathStringColumn.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TracePathStringColumn.javaindex 55c71d4fd2..047e0fcb43 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TracePathStringColumn.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TracePathStringColumn.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,7 +17,6 @@ package ghidra.app.plugin.core.debug.gui.model.columns;import docking.widgets.table.AbstractDynamicTableColumn;import ghidra.app.plugin.core.debug.gui.model.PathTableModel.PathRow;-import ghidra.dbg.util.PathUtils;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.ServiceProvider;import ghidra.trace.model.Trace;@@ -39,6 +38,6 @@ public class TracePathStringColumn extends AbstractDynamicTableColumn<PathRow, S@Overridepublic String getValue(PathRow rowObject, Settings settings, Trace data,ServiceProvider serviceProvider) throws IllegalArgumentException {- return PathUtils.toString(rowObject.getPath().getKeyList());+ return rowObject.getPath().getPath().toString();}}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueKeyColumn.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueKeyColumn.javaindex 308a15405d..609ed3b7b1 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueKeyColumn.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueKeyColumn.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -19,10 +19,10 @@ import java.util.Comparator;import docking.widgets.table.AbstractDynamicTableColumn;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;-import ghidra.dbg.util.PathUtils.TargetObjectKeyComparator;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.ServiceProvider;import ghidra.trace.model.Trace;+import ghidra.trace.model.target.path.KeyPath.KeyComparator;import ghidra.util.table.column.GColumnRenderer;public class TraceValueKeyColumn extends AbstractDynamicTableColumn<ValueRow, String, Trace> {@@ -46,6 +46,6 @@ public class TraceValueKeyColumn extends AbstractDynamicTableColumn<ValueRow, St@Overridepublic Comparator<String> getComparator() {- return TargetObjectKeyComparator.CHILD;+ return KeyComparator.CHILD;}}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueObjectAttributeColumn.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueObjectAttributeColumn.javaindex cc25544355..a9d8e90e0e 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueObjectAttributeColumn.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/model/columns/TraceValueObjectAttributeColumn.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,16 +17,10 @@ package ghidra.app.plugin.core.debug.gui.model.columns;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueProperty;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;-import ghidra.dbg.target.TargetAttacher.TargetAttachKindSet;-import ghidra.dbg.target.TargetBreakpointSpecContainer.TargetBreakpointKindSet;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.TargetMethod.TargetParameterMap;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetSteppable.TargetStepKindSet;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.AttributeSchema;-import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.TraceExecutionState;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.AttributeSchema;/*** A column which displays the object's value for a given attribute@@ -44,24 +38,9 @@ public class TraceValueObjectAttributeColumn<T> extends TraceValueObjectProperty*/public static Class<?> computeAttributeType(SchemaContext ctx,AttributeSchema attributeSchema) {- TargetObjectSchema schema = ctx.getSchema(attributeSchema.getSchema());+ TraceObjectSchema schema = ctx.getSchema(attributeSchema.getSchema());Class<?> type = schema.getType();- if (type == TargetObject.class) {- return TraceObject.class;- }- if (type == TargetExecutionState.class) {- return String.class;- }- if (type == TargetParameterMap.class) {- return String.class;- }- if (type == TargetAttachKindSet.class) {- return String.class;- }- if (type == TargetBreakpointKindSet.class) {- return String.class;- }- if (type == TargetStepKindSet.class) {+ if (type == TraceExecutionState.class) {return String.class;}return type;diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesPanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesPanel.javaindex 33302ada21..cc23ba2586 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesPanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesPanel.java@@ -15,7 +15,8 @@*/package ghidra.app.plugin.core.debug.gui.modules;-import java.util.*;+import java.util.HashSet;+import java.util.Set;import javax.swing.event.ListSelectionEvent;@@ -25,9 +26,6 @@ import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueAttribute;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;import ghidra.app.plugin.core.debug.gui.model.columns.*;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;-import ghidra.dbg.target.TargetModule;-import ghidra.dbg.target.TargetProcess;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.debug.api.model.DebuggerObjectActionContext;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.Plugin;@@ -38,12 +36,15 @@ import ghidra.trace.model.Trace;import ghidra.trace.model.modules.*;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.thread.TraceObjectProcess;public class DebuggerModulesPanel extends AbstractObjectsTableBasedPanel<TraceObjectModule> {private static class ModuleBaseColumn extends AbstractTraceValueObjectAddressColumn {public ModuleBaseColumn() {- super(TargetModule.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectModule.KEY_RANGE);}@Override@@ -59,7 +60,7 @@ public class DebuggerModulesPanel extends AbstractObjectsTableBasedPanel<TraceObprivate static class ModuleMaxColumn extends AbstractTraceValueObjectAddressColumn {public ModuleMaxColumn() {- super(TargetModule.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectModule.KEY_RANGE);}@Override@@ -75,7 +76,7 @@ public class DebuggerModulesPanel extends AbstractObjectsTableBasedPanel<TraceObprivate static class ModuleNameColumn extends TraceValueObjectAttributeColumn<String> {public ModuleNameColumn() {- super(TargetModule.MODULE_NAME_ATTRIBUTE_NAME, String.class);+ super(TraceObjectModule.KEY_MODULE_NAME, String.class);}@Override@@ -97,7 +98,7 @@ public class DebuggerModulesPanel extends AbstractObjectsTableBasedPanel<TraceObreturn "";}ValueAttribute<AddressRange> attr =- rowObject.getAttribute(TargetModule.RANGE_ATTRIBUTE_NAME, AddressRange.class);+ rowObject.getAttribute(TraceObjectModule.KEY_RANGE, AddressRange.class);if (attr == null) {return "";}@@ -130,7 +131,7 @@ public class DebuggerModulesPanel extends AbstractObjectsTableBasedPanel<TraceObprivate static class ModuleLengthColumn extends AbstractTraceValueObjectLengthColumn {public ModuleLengthColumn() {- super(TargetModule.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectModule.KEY_RANGE);}@Override@@ -219,9 +220,9 @@ public class DebuggerModulesPanel extends AbstractObjectsTableBasedPanel<TraceObreturn result;}- protected static ModelQuery successorModules(TargetObjectSchema rootSchema, List<String> path) {- TargetObjectSchema schema = rootSchema.getSuccessorSchema(path);- return new ModelQuery(schema.searchFor(TargetModule.class, path, true));+ protected static ModelQuery successorModules(TraceObjectSchema rootSchema, KeyPath path) {+ TraceObjectSchema schema = rootSchema.getSuccessorSchema(path);+ return new ModelQuery(schema.searchFor(TraceObjectModule.class, path, true));}private final DebuggerModulesProvider provider;@@ -238,25 +239,24 @@ public class DebuggerModulesPanel extends AbstractObjectsTableBasedPanel<TraceOb@Overrideprotected ModelQuery computeQuery(TraceObject object) {- TargetObjectSchema rootSchema = object.getRoot().getTargetSchema();- List<String> seedPath = object.getCanonicalPath().getKeyList();- List<String> processPath = rootSchema.searchForAncestor(TargetProcess.class, seedPath);+ TraceObjectSchema rootSchema = object.getRoot().getSchema();+ KeyPath seedPath = object.getCanonicalPath();+ KeyPath processPath = rootSchema.searchForAncestor(TraceObjectProcess.class, seedPath);if (processPath != null) {ModelQuery result = successorModules(rootSchema, processPath);if (!result.isEmpty()) {return result;}}- List<String> containerPath =- rootSchema.searchForSuitableContainer(TargetModule.class, seedPath);-+ KeyPath containerPath =+ rootSchema.searchForSuitableContainer(TraceObjectModule.class, seedPath);if (containerPath != null) {ModelQuery result = successorModules(rootSchema, containerPath);if (!result.isEmpty()) {return result;}}- return successorModules(rootSchema, List.of());+ return successorModules(rootSchema, KeyPath.ROOT);}public void setSelectedModules(Set<TraceModule> sel) {diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionsPanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionsPanel.javaindex b303088409..934e5da971 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionsPanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerSectionsPanel.java@@ -15,7 +15,6 @@*/package ghidra.app.plugin.core.debug.gui.modules;-import java.util.List;import java.util.Set;import java.util.stream.Collectors;@@ -26,9 +25,6 @@ import docking.widgets.table.TableFilter;import ghidra.app.plugin.core.debug.gui.model.*;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.*;import ghidra.app.plugin.core.debug.gui.model.columns.*;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathUtils;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.Plugin;import ghidra.framework.plugintool.ServiceProvider;@@ -36,16 +32,20 @@ import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;import ghidra.trace.database.module.TraceObjectSection;import ghidra.trace.model.Trace;+import ghidra.trace.model.modules.TraceObjectModule;import ghidra.trace.model.modules.TraceSection;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.thread.TraceObjectProcess;public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceObjectSection> {private static class SectionStartColumn extends AbstractTraceValueObjectAddressColumn {public SectionStartColumn() {- super(TargetSection.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectSection.KEY_RANGE);}@Override@@ -61,7 +61,7 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceOprivate static class SectionEndColumn extends AbstractTraceValueObjectAddressColumn {public SectionEndColumn() {- super(TargetSection.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectSection.KEY_RANGE);}@Override@@ -84,11 +84,7 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceO@Overridepublic String getValue(ValueRow rowObject, Settings settings, Trace data,ServiceProvider serviceProvider) throws IllegalArgumentException {- String key = rowObject.getValue().getEntryKey();- if (PathUtils.isIndex(key)) {- return PathUtils.parseIndex(key);- }- return key;+ return KeyPath.parseIfIndex(rowObject.getValue().getEntryKey());}}@@ -125,7 +121,7 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceOreturn "";}TraceObjectValue nameEntry = module.getAttribute(row.currentSnap(),- TargetModule.MODULE_NAME_ATTRIBUTE_NAME);+ TraceObjectModule.KEY_MODULE_NAME);if (nameEntry == null) {return "";}@@ -137,7 +133,7 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceOprivate static class SectionLengthColumn extends AbstractTraceValueObjectLengthColumn {public SectionLengthColumn() {- super(TargetSection.RANGE_ATTRIBUTE_NAME);+ super(TraceObjectSection.KEY_RANGE);}@Override@@ -166,21 +162,20 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceOprivate static TraceObject getModule(ValueRow row) {TraceObjectValue moduleEntry =- row.getAttributeEntry(TargetSection.MODULE_ATTRIBUTE_NAME);+ row.getAttributeEntry(TraceObjectSection.KEY_MODULE);if (moduleEntry != null && moduleEntry.isObject()) {return moduleEntry.getChild();}return row.getValue().getChild()- .queryCanonicalAncestorsTargetInterface(TargetModule.class)+ .findCanonicalAncestorsInterface(TraceObjectModule.class).findFirst().orElse(null);}- protected static ModelQuery successorSections(TargetObjectSchema rootSchema,- List<String> path) {- TargetObjectSchema schema = rootSchema.getSuccessorSchema(path);- return new ModelQuery(schema.searchFor(TargetSection.class, path, true));+ protected static ModelQuery successorSections(TraceObjectSchema rootSchema, KeyPath path) {+ TraceObjectSchema schema = rootSchema.getSuccessorSchema(path);+ return new ModelQuery(schema.searchFor(TraceObjectSection.class, path, true));}private class SectionsBySelectedModulesTableFilter implements TableFilter<ValueRow> {@@ -217,9 +212,9 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceO@Overrideprotected ModelQuery computeQuery(TraceObject object) {- TargetObjectSchema rootSchema = object.getRoot().getTargetSchema();- List<String> seedPath = object.getCanonicalPath().getKeyList();- List<String> processPath = rootSchema.searchForAncestor(TargetProcess.class, seedPath);+ TraceObjectSchema rootSchema = object.getRoot().getSchema();+ KeyPath seedPath = object.getCanonicalPath();+ KeyPath processPath = rootSchema.searchForAncestor(TraceObjectProcess.class, seedPath);if (processPath != null) {ModelQuery result = successorSections(rootSchema, processPath);if (!result.isEmpty()) {@@ -227,8 +222,8 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceO}}// Yes, anchor on the *module* container when searching for sections- List<String> containerPath =- rootSchema.searchForSuitableContainer(TargetModule.class, seedPath);+ KeyPath containerPath =+ rootSchema.searchForSuitableContainer(TraceObjectModule.class, seedPath);if (containerPath != null) {ModelQuery result = successorSections(rootSchema, containerPath);@@ -236,7 +231,7 @@ public class DebuggerSectionsPanel extends AbstractObjectsTableBasedPanel<TraceOreturn result;}}- return successorSections(rootSchema, List.of());+ return successorSections(rootSchema, KeyPath.ROOT);}public void setFilteredBySelectedModules(boolean filtered) {diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/DebuggerMethodInvocationDialog.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/DebuggerMethodInvocationDialog.javaindex c45d3e0889..735854706e 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/DebuggerMethodInvocationDialog.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/DebuggerMethodInvocationDialog.java@@ -21,12 +21,12 @@ import java.util.Set;import javax.swing.Icon;import ghidra.app.plugin.core.debug.gui.AbstractDebuggerParameterDialog;-import ghidra.dbg.target.TargetMethod;-import ghidra.dbg.target.TargetMethod.ParameterDescription;import ghidra.debug.api.ValStr;import ghidra.framework.options.SaveState;import ghidra.framework.plugintool.AutoConfigState.ConfigStateField;import ghidra.framework.plugintool.PluginTool;+import ghidra.trace.model.target.iface.TraceObjectMethod;+import ghidra.trace.model.target.iface.TraceObjectMethod.ParameterDescription;@Deprecated(forRemoval = true, since = "11.3")public class DebuggerMethodInvocationDialog@@ -71,7 +71,7 @@ public class DebuggerMethodInvocationDialogprotected Map<String, ValStr<?>> validateArguments(Map<String, ParameterDescription<?>> parameters, Map<String, ValStr<?>> arguments) {Map<String, ?> args = ValStr.toPlainMap(arguments);- return ValStr.fromPlainMap(TargetMethod.validateArguments(parameters, args, false));+ return ValStr.fromPlainMap(TraceObjectMethod.validateArguments(parameters, args, false));}@Overridediff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.javaindex c44325bd16..65dda7f0a8 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java@@ -49,7 +49,6 @@ import ghidra.app.services.DebuggerControlService.StateEditor;import ghidra.async.AsyncLazyValue;import ghidra.async.AsyncUtils;import ghidra.base.widgets.table.DataTypeTableCellEditor;-import ghidra.dbg.error.DebuggerModelAccessException;import ghidra.debug.api.target.Target;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.docking.settings.*;@@ -1318,7 +1317,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapterprivate void reportError(String title, String message, Throwable ex) {plugin.getTool().setStatusInfo(message + ": " + ex.getMessage());- if (title != null && !(ex instanceof DebuggerModelAccessException)) {+ if (title != null) {Msg.showError(this, getComponent(), title, message, ex);}else if (consoleService != null) {diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPanel.javaindex e5458adb28..156a8cd724 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPanel.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,7 +15,6 @@*/package ghidra.app.plugin.core.debug.gui.stack;-import java.util.List;import java.util.Objects;import javax.swing.JTable;@@ -27,10 +26,6 @@ import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.*;import ghidra.app.plugin.core.debug.gui.model.columns.*;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;import ghidra.app.services.DebuggerTraceManagerService;-import ghidra.dbg.target.TargetStack;-import ghidra.dbg.target.TargetStackFrame;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathMatcher;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.Plugin;@@ -39,9 +34,13 @@ import ghidra.framework.plugintool.annotation.AutoServiceConsumed;import ghidra.program.model.address.Address;import ghidra.program.model.listing.Function;import ghidra.trace.model.Trace;+import ghidra.trace.model.stack.TraceObjectStack;import ghidra.trace.model.stack.TraceObjectStackFrame;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.PathMatcher;+import ghidra.trace.model.target.schema.TraceObjectSchema;public class DebuggerStackPanel extends AbstractObjectsTableBasedPanel<TraceObjectStackFrame>implements ListSelectionListener {@@ -60,7 +59,7 @@ public class DebuggerStackPanel extends AbstractObjectsTableBasedPanel<TraceObjeprivate static class FramePcColumn extends TraceValueObjectAttributeColumn<Address> {public FramePcColumn() {- super(TargetStackFrame.PC_ATTRIBUTE_NAME, Address.class);+ super(TraceObjectStackFrame.KEY_PC, Address.class);}@Override@@ -73,7 +72,7 @@ public class DebuggerStackPanel extends AbstractObjectsTableBasedPanel<TraceObjeif (!(row.getValue().getValue() instanceof TraceObject object)) {return null;}- TraceObjectValue attrPc = object.getAttribute(snap, TargetStackFrame.PC_ATTRIBUTE_NAME);+ TraceObjectValue attrPc = object.getAttribute(snap, TraceObjectStackFrame.KEY_PC);if (attrPc == null || !(attrPc.getValue() instanceof Address pc)) {return null;}@@ -189,14 +188,14 @@ public class DebuggerStackPanel extends AbstractObjectsTableBasedPanel<TraceObje@Overrideprotected ModelQuery computeQuery(TraceObject object) {- TargetObjectSchema rootSchema = object.getRoot().getTargetSchema();- List<String> stackPath = rootSchema- .searchForSuitable(TargetStack.class, object.getCanonicalPath().getKeyList());+ TraceObjectSchema rootSchema = object.getRoot().getSchema();+ KeyPath stackPath =+ rootSchema.searchForSuitable(TraceObjectStack.class, object.getCanonicalPath());if (stackPath == null) {return ModelQuery.EMPTY;}- TargetObjectSchema stackSchema = rootSchema.getSuccessorSchema(stackPath);- PathMatcher matcher = stackSchema.searchFor(TargetStackFrame.class, stackPath, true);+ TraceObjectSchema stackSchema = rootSchema.getSuccessorSchema(stackPath);+ PathMatcher matcher = stackSchema.searchFor(TraceObjectStackFrame.class, stackPath, true);return new ModelQuery(matcher);}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPanel.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPanel.javaindex 25a182d578..75839f5a2d 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPanel.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPanel.java@@ -15,7 +15,6 @@*/package ghidra.app.plugin.core.debug.gui.thread;-import java.util.List;import java.util.Objects;import javax.swing.event.ListSelectionEvent;@@ -30,8 +29,6 @@ import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.*;import ghidra.app.plugin.core.debug.gui.model.columns.*;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;import ghidra.app.services.DebuggerTraceManagerService;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.docking.settings.Settings;import ghidra.framework.plugintool.Plugin;@@ -41,13 +38,17 @@ import ghidra.program.model.address.Address;import ghidra.program.model.listing.Function;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectExecutionStateful;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.thread.TraceObjectProcess;import ghidra.trace.model.thread.TraceObjectThread;public class DebuggerThreadsPanel extends AbstractObjectsTableBasedPanel<TraceObjectThread> {- protected static ModelQuery successorThreads(TargetObjectSchema rootSchema, List<String> path) {- TargetObjectSchema schema = rootSchema.getSuccessorSchema(path);- return new ModelQuery(schema.searchFor(TargetThread.class, path, true));+ protected static ModelQuery successorThreads(TraceObjectSchema rootSchema, KeyPath path) {+ TraceObjectSchema schema = rootSchema.getSuccessorSchema(path);+ return new ModelQuery(schema.searchFor(TraceObjectThread.class, path, true));}private static class ThreadPathColumn extends TraceValueKeyColumn {@@ -245,7 +246,7 @@ public class DebuggerThreadsPanel extends AbstractObjectsTableBasedPanel<TraceObprivate static class ThreadStateColumn extends TraceValueObjectAttributeColumn<String> {public ThreadStateColumn() {// NB. The recorder converts enums to strings- super(TargetExecutionStateful.STATE_ATTRIBUTE_NAME, String.class);+ super(TraceObjectExecutionStateful.KEY_STATE, String.class);}@Override@@ -343,17 +344,17 @@ public class DebuggerThreadsPanel extends AbstractObjectsTableBasedPanel<TraceOb@Overrideprotected ModelQuery computeQuery(TraceObject object) {- TargetObjectSchema rootSchema = object.getRoot().getTargetSchema();- List<String> seedPath = object.getCanonicalPath().getKeyList();- List<String> processPath = rootSchema.searchForAncestor(TargetProcess.class, seedPath);+ TraceObjectSchema rootSchema = object.getRoot().getSchema();+ KeyPath seedPath = object.getCanonicalPath();+ KeyPath processPath = rootSchema.searchForAncestor(TraceObjectProcess.class, seedPath);if (processPath != null) {ModelQuery result = successorThreads(rootSchema, processPath);if (!result.isEmpty()) {return result;}}- List<String> containerPath =- rootSchema.searchForSuitableContainer(TargetThread.class, seedPath);+ KeyPath containerPath =+ rootSchema.searchForSuitableContainer(TraceObjectThread.class, seedPath);if (containerPath != null) {ModelQuery result = successorThreads(rootSchema, containerPath);@@ -361,7 +362,7 @@ public class DebuggerThreadsPanel extends AbstractObjectsTableBasedPanel<TraceObreturn result;}}- return successorThreads(rootSchema, List.of());+ return successorThreads(rootSchema, KeyPath.ROOT);}private void trySelectCurrentThread() {diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/ThreadRow.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/ThreadRow.javaindex dc1c0bc01a..03eeb177af 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/ThreadRow.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/thread/ThreadRow.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -19,13 +19,11 @@ import db.Transaction;import ghidra.app.plugin.core.debug.gui.action.PCLocationTrackingSpec;import ghidra.app.plugin.core.debug.gui.action.SPLocationTrackingSpec;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;import ghidra.debug.api.target.Target;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.program.model.address.Address;import ghidra.program.model.listing.Function;-import ghidra.trace.model.Lifespan;-import ghidra.trace.model.Trace;+import ghidra.trace.model.*;import ghidra.trace.model.thread.TraceThread;import ghidra.util.Msg;@@ -120,7 +118,7 @@ public class ThreadRow {if (target == null) {return ThreadState.ALIVE;}- TargetExecutionState state = target.getThreadExecutionState(thread);+ TraceExecutionState state = target.getThreadExecutionState(thread);if (state == null) {return ThreadState.UNKNOWN;}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/mapping/DebuggerPlatformOpinion.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/mapping/DebuggerPlatformOpinion.javaindex 8bf311b196..96bc9c4e9e 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/mapping/DebuggerPlatformOpinion.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/mapping/DebuggerPlatformOpinion.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,13 +17,14 @@ package ghidra.app.plugin.core.debug.mapping;import java.util.*;-import ghidra.dbg.target.TargetEnvironment;-import ghidra.dbg.util.PathPredicates;import ghidra.program.model.lang.Endian;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.iface.TraceObjectEnvironment;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;import ghidra.util.Msg;import ghidra.util.classfinder.ClassSearcher;import ghidra.util.classfinder.ExtensionPoint;@@ -65,12 +66,12 @@ public interface DebuggerPlatformOpinion extends ExtensionPoint {return null;}TraceObject root = object.getRoot();- List<String> pathToEnv = root.getTargetSchema()- .searchForSuitable(TargetEnvironment.class, object.getCanonicalPath().getKeyList());+ KeyPath pathToEnv = root.getSchema()+ .searchForSuitable(TraceObjectEnvironment.class, object.getCanonicalPath());if (pathToEnv == null) {return null;}- return root.getSuccessors(Lifespan.at(snap), PathPredicates.pattern(pathToEnv))+ return root.getSuccessors(Lifespan.at(snap), PathFilter.pattern(pathToEnv)).findAny().map(p -> p.getDestination(root)).orElse(null);@@ -85,15 +86,15 @@ public interface DebuggerPlatformOpinion extends ExtensionPoint {}static String getDebugggerFromEnv(TraceObject env, long snap) {- return getStringAttribute(env, snap, TargetEnvironment.DEBUGGER_ATTRIBUTE_NAME);+ return getStringAttribute(env, snap, TraceObjectEnvironment.KEY_DEBUGGER);}static String getArchitectureFromEnv(TraceObject env, long snap) {- return getStringAttribute(env, snap, TargetEnvironment.ARCH_ATTRIBUTE_NAME);+ return getStringAttribute(env, snap, TraceObjectEnvironment.KEY_ARCH);}static String getOperatingSystemFromEnv(TraceObject env, long snap) {- return getStringAttribute(env, snap, TargetEnvironment.OS_ATTRIBUTE_NAME);+ return getStringAttribute(env, snap, TraceObjectEnvironment.KEY_OS);}/**@@ -104,7 +105,7 @@ public interface DebuggerPlatformOpinion extends ExtensionPoint {* @return the endianness, or null*/static Endian getEndianFromEnv(TraceObject env, long snap) {- String strEndian = getStringAttribute(env, snap, TargetEnvironment.ENDIAN_ATTRIBUTE_NAME);+ String strEndian = getStringAttribute(env, snap, TraceObjectEnvironment.KEY_ENDIAN);if (strEndian == null) {return null;}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/PlaceEmuBreakpointActionItem.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/PlaceEmuBreakpointActionItem.javaindex 932c0d2a2f..786875bfcb 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/PlaceEmuBreakpointActionItem.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/PlaceEmuBreakpointActionItem.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,21 +15,21 @@*/package ghidra.app.plugin.core.debug.service.breakpoint;-import java.util.*;+import java.util.Collection;+import java.util.Set;import java.util.concurrent.CompletableFuture;import db.Transaction;import ghidra.async.AsyncUtils;-import ghidra.dbg.target.*;-import ghidra.dbg.util.PathMatcher;import ghidra.program.model.address.*;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;-import ghidra.trace.model.breakpoint.TraceBreakpoint;-import ghidra.trace.model.breakpoint.TraceBreakpointKind;+import ghidra.trace.model.breakpoint.*;import ghidra.trace.model.memory.TraceMemoryRegion;import ghidra.trace.model.memory.TraceObjectMemoryRegion;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathMatcher;import ghidra.util.exception.DuplicateNameException;public record PlaceEmuBreakpointActionItem(Trace trace, long snap, Address address, long length,@@ -69,7 +69,8 @@ public record PlaceEmuBreakpointActionItem(Trace trace, long snap, Address addreif (region == null) {throw new IllegalArgumentException("Address does not belong to a memory in the trace");}- return region.getObject().querySuitableTargetInterface(TargetBreakpointSpecContainer.class);+ return region.getObject()+ .findSuitableContainerInterface(TraceObjectBreakpointSpec.class);}private String computePath() {@@ -83,21 +84,21 @@ public record PlaceEmuBreakpointActionItem(Trace trace, long snap, Address addre"Address is not associated with a breakpoint container");}PathMatcher specMatcher =- container.getTargetSchema().searchFor(TargetBreakpointSpec.class, true);+ container.getSchema().searchFor(TraceObjectBreakpointSpec.class, true);if (specMatcher == null) {throw new IllegalArgumentException("Cannot find path to breakpoint specifications");}- List<String> specRelPath = specMatcher.applyKeys(name).getSingletonPath();+ KeyPath specRelPath = specMatcher.applyKeys(name).getSingletonPath();if (specRelPath == null) {throw new IllegalArgumentException("Too many wildcards to breakpoint specification");}- PathMatcher locMatcher = container.getTargetSchema()+ PathMatcher locMatcher = container.getSchema().getSuccessorSchema(specRelPath)- .searchFor(TargetBreakpointLocation.class, true);+ .searchFor(TraceObjectBreakpointLocation.class, true);if (locMatcher == null) {throw new IllegalArgumentException("Cannot find path to breakpoint locations");}- List<String> locRelPath = locMatcher.applyIntKeys(0).getSingletonPath();+ KeyPath locRelPath = locMatcher.applyIntKeys(0).getSingletonPath();if (locRelPath == null) {throw new IllegalArgumentException("Too many wildcards to breakpoint location");}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/ProgramEmulationUtils.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/ProgramEmulationUtils.javaindex c3f7f44e3b..ffb54db0cd 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/ProgramEmulationUtils.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/emulation/ProgramEmulationUtils.java@@ -27,10 +27,6 @@ import db.Transaction;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils.Extrema;import ghidra.app.services.DebuggerEmulationService;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.util.*;import ghidra.framework.model.DomainFile;import ghidra.program.model.address.*;import ghidra.program.model.lang.*;@@ -42,8 +38,13 @@ import ghidra.trace.database.DBTrace;import ghidra.trace.model.*;import ghidra.trace.model.memory.*;import ghidra.trace.model.modules.TraceConflictedMappingException;-import ghidra.trace.model.target.*;+import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.TraceObjectManager;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.*;import ghidra.trace.model.time.TraceSnapshot;import ghidra.util.*;@@ -72,8 +73,6 @@ public class ProgramEmulationUtils {</schema><schema name='BreakpointContainer' canonical='yes' elementResync='NEVER'attributeResync='NEVER'>- <interface name='BreakpointSpecContainer' />- <interface name='BreakpointLocationContainer' /><element schema='Breakpoint' /></schema><schema name='Breakpoint' elementResync='NEVER' attributeResync='NEVER'>@@ -123,7 +122,7 @@ public class ProgramEmulationUtils {</context>""";public static final SchemaContext EMU_CTX;- public static final TargetObjectSchema EMU_SESSION_SCHEMA;+ public static final TraceObjectSchema EMU_SESSION_SCHEMA;static {try {EMU_CTX = XmlSchemaContext.deserialize(EMU_CTX_XML);@@ -234,9 +233,10 @@ public class ProgramEmulationUtils {// NB. No need to populate as module.// UI will sync from mapping, so it's obvious where the cursor is.- String path = PathUtils.toString(patRegion+ String path = patRegion.applyKeys(block.getStart() + "-" + modName + ":" + block.getName())- .getSingletonPath());+ .getSingletonPath()+ .toString();trace.getMemoryManager().createRegion(path, snapshot.getKey(), range, getRegionFlags(block));}@@ -270,8 +270,8 @@ public class ProgramEmulationUtils {// N.B. Bytes will be loaded lazily}- public static PathPattern computePattern(TargetObjectSchema root, Trace trace,- Class<? extends TargetObject> iface) {+ public static PathPattern computePattern(TraceObjectSchema root, Trace trace,+ Class<? extends TraceObjectInterface> iface) {PathMatcher matcher = root.searchFor(iface, true);PathPattern pattern = matcher.getSingletonPattern();if (pattern == null || pattern.countWildcards() != 1) {@@ -282,19 +282,19 @@ public class ProgramEmulationUtils {}public static PathPattern computePatternRegion(Trace trace) {- TargetObjectSchema root = trace.getObjectManager().getRootSchema();+ TraceObjectSchema root = trace.getObjectManager().getRootSchema();if (root == null) {- return new PathPattern(PathUtils.parse("Memory[]"));+ return PathFilter.parse("Memory[]");}- return computePattern(root, trace, TargetMemoryRegion.class);+ return computePattern(root, trace, TraceObjectMemoryRegion.class);}public static PathPattern computePatternThread(Trace trace) {- TargetObjectSchema root = trace.getObjectManager().getRootSchema();+ TraceObjectSchema root = trace.getObjectManager().getRootSchema();if (root == null) {- return new PathPattern(PathUtils.parse("Threads[]"));+ return PathFilter.parse("Threads[]");}- return computePattern(root, trace, TargetThread.class);+ return computePattern(root, trace, TraceObjectThread.class);}/**@@ -312,13 +312,13 @@ public class ProgramEmulationUtils {PathPattern patThread = computePatternThread(trace);long next = tm.getAllThreads().size();String path;- while (!tm.getThreadsByPath(path =- PathUtils.toString(patThread.applyKeys(Long.toString(next)).getSingletonPath()))+ while (!tm.getThreadsByPath(+ path = patThread.applyKeys(Long.toString(next)).getSingletonPath().toString()).isEmpty()) {next++;}try {- return tm.createThread(path, "[" + next + "]", snap);+ return tm.createThread(path, KeyPath.makeIndex(next), snap);}catch (DuplicateNameException e) {throw new AssertionError(e);@@ -341,15 +341,14 @@ public class ProgramEmulationUtils {TraceMemoryManager memory = trace.getMemoryManager();if (thread instanceof TraceObjectThread ot) {TraceObject object = ot.getObject();- PathPredicates regsMatcher = object.getRoot()- .getTargetSchema()- .searchForRegisterContainer(0, object.getCanonicalPath().getKeyList());- if (regsMatcher.isEmpty()) {+ PathFilter regsFilter = object.getRoot()+ .getSchema()+ .searchForRegisterContainer(0, object.getCanonicalPath());+ if (regsFilter.isNone()) {throw new IllegalArgumentException("Cannot create register container");}- for (PathPattern regsPattern : regsMatcher.getPatterns()) {- trace.getObjectManager()- .createObject(TraceObjectKeyPath.of(regsPattern.getSingletonPath()));+ for (PathPattern regsPattern : regsFilter.getPatterns()) {+ trace.getObjectManager().createObject(regsPattern.getSingletonPath());break;}}@@ -448,12 +447,10 @@ public class ProgramEmulationUtils {}PathPattern patRegion = computePatternRegion(trace);- String threadName = PathUtils.isIndex(thread.getName())- ? PathUtils.parseIndex(thread.getName())- : thread.getName();- String path = PathUtils.toString(- patRegion.applyKeys(alloc.getMinAddress() + "-stack " + threadName)- .getSingletonPath());+ String threadName = KeyPath.parseIfIndex(thread.getName());+ String path = patRegion.applyKeys(alloc.getMinAddress() + "-stack " + threadName)+ .getSingletonPath()+ .toString();TraceMemoryManager mm = trace.getMemoryManager();try {return mm.createRegion(path, snap, alloc,@@ -512,9 +509,9 @@ public class ProgramEmulationUtils {return alloc;}PathPattern patRegion = computePatternRegion(trace);- String path = PathUtils.toString(- patRegion.applyKeys(stackBlock.getStart() + "-STACK")- .getSingletonPath());+ String path = patRegion.applyKeys(stackBlock.getStart() + "-STACK")+ .getSingletonPath()+ .toString();TraceMemoryManager mm = trace.getMemoryManager();try {return mm.createRegion(path, snap, alloc,@@ -584,12 +581,11 @@ public class ProgramEmulationUtils {for (AddressRange candidate : left) {if (Long.compareUnsigned(candidate.getLength(), size) >= 0) {AddressRange alloc = new AddressRangeImpl(candidate.getMinAddress(), size);- String threadName = PathUtils.isIndex(thread.getName())- ? PathUtils.parseIndex(thread.getName())- : thread.getName();- String path = PathUtils.toString(- patRegion.applyKeys(alloc.getMinAddress() + "-stack " + threadName)- .getSingletonPath());+ String threadName = KeyPath.parseIfIndex(thread.getName());+ String path = patRegion+ .applyKeys(alloc.getMinAddress() + "-stack " + threadName)+ .getSingletonPath()+ .toString();return mm.createRegion(path, snap, alloc,TraceMemoryFlag.READ, TraceMemoryFlag.WRITE).getRange();}@@ -606,13 +602,13 @@ public class ProgramEmulationUtils {TraceObjectManager om = trace.getObjectManager();om.createRootObject(EMU_SESSION_SCHEMA);- om.createObject(TraceObjectKeyPath.parse("Breakpoints"))+ om.createObject(KeyPath.parse("Breakpoints")).insert(Lifespan.ALL, ConflictResolution.DENY);- om.createObject(TraceObjectKeyPath.parse("Memory"))+ om.createObject(KeyPath.parse("Memory")).insert(Lifespan.ALL, ConflictResolution.DENY);- om.createObject(TraceObjectKeyPath.parse("Modules"))+ om.createObject(KeyPath.parse("Modules")).insert(Lifespan.ALL, ConflictResolution.DENY);- om.createObject(TraceObjectKeyPath.parse("Threads"))+ om.createObject(KeyPath.parse("Threads")).insert(Lifespan.ALL, ConflictResolution.DENY);}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingProposals.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingProposals.javaindex bdb9200fb5..378ea85834 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingProposals.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingProposals.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -23,7 +23,6 @@ import java.util.stream.Collectors;import java.util.stream.Stream;import ghidra.app.plugin.core.debug.service.modules.ProgramModuleIndexer.IndexEntry;-import ghidra.dbg.util.PathUtils;import ghidra.debug.api.modules.*;import ghidra.framework.model.DomainFile;import ghidra.graph.*;@@ -31,6 +30,7 @@ import ghidra.graph.jung.JungDirectedGraph;import ghidra.program.model.listing.Program;import ghidra.trace.model.memory.TraceMemoryRegion;import ghidra.trace.model.modules.TraceModule;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.Msg;public enum DebuggerStaticMappingProposals {@@ -243,11 +243,8 @@ public enum DebuggerStaticMappingProposals {protected static Set<String> getLikelyModulesFromName(TraceMemoryRegion region) {String key;try {- List<String> path = PathUtils.parse(region.getPath());- key = PathUtils.getKey(path);- if (PathUtils.isIndex(key)) {- key = PathUtils.parseIndex(key);- }+ KeyPath path = KeyPath.parse(region.getPath());+ key = KeyPath.parseIfIndex(path.key());}catch (IllegalArgumentException e) { // Parse errorMsg.error(DebuggerStaticMappingProposals.class,diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.javaindex 04b76e5db0..e967b5eb12 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.java@@ -496,7 +496,7 @@ public class DebuggerStaticMappingServicePlugin extends Pluginsynchronized (lock) {InfoPerTrace info = requireTrackedInfo(trace);if (info == null) {- return null;+ return Map.of();}return info.getOpenMappedViews(set, Lifespan.at(snap));}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.javaindex b6b98a037d..4b62892a61 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.java@@ -39,7 +39,6 @@ import ghidra.app.services.*;import ghidra.app.services.DebuggerControlService.ControlModeChangeListener;import ghidra.async.*;import ghidra.async.AsyncConfigFieldCodec.BooleanAsyncConfigFieldCodec;-import ghidra.dbg.target.TargetObject;import ghidra.debug.api.control.ControlMode;import ghidra.debug.api.platform.DebuggerPlatformMapper;import ghidra.debug.api.target.Target;@@ -61,7 +60,7 @@ import ghidra.trace.model.guest.TracePlatform;import ghidra.trace.model.program.TraceProgramView;import ghidra.trace.model.program.TraceVariableSnapProgramView;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.TraceSnapshot;import ghidra.trace.model.time.schedule.TraceSchedule;@@ -120,7 +119,7 @@ public class DebuggerTraceManagerServicePlugin extends PluginTarget target = current.getTarget();if (supportsFocus(target)) {// TODO: Same for stack frame? I can't imagine it's as common as this....- TraceObjectKeyPath focus = target.getFocus();+ KeyPath focus = target.getFocus();if (focus == null) {return;}@@ -257,7 +256,7 @@ public class DebuggerTraceManagerServicePlugin extends Pluginreturn;}DebuggerCoordinates coords = current;- TraceObjectKeyPath focus = curTarget.getFocus();+ KeyPath focus = curTarget.getFocus();if (focus != null) {coords = coords.path(focus);}@@ -288,7 +287,6 @@ public class DebuggerTraceManagerServicePlugin extends Pluginnew ForFollowPresentListener();protected DebuggerCoordinates current = DebuggerCoordinates.NOWHERE;- protected TargetObject curObj;@AutoConfigStateField(codec = BooleanAsyncConfigFieldCodec.class)protected final AsyncReference<Boolean, Void> saveTracesByDefault = new AsyncReference<>(true);@AutoConfigStateField(codec = BooleanAsyncConfigFieldCodec.class)@@ -1216,7 +1214,7 @@ public class DebuggerTraceManagerServicePlugin extends Plugin}@Override- public DebuggerCoordinates resolvePath(TraceObjectKeyPath path) {+ public DebuggerCoordinates resolvePath(KeyPath path) {return current.path(path);}diff --git a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPluginScreenShots.java b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPluginScreenShots.javaindex 3b0ea37a70..ea5754d144 100644--- a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPluginScreenShots.java+++ b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsPluginScreenShots.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -24,9 +24,6 @@ import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServiceimport ghidra.app.plugin.core.progmgr.ProgramManagerPlugin;import ghidra.app.services.DebuggerTraceManagerService;import ghidra.app.services.ProgramManager;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.framework.model.DomainFolder;import ghidra.program.database.ProgramBuilder;import ghidra.program.model.address.Address;@@ -36,6 +33,9 @@ import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.database.memory.DBTraceMemoryManager;import ghidra.trace.model.Lifespan;import ghidra.trace.model.memory.TraceMemoryFlag;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.util.task.TaskMonitor;import help.screenshot.GhidraScreenShotGenerator;diff --git a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelPluginScreenShots.java b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelPluginScreenShots.javaindex cc2895f014..830c23fddf 100644--- a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelPluginScreenShots.java+++ b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/model/DebuggerModelPluginScreenShots.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -26,10 +26,6 @@ import db.Transaction;import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;-import ghidra.dbg.target.TargetEventScope;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.program.database.ProgramBuilder;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.database.target.DBTraceObjectManager;@@ -37,6 +33,10 @@ import ghidra.trace.database.target.DBTraceObjectValue;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.iface.TraceObjectEventScope;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import help.screenshot.GhidraScreenShotGenerator;public class DebuggerModelPluginScreenShots extends GhidraScreenShotGenerator {@@ -61,8 +61,6 @@ public class DebuggerModelPluginScreenShots extends GhidraScreenShotGenerator {<attribute name="Modules" schema="ModuleContainer" /></schema><schema name="BreakpointContainer" canonical="yes">- <interface name="BreakpointSpecContainer" />- <interface name="BreakpointLocationContainer" /><element schema="Breakpoint" /></schema><schema name="Breakpoint">@@ -98,7 +96,10 @@ public class DebuggerModelPluginScreenShots extends GhidraScreenShotGenerator {<attribute-alias from="_pc" to="PC" /></schema><schema name="ModuleContainer" canonical="yes">- <interface name="ModuleContainer" />+ <element schema="Module" />+ </schema>+ <schema name="Module">+ <interface name="Module" /></schema></context>""";public static final SchemaContext CTX;@@ -179,7 +180,7 @@ public class DebuggerModelPluginScreenShots extends GhidraScreenShotGenerator {proc.child("Modules");}}- root.value(TargetEventScope.EVENT_OBJECT_ATTRIBUTE_NAME, l.thread);+ root.value(TraceObjectEventScope.KEY_EVENT_THREAD, l.thread);}traceManager.openTrace(tb.trace);diff --git a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/platform/DebuggerPlatformPluginScreenShots.java b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/platform/DebuggerPlatformPluginScreenShots.javaindex 18c2589f3a..d4ebbe5541 100644--- a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/platform/DebuggerPlatformPluginScreenShots.java+++ b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/platform/DebuggerPlatformPluginScreenShots.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -21,11 +21,11 @@ import org.junit.Test;import db.Transaction;import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServicePlugin;import ghidra.app.services.DebuggerTraceManagerService;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.database.target.DBTraceObjectManagerTest;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import help.screenshot.GhidraScreenShotGenerator;public class DebuggerPlatformPluginScreenShots extends GhidraScreenShotGenerator {diff --git a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPluginScreenShots.java b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPluginScreenShots.javaindex 9b23e4370e..21e2ae0f0d 100644--- a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPluginScreenShots.java+++ b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackPluginScreenShots.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -40,9 +40,6 @@ import ghidra.app.services.*;import ghidra.app.services.DebuggerControlService.StateEditor;import ghidra.app.services.DebuggerEmulationService.EmulationResult;import ghidra.async.AsyncTestUtils;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.control.ControlMode;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.framework.model.DomainFolder;@@ -66,6 +63,9 @@ import ghidra.trace.model.Lifespan;import ghidra.trace.model.breakpoint.TraceBreakpointKind;import ghidra.trace.model.stack.TraceStack;import ghidra.trace.model.stack.TraceStackFrame;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.schedule.Scheduler;import ghidra.util.InvalidNameException;diff --git a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPluginScreenShots.java b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPluginScreenShots.javaindex 5140c883a4..1a0cb9e6e3 100644--- a/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPluginScreenShots.java+++ b/Ghidra/Debug/Debugger/src/screen/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsPluginScreenShots.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -44,7 +44,7 @@ import ghidra.trace.database.time.DBTraceTimeManager;import ghidra.trace.model.DefaultTraceLocation;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.util.task.TaskMonitor;@@ -122,13 +122,13 @@ public class DebuggerThreadsPluginScreenShots extends GhidraScreenShotGeneratort3.getObject().setValue(Lifespan.nowOn(0), "_state", "TERMINATED");t4.getObject().setValue(Lifespan.nowOn(0), "_state", "TERMINATED");- om.createObject(TraceObjectKeyPath.parse("Threads[1].Registers"))+ om.createObject(KeyPath.parse("Threads[1].Registers")).insert(Lifespan.nowOn(0), ConflictResolution.DENY);- om.createObject(TraceObjectKeyPath.parse("Threads[2].Registers"))+ om.createObject(KeyPath.parse("Threads[2].Registers")).insert(Lifespan.nowOn(2), ConflictResolution.DENY);- om.createObject(TraceObjectKeyPath.parse("Threads[3].Registers"))+ om.createObject(KeyPath.parse("Threads[3].Registers")).insert(Lifespan.nowOn(5), ConflictResolution.DENY);- om.createObject(TraceObjectKeyPath.parse("Threads[4].Registers"))+ om.createObject(KeyPath.parse("Threads[4].Registers")).insert(Lifespan.nowOn(10), ConflictResolution.DENY);// insert calls will extend thread life :/t3.getObject().getCanonicalParent(13).setMaxSnap(10);diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/disassemble/DebuggerDisassemblyTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/disassemble/DebuggerDisassemblyTest.javaindex 2e427ee300..484b5ea728 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/disassemble/DebuggerDisassemblyTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/disassemble/DebuggerDisassemblyTest.java@@ -40,10 +40,6 @@ import ghidra.app.plugin.core.debug.service.emulation.DebuggerEmulationServicePlimport ghidra.app.plugin.core.debug.service.emulation.ProgramEmulationUtils;import ghidra.app.plugin.core.debug.service.platform.DebuggerPlatformServicePlugin;import ghidra.app.services.*;-import ghidra.dbg.target.TargetEnvironment;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.control.ControlMode;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressSet;@@ -66,7 +62,11 @@ import ghidra.trace.model.memory.TraceObjectMemoryRegion;import ghidra.trace.model.program.TraceProgramView;import ghidra.trace.model.stack.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.iface.TraceObjectEnvironment;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.schedule.TraceSchedule;@@ -174,15 +174,15 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerTest {try (Transaction tx = tb.startTransaction()) {objects.createRootObject(ctx.getSchema(new SchemaName("Session")));DBTraceObject env =- objects.createObject(TraceObjectKeyPath.parse("Targets[0].Environment"));- assertEquals(ctx.getSchema(new SchemaName("Environment")), env.getTargetSchema());+ objects.createObject(KeyPath.parse("Targets[0].Environment"));+ assertEquals(ctx.getSchema(new SchemaName("Environment")), env.getSchema());Lifespan zeroOn = Lifespan.nowOn(0);env.insert(zeroOn, ConflictResolution.DENY);- env.setAttribute(zeroOn, TargetEnvironment.DEBUGGER_ATTRIBUTE_NAME, "test");- env.setAttribute(zeroOn, TargetEnvironment.ARCH_ATTRIBUTE_NAME, arch);+ env.setAttribute(zeroOn, TraceObjectEnvironment.KEY_DEBUGGER, "test");+ env.setAttribute(zeroOn, TraceObjectEnvironment.KEY_ARCH, arch);DBTraceObject objBinText =- objects.createObject(TraceObjectKeyPath.parse("Targets[0].Memory[bin:.text]"));+ objects.createObject(KeyPath.parse("Targets[0].Memory[bin:.text]"));TraceObjectMemoryRegion binText =objBinText.queryInterface(TraceObjectMemoryRegion.class);binText.addFlags(zeroOn, Set.of(TraceMemoryFlag.EXECUTE));@@ -193,17 +193,17 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerTest {DBTraceMemoryManager memory = tb.trace.getMemoryManager();if (pcInStack) {DBTraceObject objFrame = objects- .createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0].Stack[0]"));+ .createObject(KeyPath.parse("Targets[0].Threads[0].Stack[0]"));objFrame.insert(zeroOn, ConflictResolution.DENY);TraceObjectStackFrame frame = objFrame.queryInterface(TraceObjectStackFrame.class);frame.setProgramCounter(zeroOn, tb.addr(offset));}else {objects.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Stack[0].Registers"))+ KeyPath.parse("Targets[0].Threads[0].Stack[0].Registers")).insert(zeroOn, ConflictResolution.DENY);TraceObjectThread thread = objects- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Targets[0].Threads[0]"))+ .getObjectByCanonicalPath(KeyPath.parse("Targets[0].Threads[0]")).queryInterface(TraceObjectThread.class);traceManager.activateThread(thread);DBTraceMemorySpace regs =@@ -218,7 +218,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerTest {assertEquals(bytes.remaining(), memory.putBytes(0, tb.addr(offset), bytes));}TraceObjectThread thread =- objects.getObjectByCanonicalPath(TraceObjectKeyPath.parse("Targets[0].Threads[0]"))+ objects.getObjectByCanonicalPath(KeyPath.parse("Targets[0].Threads[0]")).queryInterface(TraceObjectThread.class);traceManager.activateThread(thread);return thread;@@ -484,7 +484,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerTest {try (Transaction tx = tb.startTransaction()) {tb.trace.getObjectManager().createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Stack[0].Registers"))+ KeyPath.parse("Targets[0].Threads[0].Stack[0].Registers")).insert(Lifespan.nowOn(0), ConflictResolution.DENY);DBTraceMemorySpace regs = Objects.requireNonNull(tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true));@@ -519,7 +519,7 @@ public class DebuggerDisassemblyTest extends AbstractGhidraHeadedDebuggerTest {try (Transaction tx = tb.startTransaction()) {tb.trace.getObjectManager().createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Stack[0].Registers"))+ KeyPath.parse("Targets[0].Threads[0].Stack[0].Registers")).insert(Lifespan.nowOn(0), ConflictResolution.DENY);DBTraceMemorySpace regs = Objects.requireNonNull(tb.trace.getMemoryManager().getMemoryRegisterSpace(thread, true));diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.javaindex acbbc298d3..8c060a32fa 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java@@ -51,8 +51,6 @@ import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServiceimport ghidra.app.services.*;import ghidra.app.util.viewer.listingpanel.ListingPanel;import ghidra.async.AsyncTestUtils;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.action.LocationTrackingSpec;import ghidra.debug.api.action.LocationTrackingSpecFactory;import ghidra.docking.settings.SettingsImpl;@@ -68,6 +66,8 @@ import ghidra.test.AbstractGhidraHeadedIntegrationTest;import ghidra.test.TestEnv;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.Trace;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.util.InvalidNameException;import ghidra.util.NumericUtilities;import ghidra.util.datastruct.TestDataStructureErrorHandlerInstaller;@@ -77,6 +77,39 @@ import ghidra.util.task.ConsoleTaskMonitor;public abstract class AbstractGhidraHeadedDebuggerTestextends AbstractGhidraHeadedIntegrationTest implements AsyncTestUtils {+ /**+ * Any test that uses staticall-initialized variables with any real complexity runs the risk of+ * invoking the logger before said logger has been initialized. The abstract test case is+ * responsible for initializing it, and it affords its subclasses the opportunity to override+ * things like the application layout and configuration. Thus, we cannot initialize the+ * application in the static initializer here. What will happen, then, is the logger will be+ * partially initialized, and the XML config files refer to system properties that will not have+ * been set yet. This manifests in strange files being created in the tests' working+ * directories, e.g., <code>${sys:logFilename}</code>.+ *+ * <p>+ * A cheap hack to avoid this issue is to just initialize those system properties to some temp+ * file. Once the logging system is initialized, the variables will be overwritten by the+ * application config and the logger re- and fully-initialized. For what it's worth, the logging+ * config for the test case is going to be a file in a temp directory, anyway. As long as it's+ * cleaned up by the JVM or the OS, we should be happy. I just want to ensure they're not+ * showing up in git commits.+ *+ * <p>+ * TODO: Should this hack be moved up into the super classes of the Ghidra Test framework?+ */+ static {+ try {+ System.setProperty("logFilename",+ Files.createTempFile("ghidraTest", ".log").toString());+ System.setProperty("scriptLogFilename",+ Files.createTempFile("ghidraTestScript", ".log").toString());+ }+ catch (IOException e) {+ throw new AssertionError(e);+ }+ }+public static final String LANGID_TOYBE64 = "Toy:BE:64:default";protected static byte[] arr(String hex) {diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsProviderTest.javaindex d9012fcc91..be51446186 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsProviderTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerRegionsProviderTest.java@@ -36,10 +36,6 @@ import ghidra.app.plugin.core.debug.gui.memory.DebuggerRegionMapProposalDialog.Rimport ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueProperty;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;import ghidra.app.plugin.core.debug.gui.model.QueryPanelTestHelper;-import ghidra.dbg.target.TargetMemoryRegion;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.modules.RegionMapProposal.RegionMapEntry;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.program.model.address.*;@@ -53,6 +49,10 @@ import ghidra.trace.model.memory.TraceObjectMemoryRegion;import ghidra.trace.model.modules.TraceStaticMapping;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.util.table.GhidraTable;@Category(NightlyCategory.class)@@ -111,18 +111,18 @@ public class DebuggerRegionsProviderTest extends AbstractGhidraHeadedDebuggerTesprotected TraceObjectMemoryRegion addRegion(String name, long loaded, AddressRange range) {boolean isData = name.endsWith(".data");TraceObjectManager om = tb.trace.getObjectManager();- TraceObjectKeyPath memPath = TraceObjectKeyPath.parse("Memory");+ KeyPath memPath = KeyPath.parse("Memory");Lifespan span = Lifespan.nowOn(loaded);TraceObjectMemoryRegion region = Objects.requireNonNull(om.createObject(memPath.index(name)).insert(span, ConflictResolution.TRUNCATE).getDestination(null).queryInterface(TraceObjectMemoryRegion.class));TraceObject obj = region.getObject();- obj.setAttribute(span, TargetMemoryRegion.DISPLAY_ATTRIBUTE_NAME, name);- obj.setAttribute(span, TargetMemoryRegion.RANGE_ATTRIBUTE_NAME, range);- obj.setAttribute(span, TargetMemoryRegion.READABLE_ATTRIBUTE_NAME, true);- obj.setAttribute(span, TargetMemoryRegion.WRITABLE_ATTRIBUTE_NAME, isData);- obj.setAttribute(span, TargetMemoryRegion.EXECUTABLE_ATTRIBUTE_NAME, !isData);+ obj.setAttribute(span, TraceObjectMemoryRegion.KEY_DISPLAY, name);+ obj.setAttribute(span, TraceObjectMemoryRegion.KEY_RANGE, range);+ obj.setAttribute(span, TraceObjectMemoryRegion.KEY_READABLE, true);+ obj.setAttribute(span, TraceObjectMemoryRegion.KEY_WRITABLE, isData);+ obj.setAttribute(span, TraceObjectMemoryRegion.KEY_EXECUTABLE, !isData);return region;}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.javaindex 61be7fdc82..fc2c8b8ed2 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@@ -38,15 +38,16 @@ import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.ValueRow;import ghidra.app.plugin.core.debug.gui.model.ObjectTreeModel.AbstractNode;import ghidra.app.plugin.core.debug.gui.model.PathTableModel.PathRow;import ghidra.app.plugin.core.debug.gui.model.columns.*;-import ghidra.dbg.target.TargetEventScope;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.iface.TraceObjectEventScope;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;@@ -150,7 +151,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestprotected TraceObject createThread(long i, TraceObject prevThread) {TraceObjectManager objects = tb.trace.getObjectManager();- TraceObjectKeyPath threadContainerPath = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath threadContainerPath = KeyPath.parse("Processes[0].Threads");TraceObject thread = objects.createObject(threadContainerPath.index(i));thread.insert(Lifespan.span(i, 10), ConflictResolution.DENY);thread.insert(Lifespan.nowOn(10 + i), ConflictResolution.DENY);@@ -162,14 +163,14 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestprevThread.setAttribute(Lifespan.nowOn(i), "_next", thread);}objects.getRootObject()- .setAttribute(Lifespan.nowOn(i), TargetEventScope.EVENT_OBJECT_ATTRIBUTE_NAME,+ .setAttribute(Lifespan.nowOn(i), TraceObjectEventScope.KEY_EVENT_THREAD,thread);return thread;}protected TraceObject createStack(TraceObject thread) {try (Transaction tx = tb.startTransaction()) {- TraceObjectKeyPath stackPath = thread.getCanonicalPath().key("Stack");+ KeyPath stackPath = thread.getCanonicalPath().key("Stack");TraceObjectManager objects = tb.trace.getObjectManager();TraceObject stack = objects.createObject(stackPath);objects.createObject(stackPath.index(0))@@ -194,7 +195,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestTraceObjectManager objects = tb.trace.getObjectManager();try (Transaction tx = tb.startTransaction()) {createThread(10, objects.getObjectByCanonicalPath(- TraceObjectKeyPath.parse("Processes[0].Threads[9]")));+ KeyPath.parse("Processes[0].Threads[9]")));}}@@ -202,7 +203,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestTraceObjectManager objects = tb.trace.getObjectManager();try (Transaction tx = tb.startTransaction()) {TraceObject handleContainer =- objects.createObject(TraceObjectKeyPath.parse("Processes[0].Handles"));+ objects.createObject(KeyPath.parse("Processes[0].Handles"));handleContainer.insert(Lifespan.nowOn(0), ConflictResolution.DENY);for (int i = 0; i < 10; i++) {handleContainer.setElement(Lifespan.nowOn(-i), i,@@ -213,10 +214,10 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestprotected void populateLinks() throws Throwable {TraceObjectManager objects = tb.trace.getObjectManager();- TraceObjectKeyPath threadContainerPath = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath threadContainerPath = KeyPath.parse("Processes[0].Threads");try (Transaction tx = tb.startTransaction()) {TraceObject linkContainer =- objects.createObject(TraceObjectKeyPath.parse("Processes[0].Links"));+ objects.createObject(KeyPath.parse("Processes[0].Links"));linkContainer.insert(Lifespan.nowOn(0), ConflictResolution.DENY);for (int i = 0; i < 10; i++) {linkContainer.setElement(Lifespan.nowOn(0), i,@@ -229,10 +230,10 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestTraceObjectManager objects = tb.trace.getObjectManager();try (Transaction tx = tb.startTransaction()) {TraceObject boxed =- objects.createObject(TraceObjectKeyPath.parse("Processes[0].Boxed"));+ objects.createObject(KeyPath.parse("Processes[0].Boxed"));boxed.insert(Lifespan.nowOn(0), ConflictResolution.DENY);- boxed.setAttribute(Lifespan.nowOn(2), TargetObject.DISPLAY_ATTRIBUTE_NAME, "2");- boxed.setAttribute(Lifespan.nowOn(4), TargetObject.DISPLAY_ATTRIBUTE_NAME, "4");+ boxed.setAttribute(Lifespan.nowOn(2), TraceObjectInterface.KEY_DISPLAY, "2");+ boxed.setAttribute(Lifespan.nowOn(4), TraceObjectInterface.KEY_DISPLAY, "4");}}@@ -246,7 +247,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestpopulateBoxedPrimitive();}- protected void assertPathIs(TraceObjectKeyPath path, int elemCount, int attrCount) {+ protected void assertPathIs(KeyPath path, int elemCount, int attrCount) {assertEquals(path, modelProvider.getPath());assertEquals(path.toString(), modelProvider.pathField.getText());// Table model is threaded@@ -257,22 +258,22 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest}protected void assertPathIsThreadsContainer() {- assertPathIs(TraceObjectKeyPath.parse("Processes[0].Threads"), 10, 0);+ assertPathIs(KeyPath.parse("Processes[0].Threads"), 10, 0);}@Testpublic void testSetPathWOutTrace() throws Throwable {- modelProvider.setPath(TraceObjectKeyPath.parse(""));+ modelProvider.setPath(KeyPath.parse(""));waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads"));waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse(""));+ modelProvider.setPath(KeyPath.parse(""));waitForSwing();}@Testpublic void testSelectRootWOutTrace() throws Throwable {- modelProvider.objectsTreePanel.setSelectedKeyPaths(Set.of(TraceObjectKeyPath.parse("")));+ modelProvider.objectsTreePanel.setSelectedKeyPaths(Set.of(KeyPath.parse("")));waitForSwing();}@@ -283,7 +284,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.objectsTreePanel.setSelectedKeyPaths(Set.of(TraceObjectKeyPath.parse("")));+ modelProvider.objectsTreePanel.setSelectedKeyPaths(Set.of(KeyPath.parse("")));waitForSwing();}@@ -293,7 +294,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads"));waitForSwing();assertPathIsThreadsContainer();@@ -319,7 +320,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForTasks();modelProvider.objectsTreePanel- .setSelectedKeyPaths(List.of(TraceObjectKeyPath.parse("Processes[0].Threads")));+ .setSelectedKeyPaths(List.of(KeyPath.parse("Processes[0].Threads")));waitForSwing();waitForPass(() -> assertPathIsThreadsContainer());@@ -331,7 +332,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads"));waitForTasks();ValueRow selElem = waitForValue(() -> {@@ -354,7 +355,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.activatePath(TraceObjectKeyPath.parse("Processes[0].NoSuch"));+ modelProvider.activatePath(KeyPath.parse("Processes[0].NoSuch"));waitForTasks();assertEquals("No such object at path Processes[0].NoSuch", tool.getStatusInfo());@@ -366,7 +367,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Handles"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Handles"));waitForTasks();int keyColIndex =@@ -397,7 +398,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads"));waitForTasks();modelProvider.pathField.setText("SomeNonsenseToBeCancelled");@@ -413,7 +414,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestTraceObjectManager objects = tb.trace.getObjectManager();TraceObject root = objects.getRootObject();- TraceObjectKeyPath process0Path = TraceObjectKeyPath.parse("Processes[0]");+ KeyPath process0Path = KeyPath.parse("Processes[0]");TraceObject process0 = objects.getObjectByCanonicalPath(process0Path);traceManager.activateObject(root);waitForTasks();@@ -441,7 +442,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- TraceObjectKeyPath pathLinks = TraceObjectKeyPath.parse("Processes[0].Links");+ KeyPath pathLinks = KeyPath.parse("Processes[0].Links");modelProvider.setPath(pathLinks);waitForTasks();@@ -463,7 +464,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest});clickTableCell(modelProvider.elementsTablePanel.table, rowIndex, 0, 2);- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[7]"),+ assertEquals(KeyPath.parse("Processes[0].Threads[7]"),traceManager.getCurrentObject().getCanonicalPath());}@@ -473,7 +474,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads"));waitForTasks();ValueRow row2 = waitForValue(() -> {@@ -494,7 +495,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest});clickTableCell(modelProvider.elementsTablePanel.table, rowIndex, 0, 2);- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[2]"),+ assertEquals(KeyPath.parse("Processes[0].Threads[2]"),traceManager.getCurrentObject().getCanonicalPath());}@@ -522,7 +523,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads[2]"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads[2]"));waitForTasks();selectAttribute("_next");waitForTasks();@@ -536,7 +537,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest});clickTableCell(modelProvider.attributesTablePanel.table, rowIndex, 0, 2);- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[3]"),+ assertEquals(KeyPath.parse("Processes[0].Threads[3]"),traceManager.getCurrentObject().getCanonicalPath());}@@ -546,7 +547,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0]"));+ modelProvider.setPath(KeyPath.parse("Processes[0]"));waitForTasks();PathRow rowNext = waitForValue(() -> {@@ -574,7 +575,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestclickTableCell(modelProvider.attributesTablePanel.table, rowIndex, 0, 2);// ThreadContainer is not activatable, so only changes provider's path- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads"), modelProvider.getPath());+ assertEquals(KeyPath.parse("Processes[0].Threads"), modelProvider.getPath());}@Test@@ -585,23 +586,23 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads"));waitForTasks();- assertPathIs(TraceObjectKeyPath.parse("Processes[0].Threads"), 10, 0);+ assertPathIs(KeyPath.parse("Processes[0].Threads"), 10, 0);performAction(modelProvider.actionLimitToCurrentSnap);assertTrue(modelProvider.isLimitToCurrentSnap());assertTrue(modelProvider.actionLimitToCurrentSnap.isSelected());- assertPathIs(TraceObjectKeyPath.parse("Processes[0].Threads"), 1, 0);+ assertPathIs(KeyPath.parse("Processes[0].Threads"), 1, 0);traceManager.activateSnap(5);- assertPathIs(TraceObjectKeyPath.parse("Processes[0].Threads"), 6, 0);+ assertPathIs(KeyPath.parse("Processes[0].Threads"), 6, 0);performAction(modelProvider.actionLimitToCurrentSnap);assertFalse(modelProvider.isLimitToCurrentSnap());assertFalse(modelProvider.actionLimitToCurrentSnap.isSelected());- assertPathIs(TraceObjectKeyPath.parse("Processes[0].Threads"), 10, 0);+ assertPathIs(KeyPath.parse("Processes[0].Threads"), 10, 0);}@Test@@ -611,7 +612,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- TraceObjectKeyPath thread2Path = TraceObjectKeyPath.parse("Processes[0].Threads[2]");+ KeyPath thread2Path = KeyPath.parse("Processes[0].Threads[2]");modelProvider.setPath(thread2Path);modelProvider.setTreeSelection(thread2Path);waitForTasks();@@ -641,7 +642,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads[2]"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads[2]"));waitForTasks();selectAttribute("_next");waitForSwing();@@ -651,7 +652,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestassertTrue(runSwing(() -> modelProvider.actionFollowLink.isEnabledForContext(ctx)));performAction(modelProvider.actionFollowLink, ctx, true);- TraceObjectKeyPath thread3Path = TraceObjectKeyPath.parse("Processes[0].Threads[3]");+ KeyPath thread3Path = KeyPath.parse("Processes[0].Threads[3]");assertPathIs(thread3Path, 0, 5);}@@ -661,24 +662,24 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateTrace(tb.trace);waitForSwing();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads[2]"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads[2]"));waitForTasks();// Pre-check- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[2]"), modelProvider.path);+ assertEquals(KeyPath.parse("Processes[0].Threads[2]"), modelProvider.path);performAction(modelProvider.actionCloneWindow);DebuggerModelProvider clone = Unique.assertOne(modelPlugin.getDisconnectedProviders());assertEquals(tb.trace, clone.current.getTrace());- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[2]"), clone.path);+ assertEquals(KeyPath.parse("Processes[0].Threads[2]"), clone.path);}@Testpublic void testPanesTrackAddElement() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath path = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath path = KeyPath.parse("Processes[0].Threads");traceManager.activateTrace(tb.trace);waitForSwing();@@ -696,7 +697,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest@Testpublic void testPanesTrackAddAttribute() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath path = TraceObjectKeyPath.parse("Processes[0].Threads[2]");+ KeyPath path = KeyPath.parse("Processes[0].Threads[2]");traceManager.activateTrace(tb.trace);waitForSwing();@@ -717,7 +718,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest@Testpublic void testPanesTrackRemoveElement() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath path = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath path = KeyPath.parse("Processes[0].Threads");traceManager.activateTrace(tb.trace);waitForSwing();@@ -738,7 +739,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest@Testpublic void testPanesTrackRemoveAttribute() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath path = TraceObjectKeyPath.parse("Processes[0].Threads[2]");+ KeyPath path = KeyPath.parse("Processes[0].Threads[2]");traceManager.activateTrace(tb.trace);waitForSwing();@@ -760,7 +761,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestpublic void testPanesTrackLifespanChangedElement() throws Throwable {modelProvider.setLimitToCurrentSnap(true);createTraceAndPopulateObjects();- TraceObjectKeyPath path = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath path = KeyPath.parse("Processes[0].Threads");TraceObject threads = tb.trace.getObjectManager().getObjectByCanonicalPath(path);TraceObjectValue element2 = threads.getElement(2, 2);@@ -792,7 +793,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestmodelProvider.setLimitToCurrentSnap(true);modelProvider.setShowHidden(true);createTraceAndPopulateObjects();- TraceObjectKeyPath path = TraceObjectKeyPath.parse("Processes[0].Threads[2]");+ KeyPath path = KeyPath.parse("Processes[0].Threads[2]");TraceObject thread = tb.trace.getObjectManager().getObjectByCanonicalPath(path);TraceObjectValue attrSelf = thread.getAttribute(2, "_self");@@ -822,7 +823,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest@Testpublic void testTreeTracksDisplayChange() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath path = TraceObjectKeyPath.parse("Processes[0].Threads[2]");+ KeyPath path = KeyPath.parse("Processes[0].Threads[2]");TraceObject thread = tb.trace.getObjectManager().getObjectByCanonicalPath(path);traceManager.activateTrace(tb.trace);@@ -848,7 +849,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestTraceObjectManager objects = tb.trace.getObjectManager();TraceObject root = objects.getRootObject();TraceObject process0 =- objects.getObjectByCanonicalPath(TraceObjectKeyPath.parse("Processes[0]"));+ objects.getObjectByCanonicalPath(KeyPath.parse("Processes[0]"));traceManager.activateObject(root);waitForTasks();@@ -885,20 +886,20 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestcreateTraceAndPopulateObjects();TraceObjectManager objects = tb.trace.getObjectManager();TraceObject thread0 =- objects.getObjectByCanonicalPath(TraceObjectKeyPath.parse("Processes[0].Threads[0]"));+ objects.getObjectByCanonicalPath(KeyPath.parse("Processes[0].Threads[0]"));TraceObject thread1 =- objects.getObjectByCanonicalPath(TraceObjectKeyPath.parse("Processes[0].Threads[1]"));+ objects.getObjectByCanonicalPath(KeyPath.parse("Processes[0].Threads[1]"));modelProvider.setShowHidden(true);traceManager.activateObject(thread0);traceManager.activateSnap(1);waitForTasks();- modelProvider.setPath(TraceObjectKeyPath.parse("Processes[0].Threads[0]._self"));+ modelProvider.setPath(KeyPath.parse("Processes[0].Threads[0]._self"));waitForTasks();traceManager.activateObject(thread1);waitForSwing();- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[0]._next"),+ assertEquals(KeyPath.parse("Processes[0].Threads[0]._next"),modelProvider.getPath());}@@ -906,7 +907,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestpublic void testObjectActivationSelectsElement() throws Throwable {createTraceAndPopulateObjects();TraceObjectManager objects = tb.trace.getObjectManager();- TraceObjectKeyPath processesPath = TraceObjectKeyPath.parse("Processes");+ KeyPath processesPath = KeyPath.parse("Processes");TraceObject processes = objects.getObjectByCanonicalPath(processesPath);TraceObject process0 = processes.getElement(0, 0).getChild();traceManager.activateObject(processes);@@ -947,14 +948,14 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateObject(processes);waitForTasks();- assertEquals(TraceObjectKeyPath.of(), modelProvider.getPath());+ assertEquals(KeyPath.of(), modelProvider.getPath());assertEquals(processes, modelProvider.attributesTablePanel.getSelectedItem().getValue());}protected TraceThread populateThread0Stack() {TraceObjectManager objects = tb.trace.getObjectManager();TraceObject threadObj0 =- objects.getObjectByCanonicalPath(TraceObjectKeyPath.parse("Processes[0].Threads[0]"));+ objects.getObjectByCanonicalPath(KeyPath.parse("Processes[0].Threads[0]"));TraceThread thread0 = threadObj0.queryInterface(TraceObjectThread.class);createStack(threadObj0);return thread0;@@ -967,12 +968,12 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activate(DebuggerCoordinates.NOWHERE.thread(thread0).frame(0));waitForSwing();- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[0].Stack[0]"),+ assertEquals(KeyPath.parse("Processes[0].Threads[0].Stack[0]"),modelProvider.getPath());traceManager.activateFrame(1);waitForSwing();- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[0].Stack[1]"),+ assertEquals(KeyPath.parse("Processes[0].Threads[0].Stack[1]"),modelProvider.getPath());}@@ -980,7 +981,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestpublic void testFrameActivationSelectsElement() throws Throwable {createTraceAndPopulateObjects();TraceThread thread0 = populateThread0Stack();- TraceObjectKeyPath stackPath = TraceObjectKeyPath.parse("Processes[0].Threads[0].Stack");+ KeyPath stackPath = KeyPath.parse("Processes[0].Threads[0].Stack");traceManager.activateThread(thread0);waitForSwing();@@ -1012,11 +1013,11 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttraceManager.activateThread(thread0);traceManager.activateSnap(1);waitForSwing();- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[0]"), modelProvider.getPath());+ assertEquals(KeyPath.parse("Processes[0].Threads[0]"), modelProvider.getPath());traceManager.activateThread(thread1);waitForSwing();- assertEquals(TraceObjectKeyPath.parse("Processes[0].Threads[1]"), modelProvider.getPath());+ assertEquals(KeyPath.parse("Processes[0].Threads[1]"), modelProvider.getPath());}@Test@@ -1026,7 +1027,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTesttb.trace.getThreadManager().getLiveThreadByPath(1, "Processes[0].Threads[0]");TraceThread thread1 =tb.trace.getThreadManager().getLiveThreadByPath(1, "Processes[0].Threads[1]");- TraceObjectKeyPath threadsPath = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath threadsPath = KeyPath.parse("Processes[0].Threads");traceManager.activateTrace(tb.trace);traceManager.activateSnap(1);@@ -1053,7 +1054,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestpublic void testSetValueAffectsTree() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath threadsPath = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath threadsPath = KeyPath.parse("Processes[0].Threads");TraceObject threads = tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath);TraceObject thread0 =tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath.index(0));@@ -1080,7 +1081,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTestpublic void testDuplicateNameInSameParentDoesntCorruptTree() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath threadsPath = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath threadsPath = KeyPath.parse("Processes[0].Threads");TraceObject threads = tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath);TraceObject thread0 =tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath.index(0));@@ -1123,7 +1124,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest@Testpublic void testDuplicateNameDifferentLifespanAppearInAttributesTable() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath threadsPath = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath threadsPath = KeyPath.parse("Processes[0].Threads");TraceObject threads = tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath);TraceObject thread0 =tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath.index(0));@@ -1151,7 +1152,7 @@ public class DebuggerModelProviderTest extends AbstractGhidraHeadedDebuggerTest@Testpublic void testDuplicateNameDifferentLifespanAppearInElementsTable() throws Throwable {createTraceAndPopulateObjects();- TraceObjectKeyPath threadsPath = TraceObjectKeyPath.parse("Processes[0].Threads");+ KeyPath threadsPath = KeyPath.parse("Processes[0].Threads");TraceObject threads = tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath);TraceObject thread0 =tb.trace.getObjectManager().getObjectByCanonicalPath(threadsPath.index(0));diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/ModelQueryTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/ModelQueryTest.javaindex 918df7dcc9..f15b9fb7bb 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/ModelQueryTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/model/ModelQueryTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -22,11 +22,11 @@ import org.junit.Test;import db.Transaction;import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.trace.database.target.DBTraceObjectManager;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.target.TraceObjectValue;public class ModelQueryTest extends AbstractGhidraHeadedDebuggerTest {@@ -44,7 +44,7 @@ public class ModelQueryTest extends AbstractGhidraHeadedDebuggerTest {objects.createRootObject(CTX.getSchema(new SchemaName("Session")));TraceObjectValue thread0Val =- objects.createObject(TraceObjectKeyPath.parse("Processes[0].Threads[0]"))+ objects.createObject(KeyPath.parse("Processes[0].Threads[0]")).insert(Lifespan.nowOn(0), ConflictResolution.DENY).getLastEntry();@@ -71,7 +71,7 @@ public class ModelQueryTest extends AbstractGhidraHeadedDebuggerTest {objects.createRootObject(CTX.getSchema(new SchemaName("Session")));TraceObjectValue thread0Val =- objects.createObject(TraceObjectKeyPath.parse("Processes[0].Threads[0]"))+ objects.createObject(KeyPath.parse("Processes[0].Threads[0]")).insert(Lifespan.nowOn(0), ConflictResolution.DENY).getLastEntry();diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesProviderTest.javaindex 5e3547b92c..6ead51911c 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesProviderTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/modules/DebuggerModulesProviderTest.java@@ -44,12 +44,6 @@ import ghidra.app.plugin.core.debug.gui.modules.DebuggerModulesProvider.MapSectiimport ghidra.app.plugin.core.debug.gui.modules.DebuggerSectionMapProposalDialog.SectionMapTableColumns;import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServiceTestAccess;import ghidra.app.services.DebuggerListingService;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathUtils;import ghidra.debug.api.modules.ModuleMapProposal.ModuleMapEntry;import ghidra.debug.api.modules.SectionMapProposal.SectionMapEntry;import ghidra.debug.api.tracemgr.DebuggerCoordinates;@@ -60,10 +54,16 @@ import ghidra.program.model.mem.MemoryBlock;import ghidra.trace.database.module.TraceObjectSection;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;+import ghidra.trace.model.memory.TraceObjectMemoryRegion;import ghidra.trace.model.modules.TraceObjectModule;import ghidra.trace.model.modules.TraceStaticMapping;-import ghidra.trace.model.target.*;+import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.TraceObjectManager;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.util.table.GhidraTable;@Category(NightlyCategory.class)@@ -139,32 +139,33 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerTes}protected void addRegionsFromModules() throws Exception {- PathPattern regionPattern = new PathPattern(PathUtils.parse("Processes[1].Memory[]"));+ PathPattern regionPattern = PathFilter.parse("Processes[1].Memory[]");TraceObjectManager om = tb.trace.getObjectManager();try (Transaction tx = tb.startTransaction()) {TraceObject root = om.getRootObject();for (TraceObject module : (Iterable<TraceObject>) () -> root- .querySuccessorsTargetInterface(Lifespan.at(0), TargetModule.class, true)+ .findSuccessorsInterface(Lifespan.at(0), TraceObjectModule.class, true).map(p -> p.getDestination(root)).iterator()) {String moduleName = module.getCanonicalPath().index();Lifespan span = module.getLife().bound();for (TraceObject section : (Iterable<TraceObject>) () -> module- .querySuccessorsTargetInterface(Lifespan.at(0), TargetSection.class, true)+ .findSuccessorsInterface(Lifespan.at(0), TraceObjectSection.class,+ true).map(p -> p.getDestination(root)).iterator()) {String sectionName = section.getCanonicalPath().index();- TraceObject region = om.createObject(TraceObjectKeyPath- .of(regionPattern.applyKeys(moduleName + ":" + sectionName)- .getSingletonPath()))+ TraceObject region = om+ .createObject(regionPattern.applyKeys(moduleName + ":" + sectionName)+ .getSingletonPath()).insert(span, ConflictResolution.TRUNCATE).getDestination(root);- region.setAttribute(span, TargetMemoryRegion.RANGE_ATTRIBUTE_NAME,- section.getAttribute(0, TargetSection.RANGE_ATTRIBUTE_NAME).getValue());- region.setAttribute(span, TargetMemoryRegion.READABLE_ATTRIBUTE_NAME, true);- region.setAttribute(span, TargetMemoryRegion.WRITABLE_ATTRIBUTE_NAME,+ region.setAttribute(span, TraceObjectMemoryRegion.KEY_RANGE,+ section.getAttribute(0, TraceObjectSection.KEY_RANGE).getValue());+ region.setAttribute(span, TraceObjectMemoryRegion.KEY_READABLE, true);+ region.setAttribute(span, TraceObjectMemoryRegion.KEY_WRITABLE,".data".equals(sectionName));- region.setAttribute(span, TargetMemoryRegion.EXECUTABLE_ATTRIBUTE_NAME,+ region.setAttribute(span, TraceObjectMemoryRegion.KEY_EXECUTABLE,".text".equals(sectionName));}}@@ -172,15 +173,15 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerTes}protected TraceObjectModule addModule(String name, AddressRange range, Lifespan span) {- PathPattern modulePattern = new PathPattern(PathUtils.parse("Processes[1].Modules[]"));+ PathPattern modulePattern = PathFilter.parse("Processes[1].Modules[]");TraceObjectManager om = tb.trace.getObjectManager();TraceObjectModule module = Objects.requireNonNull(- om.createObject(TraceObjectKeyPath.of(modulePattern.applyKeys(name).getSingletonPath()))+ om.createObject(modulePattern.applyKeys(name).getSingletonPath()).insert(span, ConflictResolution.TRUNCATE).getDestination(null).queryInterface(TraceObjectModule.class));- module.getObject().setAttribute(span, TargetModule.MODULE_NAME_ATTRIBUTE_NAME, name);- module.getObject().setAttribute(span, TargetModule.RANGE_ATTRIBUTE_NAME, range);+ module.getObject().setAttribute(span, TraceObjectModule.KEY_MODULE_NAME, name);+ module.getObject().setAttribute(span, TraceObjectModule.KEY_RANGE, range);return module;}@@ -194,7 +195,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerTes.insert(span, ConflictResolution.TRUNCATE).getDestination(null).queryInterface(TraceObjectSection.class));- section.getObject().setAttribute(span, TargetSection.RANGE_ATTRIBUTE_NAME, range);+ section.getObject().setAttribute(span, TraceObjectSection.KEY_RANGE, range);return section;}@@ -717,7 +718,7 @@ public class DebuggerModulesProviderTest extends AbstractGhidraHeadedDebuggerTesfor (ValueRow row : visibleSections()) {assertEquals(modExe.getObject(), row.getValue().getChild()- .queryCanonicalAncestorsTargetInterface(TargetModule.class)+ .findCanonicalAncestorsInterface(TraceObjectModule.class).findFirst().orElse(null));}diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackProviderTest.javaindex 19636ef5ee..7deb2b34b3 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackProviderTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/stack/DebuggerStackProviderTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -33,13 +33,6 @@ import ghidra.app.plugin.core.debug.gui.model.QueryPanelTestHelper;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;import ghidra.app.services.DebuggerStaticMappingService;-import ghidra.dbg.target.TargetMemoryRegion;-import ghidra.dbg.target.TargetStackFrame;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathUtils;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressSet;@@ -50,8 +43,14 @@ import ghidra.program.util.ProgramLocation;import ghidra.trace.model.*;import ghidra.trace.model.memory.TraceObjectMemoryRegion;import ghidra.trace.model.stack.TraceObjectStack;-import ghidra.trace.model.target.*;+import ghidra.trace.model.stack.TraceObjectStackFrame;+import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.TraceObjectManager;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.util.table.GhidraTable;import ghidra.util.task.TaskMonitor;@@ -169,9 +168,8 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerTest}protected TraceObjectThread addThread(int n) {- PathPattern threadPattern = new PathPattern(PathUtils.parse("Processes[1].Threads[]"));- TraceObjectKeyPath threadPath =- TraceObjectKeyPath.of(threadPattern.applyIntKeys(n).getSingletonPath());+ PathPattern threadPattern = PathFilter.parse("Processes[1].Threads[]");+ KeyPath threadPath = threadPattern.applyIntKeys(n).getSingletonPath();try (Transaction tx = tb.startTransaction()) {return Objects.requireNonNull(tb.trace.getObjectManager().createObject(threadPath)@@ -182,7 +180,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerTest}protected TraceObjectStack addStack(TraceObjectThread thread) {- TraceObjectKeyPath stackPath = thread.getObject().getCanonicalPath().extend("Stack");+ KeyPath stackPath = thread.getObject().getCanonicalPath().extend("Stack");try (Transaction tx = tb.startTransaction()) {return Objects.requireNonNull(tb.trace.getObjectManager().createObject(stackPath)@@ -197,14 +195,14 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerTest}protected void addStackFrames(TraceObjectStack stack, int count) {- TraceObjectKeyPath stackPath = stack.getObject().getCanonicalPath();+ KeyPath stackPath = stack.getObject().getCanonicalPath();TraceObjectManager om = tb.trace.getObjectManager();try (Transaction tx = tb.startTransaction()) {for (int i = 0; i < count; i++) {TraceObject frame = om.createObject(stackPath.index(i)).insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE).getDestination(null);- frame.setAttribute(Lifespan.nowOn(0), TargetStackFrame.PC_ATTRIBUTE_NAME,+ frame.setAttribute(Lifespan.nowOn(0), TraceObjectStackFrame.KEY_PC,tb.addr(0x00400100 + 0x100 * i));}}@@ -233,7 +231,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerTest.getColumnByNameAndType(tableModel, table, "Function", ValueProperty.class).column();- assertEquals(PathUtils.makeKey(PathUtils.makeIndex(level)), rowColVal(row, levelCol));+ assertEquals(KeyPath.makeKey(KeyPath.makeIndex(level)), rowColVal(row, levelCol));assertEquals(pcVal, rowColVal(row, pcCol));assertEquals(func, rowColVal(row, funcCol));}@@ -334,7 +332,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerTestassertTableSize(15);List<ValueRow> allItems = stackProvider.panel.getAllItems();for (int i = 0; i < 15; i++) {- assertEquals(PathUtils.makeKey(PathUtils.makeIndex(i)), allItems.get(i).getKey());+ assertEquals(KeyPath.makeKey(KeyPath.makeIndex(i)), allItems.get(i).getKey());}});}@@ -358,7 +356,7 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerTest.createObject(stack.getObject().getCanonicalPath().index(2)).insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE).getDestination(null);- frame2.setAttribute(Lifespan.nowOn(0), TargetStackFrame.PC_ATTRIBUTE_NAME,+ frame2.setAttribute(Lifespan.nowOn(0), TraceObjectStackFrame.KEY_PC,tb.addr(0x00400300));}waitForDomainObject(tb.trace);@@ -583,12 +581,12 @@ public class DebuggerStackProviderTest extends AbstractGhidraHeadedDebuggerTesttry (Transaction tx = tb.startTransaction()) {TraceObjectMemoryRegion region = Objects.requireNonNull(tb.trace.getObjectManager()- .createObject(TraceObjectKeyPath.parse("Processes[1].Memory[bin:.text]"))+ .createObject(KeyPath.parse("Processes[1].Memory[bin:.text]")).insert(Lifespan.nowOn(0), ConflictResolution.TRUNCATE).getDestination(null).queryInterface(TraceObjectMemoryRegion.class));region.getObject()- .setAttribute(Lifespan.nowOn(0), TargetMemoryRegion.RANGE_ATTRIBUTE_NAME,+ .setAttribute(Lifespan.nowOn(0), TraceObjectMemoryRegion.KEY_RANGE,tb.drng(0x00400000, 0x00400fff));TraceLocation dloc =diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsProviderTest.javaindex 9cc9120ae0..b3dc4a001a 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsProviderTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/thread/DebuggerThreadsProviderTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -30,19 +30,16 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;import ghidra.app.plugin.core.debug.gui.model.ObjectTableModel.*;import ghidra.app.plugin.core.debug.gui.model.QueryPanelTestHelper;import ghidra.app.plugin.core.debug.service.tracemgr.DebuggerTraceManagerServiceTestAccess;-import ghidra.dbg.target.TargetExecutionStateful;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathUtils;import ghidra.debug.api.tracemgr.DebuggerCoordinates;-import ghidra.trace.model.Lifespan;-import ghidra.trace.model.Trace;+import ghidra.trace.model.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;import ghidra.trace.model.target.TraceObjectManager;+import ghidra.trace.model.target.iface.TraceObjectExecutionStateful;+import ghidra.trace.model.target.path.PathFilter;+import ghidra.trace.model.target.path.PathPattern;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.time.TraceTimeManager;import ghidra.util.table.GhidraTable;@@ -100,15 +97,15 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerTesprotected TraceObjectThread addThread(int index, Lifespan lifespan, String comment) {TraceObjectManager om = tb.trace.getObjectManager();- PathPattern threadPattern = new PathPattern(PathUtils.parse("Processes[1].Threads[]"));+ PathPattern threadPattern = PathFilter.parse("Processes[1].Threads[]");TraceObjectThread thread = Objects.requireNonNull(om.createObject(- TraceObjectKeyPath.of(threadPattern.applyIntKeys(index).getSingletonPath()))+ threadPattern.applyIntKeys(index).getSingletonPath()).insert(lifespan, ConflictResolution.TRUNCATE).getDestination(null).queryInterface(TraceObjectThread.class));thread.getObject()- .setAttribute(lifespan, TargetExecutionStateful.STATE_ATTRIBUTE_NAME,- TargetExecutionState.STOPPED.name());+ .setAttribute(lifespan, TraceObjectExecutionStateful.KEY_STATE,+ TraceExecutionState.STOPPED.name());thread.getObject().setAttribute(lifespan, TraceObjectThread.KEY_COMMENT, comment);return thread;}@@ -129,7 +126,7 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerTes}protected void assertThreadRow(int position, Object object, String name,- TargetExecutionState state, String comment) {+ TraceExecutionState state, String comment) {// NB. Not testing plot, since that's unmodified from generic ObjectTableValueRow row = provider.panel.getAllItems().get(position);var tableModel = QueryPanelTestHelper.getTableModel(provider.panel);@@ -154,9 +151,9 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerTesassertThreadsTableSize(2);assertThreadRow(0, thread1.getObject(), "Processes[1].Threads[1]",- TargetExecutionState.STOPPED, "A comment");+ TraceExecutionState.STOPPED, "A comment");assertThreadRow(1, thread2.getObject(), "Processes[1].Threads[2]",- TargetExecutionState.STOPPED, "Another comment");+ TraceExecutionState.STOPPED, "Another comment");}protected void assertNoThreadSelected() {@@ -289,7 +286,7 @@ public class DebuggerThreadsProviderTest extends AbstractGhidraHeadedDebuggerTeswaitForPass(() -> {assertThreadRow(0, thread1.getObject(), "Processes[1].Threads[1]",- TargetExecutionState.STOPPED, "A comment");+ TraceExecutionState.STOPPED, "A comment");});// NOTE: Destruction will not be visible in plot unless snapshot 15 is created}diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/MockTarget.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/MockTarget.javaindex 489f43a716..ffc8d50c0a 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/MockTarget.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/MockTarget.java@@ -21,19 +21,19 @@ import java.util.concurrent.CompletableFuture;import docking.ActionContext;import ghidra.async.AsyncUtils;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;import ghidra.debug.api.target.ActionName;import ghidra.debug.api.target.Target;import ghidra.debug.api.tracemgr.DebuggerCoordinates;import ghidra.program.model.address.*;import ghidra.program.model.lang.Register;import ghidra.program.model.lang.RegisterValue;+import ghidra.trace.model.TraceExecutionState;import ghidra.trace.model.Trace;import ghidra.trace.model.breakpoint.TraceBreakpoint;import ghidra.trace.model.breakpoint.TraceBreakpointKind;import ghidra.trace.model.guest.TracePlatform;import ghidra.trace.model.stack.TraceStackFrame;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceThread;import ghidra.util.exception.CancelledException;import ghidra.util.task.TaskMonitor;@@ -76,17 +76,17 @@ public class MockTarget implements Target {}@Override- public TraceThread getThreadForSuccessor(TraceObjectKeyPath path) {+ public TraceThread getThreadForSuccessor(KeyPath path) {return null;}@Override- public TargetExecutionState getThreadExecutionState(TraceThread thread) {+ public TraceExecutionState getThreadExecutionState(TraceThread thread) {return null;}@Override- public TraceStackFrame getStackFrameForSuccessor(TraceObjectKeyPath path) {+ public TraceStackFrame getStackFrameForSuccessor(KeyPath path) {return null;}@@ -96,7 +96,7 @@ public class MockTarget implements Target {}@Override- public TraceObjectKeyPath getFocus() {+ public KeyPath getFocus() {return null;}diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServiceTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServiceTest.javaindex e5e358a1a6..baddac95ac 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServiceTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServiceTest.java@@ -28,9 +28,6 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;import ghidra.app.plugin.core.debug.gui.modules.DebuggerModulesProviderTest;import ghidra.app.services.DebuggerStaticMappingService;import ghidra.app.services.DebuggerStaticMappingService.MappedAddressRange;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.framework.model.DomainFile;import ghidra.program.model.address.*;import ghidra.program.model.listing.Program;@@ -44,7 +41,10 @@ import ghidra.trace.model.memory.TraceMemoryFlag;import ghidra.trace.model.memory.TraceMemoryRegion;import ghidra.trace.model.modules.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.util.Msg;// Not technically a GUI test, but must be carried out in the context of a plugin tool@@ -684,7 +684,7 @@ public class DebuggerStaticMappingServiceTest extends AbstractGhidraHeadedDebuggDBTraceObjectManager objects = tb.trace.getObjectManager();objects.createRootObject(ctx.getSchema(new SchemaName("Session")));objModBash =- objects.createObject(TraceObjectKeyPath.parse("Processes[1].Modules[/bin/bash]"));+ objects.createObject(KeyPath.parse("Processes[1].Modules[/bin/bash]"));objModBash.insert(Lifespan.nowOn(0), ConflictResolution.DENY);}diff --git a/Ghidra/Debug/Framework-Debugging/Module.manifest b/Ghidra/Debug/Framework-Debugging/Module.manifestdeleted file mode 100644index d7934ca912..0000000000--- a/Ghidra/Debug/Framework-Debugging/Module.manifest+++ /dev/null@@ -1,2 +0,0 @@-MODULE FILE LICENSE: lib/jna-5.14.0.jar Apache License 2.0-MODULE FILE LICENSE: lib/jna-platform-5.14.0.jar Apache License 2.0\ No newline at end of filediff --git a/Ghidra/Debug/Framework-Debugging/README.md b/Ghidra/Debug/Framework-Debugging/README.mddeleted file mode 100644index 7798ce1442..0000000000--- a/Ghidra/Debug/Framework-Debugging/README.md+++ /dev/null@@ -1 +0,0 @@-# Framework-Debuggingdiff --git a/Ghidra/Debug/Framework-Debugging/build.gradle b/Ghidra/Debug/Framework-Debugging/build.gradledeleted file mode 100644index 7437fb091d..0000000000--- a/Ghidra/Debug/Framework-Debugging/build.gradle+++ /dev/null@@ -1,172 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-apply from: "${rootProject.projectDir}/gradle/javaProject.gradle"-apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle"-apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle"-apply from: "${rootProject.projectDir}/gradle/nativeProject.gradle"-apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle"--apply plugin: 'eclipse'-eclipse.project.name = 'Debug Framework-Debugging'--dependencies {- api project(':Framework-AsyncComm')- api project(':Generic')- api project(':SoftwareModeling')- api project(':ProposedUtils')-- api "net.java.dev.jna:jna:5.14.0"- api "net.java.dev.jna:jna-platform:5.14.0"-- testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')-}--// Ensure the below native test binaries don't get built for a distribution-ext.nativesTestOnly = true--task testSpecimenWin_x86_64 {- dependsOn 'expCreateProcessWin_x86_64Executable'- dependsOn 'expCreateThreadExitWin_x86_64Executable'- //dependsOn 'expCreateThreadSpinWin_x86_64Executable'- dependsOn 'expPrintWin_x86_64Executable'- //dependsOn 'expSpinWin_x86_64Executable'- dependsOn 'expRegistersWin_x86_64Executable'- dependsOn 'expStackWin_x86_64Executable'-}--task testSpecimenLinux_x86_64 {- dependsOn 'expCloneExecExecutable'//Linux_x86_64Executable'- dependsOn 'expCloneExitLinux_x86_64Executable'- //dependsOn 'expCloneSpinExecutable'//Linux_x86_64Executable'- dependsOn 'expForkExecutable'//Linux_x86_64Executable'- dependsOn 'expPrintLinux_x86_64Executable'- dependsOn 'expReadLinux_x86_64Executable'- dependsOn 'expSpinLinux_x86_64Executable'- dependsOn 'expRegistersLinux_x86_64Executable'- dependsOn 'expStackLinux_x86_64Executable'- dependsOn 'expTraceableSleepExecutable'//Linux_x86_64Executable'-- doLast {- exec {- workingDir "build/os/linux_x86_64"- commandLine "strip", "-o", "expSpin.stripped", "expSpin"- }- }-}--task testSpecimenMac_arm_64 {- dependsOn 'expCloneExitMac_arm_64Executable'- dependsOn 'expPrintMac_arm_64Executable'- dependsOn 'expReadMac_arm_64Executable'-}--// TODO: testSpecimenMac_x86_64 (Intel)-// will likely need to codesign them to grant debugee-entitlement--model {- components {- expCreateProcess(NativeExecutableSpec) {- targetPlatform "win_x86_64"- targetPlatform "win_x86_32" // TODO: Test on these- }- expCreateThreadExit(NativeExecutableSpec) {- targetPlatform "win_x86_64"- targetPlatform "win_x86_32" // TODO: Test on these- }- expCreateThreadSpin(NativeExecutableSpec) {- targetPlatform "win_x86_64"- targetPlatform "win_x86_32" // TODO: Test on these- }- expCloneExec(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- //targetPlatform "linux_x86_32" // TODO: Test on these- }- expCloneExit(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- //targetPlatform "linux_x86_32" // TODO: Test on these- targetPlatform "mac_arm_64"- }- expCloneSpin(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- //targetPlatform "linux_x86_32" // TODO: Test on these- }- expFork(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- //targetPlatform "linux_x86_32" // TODO: Test on these- }- expPrint(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- //targetPlatform "linux_x86_32" // TODO: Test on these- targetPlatform "win_x86_64"- targetPlatform "win_x86_32" // TODO: Test on these- targetPlatform "mac_arm_64"- }- expRead(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- targetPlatform "mac_arm_64"- }- expSpin(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- targetPlatform "win_x86_64"- targetPlatform "win_x86_32" // TODO: Test on these- }- expRegisters(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- //targetPlatform "linux_x86_32" // TODO: Test on these- targetPlatform "win_x86_64"- targetPlatform "win_x86_32" // TODO: Test on these- }- expStack(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- //targetPlatform "linux_x86_32" // TODO: Test on these- targetPlatform "win_x86_64"- targetPlatform "win_x86_32" // TODO: Test on these- }- expTraceableSleep(NativeExecutableSpec) {- targetPlatform "linux_x86_64"- }- }-- binaries {- withType(NativeExecutableBinarySpec) {- if (toolChain in Gcc) {- cCompiler.args("-std=c99")- linker.args("-lpthread")- linker.args("-lutil")- }- if (toolChain in VisualCpp) {- cppCompiler.define("VS_PROJECT")- // NB. No /SUBSYSTEM:CONSOLE- // that creates a subprocess- linker.args("/SUBSYSTEM:windows", "/DYNAMICBASE", "/NXCOMPAT")- linker.args("shell32.lib");- }- if (isWindows(targetPlatform.name)) {- cppCompiler.define("WIN32")- cCompiler.define("WIN32")-- cppCompiler.define("_WINDOWS")- cCompiler.define("_WINDOWS")-- cppCompiler.define("UNICODE")- cCompiler.define("_UNICODE")-- cppCompiler.define("_UNICODE")- cCompiler.define("UNICODE")- }- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/certification.manifest b/Ghidra/Debug/Framework-Debugging/certification.manifestdeleted file mode 100644index 9e9e246da1..0000000000--- a/Ghidra/Debug/Framework-Debugging/certification.manifest+++ /dev/null@@ -1,9 +0,0 @@-##VERSION: 2.0-##MODULE IP: Apache License 2.0-Module.manifest||GHIDRA||||END|-README.md||GHIDRA||||END|-data/ExtensionPoint.manifest||GHIDRA||||END|-src/main/resources/agent.log4j.xml||GHIDRA||||END|-src/main/resources/log4j-appender-console.xml||GHIDRA||||END|-src/main/resources/log4j-appender-logpanel.xml||GHIDRA||||END|-src/test/resources/ghidra/dbg/model/test_schema.xml||GHIDRA||||END|diff --git a/Ghidra/Debug/Framework-Debugging/data/ExtensionPoint.manifest b/Ghidra/Debug/Framework-Debugging/data/ExtensionPoint.manifestdeleted file mode 100644index bc87d4d105..0000000000--- a/Ghidra/Debug/Framework-Debugging/data/ExtensionPoint.manifest+++ /dev/null@@ -1 +0,0 @@-DebuggerClientFactorydiff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/AnnotatedDebuggerAttributeListener.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/AnnotatedDebuggerAttributeListener.javadeleted file mode 100644index f4b463ab6f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/AnnotatedDebuggerAttributeListener.java+++ /dev/null@@ -1,141 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--import java.lang.annotation.*;-import java.lang.invoke.MethodHandle;-import java.lang.invoke.MethodHandles.Lookup;-import java.lang.reflect.Method;-import java.lang.reflect.Parameter;-import java.util.*;--import ghidra.dbg.target.TargetObject;-import ghidra.util.Msg;--/**- * A model listener that permits {@link AttributeCallback} annotations for convenient callbacks when- * the named attribute changes- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public abstract class AnnotatedDebuggerAttributeListener implements DebuggerModelListener {- private static final String ATTR_METHODS =- "@" + AttributeCallback.class.getSimpleName() + "-annotated methods";- private static final String PARAMS_ERR =- ATTR_METHODS + " must accept 2 parameters: (TargetObject, T)";-- /**- * Annotation for a method receiving an attribute change callback- *- * <p>- * The annotated method must accept parameters {@code (TargetObject, T)}, where {@code T} is the- * type of the attribute. Currently, very little checks are applied during construction.- * Incorrect use will result in errors during callback invocation.- */- @Target(ElementType.METHOD)- @Retention(RetentionPolicy.RUNTIME)- protected @interface AttributeCallback {- String value();- }-- private static class Wiring {- private final Map<String, Set<MethodHandle>> handles = new HashMap<>();-- private Wiring(Class<?> cls, Lookup lookup) {- try {- collect(cls, lookup);- }- catch (IllegalAccessException e) {- throw new IllegalArgumentException("Lookup must have access " + ATTR_METHODS, e);- }- }-- private void collectFromClass(Class<?> cls, Lookup lookup) throws IllegalAccessException {- for (Method m : cls.getDeclaredMethods()) {- AttributeCallback annot = m.getAnnotation(AttributeCallback.class);- if (annot == null) {- continue;- }- Parameter[] parameters = m.getParameters();- if (parameters.length != 2) {- throw new IllegalArgumentException(PARAMS_ERR);- }- if (!parameters[0].getType().isAssignableFrom(TargetObject.class)) {- throw new IllegalArgumentException(PARAMS_ERR);- }- MethodHandle handle = lookup.unreflect(m);- handles.computeIfAbsent(annot.value(), __ -> new HashSet<>()).add(handle);- }- }-- private void collect(Class<?> cls, Lookup lookup) throws IllegalAccessException {- collectFromClass(cls, lookup);-- Class<?> s = cls.getSuperclass();- if (s != null) {- collect(s, lookup);- }-- for (Class<?> i : cls.getInterfaces()) {- collect(i, lookup);- }- }-- private void fireChange(AnnotatedDebuggerAttributeListener l, TargetObject object,- String name, Object value) {- Set<MethodHandle> set = handles.get(name);- if (set == null) {- return;- }- for (MethodHandle h : set) {- try {- h.invoke(l, object, value);- }- catch (Throwable e) {- Msg.error(this, "Error invoking " + h + ": " + e);- }- }- }- }-- private static final Map<Class<? extends AnnotatedDebuggerAttributeListener>, Wiring> WIRINGS_BY_CLASS =- new HashMap<>();-- private final Wiring wiring;-- public AnnotatedDebuggerAttributeListener(Lookup lookup) {- wiring = WIRINGS_BY_CLASS.computeIfAbsent(getClass(), cls -> new Wiring(cls, lookup));- }-- protected boolean checkFire(TargetObject object) {- return true;- }-- @Override- public void attributesChanged(TargetObject object, Collection<String> removed,- Map<String, ?> added) {- if (!checkFire(object)) {- return;- }- for (String name : removed) {- wiring.fireChange(this, object, name, null);- }- for (Map.Entry<String, ?> ent : added.entrySet()) {- wiring.fireChange(this, object, ent.getKey(), ent.getValue());- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebugModelConventions.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebugModelConventions.javadeleted file mode 100644index a5240dc49e..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebugModelConventions.java+++ /dev/null@@ -1,556 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.stream.Collectors;--import ghidra.async.*;-import ghidra.dbg.target.*;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathPredicates;-import ghidra.dbg.util.PathUtils;-import ghidra.dbg.util.PathUtils.PathComparator;-import ghidra.util.Msg;-import ghidra.util.Swing;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public enum DebugModelConventions {- ;-- protected static CompletableFuture<Void> runNotInSwing(Object originator, Runnable runnable,- String cbName) {- if (Swing.isSwingThread()) {- return CompletableFuture.runAsync(runnable).exceptionally(e -> {- Msg.error(originator, "Error in " + cbName, e);- return null;- });- }- try {- runnable.run();- }- catch (Throwable e) {- Msg.error(originator, "Error in " + cbName, e);- }- return AsyncUtils.nil();- }-- /**- * Search for a suitable object implementing the given interface, starting at a given seed.- *- * <p>- * This performs an n-up-1-down search starting at the given seed, seeking an object which- * implements the given interface. The 1-down part is only applied from objects implementing- * {@link TargetAggregate}. See {@link TargetObject} for the specifics of expected model- * conventions.- *- * <p>- * Note that many a debugger target object interface type require a self-referential {@code T}- * parameter referring to the implementing class type. To avoid referring to a particular- * implementation, it becomes necessary to leave {@code T} as {@code ?}, but that can never- * satisfy the constraints of this method. To work around this, such interfaces must provide a- * static {@code tclass} field, which can properly satisfy the type constraints of this method- * for such self-referential type variables. The returned value must be ascribed to the- * wild-carded type, because the work-around involves a hidden class. Perhaps a little verbose- * (hey, it's Java!), the following is the recommended pattern, e.g., to discover the- * environment of a given process:- *- * <pre>- * CompletableFuture<? extends TargetEnvironment<?>> futureEnv =- * DebugModelConventions.findSuitable(TargetEnvironment.tclass, aProcess);- * </pre>- *- * @param <T> the desired interface type.- * @param iface the (probably {@code tclass}) of the desired interface type- * @param seed the starting object- * @return a future which completes with the discovered object or completes with null, if not- * found.- * @deprecated use {@link #suitable(Class, TargetObject)} instead- */- @Deprecated(forRemoval = true)- public static <T extends TargetObject> CompletableFuture<T> findSuitable(Class<T> iface,- TargetObject seed) {- if (iface.isAssignableFrom(seed.getClass())) {- return CompletableFuture.completedFuture(iface.cast(seed));- }- if (seed instanceof TargetAggregate) {- return findInAggregate(iface, seed).thenCompose(agg -> {- if (agg.size() == 1) {- return CompletableFuture.completedFuture(agg.iterator().next());- }- return findParentSuitable(iface, seed);- });- }- return findParentSuitable(iface, seed);- }-- /**- * Search for a suitable object implementing the given interface, starting at a given seed.- *- * <p>- * This performs an n-up-m-down search starting at the given seed, seeking an object which- * implements the given interface. The m-down part is only applied from objects implementing- * {@link TargetAggregate}. See {@link TargetObject} for the specifics of expected model- * conventions.- *- * <p>- * Note that many a debugger target object interface type require a self-referential {@code T}- * parameter referring to the implementing class type. To avoid referring to a particular- * implementation, it becomes necessary to leave {@code T} as {@code ?}, but that can never- * satisfy the constraints of this method. To work around this, such interfaces must provide a- * static {@code tclass} field, which can properly satisfy the type constraints of this method- * for such self-referential type variables. The returned value must be ascribed to the- * wild-carded type, because the work-around involves a hidden class. Perhaps a little verbose- * (hey, it's Java!), the following is the recommended pattern, e.g., to discover the- * environment of a given process:- *- * <pre>- * CompletableFuture<? extends TargetEnvironment<?>> futureEnv =- * DebugModelConventions.suitable(TargetEnvironment.tclass, aProcess);- * </pre>- *- * @param <T> the desired interface type.- * @param iface the (probably {@code tclass}) of the desired interface type- * @param seed the starting object- * @return a future which completes with the discovered object or completes with null, if not- * found.- */- public static <T extends TargetObject> CompletableFuture<T> suitable(Class<T> iface,- TargetObject seed) {- List<String> path =- seed.getModel().getRootSchema().searchForSuitable(iface, seed.getPath());- if (path == null) {- return null;- }- return seed.getModel().fetchModelObject(path).thenApply(obj -> iface.cast(obj));- }-- public static <T extends TargetObject> T ancestor(Class<T> iface, TargetObject seed) {- List<String> path =- seed.getModel().getRootSchema().searchForAncestor(iface, seed.getPath());- if (path == null) {- return null;- }- return iface.cast(seed.getModel().getModelObject(path));- }-- private static <T extends TargetObject> CompletableFuture<T> findParentSuitable(Class<T> iface,- TargetObject obj) {- TargetObject parent = obj.getParent();- if (parent == null) {- return AsyncUtils.nil();- }- return findSuitable(iface, parent);- }-- /**- * Search for an object implementing the given interface among itself and its attributes.- *- * <p>- * This method descends into the attributes of objects which implement the- * {@link TargetAggregate} interface. All found objects will comes from the same "level" in the- * tree, the algorithm terminating as soon as it finds a level with at least one object having- * the interface. When it terminates, all such objects at that level will be included. The- * resulting collection is in no particular order.- *- * @param <T> the desired interface type.- * @param iface the (probably {@code tclass}) of the desired interface type- * @param seed the starting object- * @return a future which completes with the, possibly empty, collection of discovered objects- */- public static <T extends TargetObject> CompletableFuture<Collection<T>> findInAggregate(- Class<T> iface, TargetObject seed) {- return findInAggregate(iface, Set.of(seed));- }-- /**- * Search for an object implementing the given interface among those given and their attributes.- *- * <p>- * All seeds should be at the same "level", or else the result is not well defined.- *- * @see #findInAggregate(Class, TargetObject)- */- public static <T extends TargetObject> CompletableFuture<Collection<T>> findInAggregate(- Class<T> iface, Collection<? extends TargetObject> seeds) {- if (seeds.isEmpty()) {- return CompletableFuture.completedFuture(Set.of());- }- Set<T> result = seeds.stream()- .filter(obj -> iface.isAssignableFrom(obj.getClass()))- .map(obj -> iface.cast(obj))- .collect(Collectors.toSet());- if (!result.isEmpty()) {- return CompletableFuture.completedFuture(result);- }- AsyncFence fence = new AsyncFence();- Set<TargetObject> nextLevel = new HashSet<>();- for (TargetObject seed : seeds) {- if (!(seed instanceof TargetAggregate)) {- continue;- }- fence.include(seed.fetchAttributes().thenAccept(attributes -> {- synchronized (nextLevel) {- for (Map.Entry<String, ?> ent : attributes.entrySet()) {- Object val = ent.getValue();- if (!(val instanceof TargetObject)) {- continue;- }- TargetObject obj = (TargetObject) val;- if (PathUtils.isLink(seed.getPath(), ent.getKey(), obj.getPath())) {- // TODO: Resolve links? Must ensure I don't re-visit anyone- continue;- }- nextLevel.add(obj);- }- }- }));- }- return fence.ready().thenCompose(__ -> findInAggregate(iface, nextLevel));- }-- public abstract static class AncestorTraversal<T> extends CompletableFuture<T> {- public enum Result {- FOUND, CONTINUE, TERMINATE;- }-- protected TargetObject cur;-- public AncestorTraversal(TargetObject successor) {- cur = successor;- }-- protected abstract Result check(TargetObject obj);-- protected abstract T finish(TargetObject obj);-- public AncestorTraversal<T> start() {- try {- next(cur);- }- catch (Throwable ex) {- completeExceptionally(ex);- }- return this;- }-- protected void next(TargetObject ancestor) {- cur = ancestor;- if (cur == null) {- complete(null);- return;- }- switch (check(cur)) {- case FOUND:- complete(finish(cur));- return;- case CONTINUE:- next(cur.getParent());- return;- case TERMINATE:- complete(null);- return;- }- }-- protected Void exc(Throwable ex) {- completeExceptionally(ex);- return null;- }- }-- /**- * Find the nearest ancestor which implements the given interface.- *- * <p>- * This is similar to {@link #findSuitable(Class, TargetObject)}, except without the 1-down- * rule.- *- * @param <T> the type of the required interface- * @param iface the (probably {@code tclass}) for the required interface- * @param successor the seed object- * @return a future which completes with the found object or completes with null if not found.- */- public static <T extends TargetObject> CompletableFuture<T> nearestAncestor(Class<T> iface,- TargetObject successor) {- return new AncestorTraversal<T>(successor) {- @Override- protected Result check(TargetObject obj) {- if (iface.isAssignableFrom(obj.getClass())) {- return Result.FOUND;- }- return Result.CONTINUE;- }-- @Override- protected T finish(TargetObject obj) {- return iface.cast(obj);- }- }.start();- }-- /**- * Collect all ancestors (including seed) supporting the given interface- *- * @param <T> the type of interface- * @param seed the starting point- * @param iface the class of the interface- * @return the collection of ancestors supporting the interface- */- public static <T extends TargetObject> CompletableFuture<Collection<T>> collectAncestors(- TargetObject seed, Class<T> iface) {- DebuggerObjectModel model = seed.getModel();- List<T> result = new ArrayList<>(seed.getPath().size() + 1);- AsyncFence fence = new AsyncFence();- for (List<String> path = seed.getPath(); path != null; path = PathUtils.parent(path)) {- fence.include(model.fetchModelObject(path).thenAccept(obj -> {- if (iface.isAssignableFrom(obj.getClass())) {- result.add(iface.cast(obj));- }- }));- }- return fence.ready().thenApply(__ -> {- result.sort(Comparator.comparing(o -> o.getPath().size()));- return result;- });- }-- /**- * Collect all successors (including seed) that are elements supporting the given interface.- *- * @param <T> the type of interface- * @param seed the starting point (root of subtree to inspect)- * @param iface the class of the interface- * @return the collection of successor elements supporting the interface- * @deprecated use {@link TargetObjectSchema#searchFor(Class, boolean)} and- * {@link PathPredicates#collectSuccessorRefs(TargetObject)} instead.- */- // TODO: Test this method- @Deprecated(forRemoval = true)- public static <T extends TargetObject> CompletableFuture<Collection<T>> collectSuccessors(- TargetObject seed, Class<T> iface) {- Collection<T> result =- new TreeSet<>(Comparator.comparing(TargetObject::getPath, PathComparator.KEYED));- AsyncFence fence = new AsyncFence();- fence.include(seed.fetchElements().thenCompose(elements -> {- AsyncFence elemFence = new AsyncFence();- synchronized (result) {- for (TargetObject e : elements.values()) {- if (iface.isInstance(e)) {- result.add(iface.cast(e));- continue;- }- elemFence.include(collectSuccessors(e, iface).thenAccept(sub -> {- synchronized (result) {- result.addAll(sub);- }- }));- }- }- return elemFence.ready();- }));- fence.include(seed.fetchAttributes().thenCompose(attributes -> {- AsyncFence attrFence = new AsyncFence();- synchronized (result) {- for (Map.Entry<String, ?> ent : attributes.entrySet()) {- Object val = ent.getValue();- if (!(val instanceof TargetObject)) {- continue;- }- TargetObject a = (TargetObject) val;- if (PathUtils.isLink(seed.getPath(), ent.getKey(), a.getPath())) {- continue;- }- if (iface.isInstance(a)) {- result.add(iface.cast(a));- continue;- }- attrFence.include(collectSuccessors(a, iface).thenAccept(sub -> {- synchronized (result) {- result.addAll(sub);- }- }));- }- }- return attrFence.ready();- }));- return fence.ready().thenApply(__ -> {- return result;- });- }-- /**- * Find the nearest ancestor thread- *- * @param successor the seed object- * @return a future which completes with the found thread or completes with {@code null}.- */- public static CompletableFuture<TargetThread> findThread(TargetObject successor) {- return new AncestorTraversal<TargetThread>(successor) {- @Override- protected Result check(TargetObject obj) {- if (obj.isRoot()) {- return Result.TERMINATE;- }- if (obj instanceof TargetThread) {- return Result.FOUND;- }- return Result.CONTINUE;- }-- @Override- protected TargetThread finish(TargetObject obj) {- return (TargetThread) obj;- }- }.start();- }-- /**- * Check if the given process is alive- *- * @param process the process- * @return true if alive- */- public static boolean isProcessAlive(TargetProcess process) {- if (!process.isValid()) {- return false;- }- if (!(process instanceof TargetExecutionStateful)) {- return true;- }- TargetExecutionStateful exe = (TargetExecutionStateful) process;- TargetExecutionState state = exe.getExecutionState();- if (state == null) {- Msg.trace(null, "null state for " + exe);- return false;- }- return state.isAlive();- }-- /**- * Check if a target is a live process, and cast if so- *- * @param target the potential process- * @return the process if live, or null- */- public static TargetProcess liveProcessOrNull(TargetObject target) {- if (!(target instanceof TargetProcess)) {- return null;- }- TargetProcess process = (TargetProcess) target;- return isProcessAlive(process) ? process : null;- }-- public static class AsyncAttribute<T> extends AsyncReference<T, Void>- implements DebuggerModelListener {- private final TargetObject obj;- private final String name;-- @SuppressWarnings("unchecked")- public AsyncAttribute(TargetObject obj, String name) {- this.name = name;- this.obj = obj;- obj.getModel().addModelListener(this);- set((T) obj.getCachedAttribute(name), null);- obj.fetchAttribute(name).exceptionally(ex -> {- Msg.error(this, "Could not get initial value of " + name + " for " + obj, ex);- return null;- });- }-- @Override- @SuppressWarnings("unchecked")- public void attributesChanged(TargetObject parent, Collection<String> removed,- Map<String, ?> added) {- if (parent != obj) {- return;- }- if (added.containsKey(name)) {- set((T) added.get(name), null);- }- else if (removed.contains(name)) {- set(null, null);- }- }-- public void dispose() {- this.dispose(new AssertionError("disposed"));- }-- @Override- public void dispose(Throwable reason) {- super.dispose(reason);- obj.getModel().removeModelListener(this);- }- }-- public static class AsyncState extends AsyncAttribute<TargetExecutionState> {- public AsyncState(TargetExecutionStateful stateful) {- super(stateful, TargetExecutionStateful.STATE_ATTRIBUTE_NAME);- }- }-- public static class AsyncAccess extends AsyncAttribute<Boolean> {- public AsyncAccess(TargetAccessConditioned ac) {- super(ac, TargetAccessConditioned.ACCESSIBLE_ATTRIBUTE_NAME);- }- }-- /**- * Request activation of the given object in its nearest active scope- *- * <p>- * Note if the object has no suitable active scope, this method fails silently.- *- * @param obj the object on which to request activation- * @return a future which completes when activation is granted, or exceptionally- */- public static CompletableFuture<Void> requestActivation(TargetObject obj) {- CompletableFuture<? extends TargetActiveScope> futureActivator =- DebugModelConventions.findSuitable(TargetActiveScope.class, obj);- return futureActivator.thenCompose(activator -> {- if (activator == null) {- return AsyncUtils.nil();- }- return activator.requestActivation(obj);- });- }-- /**- * Request focus on the given object in its nearest focus scope- *- * <p>- * Note if the object has no suitable focus scope, this method fails silently.- *- * @param obj the object on which to request focus- * @return a future which completes when focus is granted, or exceptionally- */- public static CompletableFuture<Void> requestFocus(TargetObject obj) {- CompletableFuture<? extends TargetFocusScope> futureScope =- DebugModelConventions.findSuitable(TargetFocusScope.class, obj);- return futureScope.thenCompose(scope -> {- if (scope == null) {- return AsyncUtils.nil();- }- return scope.requestFocus(obj);- });- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerAbnormalModelClosedReason.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerAbnormalModelClosedReason.javadeleted file mode 100644index 545adcc829..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerAbnormalModelClosedReason.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--@Deprecated(forRemoval = true, since = "11.2")-class DebuggerAbnormalModelClosedReason implements DebuggerModelClosedReason {- final Throwable exc;-- public DebuggerAbnormalModelClosedReason(Throwable exc) {- this.exc = exc;- }-- @Override- public boolean hasException() {- return true;- }-- @Override- public boolean isClientInitiated() {- return false;- }-- @Override- public Throwable getException() {- return exc;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelClosedReason.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelClosedReason.javadeleted file mode 100644index 0a6f0ecdec..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelClosedReason.java+++ /dev/null@@ -1,63 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--/**- * A reason given for a closed connection- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface DebuggerModelClosedReason {- DebuggerModelClosedReason NORMAL = DebuggerNormalModelClosedReason.NORMAL;-- static DebuggerModelClosedReason normal() {- return NORMAL;- }-- static DebuggerModelClosedReason abnormal(Throwable exc) {- return new DebuggerAbnormalModelClosedReason(exc);- }-- /**- * Check for exceptional cause for the closed model- *- * <p>- * Usually, if the model is closed unexpectedly, there is an exception to document the cause. If- * available, the implementation should provide this exception.- *- * @return true if an exception is recorded- */- boolean hasException();-- /**- * Check if the model was closed by the client- *- * <p>- * In this case, the closed model is completely ordinary. While the model is still no longer- * valid, there is no cause to alert the user.- *- * @return true if the model was closed by the client- */- boolean isClientInitiated();-- /**- * Get the recorded exception, if available- *- * @return the exception or null- */- Throwable getException();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelFactory.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelFactory.javadeleted file mode 100644index a2699b8e36..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelFactory.java+++ /dev/null@@ -1,70 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--import ghidra.dbg.util.ConfigurableFactory;-import ghidra.program.model.listing.Program;-import ghidra.util.classfinder.ExtensionPoint;--/**- * A factory for a debugger model- *- * <p>- * This provides a discoverable means of configuring and creating a debug model.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface DebuggerModelFactory- extends ExtensionPoint, ConfigurableFactory<DebuggerObjectModel> {-- /**- * Get the priority for selecting this factory by default for the given program- *- * <p>- * A default factory is selected when the current factory and the last successful factory are- * incompatible with the current program, or if this is the very first time connecting. Of those- * factories compatible with the current program, the one with the highest priority (larger- * numerical value) is selected. If none are compatible, then the current selection is left as- * is.- *- * <p>- * Note that negative priorities imply the factory is not compatible with the given program or- * local system.- *- * @param program the current program, or null- * @return the priority, higher values mean higher priority- */- default int getPriority(Program program) {- return 0;- }-- /**- * Check if this factory is compatible with the local system and given program.- *- * <p>- * <b>WARNING:</b> Implementations should not likely override this method. If one does, it must- * behave in the same manner as given in this default implementation: If- * {@link #getPriority(Program)} would return a non-negative result for the program, then this- * factory is compatible with that program. If negative, this factory is not compatible.- *- * @param program the current program, or null- * @return true if compatible- */- default boolean isCompatible(Program program) {- return getPriority(program) >= 0;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelListener.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelListener.javadeleted file mode 100644index 0c0d410117..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerModelListener.java+++ /dev/null@@ -1,323 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--import java.util.*;--import ghidra.dbg.error.DebuggerMemoryAccessException;-import ghidra.dbg.target.*;-import ghidra.dbg.target.TargetConsole.Channel;-import ghidra.dbg.target.TargetEventScope.TargetEventType;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.program.model.address.Address;-import ghidra.program.model.address.AddressRange;-import ghidra.util.Msg;--/**- * A listener for events related to the debugger model, including its connection and objects- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface DebuggerModelListener {-- /**- * An error occurred such that this listener will no longer receive events- *- * @param t the exception describing the error- */- default public void catastrophic(Throwable t) {- Msg.error(this, "Catastrophic listener error", t);- }-- /**- * The model has been successfully opened- *- * <p>- * For example, the connection to a debugger daemon has been established and negotiated.- */- default public void modelOpened() {- }-- /**- * The model's state has changed, prompting an update to its description- */- default public void modelStateChanged() {- }-- /**- * The model was closed- *- * <p>- * For example, the remote closed the connection, or the connection was lost. Whatever the case,- * the model is invalid after this callback.- *- * @param reason the reason for the model to close- */- default public void modelClosed(DebuggerModelClosedReason reason) {- }-- /**- * An object was created- *- * <p>- * This can only be received by listening on the model. While the created object can now appear- * in other callbacks, it should not be used aside from those callbacks, until it is added to- * the model. Until that time, the object may not adhere to the schema, since its children are- * still being initialized.- *- * @param object the newly-created object- */- default void created(TargetObject object) {- }-- /**- * An object is no longer valid- *- * <p>- * This should be the final callback ever issued for this object. Invalidation of an object- * implies invalidation of all its successors; nevertheless, the implementation MUST explicitly- * invoke this callback for those successors in preorder. Users need only listen for- * invalidation by installing a listener on the object of interest. However, a user must be able- * to ignore invalidation events on an object it has already removed and/or invalidated. The- * {@code branch} parameter will identify the branch node of the sub-tree being removed. For- * models that are managed by a client connection, disconnecting or otherwise terminating the- * session should invalidate the root, and thus every object must receive this callback.- *- * <p>- * If an invalidated object is replaced (i.e., a new object with the same path is added to the- * model), the implementation must be careful to issue all invalidations related to the removed- * object before the replacement is added, so that delayed invalidations are not mistakenly- * applied to the replacement or its successors.- *- * @param object the now-invalid object- * @param branch the root of the sub-tree being invalidated- * @param reason an informational, human-consumable reason, if applicable- */- default void invalidated(TargetObject object, TargetObject branch, String reason) {- }-- /**- * The root object has been added to the model- *- * <p>- * This indicates the root is ready, not just {@link #created(TargetObject)}. Note this callback- * indicates the root being "added to the model."- *- * @param root the root object- */- default public void rootAdded(TargetObject root) {- }-- /**- * The object's elements changed- *- * <p>- * The listener must have received a prior {@link #created(TargetObject)} callback for the- * parent and all (object-valued) elements being added. Assuming {@code object} has already been- * "added the model," this callback indicates all objects in the {@code added} parameter being- * "added to the model" along with their successors.- *- * @param object the object whose children changed- * @param removed the list of removed children- * @param added a map of indices to new children references- */- default void elementsChanged(TargetObject object, Collection<String> removed,- Map<String, ? extends TargetObject> added) {- }-- /**- * The object's attributes changed- *- * <p>- * In the case of an object-valued attribute, changes to that object do not constitute a changed- * attribute. The attribute is considered changed only when that attribute is assigned to a- * completely different object.- *- * @param object the object whose attributes changed- * @param removed the list of removed attributes- * @param added a map of names to new/changed attributes- */- default void attributesChanged(TargetObject object, Collection<String> removed,- Map<String, ?> added) {- }-- /**- * The model has requested the client invalidate (non-tree) caches associated with an object- *- * <p>- * For objects with methods exposing contents other than elements and attributes (e.g., memory- * and register contents), this callback requests that any caches associated with that content- * be invalidated. Most notably, this usually occurs when an object (e.g., thread) enters the- * {@link TargetExecutionState#RUNNING} state, to inform proxies that they should invalidate- * their memory and register caches. In most cases, clients need not worry about this callback.- * Protocol implementations that use the model, however, should forward this request to the- * client-side peer.- *- * <p>- * Note caches of elements and attributes are not affected by this callback. See- * {@link TargetObject#invalidateCaches()}.- *- * @param object the object whose caches must be invalidated- */- default void invalidateCacheRequested(TargetObject object) {- }-- /**- * A breakpoint trapped execution- *- * <p>- * The program counter can be obtained in a few ways. The most reliable is to get the address of- * the breakpoint location. If available, the frame will also contain the program counter.- * Finally, the trapped object or one of its relatives may offer the program counter.- *- * @param container the container whose breakpoint trapped execution- * @param trapped the object whose execution was trapped, usually a {@link TargetThread}- * @param frame the innermost stack frame, if available, of the trapped object- * @param spec the breakpoint specification- * @param breakpoint the breakpoint location that actually trapped execution- */- default void breakpointHit(TargetObject container, TargetObject trapped,- TargetStackFrame frame, TargetBreakpointSpec spec,- TargetBreakpointLocation breakpoint) {- }-- /**- * A console has produced output (given as bytes)- *- * <p>- * Note that "captured" outputs will not be reported in this callback. See- * {@link TargetInterpreter#executeCapture(String)}.- *- * @param console the console producing the output- * @param channel identifies the "output stream", stdout or stderr- * @param data the output data- */- default void consoleOutput(TargetObject console, Channel channel, byte[] data) {- }-- /**- * A console has produced output (given as a string)- *- * @implNote Overriding this method is not a substitute for overriding- * {@link #consoleOutput(TargetObject, Channel, byte[])}. Some models may invoke this- * {@code String} variant as a convenience, which by default, invokes the- * {@code byte[]} variant, but models are only expected to invoke the {@code byte[]}- * variant. A client may override this method simply to avoid back-and-forth- * conversions between {@code String}s and {@code byte[]}s.- *- * @param console the console producing the output- * @param channel identifies the "output stream", stdout or stderr- * @param text the output text- */- default void consoleOutput(TargetObject console, Channel channel, String text) {- consoleOutput(console, channel, text.getBytes(TargetConsole.CHARSET));- }-- /**- * A "special" event has occurred- *- * <p>- * When present, this callback must be invoked before any other callback which results from this- * event, except creation events. E.g., for PROCESS_EXITED, this must be called before the- * affected process is invalidated.- *- * <p>- * Whenever possible, event thread must be given. This is often the thread given focus by the- * debugger immediately upon stopping for the event. Parameters are not (yet) strictly- * specified, but it should include the stopped target, if that target is not already given by- * the event thread. It may optionally contain other useful information, such as an exit code,- * but no client should depend on that information being given.- *- * <p>- * The best way to communicate to users what has happened is via the description. Almost every- * other result of an event is communicated by other means in the model, e.g., state changes,- * object creation, invalidation. The description should contain as much information as possible- * to cue users as to why the other changes have occurred, and point them to relevant objects.- * For example, if trapped on a breakpoint, the description might contain the breakpoint's- * identifier. If the debugger prints a message for this event, that message is probably a- * sufficient description.- *- * @param object the event scope- * @param eventThread if applicable, the thread causing the event- * @param type the type of event- * @param description a human-readable description of the event- * @param parameters extra parameters for the event. TODO: Specify these for each type, or break- * this into other callbacks.- */- default void event(TargetObject object, TargetThread eventThread, TargetEventType type,- String description, List<Object> parameters) {- }-- /**- * Memory was successfully read or written- *- * <p>- * This implies memory caches should be updated. If the implementation employs a cache, then it- * need only report reads or writes which updated that cache. However, that cache must be- * invalidated whenever any other event occurs which could change memory, e.g., the target- * stepping or running. See {@link #invalidateCacheRequested(TargetObject)}. If the- * implementation does not employ a cache, then it must report <em>every</em> successful- * client-driven read or write. If the implementation can detect <em>debugger-driven</em> memory- * reads and writes, then it is recommended to call this method for those events. However, this- * method <em>must not</em> be called for <em>target-driven</em> memory changes. In other words,- * this method should only be called for reads or writes requested by the user.- *- * @param memory this memory object- * @param address the starting address of the affected range- * @param data the new data for the affected range- */- default void memoryUpdated(TargetObject memory, Address address, byte[] data) {- }-- /**- * An attempt to read memory failed- *- * <p>- * Like {@link #memoryUpdated(TargetMemory, Address, byte[])}, this should only be invoked for- * <em>user-driven</em> requests. Failure of the <em>target</em> to read its own memory would- * likely be reported via an exception, not this callback.- *- * @param memory the memory object- * @param range the range for the read which generated the error- * @param e the error- */- default void memoryReadError(TargetObject memory, AddressRange range,- DebuggerMemoryAccessException e) {- }-- /**- * Registers were successfully read or written- *- * <p>- * This implies register caches should be updated. If the implementation employs a cache, then- * it need only report reads or writes which updated that cache. However, that cache must be- * invalidated whenever any other event occurs which could change register values, e.g., the- * target stepping or running. See {@link #invalidateCacheRequested(TargetObject)}. If the- * implementation does not employ a cache, then it must report <em>every</em> successful- * client-driven read or write. If the implementation can detect <em>debugger-driven</em>- * register reads and writes, then it recommended to call this method for those events. However,- * this method <em>must not</em> be called for <em>target-driven</em> register changes, except- * perhaps when the target becomes suspended. Note that some models may additionally provide a- * {@code value} attribute on each register -- when the register bank is its own description- * container -- however, updating those attributes is not a substitute for this callback.- *- * @param bank this register bank object- * @param updates a name-value map of updated registers- */- default void registersUpdated(TargetObject bank, Map<String, byte[]> updates) {- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerNormalModelClosedReason.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerNormalModelClosedReason.javadeleted file mode 100644index 10ac7111d1..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerNormalModelClosedReason.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--@Deprecated(forRemoval = true, since = "11.2")-enum DebuggerNormalModelClosedReason implements DebuggerModelClosedReason {- NORMAL;-- @Override- public boolean hasException() {- return false;- }-- @Override- public boolean isClientInitiated() {- return true;- }-- @Override- public Throwable getException() {- return null;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerObjectModel.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerObjectModel.javadeleted file mode 100644index fdbf51782f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerObjectModel.java+++ /dev/null@@ -1,614 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.concurrent.RejectedExecutionException;-import java.util.function.Predicate;--import ghidra.async.*;-import ghidra.dbg.error.*;-import ghidra.dbg.target.TargetMemory;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.ResyncMode;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.*;-import ghidra.util.Msg;--/**- * A debugger model, often a connection to an external debugger- *- * <p>- * This is an abstraction of debugger operations and attempts to limit assumptions to those that- * generalize to most platforms. Debuggers and the target processes may be temperamental, so an- * asynchronous pattern is employed to prevent deadlocks on dropped connections, slow connections,- * buggy daemons, etc.- *- * <p>- * For methods returning a {@link CompletableFuture}, the documentation describes its return value- * assuming successful completion. Any of the futures may complete exceptionally.- *- * <p>- * The completion of any future returned by a method does not imply any state change in the- * debugger. It merely acknowledges that the request was received by the debugger. Only listener- * callbacks confirm or otherwise communicate actual state changes. If, in the underlying protocol,- * confirmation of a request implies a state change, then the implementation must make the- * appropriate callbacks.- *- * <p>- * The model object only exposes the connection state and a root object. The model comprises an- * arbitrary tree of {@link TargetObject}s each supporting zero or more discoverable interfaces. The- * debugging framework provides a number of "stock" interfaces which should be sufficient to model- * most debuggers. The tree is how the client accesses objects, e.g., processes and threads, on the- * target.- *- * <p>- * Users and implementors of this interface may find {@link AsyncUtils} useful. An implementation of- * this interface should never block the calling thread to wait on an external event, otherwise, you- * risk deadlocking Ghidra's UI.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface DebuggerObjectModel {-- public static enum RefreshBehavior {- REFRESH_ALWAYS {- @Override- public boolean isRefresh(Collection<?> col) {- return true;- }- },- REFRESH_NEVER {- @Override- public boolean isRefresh(Collection<?> col) {- return false;- }- },- REFRESH_WHEN_ABSENT {- @Override- public boolean isRefresh(Collection<?> col) {- return col.isEmpty();- }- };-- public abstract boolean isRefresh(Collection<?> col);- }-- public static final TypeSpec<Map<String, ? extends TargetObject>> ELEMENT_MAP_TYPE =- TypeSpec.auto();- public static final TypeSpec<Map<String, ?>> ATTRIBUTE_MAP_TYPE = TypeSpec.auto();-- /**- * Check that a given {@link TargetObject} interface has a name- *- * <p>- * Names are assigned using the {@link DebuggerTargetObjectIface} annotation.- *- * @implNote To be language agnostic, we never use the name of the Java implementation of the- * interface.- *- * @param iface the class of the interface- * @return the name of the interface- * @throws IllegalArgumentException if the interface is not annotated- */- public static String requireIfaceName(Class<? extends TargetObject> iface) {- DebuggerTargetObjectIface annot = iface.getAnnotation(DebuggerTargetObjectIface.class);- if (annot == null) {- throw new IllegalArgumentException(iface + " has no @" +- DebuggerTargetObjectIface.class.getSimpleName() + " annotation.");- }- return annot.value();- }-- /**- * Check that the given value is not null- *- * @param <T> the type of the value- * @param val the value- * @param path the path where the value was expected- * @return the non-null value- * @throws DebuggerModelNoSuchPathException if -val- is null- */- public static <T> T requireNonNull(T val, List<String> path) {- if (val == null) {- throw new DebuggerModelNoSuchPathException("Path " + path + " does not exist");- }- return val;- }-- /**- * Check that the given object is non-null and supports a required interface- *- * <p>- * Because most of the {@link TargetObject} interfaces have a (self-referential) type parameter,- * this call will most likely be on its own line, assigned to a variable of the interface type- * using a wildcard {@code <?>} parameter. Otherwise, raw types get involved, making things- * rather messy.- *- * @param <T> the type of the interface- * @param iface the class for the interface- * @param obj the object to check- * @param path the path where the object was expected- * @return the (non-null) object cast to the required interface- * @throws DebuggerModelNoSuchPathException if -obj- is null- * @throws DebuggerModelTypeException if -obj- does not support -iface-- */- public static <T extends TargetObject> T requireIface(Class<T> iface, TargetObject obj,- List<String> path) {- requireNonNull(obj, path);- String name = requireIfaceName(iface);- if (iface.isAssignableFrom(obj.getClass())) {- return iface.cast(obj);- }- throw new DebuggerModelTypeException("Object " + path + " is missing " + name);- }-- /**- * Get a brief description of the client, suitable for display in lists- *- * @return the description- */- public default String getBrief() {- return toString();- }-- /**- * Add a listener for model events- *- * <p>- * If requested, the listener is notified of existing objects via an event replay. It will first- * replay all the created events in the same order they were originally emitted. Any objects- * which have since been invalidated are excluded in the replay. They don't exist anymore, after- * all. Next it will replay the attribute- and element-added events in post order. This is an- * attempt to ensure an object's dependencies are met by the time the client receives its added- * event. This isn't always possible due to cycles, but such cycles are usually informational.- *- * @param listener the listener- * @param replay true to replay object tree events (doesn't include register or memory caches)- */- public void addModelListener(DebuggerModelListener listener, boolean replay);-- /**- * Add a listener for model events, without replay- *- * @param listener the listener- */- public default void addModelListener(DebuggerModelListener listener) {- addModelListener(listener, false);- }-- /**- * Remove a model event listener- *- * @param listener the listener- */- public void removeModelListener(DebuggerModelListener listener);-- /**- * Check if the model believes it is alive- *- * <p>- * Basically, this should be true if the model has started, but not yet terminated. To test- * whether the model is actually responsive, use {@link #ping(String)}.- *- * @return true if alive- */- public boolean isAlive();-- /**- * Get the schema of this model, i.e., the schema of its root object.- *- * <p>- * The schema may not be known until the model has been successfully opened. Some factories will- * ensure success before providing the model, but this may not always be the case. Callers- * should listen for {@link DebuggerModelListener#modelOpened()} or retrieve the root object- * first.- *- * @return the root schema- */- public default TargetObjectSchema getRootSchema() {- return EnumerableTargetObjectSchema.OBJECT;- }-- /**- * Check if the debugger agent is alive (optional operation)- *- * <p>- * For models providing such a mechanism, check if the debugger is alive and able to process- * commands. Even if an explicit "ping" command is not available, an implementor is encouraged- * to use some sort of NOP or echo command to test for responsiveness.- *- * @param content some content to optionally incorporate into the test- * @return a future that completes when the daemon is verified to be alive- */- public CompletableFuture<Void> ping(String content);-- /**- * Check that a given reference (or object) belongs to this model- *- * <p>- * As a convenience, this method takes an expected class and casts -ref- to it. This is meant- * only to cast to an implementation-specific type, not for checking that an object supports a- * given interface. Use {@link #requireIface(Class, TargetObject, List)} for interface checking.- *- * @param <T> the required implementation-specific type- * @param cls the class for the required type- * @param obj the object to check- * @return the object, cast to the desired typed- * @throws DebuggerIllegalArgumentException if {@code obj} does not belong to this model- */- default <T extends TargetObject> T assertMine(Class<T> cls, TargetObject obj) {- if (obj.getModel() != this) {- throw new DebuggerIllegalArgumentException(- "TargetObject " + obj + " does not belong to this model");- }- return cls.cast(obj);- }-- /**- * Fetch the attributes of a given model path- *- * <p>- * Giving an empty path will retrieve the attributes of the root object. If the path does not- * exist, the future completes with {@code null}.- *- * @param path the path- * @param refresh true to invalidate caches involved in handling this request- * @return a future map of attributes- */- public CompletableFuture<? extends Map<String, ?>> fetchObjectAttributes(List<String> path,- RefreshBehavior refresh);-- /**- * Fetch the attributes of the given model path, without refreshing- *- * @see #fetchObjectAttributes(List, RefreshBehavior)- */- public default CompletableFuture<? extends Map<String, ?>> fetchObjectAttributes(- List<String> path) {- return fetchObjectAttributes(path, RefreshBehavior.REFRESH_NEVER);- }-- /**- * @see #fetchObjectAttributes(List)- */- public default CompletableFuture<? extends Map<String, ?>> fetchObjectAttributes(- String... path) {- return fetchObjectAttributes(List.of(path));- }-- /**- * Fetch the elements of a given model path- *- * <p>- * Giving an empty path will retrieve all the top-level objects, i.e., elements of the root. If- * the path does not exist, the future completes with {@code null}.- *- * @param path the path- * @param refresh true to invalidate caches involved in handling this request- * @return a future map of elements- */- public CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchObjectElements(- List<String> path, RefreshBehavior refresh);-- /**- * Fetch the elements of the given model path, without refreshing- *- * @see #fetchObjectElements(List, RefreshBehavior)- */- public default CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchObjectElements(- List<String> path) {- return fetchObjectElements(path, RefreshBehavior.REFRESH_NEVER);- }-- /**- * @see #fetchObjectElements(List)- */- public default CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchObjectElements(- String... path) {- return fetchObjectElements(List.of(path));- }-- /**- * Fetch the root object of the model- *- * <p>- * The root is a virtual object to contain all the top-level objects of the model tree. This- * object represents the debugger itself. Note in most cases {@link #getModelRoot()} is- * sufficient; however, if you've just created the model, it is prudent to wait for it to create- * its root. For asynchronous cases, just listen for the root-creation and -added events. This- * method returns a future which completes after the root-added event.- *- * @return a future which completes with the root- */- public CompletableFuture<? extends TargetObject> fetchModelRoot();-- /**- * Get the root object of the model- *- * @return the root or {@code null} if it hasn't been created, yet- */- public TargetObject getModelRoot();-- /**- * Fetch the value at the given path- *- * @param path the path of the value- * @return a future completing with the value or with {@code null} if the path does not exist- */- public CompletableFuture<?> fetchModelValue(List<String> path);-- /**- * Fetch a model value, optionally refreshing caches along the path- *- * <p>- * By convention, no attribute nor element may have a {@code null} value. Thus, a {@code null}- * return value always indicates the path does not exist.- *- * <p>- * When refresh is true, only the applicable cache at each successor is refreshed. For example,- * when the path is {@code A.B[1].C[2]}, then only {@code B}'s and {@code C}'s element caches- * are refreshed; and {@code A}'s, {@code B[1]}'s, and {@code C[2]}'s attribute caches are- * refreshed.- *- * @param path the path- * @param refresh true to refresh caches- * @return the found value, or {@code null} if it does not exist- */- public CompletableFuture<?> fetchModelValue(List<String> path, RefreshBehavior refresh);-- /**- * @see #fetchModelValue(List)- */- public default CompletableFuture<?> fetchModelValue(String... path) {- return fetchModelValue(List.of(path));- }-- /**- * Get the value at a given path- *- * <p>- * If the path does not exist, null is returned. Note that an attempt to access the child of a- * primitive is the same as accessing a path that does not exist; however, an error will be- * logged, since this typically indicates a programming error.- *- * @param path the path- * @return the value- */- public default Object getModelValue(List<String> path) {- Object cur = getModelRoot();- for (String key : path) {- if (cur == null) {- return null;- }- if (!(cur instanceof TargetObject)) {- Msg.error(this, "Primitive " + cur + " cannot have child '" + key + "'");- return null;- }- TargetObject obj = (TargetObject) cur;- if (PathUtils.isIndex(key)) {- cur = obj.getCachedElements().get(PathUtils.parseIndex(key));- continue;- }- assert PathUtils.isName(key);- cur = obj.getCachedAttribute(key);- }- return cur;- }-- /**- * Fetch the object with the given path- *- * <p>- * If the value at the path is a link, this will attempt to fetch it.- *- * @param path the path of the object- * @param refresh ignore the cache- * @return a future completing with the object or with {@code null} if it does not exist- * @throws DebuggerModelTypeException if the value at the path is not a {@link TargetObject}- */- public default CompletableFuture<? extends TargetObject> fetchModelObject(List<String> path,- RefreshBehavior refresh) {- return fetchModelValue(path, refresh).thenApply(v -> {- if (v == null) {- return null;- }- if (!(v instanceof TargetObject)) {- throw DebuggerModelTypeException.typeRequired(v, path, TargetObject.class);- }- return (TargetObject) v;- });- }-- /**- * Get an object from the model, resyncing according to the schema- *- * <p>- * This is necessary when an object in the path has a resync mode other than- * {@link ResyncMode#NEVER} for the child being retrieved. Please note that some synchronization- * may still be required on the client side, since accessing the object before it is created- * will cause a {@code null} completion.- *- * @return a future that completes with the object or with {@code null} if it doesn't exist- */- @Deprecated- public default CompletableFuture<? extends TargetObject> fetchModelObject(List<String> path) {- return fetchModelObject(path, RefreshBehavior.REFRESH_NEVER);- }-- /**- * Get an object from the model- *- * <p>- * Note this may return an object which is still being constructed, i.e., between being created- * and being added to the model. This differs from {@link #getModelValue(List)}, which will only- * return an object after it has been added. This method also never follows links.- *- * @param path the path of the object- * @return the object or {@code null} if it doesn't exist- */- public TargetObject getModelObject(List<String> path);-- /**- * Get all created objects matching a given predicate- *- * <p>- * Note the predicate is executed while holding an internal model-wide lock. Be careful and keep- * it simple.- *- * @param predicate the predicate- * @return the set of matching objects- */- public Set<TargetObject> getModelObjects(Predicate<? super TargetObject> predicate);-- /**- * @see #fetchModelObject(List)- */- @Deprecated- public default CompletableFuture<? extends TargetObject> fetchModelObject(String... path) {- return fetchModelObject(List.of(path));- }-- /**- * @see #getModelObject(List)- */- public default TargetObject getModelObject(String... path) {- return getModelObject(List.of(path));- }-- /**- * Fetch the attribute with the given path- *- * Note that model implementations should avoid nullable attributes, since a null-valued- * attribute cannot easily be distinguished from a non-existent attribute.- *- * @param path the path of the attribute- * @return a future that completes with the value or with {@code null} if it does not exist- */- public default CompletableFuture<?> fetchObjectAttribute(List<String> path) {- return fetchModelObject(PathUtils.parent(path)).thenApply(- parent -> parent == null ? null : parent.fetchAttribute(PathUtils.getKey(path)));- }-- /**- * @see #fetchObjectAttribute(List)- */- public default CompletableFuture<?> getObjectAttribute(String... path) {- return fetchObjectAttribute(List.of(path));- }-- /**- * Get a factory for target addresses- *- * <p>- * Technically, putting this here instead of just {@link TargetMemory} imposes a subtle- * limitation: All targets in the model have to have the same factory. I'm not certain that's a- * huge concern at this point. The alternative is that the memory mapper has to accept and- * compose new address factories, or we need a separate mapper per factory encountered along- * with a mechanism to choose the correct one.- *- * @return the factory- */- public AddressFactory getAddressFactory();-- /**- * TODO Document me- *- * @param name- * @return- */- default public AddressSpace getAddressSpace(String name) {- return getAddressFactory().getAddressSpace(name);- }-- /**- * TODO Document me- *- * @param space- * @param offset- * @return- */- public default Address getAddress(String space, long offset) {- if (Address.NO_ADDRESS.getAddressSpace().getName().equals(space)) {- return Address.NO_ADDRESS;- }- return getAddressSpace(space).getAddress(offset);- }-- /**- * Invalidate the caches for every object known locally.- *- * <p>- * Unlike, {@link TargetObject#invalidateCaches()}, this does not push the request to a remote- * object. If the objects are proxies, just the proxies' caches are cleared. Again, this does- * not apply to caches for the objects' children.- */- public void invalidateAllLocalCaches();-- /**- * Close the session and dispose the model- *- * <p>- * For local sessions, terminate the debugger. For client sessions, disconnect.- *- * @return a future which completes when the session is closed- */- public CompletableFuture<Void> close();-- /**- * A convenience for reporting errors conditionally- *- * <p>- * If the message is ignorable, e.g., a {@link DebuggerModelTerminatingException}, then the- * report will be reduced to a stack-free warning.- *- * @param origin the object producing the error- * @param message the error message- * @param ex the exception- */- default void reportError(Object origin, String message, Throwable ex) {- Throwable unwrapped = AsyncUtils.unwrapThrowable(ex);- if (ex == null || DebuggerModelTerminatingException.isIgnorable(ex)) {- Msg.warn(origin, message + ": " + ex);- }- else if (unwrapped instanceof RejectedExecutionException) {- Msg.trace(origin, "Ignoring rejection", ex);- }- else if (unwrapped instanceof DisposedException) {- Msg.trace(origin, "Ignoring disposal", ex);- }- else {- Msg.error(origin, message, ex);- }- }-- /**- * Permit all callbacks to be invoked before proceeding- *- * <p>- * This operates by placing the request into the queue itself, so that any event callbacks- * queued <em>at the time of the flush invocation</em> are completed first. There are no- * guarantees with respect to events which get queued <em>after the flush invocation</em>.- *- * @return a future which completes when all queued callbacks have been invoked- */- CompletableFuture<Void> flushEvents();--}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerObjectModelWithMemory.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerObjectModelWithMemory.javadeleted file mode 100644index 14daf0c9ae..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerObjectModelWithMemory.java+++ /dev/null@@ -1,27 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--import ghidra.dbg.target.TargetMemory;-import ghidra.dbg.target.TargetObject;-import ghidra.program.model.address.Address;--@Deprecated(forRemoval = true, since = "11.2")-public interface DebuggerObjectModelWithMemory {-- TargetMemory getMemory(TargetObject target, Address address, int length);--}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerTargetObjectIface.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerTargetObjectIface.javadeleted file mode 100644index 4575475098..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/DebuggerTargetObjectIface.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg;--import java.lang.annotation.*;--import ghidra.dbg.target.TargetObject;--/**- * Annotation to assign the name of a target object interface to its Java implementation, an- * interface extending {@link TargetObject}.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@Retention(RetentionPolicy.RUNTIME)-@Target(ElementType.TYPE)-public @interface DebuggerTargetObjectIface {- /**- * The name of the interface- */- String value();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AbstractDebuggerObjectModel.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AbstractDebuggerObjectModel.javadeleted file mode 100644index 425df72d06..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AbstractDebuggerObjectModel.java+++ /dev/null@@ -1,288 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import java.util.*;-import java.util.concurrent.*;-import java.util.function.Predicate;-import java.util.stream.Collectors;--import org.apache.commons.lang3.concurrent.BasicThreadFactory;--import ghidra.async.AsyncUtils;-import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.PathUtils;-import ghidra.util.Msg;-import ghidra.util.datastruct.ListenerSet;-import ghidra.util.datastruct.PrivatelyQueuedListener;--@Deprecated(forRemoval = true, since = "11.2")-public abstract class AbstractDebuggerObjectModel implements SpiDebuggerObjectModel {- public final Object lock = new Object();- public final Object cbLock = new Object();- protected final ExecutorService clientExecutor = Executors.newSingleThreadExecutor(- new BasicThreadFactory.Builder().namingPattern(getClass().getSimpleName() + "-thread-%d")- .build());-- protected final ListenerSet<DebuggerModelListener> listeners =- new ListenerSet<>(DebuggerModelListener.class, true);-- protected final PrivatelyQueuedListener<DebuggerModelListener> asyncListeners =- new PrivatelyQueuedListener<DebuggerModelListener>(DebuggerModelListener.class,- clientExecutor, listeners.invoke());-- protected SpiTargetObject root;- protected boolean rootAdded;- protected boolean cbRootAdded;- protected CompletableFuture<SpiTargetObject> completedRoot = new CompletableFuture<>();-- // Remember the order of creation events- protected final Map<List<String>, SpiTargetObject> creationLog = new LinkedHashMap<>();- protected final Map<List<String>, SpiTargetObject> cbCreationLog = new LinkedHashMap<>();-- protected void objectCreated(SpiTargetObject object) {- synchronized (lock) {- creationLog.put(object.getPath(), object);- if (object.isRoot()) {- if (this.root != null) {- throw new IllegalStateException("Already have a root");- }- this.root = object;- }- CompletableFuture.runAsync(() -> {- synchronized (cbLock) {- cbCreationLog.put(object.getPath(), object);- }- }, clientExecutor).exceptionally(ex -> {- Msg.error(this, "Error updating objectCreated before callback");- return null;- });- }- }-- protected void objectInvalidated(TargetObject object) {- synchronized (lock) {- creationLog.remove(object.getPath());- CompletableFuture.runAsync(() -> {- synchronized (cbLock) {- cbCreationLog.remove(object.getPath());- }- }, clientExecutor).exceptionally(ex -> {- Msg.error(this, "Error updated objectInvalidated before callback");- return null;- });- }- }-- protected void addModelRoot(SpiTargetObject root) {- assert root == this.root;- synchronized (lock) {- rootAdded = true;- root.getSchema()- .validateTypeAndInterfaces(root, null, null, root.enforcesStrictSchema());- CompletableFuture.runAsync(() -> {- synchronized (cbLock) {- cbRootAdded = true;- }- completedRoot.complete(root);- }, clientExecutor).exceptionally(ex -> {- Msg.error(this, "Error updating rootAdded before callback");- return null;- });- this.completedRoot.completeAsync(() -> root, clientExecutor);-- // broadcast is privately queued on clientExecutor- broadcast().rootAdded(root);- }- }-- @Override- public CompletableFuture<? extends TargetObject> fetchModelRoot() {- return completedRoot;- }-- @Override- public SpiTargetObject getModelRoot() {- synchronized (lock) {- return root;- }- }-- protected void replayed(DebuggerModelListener listener, Runnable r) {- try {- r.run();- }- catch (Throwable t) {- Msg.error(this, "Listener " + listener + " caused unexpected exception", t);- }- }-- protected void replayTreeEvents(DebuggerModelListener listener) {- for (SpiTargetObject object : cbCreationLog.values()) {- replayed(listener, () -> listener.created(object));- }- Set<SpiTargetObject> visited = new HashSet<>();- for (SpiTargetObject object : cbCreationLog.values()) {- replayAddEvents(listener, object, visited);- }- if (cbRootAdded) {- replayed(listener, () -> listener.rootAdded(root));- }- }-- protected void replayAddEvents(DebuggerModelListener listener, SpiTargetObject object,- Set<SpiTargetObject> visited) {- if (!visited.add(object)) {- return;- }- /**- * It's rare, but technically, the creation is logged during construction, so cbAttributes- * and/or cbElements could still be null.- */- Map<String, ?> cbAttributes = object.getCallbackAttributes();- if (cbAttributes != null) {- for (Object val : cbAttributes.values()) {- if (!(val instanceof TargetObject)) {- continue;- }- assert val instanceof SpiTargetObject;- replayAddEvents(listener, (SpiTargetObject) val, visited);- }- if (!cbAttributes.isEmpty()) {- replayed(listener,- () -> listener.attributesChanged(object, List.of(), Map.copyOf(cbAttributes)));- }- }- Map<String, ? extends TargetObject> cbElements = object.getCallbackElements();- if (cbElements != null) {- for (TargetObject elem : cbElements.values()) {- assert elem instanceof SpiTargetObject;- replayAddEvents(listener, (SpiTargetObject) elem, visited);- }- if (!cbElements.isEmpty()) {- replayed(listener,- () -> listener.elementsChanged(object, List.of(), Map.copyOf(cbElements)));- }- }- }-- @Override- public void addModelListener(DebuggerModelListener listener, boolean replay) {- synchronized (lock) {- if (replay) {- CompletableFuture.runAsync(() -> {- synchronized (cbLock) {- replayTreeEvents(listener);- listeners.add(listener);- }- }, clientExecutor).exceptionally(ex -> {- listener.catastrophic(ex);- return null;- });- }- else {- listeners.add(listener);- }- }- }-- @Override- public void removeModelListener(DebuggerModelListener listener) {- // NB. Don't really care to lock here. Only making guarantees re/ adds,replays.- listeners.remove(listener);- }-- protected DebuggerModelListener broadcast() {- return asyncListeners.in;- }-- /**- * Ensure that dependent computations occur on the client executor- *- * @param <T> the type of the future value- * @param v the future- * @return a future which completes after the given one on the client executor- */- public <T> CompletableFuture<T> gateFuture(CompletableFuture<T> future) {- return future.whenCompleteAsync((t, ex) -> {- }, clientExecutor);- }-- @Override- public CompletableFuture<Void> flushEvents() {- return CompletableFuture.supplyAsync(() -> null, clientExecutor);- }-- @Override- public CompletableFuture<Void> close() {- clientExecutor.shutdown();- return AsyncUtils.nil();- }-- public void removeExisting(List<String> path) {- TargetObject existing = getModelObject(path);- // It's best if the implementation has already removed it, but just in case....- if (existing == null) {- return;- }- TargetObject parent = existing.getParent();- if (parent == null) {- assert existing == root;- throw new IllegalStateException("Cannot replace the root");- }- if (!path.equals(existing.getPath())) {- return; // Is a link- }- if (!(parent instanceof SpiTargetObject)) { // It had better be- Msg.error(this, "Could not remove existing object " + existing +- ", because parent is not an SpiTargetObject");- return;- }- SpiTargetObject spiParent = (SpiTargetObject) parent;- SpiTargetObject delegate = spiParent.getDelegate();- if (!(delegate instanceof DefaultTargetObject<?, ?>)) { // It had better be :)- Msg.error(this, "Could not remove existing object " + existing +- ", because its parent's delegate is not a DefaultTargetObject");- return;- }- DefaultTargetObject<?, ?> dtoParent = (DefaultTargetObject<?, ?>) delegate;- if (PathUtils.isIndex(path)) {- dtoParent.changeElements(List.of(PathUtils.getIndex(path)), List.of(), "Replaced");- }- else {- assert PathUtils.isName(path);- dtoParent.changeAttributes(List.of(PathUtils.getKey(path)), Map.of(), "Replaced");- }- }-- @Override- public TargetObject getModelObject(List<String> path) {- synchronized (lock) {- if (path.isEmpty()) {- return root;- }- return creationLog.get(path);- }- }-- @Override- public Set<TargetObject> getModelObjects(Predicate<? super TargetObject> predicate) {- synchronized (lock) {- return creationLog.values().stream().filter(predicate).collect(Collectors.toSet());- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AbstractTargetObject.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AbstractTargetObject.javadeleted file mode 100644index 2ee5a9cc4a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AbstractTargetObject.java+++ /dev/null@@ -1,311 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import java.lang.reflect.Proxy;-import java.util.*;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathUtils;--/**- * An abstract implementation of {@link TargetObject}- *- * <p>- * Implementors should probably use {@link DefaultTargetObject} as the base class for all objects in- * the model. If your model employs proxies (i.e., using- * {@link Proxy#newProxyInstance(ClassLoader, Class[], java.lang.reflect.InvocationHandler)}),- * please see {@link InvalidatableTargetObjectIf} to ensure subtree invalidation is handled- * properly.- *- * @param <P> the type of the parent- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public abstract class AbstractTargetObject<P extends TargetObject> implements SpiTargetObject {- public static interface ProxyFactory<I> {- SpiTargetObject createProxy(AbstractTargetObject<?> delegate, I info);- }-- protected static final ProxyFactory<Void> THIS_FACTORY = (d, i) -> d;-- protected static final CompletableFuture<Map<String, TargetObject>> COMPLETED_EMPTY_ELEMENTS =- CompletableFuture.completedFuture(Map.of());- protected static final CompletableFuture<Map<String, Object>> COMPLETED_EMPTY_ATTRIBUTES =- CompletableFuture.completedFuture(Map.of());-- protected final AbstractDebuggerObjectModel model;- protected final SpiTargetObject proxy;- protected final P parent;- protected final List<String> path;- protected final int hash;- protected final String typeHint;- protected final TargetObjectSchema schema;-- protected volatile boolean valid = true;-- public <I> AbstractTargetObject(ProxyFactory<I> proxyFactory, I proxyInfo,- AbstractDebuggerObjectModel model, P parent, String key, String typeHint,- TargetObjectSchema schema) {- this.model = model;- this.parent = parent;- if (parent == null) {- this.path = key == null ? List.of() : List.of(key);- }- else {- this.path = PathUtils.extend(parent.getPath(), key);- }-- synchronized (model.lock) {- model.removeExisting(path);-- this.hash = computeHashCode();- this.typeHint = typeHint;-- this.schema = schema;- this.proxy = proxyFactory.createProxy(this, proxyInfo);-- fireCreated();- }- }-- public AbstractTargetObject(AbstractDebuggerObjectModel model, P parent, String key,- String typeHint, TargetObjectSchema schema) {- this(THIS_FACTORY, null, model, parent, key, typeHint, schema);- }-- protected void fireCreated() {- SpiTargetObject proxy = getProxy();- assert proxy != null;- synchronized (model.lock) {- model.objectCreated(proxy);- broadcast().created(proxy);- }- }-- /**- * Get an alternative for {@code this} when invoking the listeners.- *- * <p>- * Some implementations may use on a proxy-delegate pattern to implement target objects with- * various combinations of supported interfaces. When this pattern is employed, the delegate- * will extend {@link DefaultTargetObject}, causing {@code this} to refer to the delegate rather- * than the proxy. When invoking listeners, the proxy given by this method is used instead. The- * proxy is also used for schema interface validation.- *- * @return the proxy or this- */- public SpiTargetObject getProxy() {- return proxy;- }-- @Override- public P getParent() {- return parent;- }-- @Override- public <T extends TargetObject> T as(Class<T> iface) {- return DebuggerObjectModel.requireIface(iface, getProxy(), path);- }-- @Override- public Collection<String> getInterfaceNames() {- return Protected.getInterfaceNamesOf(getProxy().getClass());- }-- /**- * Check if this object strictly conforms to the schema- *- * <p>- * This method exists to support the transition to schemas. If this method returns false, schema- * violations are logged, but whatever changes were requested that caused the violation are- * still allowed to occur. If it returns true, then any schema violation will cause an- * {@link AssertionError}. Because schema violations are presumed to be programming errors,- * there is no guarantee of consistency after an exception is thrown. In general, models without- * explicit schemas should not fail validation, since objects will likely be assigned- * {@link EnumerableTargetObjectSchema#ANY}. When developing a schema for an existing model, it- * may be useful to override this to return true to fail fast.- *- * @return true to throw exceptions on schema violations.- */- @Override- public boolean enforcesStrictSchema() {- return false;- }-- @Override- public boolean equals(Object obj) {- return doEquals(obj);- }-- @Override- public int hashCode() {- return hash;- }-- @Override- public String toString() {- //if (schema == null) {- // return String.format("<%s: path=%s model=%s schema=<null>>", getClass().getSimpleName(),- // getJoinedPath("."), getModel());- //}- return String.format("<%s: path=%s model=%s schema=%s>", getClass().getSimpleName(),- getJoinedPath("."), getModel(), schema.getName());- }-- @Override- public String getTypeHint() {- return typeHint;- }-- @Override- public TargetObjectSchema getSchema() {- return schema;- }-- @Override- public boolean isValid() {- return valid;- }-- @Override- public AbstractDebuggerObjectModel getModel() {- return model;- }-- /**- * {@inheritDoc}- *- * Overridden to avoid an infinite loop / stack overflow- */- @Override- public CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchElements() {- return COMPLETED_EMPTY_ELEMENTS;- }-- @Override- public CompletableFuture<? extends TargetObject> fetchElement(String index) {- return fetchElements().thenApply(elements -> elements.get(index));- }-- /**- * {@inheritDoc}- *- * Overridden to avoid an infinite loop / stack overflow- */- @Override- public CompletableFuture<? extends Map<String, ?>> fetchAttributes() {- return COMPLETED_EMPTY_ATTRIBUTES;- }-- @Override- public Object getProtocolID() {- return getPath();- }-- @Override- public List<String> getPath() {- return path;- }-- protected void doInvalidate(TargetObject branch, String reason) {- if (!valid) {- return;- }- valid = false;- model.objectInvalidated(getProxy());- broadcast().invalidated(getProxy(), branch, reason);- }-- protected void doInvalidateElements(Map<String, ?> elems, String reason) {- for (Map.Entry<String, ?> ent : elems.entrySet()) {- String name = ent.getKey();- Object e = ent.getValue();- if (e instanceof InvalidatableTargetObjectIf && e instanceof TargetObject) {- InvalidatableTargetObjectIf obj = (InvalidatableTargetObjectIf) e;- if (!PathUtils.isElementLink(getPath(), name, obj.getPath())) {- obj.doInvalidateSubtree((TargetObject) e, reason);- }- }- }- }-- protected void doInvalidateElements(TargetObject branch, Map<String, ?> elems, String reason) {- for (Map.Entry<String, ?> ent : elems.entrySet()) {- String name = ent.getKey();- Object e = ent.getValue();- if (e instanceof InvalidatableTargetObjectIf) {- InvalidatableTargetObjectIf obj = (InvalidatableTargetObjectIf) e;- if (!PathUtils.isElementLink(getPath(), name, obj.getPath())) {- obj.doInvalidateSubtree(branch, reason);- }- }- }- }-- protected void doInvalidateAttributes(Map<String, ?> attrs, String reason) {- for (Map.Entry<String, ?> ent : attrs.entrySet()) {- String name = ent.getKey();- Object a = ent.getValue();- if (a instanceof InvalidatableTargetObjectIf && a instanceof TargetObject) {- InvalidatableTargetObjectIf obj = (InvalidatableTargetObjectIf) a;- if (!PathUtils.isLink(getPath(), name, obj.getPath())) {- obj.doInvalidateSubtree((TargetObject) a, reason);- }- }- }- }-- protected void doInvalidateAttributes(TargetObject branch, Map<String, ?> attrs,- String reason) {- for (Map.Entry<String, ?> ent : attrs.entrySet()) {- String name = ent.getKey();- Object a = ent.getValue();- if (a instanceof InvalidatableTargetObjectIf) {- InvalidatableTargetObjectIf obj = (InvalidatableTargetObjectIf) a;- if (!PathUtils.isLink(getPath(), name, obj.getPath())) {- obj.doInvalidateSubtree(branch, reason);- }- }- }- }-- @Override- public void doInvalidateSubtree(TargetObject branch, String reason) {- // Pre-ordered traversal- doInvalidate(branch, reason);- doInvalidateElements(branch, getCachedElements(), reason);- doInvalidateAttributes(branch, getCachedAttributes(), reason);- }-- @Override- public void invalidateSubtree(TargetObject branch, String reason) {- synchronized (model.lock) {- doInvalidateSubtree(branch, reason);- }- }-- @Override- public DebuggerModelListener broadcast() {- return model.broadcast();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AgentWindow.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AgentWindow.javadeleted file mode 100644index 08c79c670f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/AgentWindow.java+++ /dev/null@@ -1,131 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import java.awt.*;-import java.awt.event.WindowEvent;-import java.awt.event.WindowListener;-import java.net.SocketAddress;--import javax.swing.*;-import javax.swing.text.*;--import org.apache.logging.log4j.LogManager;-import org.apache.logging.log4j.core.Appender;-import org.apache.logging.log4j.core.LoggerContext;-import org.apache.logging.log4j.core.config.Configuration;--import ghidra.framework.LoggingInitialization;-import ghidra.util.Msg;-import ghidra.util.Swing;-import log.LogListener;-import log.LogPanelAppender;--@Deprecated(forRemoval = true, since = "11.2")-public class AgentWindow extends JFrame implements WindowListener, LogListener {- public static final int MAX_LOG_CHARS = 100000;-- protected final JTextPane logPane = new JTextPane();- protected final JScrollPane logScroll = new JScrollPane(logPane);-- public AgentWindow(String title, SocketAddress localAddress) {- super(title);- setLayout(new BorderLayout());- addWindowListener(this);- add(new JLabel("<html>This agent is listening at <b>" + localAddress +- "</b>. Close this window to terminate it.</html>"), BorderLayout.NORTH);- logPane.setEditable(false);- logPane.setFont(Font.decode(Font.MONOSPACED));- logPane.setAutoscrolls(true);- logScroll.setAutoscrolls(true);- DefaultCaret caret = (DefaultCaret) logPane.getCaret();- caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);- add(logScroll);- setMinimumSize(new Dimension(400, 300));- setVisible(true);-- System.setProperty("log4j.configurationFile", "agent.log4j.xml");- LoggingInitialization.initializeLoggingSystem();- LoggerContext ctx = (LoggerContext) LogManager.getContext(false);- Configuration config = ctx.getConfiguration();- Appender appender = config.getAppender("logPanel");- if (!(appender instanceof LogPanelAppender)) {- Msg.error(this, "Couldn't find LogPanelAppender instance in the Log4j context. " +- "Nothing will be logged to the agent's window.");- }- else {- LogPanelAppender logPanelAppender = (LogPanelAppender) appender;- logPanelAppender.setLogListener(this);- }- }-- @Override- public void messageLogged(String message, boolean isError) {-- Swing.runIfSwingOrRunLater(() -> {- MutableAttributeSet attributes = new SimpleAttributeSet();- if (isError) {- StyleConstants.setForeground(attributes, Color.RED);- }- Document document = logPane.getStyledDocument();- try {- document.insertString(document.getLength(), message + "\n", attributes);- if (document.getLength() > MAX_LOG_CHARS) {- document.remove(0, document.getLength() - MAX_LOG_CHARS);- }- }- catch (BadLocationException e) {- throw new AssertionError(e);- }- });- }-- @Override- public void windowOpened(WindowEvent e) {- // Dont' care- }-- @Override- public void windowClosing(WindowEvent e) {- System.out.println("User closed agent window. Exiting");- System.exit(0);- }-- @Override- public void windowClosed(WindowEvent e) {- // Dont' care- }-- @Override- public void windowIconified(WindowEvent e) {- // Dont' care- }-- @Override- public void windowDeiconified(WindowEvent e) {- // Dont' care- }-- @Override- public void windowActivated(WindowEvent e) {- // Dont' care- }-- @Override- public void windowDeactivated(WindowEvent e) {- // Dont' care- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/DefaultTargetModelRoot.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/DefaultTargetModelRoot.javadeleted file mode 100644index 8d453dbbc8..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/DefaultTargetModelRoot.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetAggregate;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema;--@Deprecated(forRemoval = true, since = "11.2")-public class DefaultTargetModelRoot extends DefaultTargetObject<TargetObject, TargetObject>- implements TargetAggregate {-- public DefaultTargetModelRoot(AbstractDebuggerObjectModel model, String typeHint) {- this(model, typeHint, EnumerableTargetObjectSchema.OBJECT);- }-- public DefaultTargetModelRoot(AbstractDebuggerObjectModel model, String typeHint,- TargetObjectSchema schema) {- super(model, null, null, typeHint, schema);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/DefaultTargetObject.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/DefaultTargetObject.javadeleted file mode 100644index ac635c2cc5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/DefaultTargetObject.java+++ /dev/null@@ -1,546 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.stream.Collectors;--import ghidra.async.AsyncUtils;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.ResyncMode;-import ghidra.dbg.util.CollectionUtils.Delta;-import ghidra.util.Msg;--/**- * A default implementation of {@link TargetObject} suitable for cases where the implementation- * defines the model structure.- *- * @see AbstractTargetObject- * @param <E> the type of child elements- * @param <P> the type of the parent- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DefaultTargetObject<E extends TargetObject, P extends TargetObject>- extends AbstractTargetObject<P> {-- /** Note modifying this directly subverts notifications */- protected final Map<String, E> elements = new HashMap<>();- protected final Map<String, E> cbElements = new HashMap<>();- protected final Map<String, E> roCbElements = Collections.unmodifiableMap(cbElements);- protected CompletableFuture<Void> curElemsRequest;-- /** Note modifying this directly subverts notifications */- protected final Map<String, Object> attributes = new HashMap<>();- protected final Map<String, Object> cbAttributes = new HashMap<>();- protected final Map<String, Object> roCbAttributes = Collections.unmodifiableMap(cbAttributes);- protected CompletableFuture<Void> curAttrsRequest;-- /**- * Construct a new default target object whose schema is derived from the parent- *- * @see #DefaultTargetObject(DebuggerObjectModel, TargetObject, String, String,- * TargetObjectSchema)- * @param model the model to which the object belongs- * @param parent the (non-null) parent of this object- * @param key the key (attribute name or element index) of this object- * @param typeHint the type hint for this object- */- public DefaultTargetObject(AbstractDebuggerObjectModel model, P parent, String key,- String typeHint) {- this(model, parent, key, typeHint, parent.getSchema().getChildSchema(key));- }-- /**- * Construct a new default target object- *- * <p>- * Note, this will automatically construct the appropriate path for this object. The implementor- * should not create two objects with the same path. In that event, collisions will probably- * favor the second, but in general, it produces undefined behavior. Also, this does not add the- * new object to its parent. The implementor must do that. This affords an opportunity to- * populate this object's elements and attributes before it is added to the model.- *- * <p>- * The default update mode is set to {@link TargetUpdateMode#UNSOLICITED}, which implies the- * implementation will keep the elements cache in sync with the debugger. It is preferable to- * initialize the cache (via {@link #changeElements(Collection, Collection, String)}) before- * adding this object to the model. If it is infeasible to keep this object's elements cache- * updated, the implementor MUST set the update mode to {@link TargetUpdateMode#SOLICITED}.- * Ideally, for objects whose elements will never change, the mode can be set to- * {@link TargetUpdateMode#FIXED} immediately after populating the elements.- *- * @param model the model to which the object belongs- * @param parent the parent of this object- * @param key the key (attribute name or element index) of this object- * @param typeHint the type hint for this object- * @param schema the schema of this object- */- public DefaultTargetObject(AbstractDebuggerObjectModel model, P parent, String key,- String typeHint, TargetObjectSchema schema) {- this(THIS_FACTORY, null, model, parent, key, typeHint, schema);- }-- /**- * Construct a new (delegate) default target object- *- * <p>- * This behaves similarly to- * {@link #DefaultTargetObject(AbstractDebuggerObjectModel, TargetObject, String, String, TargetObjectSchema)}- * when this object is meant to be the delegate of a proxy. The {@code proxyFactory} and- * {@code proxyInfo} arguments are necessary to sidestep Java's insistence that the- * super-constructor be invoked first. It allows information to be passed straight to the- * factory. Using method overrides doesn't work, because the factory method gets called during- * construction, before extensions have a chance to initialize fields, on which the proxy- * inevitably depends.- *- * @param proxyFactory a factory to create the proxy, invoked in the super constructor- * @param proxyInfo additional information passed to the proxy factory- * @param model the model to which the object belongs- * @param parent the parent of this object- * @param key the key (attribute name or element index) of this object- * @param typeHint the type hint for this object- * @param schema the schema of this object- */- public <I> DefaultTargetObject(ProxyFactory<I> proxyFactory, I proxyInfo,- AbstractDebuggerObjectModel model, P parent, String key, String typeHint,- TargetObjectSchema schema) {- super(proxyFactory, proxyInfo, model, parent, key, typeHint, schema);- changeAttributes(List.of(), List.of(),- Map.ofEntries(Map.entry(DISPLAY_ATTRIBUTE_NAME, key == null ? "<root>" : key)),- "Default");- }-- public <I> DefaultTargetObject(ProxyFactory<I> proxyFactory, I proxyInfo,- AbstractDebuggerObjectModel model, P parent, String key, String typeHint) {- this(proxyFactory, proxyInfo, model, parent, key, typeHint,- parent.getSchema().getChildSchema(key));- }-- @Override- public CompletableFuture<Void> resync(RefreshBehavior refreshAttributes,- RefreshBehavior refreshElements) {- return CompletableFuture.allOf(fetchAttributes(refreshAttributes),- fetchElements(refreshElements));- }-- /**- * The elements for this object need to be updated, optionally invalidating caches- *- * <p>- * Note that cache invalidation need not imply flushing {@link #elements}. In fact, it's- * preferable not to, as it becomes unclear how to invoke callbacks without some thrashing- * (i.e., one callback to remove everything, and another to re-populate). Instead, the entries- * in {@link #elements} should be assumed stale. The implementation should additionally not rely- * on any of its internal caches, in order to ensure the fetched elements are fresh. Once- * refreshed, only the changes from the stale cache to the fresh entries need be included in the- * callback.- *- * <p>- * Note that this method completes with {@link Void}. The default implementation of- * {@link #fetchElements(boolean)} will complete with the cached elements, so this method should- * call {@link #changeElements(Collection, Collection, String)} before completion.- *- * @param refresh true to invalidate all caches involved in handling this request- * @return a future which completes when the cache has been updated- */- protected CompletableFuture<Void> requestElements(RefreshBehavior refresh) {- return AsyncUtils.nil();- }-- private boolean shouldRequestElements(RefreshBehavior refresh) {- if (refresh.equals(RefreshBehavior.REFRESH_ALWAYS)) {- return true;- }- ResyncMode resync = getSchema().getElementResyncMode();- return resync.shouldResync(curElemsRequest);- }-- /**- * {@inheritDoc}- *- * @implNote In general, an object should attempt to keep an up-to-date map of its elements,- * usually by capturing the elements and subscribing to changes. This is not possible- * in all circumstances. In those cases, implementations should override this method.- * It may take whatever asynchronous action are necessary to get an up-to-date- * response, then complete with {@link #elementsView}.- */- @Override- public CompletableFuture<? extends Map<String, ? extends E>> fetchElements(- RefreshBehavior refresh) {- CompletableFuture<Void> req;- synchronized (elements) {- if (shouldRequestElements(refresh)) {- curElemsRequest = model.gateFuture(requestElements(refresh));- }- req = curElemsRequest == null ? AsyncUtils.nil() : curElemsRequest;- }- return req.thenApply(__ -> getCachedElements());- }-- @Override- public CompletableFuture<? extends Map<String, ? extends E>> fetchElements() {- return fetchElements(RefreshBehavior.REFRESH_NEVER);- }-- @Override- public Map<String, E> getCachedElements() {- synchronized (model.lock) {- return elements == null ? Map.of() : Map.copyOf(elements);- }- }-- @Override- public Map<String, E> getCallbackElements() {- return roCbElements;- }-- /**- * {@inheritDoc}- *- * @implNote Overridden here for type- */- @Override- public CompletableFuture<E> fetchElement(String index) {- return fetchElements().thenApply(elems -> elems.get(index));- }-- protected Map<String, E> combineElements(Collection<? extends E> autoKeyed,- Map<String, ? extends E> mapKeyed) {- Map<String, E> asMap = new LinkedHashMap<>();- for (E e : autoKeyed) {- asMap.put(e.getIndex(), e);- }- asMap.putAll(mapKeyed);- return asMap;- }-- /**- * Set the elements to the given collection, invoking listeners for the delta- *- * <p>- * An existing element is left in place if it's identical to its replacement as in {@code ==}.- * This method also invalidates the sub-trees of removed elements, if any.- *- * @param autoKeyed the desired set of elements where keys are given by the elements- * @param mapKeyed the desired map of elements with specified keys (usually for links)- * @param reason the reason for the change (used as the reason for invalidation)- * @return the delta from the previous elements- */- public Delta<E, E> setElements(Collection<? extends E> autoKeyed,- Map<String, ? extends E> mapKeyed, String reason) {- if (!valid) {- return Delta.empty();- }- Map<String, E> elements = combineElements(autoKeyed, mapKeyed);- return setElements(elements, reason);- }-- /**- * TODO: Consider multiple paths for objects, using schema to denote canonical location.- */- public Delta<E, E> setElements(Collection<? extends E> elements, String reason) {- return setElements(elements, Map.of(), reason);- }-- private void updateCallbackElements(Delta<E, E> delta) {- CompletableFuture.runAsync(() -> {- synchronized (model.cbLock) {- delta.apply(this.cbElements, Delta.SAME);- }- }, model.clientExecutor).exceptionally(ex -> {- Msg.error(this, "Error updating elements before callback");- return null;- });- }-- private Delta<E, E> setElements(Map<String, E> elements, String reason) {- Delta<E, E> delta;- synchronized (model.lock) {- if (!valid) {- return Delta.empty();- }- delta = Delta.computeAndSet(this.elements, elements, Delta.SAME);- getSchema().validateElementDelta(getPath(), delta, enforcesStrictSchema());- doInvalidateElements(delta.removed, reason);- if (!delta.isEmpty()) {- updateCallbackElements(delta);- broadcast().elementsChanged(getProxy(), delta.getKeysRemoved(), delta.added);- }- }- return delta;- }-- /**- * Change the elements using the given "delta," invoking listeners- *- * <p>- * An existing element is left in place if it's identical to its replacement as in {@code ==}.- * This method also invalidates the sub-trees of removed elements, if any.- *- * @param remove the set of indices to remove- * @param autoKeyed the set of elements to add with the elements' keys- * @param mapKeyed the map of elements to add with given keys (usually for links)- * @param reason the reason for the change (used as the reason for invalidation)- * @return the actual delta from the previous to the current elements- */- public Delta<E, E> changeElements(Collection<String> remove, Collection<? extends E> autoKeyed,- Map<String, ? extends E> mapKeyed, String reason) {- if (!valid) {- return Delta.empty();- }- Map<String, E> add = combineElements(autoKeyed, mapKeyed);- return changeElements(remove, add, reason);- }-- /**- * TODO: Document me- */- public Delta<E, E> changeElements(Collection<String> remove, Collection<? extends E> add,- String reason) {- return changeElements(remove, add, Map.of(), reason);- }-- public Delta<E, E> changeElements(Collection<String> remove, Map<String, E> add,- String reason) {- Delta<E, E> delta;- synchronized (model.lock) {- if (!valid) {- return Delta.empty();- }- delta = Delta.apply(this.elements, remove, add, Delta.SAME);- getSchema().validateElementDelta(getPath(), delta, enforcesStrictSchema());- doInvalidateElements(delta.removed, reason);- if (!delta.isEmpty()) {- updateCallbackElements(delta);- broadcast().elementsChanged(getProxy(), delta.getKeysRemoved(), delta.added);- }- }- return delta;- }-- /**- * The attributes for this object need to be updated, optionally invalidating caches- *- * <p>- * This method being called with -refresh- set is almost always an indication of something gone- * wrong. The client or user should not be attempting to refresh attributes except when there's- * reason to believe the model is not keeping its attribute cache up to date.- *- * <p>- * This method otherwise operates analogously to {@link #requestElements(RefreshBehavior)}.- *- * @param refresh true to invalidate all caches involved in handling this request- * @return a future which completes when the cache has been updated- */- protected CompletableFuture<Void> requestAttributes(RefreshBehavior refresh) {- return AsyncUtils.nil();- }-- private boolean shouldRequestAttributes(RefreshBehavior refresh) {- if (refresh.equals(RefreshBehavior.REFRESH_ALWAYS)) {- return true;- }- ResyncMode resync = getSchema().getAttributeResyncMode();- return resync.shouldResync(curAttrsRequest);- }-- /**- * {@inheritDoc}- *- * @implNote An object, except in very limited circumstances, must keep an up-to-date map of its- * attributes, usually by capturing them at construction and subscribing to changes.- * In those limited circumstances, it's usually the case that the object's parent has- * update mode {@link TargetUpdateMode#SOLICITED}, which typically implies this- * object's attributes are unchanging.- */- @Override- public CompletableFuture<? extends Map<String, ?>> fetchAttributes(RefreshBehavior refresh) {- CompletableFuture<Void> req;- synchronized (attributes) {- // update_mode does not affect attributes. They always behave as if UNSOLICITED.- if (shouldRequestAttributes(refresh)) {- curAttrsRequest = model.gateFuture(requestAttributes(refresh));- }- req = curAttrsRequest == null ? AsyncUtils.nil() : curAttrsRequest;- }- return req.thenApply(__ -> {- synchronized (model.lock) {- if (schema != null) { // TODO: Remove this. Schema should never be null.- schema.validateRequiredAttributes(this, enforcesStrictSchema());- }- return getCachedAttributes();- }- });- }-- @Override- public CompletableFuture<? extends Map<String, ?>> fetchAttributes() {- return fetchAttributes(RefreshBehavior.REFRESH_NEVER);- }-- @Override- public Map<String, ?> getCachedAttributes() {- synchronized (model.lock) {- return attributes == null ? Map.of() : Map.copyOf(attributes);- }- }-- @Override- public Map<String, ?> getCallbackAttributes() {- return roCbAttributes;- }-- @Override- public Object getCachedAttribute(String name) {- synchronized (model.lock) {- // Could get called during object's constructor- return attributes == null ? null : attributes.get(name);- }- }-- protected Map<String, Object> combineAttributes(Collection<? extends TargetObject> autoKeyed,- Map<String, ?> mapKeyed) {- Map<String, Object> asMap = new LinkedHashMap<>();- for (TargetObject ca : autoKeyed) {- asMap.put(ca.getName(), ca);- }- asMap.putAll(mapKeyed);- return asMap;- }-- /**- * Set the attributes to the given map, invoking listeners for the delta- *- * <p>- * An existing attribute value is left in place if it's considered equal to its replacement as- * defined by {@link Objects#equals(Object, Object)}. This method also invalidates the sub-trees- * of removed non-reference object-valued attributes.- *- * @param autoKeyed the desired set of object-valued attributes using the objects' keys- * @param mapKeyed the desired map of other attributes (usually links and primitive values)- * @param reason the reason for the change (used as the reason for invalidation)- * @return the delta from the previous attributes- */- public Delta<?, ?> setAttributes(Collection<? extends TargetObject> autoKeyed,- Map<String, ?> mapKeyed, String reason) {- if (!valid) {- return Delta.empty();- }- Map<String, ?> attributes = combineAttributes(autoKeyed, mapKeyed);- return setAttributes(attributes, reason);- }-- private void updateCallbackAttributes(Delta<Object, ?> delta) {- CompletableFuture.runAsync(() -> {- synchronized (model.cbLock) {- delta.apply(this.cbAttributes, Delta.EQUAL);- }- }, model.clientExecutor).exceptionally(ex -> {- Msg.error(this, "Error updating elements before callback");- return null;- });- }-- /**- * TODO: Document me.- */- public Delta<?, ?> setAttributes(Map<String, ?> attributes, String reason) {- Delta<Object, ?> delta;- synchronized (model.lock) {- if (!valid) {- return Delta.empty();- }- delta = Delta.computeAndSet(this.attributes, attributes, Delta.EQUAL);- getSchema().validateAttributeDelta(getPath(), delta, enforcesStrictSchema());- doInvalidateAttributes(delta.removed, reason);- if (!delta.isEmpty()) {- updateCallbackAttributes(delta);- broadcast().attributesChanged(getProxy(), delta.getKeysRemoved(), delta.added);- }- }- return delta;- }-- /**- * Change the attributes using the given "delta," invoking listeners- *- * <p>- * An existing attribute value is left in place if it's considered equal to its replacement as- * defined by {@link Objects#equals(Object, Object)}. This method also invalidates the sub-trees- * of removed non-reference object-valued attributes.- *- * @param remove the set of names to remove- * @param autoKeyed the set of object-valued attributes to add using the objects' keys- * @param mapKeyed the map of other attributes to add (usually links and primitives)- * @param reason the reason for the change (used as the reason for invalidation)- * @return the actual delta from the previous to the current attributes- */- public Delta<?, ?> changeAttributes(List<String> remove,- Collection<? extends TargetObject> autoKeyed, Map<String, ?> mapKeyed, String reason) {- if (!valid) {- return Delta.empty();- }- Map<String, ?> add = combineAttributes(autoKeyed, mapKeyed);- return changeAttributes(remove, add, reason);- }-- public <T> Map<String, T> filterValid(String name, Map<String, T> map) {- return map.entrySet().stream().filter(ent -> {- T val = ent.getValue();- if (!(val instanceof TargetObject)) {- return true;- }- TargetObject obj = (TargetObject) val;- if (obj.isValid()) {- return true;- }- Msg.error(this, name + " " + ent.getKey() + " of " + getJoinedPath(".") +- " linked to invalid object: " + obj.getJoinedPath("."));- return false;- }).collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));- }-- /**- * This method may soon be made private. Consider- * {@link DefaultTargetObject#changeAttributes(List, Collection, Map, String)} instead.- *- * <p>- * TODO: Consider allowing objects to move and/or occupy multiple paths. The schema could be- * used to specify the "canonical" location.- */- public Delta<?, ?> changeAttributes(List<String> remove, Map<String, ?> add, String reason) {- // add = filterValid("Attribute", add);- Delta<Object, ?> delta;- synchronized (model.lock) {- if (!valid) {- return Delta.empty();- }- delta = Delta.apply(this.attributes, remove, add, Delta.EQUAL);- getSchema().validateAttributeDelta(getPath(), delta, enforcesStrictSchema());- doInvalidateAttributes(delta.removed, reason);- if (!delta.isEmpty()/* && !reason.equals("Default")*/) {- updateCallbackAttributes(delta);- broadcast().attributesChanged(getProxy(), delta.getKeysRemoved(), delta.added);- }- }- return delta;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/InvalidatableTargetObjectIf.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/InvalidatableTargetObjectIf.javadeleted file mode 100644index 0ca904ba71..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/InvalidatableTargetObjectIf.java+++ /dev/null@@ -1,77 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import java.util.*;--import ghidra.dbg.target.TargetObject;--/**- * An interface for {@link TargetObject} implementations which would like notifications of- * invalidation from parents whose implementations derive from {@link AbstractTargetObject}.- *- * <p>- * This is a mechanism used internally by model implementations to manage invalidation of subtrees- * according to conventions. If every object implementation in the model is based on- * {@link AbstractTargetObject} (or {@link DefaultTargetObject}), then this is all taken care of.- * The implementor need only call {@link DefaultTargetObject#setAttributes(Map, String)} or similar,- * and invalidation is taken care of. To invalidate the entire model, simply call- * {@link #invalidateSubtree(String)} on the root.- *- * <p>- * Explicitly implementing this interface becomes necessary when there exists a mixture of objects- * in the model, some derived from {@link AbstractTargetObject} and some not, including cases where- * {@link AbstractTargetObject} is obscured by a proxy scheme. A parent based on- * {@link AbstractTargetObject} will call {@link #invalidateSubtree(String)} on any of its children- * being removed from the model, including when the parent is invalidated. The implementation should- * release its resources and also invalidate its children accordingly. For the case of a proxy whose- * delegate derives from {@link AbstractTargetObject}, the proxy must include this interface, and- * the call need only be forwarded to the delegate.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface InvalidatableTargetObjectIf extends TargetObject {-- /**- * Invalidate this subtree- *- * <p>- * In most cases, this need only be invoked on the root to destroy the entire model, or if the- * implementation is managing the collections of children. Otherwise,- * {@link DefaultTargetObject#changeAttributes(List, Map, String)},- * {@link DefaultTargetObject#changeElements(Collection, Collection, String)},- * {@link DefaultTargetObject#setAttributes(Map, String)}, and- * {@link DefaultTargetObject#setElements(Collection, String)} will automatically invoke this- * method when they detect object removal.- *- * @param branch the root of the sub-tree that is being removed- * @param reason a human-consumable explanation for the removal- */- void invalidateSubtree(TargetObject branch, String reason);-- /**- * Invalidate this subtree, without locking- *- * <p>- * This really only exists to avoid reentering a lock. This should be called when a thread has- * already acquired the relevant lock(s).- *- * @param branch- * @param reason- */- void doInvalidateSubtree(TargetObject branch, String reason);-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/SpiDebuggerObjectModel.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/SpiDebuggerObjectModel.javadeleted file mode 100644index 9a7ee44257..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/SpiDebuggerObjectModel.java+++ /dev/null@@ -1,180 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.async.AsyncUtils;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.error.DebuggerModelTypeException;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.PathUtils;--@Deprecated(forRemoval = true, since = "11.2")-public interface SpiDebuggerObjectModel extends DebuggerObjectModel {-- @Override- default boolean isAlive() {- return true;- }-- @Override- default CompletableFuture<Void> ping(String content) {- return AsyncUtils.nil();- }-- public static CompletableFuture<Object> fetchFreshChild(TargetObject obj, String key) {- if (PathUtils.isIndex(key)) {- return obj.fetchElements(RefreshBehavior.REFRESH_ALWAYS).thenApply(elements -> {- return elements.get(PathUtils.parseIndex(key));- });- }- return obj.fetchAttributes(RefreshBehavior.REFRESH_ALWAYS).thenApply(attributes -> {- return attributes.get(key);- });- }-- public static CompletableFuture<Object> fetchSuccessorValue(TargetObject obj,- List<String> path, RefreshBehavior refresh, boolean followLinks) {- if (path.isEmpty()) {- return CompletableFuture.completedFuture(obj);- }- String key = path.get(0);- CompletableFuture<?> futureChild;- switch (refresh) {- case REFRESH_ALWAYS:- futureChild = fetchFreshChild(obj, key);- break;- case REFRESH_NEVER:- futureChild = obj.fetchChild(key);- break;- case REFRESH_WHEN_ABSENT:- default:- CompletableFuture<?> futureChild0 = obj.fetchChild(key);- futureChild = futureChild0.thenCompose(c -> {- return c == null ? fetchFreshChild(obj, key)- : CompletableFuture.completedFuture(c);- });- break;- }- return futureChild.thenCompose(c -> {- if (c == null) {- return AsyncUtils.nil();- }- if (!(c instanceof TargetObject)) {- if (path.size() == 1) {- return CompletableFuture.completedFuture(c);- }- else {- List<String> p = PathUtils.extend(obj.getPath(), key);- throw DebuggerModelTypeException.typeRequired(c, p, TargetObject.class);- }- }- TargetObject child = (TargetObject) c;- if (PathUtils.isLink(obj.getPath(), key, child.getPath()) && !followLinks) {- if (path.size() == 1) {- return CompletableFuture.completedFuture(c);- }- else {- List<String> p = PathUtils.extend(obj.getPath(), key);- throw DebuggerModelTypeException.linkForbidden(child, p);- }- }- List<String> remains = path.subList(1, path.size());- return fetchSuccessorValue(child, remains, refresh, followLinks);- });- }-- @Override- public default CompletableFuture<?> fetchModelValue(List<String> path,- RefreshBehavior refresh) {- return fetchModelRoot().thenCompose(root -> {- return fetchSuccessorValue(root, path, refresh, true);- });- }-- @Override- public default CompletableFuture<?> fetchModelValue(List<String> path) {- return fetchModelValue(path, RefreshBehavior.REFRESH_NEVER);- }-- public static CompletableFuture<Object> fetchSuccessorValueUsingAvailableCache(TargetObject obj,- List<String> path, boolean followLinks) {- if (path.isEmpty()) {- return CompletableFuture.completedFuture(obj);- }- String key = path.get(0);- CompletableFuture<?> futureChild = obj.fetchChild(key);- CompletableFuture<?> ffutureChild = futureChild.thenCompose(c -> {- return c == null ? fetchFreshChild(obj, key) : CompletableFuture.completedFuture(c);- });- return ffutureChild.thenCompose(c -> {- if (c == null) {- return AsyncUtils.nil();- }- if (!(c instanceof TargetObject)) {- if (path.size() == 1) {- return CompletableFuture.completedFuture(c);- }- else {- List<String> p = PathUtils.extend(obj.getPath(), key);- throw DebuggerModelTypeException.typeRequired(c, p, TargetObject.class);- }- }- TargetObject child = (TargetObject) c;- if (PathUtils.isLink(obj.getPath(), key, child.getPath()) && !followLinks) {- if (path.size() == 1) {- return CompletableFuture.completedFuture(c);- }- else {- List<String> p = PathUtils.extend(obj.getPath(), key);- throw DebuggerModelTypeException.linkForbidden(child, p);- }- }- List<String> remains = path.subList(1, path.size());- return fetchSuccessorValueUsingAvailableCache(child, remains, followLinks);- });- }-- @Override- public default CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchObjectElements(- List<String> path, RefreshBehavior refresh) {- return fetchModelObject(path).thenCompose(obj -> {- if (obj == null) {- return AsyncUtils.nil();- }- return obj.fetchElements(refresh);- });- }-- @Override- default CompletableFuture<? extends Map<String, ?>> fetchObjectAttributes(List<String> path,- RefreshBehavior refresh) {- return fetchModelObject(path).thenCompose(obj -> {- if (obj == null) {- return AsyncUtils.nil();- }- return obj.fetchAttributes(refresh);- });- }-- @Override- default void invalidateAllLocalCaches() {- // Do nothing- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/SpiTargetObject.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/SpiTargetObject.javadeleted file mode 100644index 4b7b7d9dd2..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/agent/SpiTargetObject.java+++ /dev/null@@ -1,42 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetObject;--@Deprecated(forRemoval = true, since = "11.2")-public interface SpiTargetObject extends TargetObject, InvalidatableTargetObjectIf {- @Override- AbstractDebuggerObjectModel getModel();-- // TODO:- //@Override- //Map<String, ? extends SpiTargetObject> getCachedElements();-- boolean enforcesStrictSchema();-- /**- * If this internal implementation is a proxy, get its delegate- *- * @return the delegate, or this same object- */- default SpiTargetObject getDelegate() {- return this;- }-- DebuggerModelListener broadcast();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetArrayDataType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetArrayDataType.javadeleted file mode 100644index c178d5ade7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetArrayDataType.java+++ /dev/null@@ -1,54 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.attributes;--import com.google.gson.JsonElement;-import com.google.gson.JsonObject;--@Deprecated(forRemoval = true, since = "11.2")-public interface TargetArrayDataType extends TargetDataType {- public class DefaultTargetArrayDataType implements TargetArrayDataType {- protected final TargetDataType elementType;- protected final int elementCount;-- public DefaultTargetArrayDataType(TargetDataType elementType, int elementCount) {- this.elementType = elementType;- this.elementCount = elementCount;- }-- @Override- public TargetDataType getElementType() {- return elementType;- }-- @Override- public int getElementCount() {- return elementCount;- }-- @Override- public JsonElement toJson() {- JsonObject object = new JsonObject();- object.add("elementType", elementType.toJson());- object.addProperty("elementCount", elementCount);- return object;- }- }-- TargetDataType getElementType();-- int getElementCount();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetBitfieldDataType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetBitfieldDataType.javadeleted file mode 100644index 24544e1c93..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetBitfieldDataType.java+++ /dev/null@@ -1,73 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.attributes;--import com.google.gson.JsonElement;-import com.google.gson.JsonObject;--/**- * A bitfield-modified data type- *- * <p>- * This is only applicable to fields of structures.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface TargetBitfieldDataType extends TargetDataType {- public class DefaultTargetBitfieldDataType implements TargetBitfieldDataType {- protected final TargetDataType fieldType;- protected final int leastBitPosition;- protected final int bitLength;-- public DefaultTargetBitfieldDataType(TargetDataType fieldType, int leastBitPosition,- int bitLength) {- this.fieldType = fieldType;- this.leastBitPosition = leastBitPosition;- this.bitLength = bitLength;- }-- @Override- public TargetDataType getFieldType() {- return fieldType;- }-- @Override- public int getLeastBitPosition() {- return leastBitPosition;- }-- @Override- public int getBitLength() {- return bitLength;- }-- @Override- public JsonElement toJson() {- JsonObject object = new JsonObject();- object.add("fieldType", fieldType.toJson());- object.addProperty("leastBitPosition", leastBitPosition);- object.addProperty("bitLength", bitLength);- return object;- }- }-- TargetDataType getFieldType();-- int getLeastBitPosition();-- int getBitLength();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetDataType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetDataType.javadeleted file mode 100644index fc511c9eb4..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetDataType.java+++ /dev/null@@ -1,29 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.attributes;--import com.google.gson.JsonElement;--import ghidra.dbg.attributes.TargetPrimitiveDataType.DefaultTargetPrimitiveDataType;-import ghidra.dbg.attributes.TargetPrimitiveDataType.PrimitiveKind;--@Deprecated(forRemoval = true, since = "11.2")-public interface TargetDataType {- TargetDataType UNDEFINED1 =- new DefaultTargetPrimitiveDataType(PrimitiveKind.UNDEFINED, 1);-- JsonElement toJson();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetObjectList.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetObjectList.javadeleted file mode 100644index b2d682d758..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetObjectList.java+++ /dev/null@@ -1,55 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.attributes;--import java.util.*;--import ghidra.dbg.target.TargetObject;--@Deprecated(forRemoval = true, since = "11.2")-public interface TargetObjectList<T extends TargetObject> extends List<T> {- public static class EmptyTargetObjectRefList<T extends TargetObject> extends AbstractList<T>- implements TargetObjectList<T> {- @Override- public T get(int index) {- return null;- }-- @Override- public int size() {- return 0;- }- }-- public static class DefaultTargetObjectList<T extends TargetObject> extends ArrayList<T>- implements TargetObjectList<T> {- // Nothing to add- }-- public static final TargetObjectList<?> EMPTY = new EmptyTargetObjectRefList<>();-- @SuppressWarnings("unchecked")- public static <T extends TargetObject> TargetObjectList<T> of() {- return (TargetObjectList<T>) EMPTY;- }-- @SuppressWarnings("unchecked")- public static <T extends TargetObject> TargetObjectList<T> of(T... e) {- DefaultTargetObjectList<T> list = new DefaultTargetObjectList<>();- list.addAll(List.of(e));- return list;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetPointerDataType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetPointerDataType.javadeleted file mode 100644index 4856717b7c..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetPointerDataType.java+++ /dev/null@@ -1,44 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.attributes;--import com.google.gson.JsonElement;-import com.google.gson.JsonObject;--@Deprecated(forRemoval = true, since = "11.2")-public interface TargetPointerDataType extends TargetDataType {- public class DefaultTargetPointerDataType implements TargetPointerDataType {- protected final TargetDataType referentType;-- public DefaultTargetPointerDataType(TargetDataType referentType) {- this.referentType = referentType;- }-- @Override- public TargetDataType getReferentType() {- return referentType;- }-- @Override- public JsonElement toJson() {- JsonObject object = new JsonObject();- object.add("referentType", referentType.toJson());- return object;- }- }-- TargetDataType getReferentType();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetPrimitiveDataType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetPrimitiveDataType.javadeleted file mode 100644index 73068cd0ac..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetPrimitiveDataType.java+++ /dev/null@@ -1,65 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.attributes;--import com.google.gson.JsonObject;--@Deprecated(forRemoval = true, since = "11.2")-public interface TargetPrimitiveDataType extends TargetDataType {- public static final TargetDataType VOID =- new DefaultTargetPrimitiveDataType(PrimitiveKind.VOID, 0);-- enum PrimitiveKind {- UNDEFINED,- VOID,- UINT,- SINT,- FLOAT,- COMPLEX;- }-- public class DefaultTargetPrimitiveDataType implements TargetPrimitiveDataType {- protected final PrimitiveKind kind;- protected final int length;-- public DefaultTargetPrimitiveDataType(PrimitiveKind kind, int length) {- this.kind = kind;- this.length = length;- }-- @Override- public PrimitiveKind getKind() {- return kind;- }-- @Override- public int getLength() {- return length;- }-- @Override- public JsonObject toJson() {- JsonObject object = new JsonObject();- object.addProperty("kind", kind.toString());- object.addProperty("length", length);- return object;- }- }-- PrimitiveKind getKind();-- int getLength();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetStringList.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetStringList.javadeleted file mode 100644index 72a13a8aea..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/attributes/TargetStringList.java+++ /dev/null@@ -1,58 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.attributes;--import java.util.*;--import org.apache.commons.collections4.list.AbstractListDecorator;--import ghidra.dbg.util.CollectionUtils.AbstractEmptyList;--@Deprecated(forRemoval = true, since = "11.2")-public interface TargetStringList extends List<String> {- public static class EmptyTargetStringList extends AbstractEmptyList<String>- implements TargetStringList {- }-- public static class ImmutableTargetStringList extends AbstractListDecorator<String>- implements TargetStringList {- public ImmutableTargetStringList(String... strings) {- super(List.of(strings));- }-- public ImmutableTargetStringList(Collection<String> col) {- super(List.copyOf(col));- }- }-- public static class MutableTargetStringList extends ArrayList<String>- implements TargetStringList {- }-- public static final TargetStringList EMPTY = new EmptyTargetStringList();-- public static TargetStringList of() {- return EMPTY;- }-- public static TargetStringList of(String... strings) {- return new ImmutableTargetStringList(strings);- }-- public static TargetStringList copyOf(Collection<String> strings) {- return new ImmutableTargetStringList(strings);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerIgnorableException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerIgnorableException.javadeleted file mode 100644index 1501954ab8..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerIgnorableException.java+++ /dev/null@@ -1,47 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--import ghidra.async.AsyncUtils;--/**- * An exception which should not alert the user- *- * <p>- * At most, it can be logged, probably without a stack trace. These are sorts of soft warnings,- * which might be issued when an exception is a normal occurrence. One example is when a model is- * shutting down. It's common for requests in the queue to be rejected once the model beings- * shutting down. Exceptions raised by those requests can likely be ignored. Please note, clients- * will likely need to apply {@link AsyncUtils#unwrapThrowable(Throwable)} in order to determine- * whether the exception is ignorable. Alternatively, use {@link #isIgnorable(Throwable)}.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerIgnorableException extends DebuggerRuntimeException {- public static boolean isIgnorable(Throwable ex) {- Throwable u = AsyncUtils.unwrapThrowable(ex);- return u instanceof DebuggerIgnorableException;- }-- public DebuggerIgnorableException(String message, Throwable cause) {- super(message, cause);- }-- public DebuggerIgnorableException(String message) {- super(message);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerIllegalArgumentException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerIllegalArgumentException.javadeleted file mode 100644index 4d1fd01a39..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerIllegalArgumentException.java+++ /dev/null@@ -1,38 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--/**- * A model method was given an illegal argument.- *- * If the argument is an object, but of the wrong type, please use- * {@link DebuggerModelTypeException} instead. If the argument is a path which doesn't exist in the- * model, use {@link DebuggerModelNoSuchPathException} instead.- *- * @implNote I am not re-using {@link IllegalArgumentException} here, as I don't want any of those- * thrown internally to be passed to the client.- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerIllegalArgumentException extends DebuggerRuntimeException {- public DebuggerIllegalArgumentException(String message) {- super(message);- }-- public DebuggerIllegalArgumentException(String message, Throwable cause) {- super(message, cause);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerMemoryAccessException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerMemoryAccessException.javadeleted file mode 100644index 8da5a11784..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerMemoryAccessException.java+++ /dev/null@@ -1,41 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--import ghidra.dbg.target.TargetMemory;-import ghidra.program.model.address.Address;--/**- * An exception for when there is an unknown (possibly permanent) condition preventing memory access- * via {@link TargetMemory#readMemory(Address, int)} and- * {@link TargetMemory#writeMemory(Address, byte[])}- *- * <p>- * If the underlying debugger is simply in a state that prevents the request from being fulfilled,- * e.g., the target process is running, then use {@link DebuggerModelAccessException} instead.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerMemoryAccessException extends DebuggerRuntimeException {- public DebuggerMemoryAccessException(String message, Throwable cause) {- super(message, cause);- }-- public DebuggerMemoryAccessException(String message) {- super(message);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelAccessException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelAccessException.javadeleted file mode 100644index bdfbb86a6c..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelAccessException.java+++ /dev/null@@ -1,46 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.PathUtils;--/**- * An exception that may be thrown if an ancestor of an object is- * {@link TargetAccessibility#INACCESSIBLE} at the time a method is invoked on that object.- *- * <p>- * In general, this exception should be considered a temporary condition, meaning the client should- * just try again later. If a UI is involved, the error, if displayed at all, should be displayed in- * the least obtrusive manner possible.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerModelAccessException extends DebuggerRuntimeException {-- public DebuggerModelAccessException(String message, Throwable cause) {- super(message, cause);- }-- public DebuggerModelAccessException(String message) {- super(message);- }-- public DebuggerModelAccessException(TargetObject object) {- super("Model path " + PathUtils.toString(object.getPath()) + " is not accessible");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelNoSuchPathException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelNoSuchPathException.javadeleted file mode 100644index 66d5859223..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelNoSuchPathException.java+++ /dev/null@@ -1,27 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerModelNoSuchPathException extends DebuggerRuntimeException {- public DebuggerModelNoSuchPathException(String message, Throwable cause) {- super(message, cause);- }-- public DebuggerModelNoSuchPathException(String message) {- super(message);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelTerminatingException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelTerminatingException.javadeleted file mode 100644index d527add714..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelTerminatingException.java+++ /dev/null@@ -1,32 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--/**- * A request was rejected, because the model is shutting down- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerModelTerminatingException extends DebuggerIgnorableException {- public DebuggerModelTerminatingException(String message, Throwable cause) {- super(message, cause);- }-- public DebuggerModelTerminatingException(String message) {- super(message);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelTypeException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelTypeException.javadeleted file mode 100644index 47de2f39d7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerModelTypeException.java+++ /dev/null@@ -1,51 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--import java.util.List;--import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.PathUtils;--/**- *- * @implNote I am not re-using {@link ClassCastException} here, as I don't want any of those thrown- * internally to be passed to the client.- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerModelTypeException extends DebuggerRuntimeException {- public static DebuggerModelTypeException typeRequired(Object got, List<String> path,- Class<?> expected) {- return new DebuggerModelTypeException("Path " + PathUtils.toString(path) +- " does not refer to a " + expected.getSimpleName() + ". Got " + got + " (of " +- got.getClass().getSimpleName() + ")");- }-- public static DebuggerModelTypeException linkForbidden(TargetObject got, List<String> path) {- return new DebuggerModelTypeException("Path " + PathUtils.toString(path) +- " is a link to " + PathUtils.toString(got.getPath()) +- ", but following links was forbidden");- }-- public DebuggerModelTypeException(String message) {- super(message);- }-- public DebuggerModelTypeException(String message, Throwable cause) {- super(message, cause);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerRegisterAccessException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerRegisterAccessException.javadeleted file mode 100644index a72a9f5664..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerRegisterAccessException.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--import ghidra.dbg.target.TargetRegisterBank;--/**- * An exception for when there is an unknown (possibly permanent) condition preventing register- * access via {@link TargetRegisterBank#readRegisters(java.util.Collection)},- * {@link TargetRegisterBank#writeRegisters(java.util.Map)}, and related methods.- *- * <p>- * If the underlying debugger is simply in a state that prevents the request from being fulfilled,- * e.g., the target process is running, then use {@link DebuggerModelAccessException} instead.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerRegisterAccessException extends DebuggerRuntimeException {- public DebuggerRegisterAccessException(String message, Throwable cause) {- super(message, cause);- }-- public DebuggerRegisterAccessException(String message) {- super(message);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerRuntimeException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerRuntimeException.javadeleted file mode 100644index d12053a39a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerRuntimeException.java+++ /dev/null@@ -1,27 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerRuntimeException extends RuntimeException {- public DebuggerRuntimeException(String message, Throwable cause) {- super(message, cause);- }-- public DebuggerRuntimeException(String message) {- super(message);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerUserException.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerUserException.javadeleted file mode 100644index 3c7e73a94c..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/error/DebuggerUserException.java+++ /dev/null@@ -1,28 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.error;--/**- * The request generated an error with a message for the user- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerUserException extends DebuggerRuntimeException {- public DebuggerUserException(String message) {- super(message);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/CachedMemory.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/CachedMemory.javadeleted file mode 100644index 3d2ec28298..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/CachedMemory.java+++ /dev/null@@ -1,238 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.memory;--import java.util.*;-import java.util.Map.Entry;-import java.util.concurrent.CompletableFuture;-import java.util.concurrent.TimeoutException;-import java.util.concurrent.atomic.AtomicReference;--import org.apache.commons.lang3.exception.ExceptionUtils;--import generic.ULongSpan;-import generic.ULongSpan.*;-import ghidra.async.AsyncFence;-import ghidra.async.AsyncUtils;-import ghidra.dbg.target.TargetProcess;-import ghidra.dbg.target.TargetThread;-import ghidra.generic.util.datastruct.SemisparseByteArray;-import ghidra.util.Msg;--/**- * A cached memory wrapper- *- * <p>- * Because debugging channels can be slow, memory reads and writes ought to be cached for the- * duration a thread (and threads sharing the same memory) are stopped. This highly-recommended- * convenience implements a write-through single-layer cache. The implementor need only provide- * references to the basic asynchronous read/write methods. Those are usually private methods of the- * {@link TargetThread} or {@link TargetProcess} implementation. The public read/write methods just- * wrap the read/write methods provided by this cache.- *- * <p>- * Implementation note: The cache is backed by a {@link SemisparseByteArray}, which is well-suited- * for reads and writes within a locality. Nothing is evicted from the cache automatically. All- * eviction is done manually by a call to {@link #clear()}. During a debug session, there are- * typically few reads or writes between execution steps. Given the purpose is to eliminate- * unnecessary reads, there is little motivation to implement an automatic eviction strategy. The- * debugger client implementation must clear the cache at each execution step, unless it can- * accurately determine that certain ranges of memory cannot be affected by a given step.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class CachedMemory implements MemoryReader, MemoryWriter {- private final SemisparseByteArray memory = new SemisparseByteArray();- private final NavigableMap<Long, PendingRead> pendingByLoc =- new TreeMap<>(ULongSpan.DOMAIN::compare);- private final MemoryReader reader;- private final MemoryWriter writer;-- protected static class PendingRead {- final ULongSpan span;- final CompletableFuture<Void> future;-- protected PendingRead(ULongSpan span, CompletableFuture<Void> future) {- this.span = span;- this.future = future;- }- }-- /**- * Create a new cache wrapping the given read/write methods- *- * The wrapped read/write methods are usually private- *- * @param reader the read implementation, usually a method reference- * @param writer the write implementation, usually a method reference- */- public CachedMemory(MemoryReader reader, MemoryWriter writer) {- this.reader = reader;- this.writer = writer;- }-- @Override- public CompletableFuture<Void> writeMemory(long addr, byte[] data) {- // TODO: Do I write to the cache first, and correct if an error occurs?- // Or leave it as write to cache on known success- return writer.writeMemory(addr, data).thenAccept(__ -> {- memory.putData(addr, data);- });- }-- protected synchronized CompletableFuture<Void> waitForReads(long addr, int len) {- ULongSpanSet undefined = memory.getUninitialized(addr, addr + len - 1);- // Do the reads in parallel- AsyncFence fence = new AsyncFence();- for (ULongSpan span : undefined.spans()) {- findPendingOrSchedule(span, fence);- }- return fence.ready();- }-- protected synchronized void findPendingOrSchedule(final ULongSpan span,- final AsyncFence fence) {- MutableULongSpanSet needRequests = new DefaultULongSpanSet();- needRequests.add(span);-- // Find all existing requests and include them in the fence- // Check if there is a preceding range which overlaps the desired range:- Entry<Long, PendingRead> prec = pendingByLoc.lowerEntry(span.min());- if (prec != null) {- PendingRead pending = prec.getValue();- if (!pending.future.isCompletedExceptionally() && span.intersects(pending.span)) {- needRequests.remove(pending.span);- fence.include(pending.future);- }- }- NavigableMap<Long, PendingRead> applicablePending =- pendingByLoc.subMap(span.min(), true, span.max(), true);- for (Map.Entry<Long, PendingRead> ent : applicablePending.entrySet()) {- PendingRead pending = ent.getValue();- if (pending.future.isCompletedExceptionally()) {- continue;- }- needRequests.remove(pending.span);- fence.include(pending.future);- }-- // Now we're left with a set of needed ranges. Make a request for each- for (ULongSpan needed : needRequests.spans()) {- final long lower = needed.min();- CompletableFuture<byte[]> futureRead = reader.readMemory(lower, (int) needed.length());- // Async to avoid re-entrant lock problem- CompletableFuture<Void> futureStored = futureRead.thenAcceptAsync(data -> {- synchronized (this) {- /*Msg.debug(this, "Completed read at " + lower.toString(16) + ": " +- NumericUtilities.convertBytesToString(data));*/- if (pendingByLoc.remove(lower) != null) {- /**- * If the cache was cleared while this read was still pending, we do not- * want to record the result.- */- memory.putData(lower, data);- //Msg.debug(this, "Cached read at " + lower.toString(16));- }- }- }).exceptionally(e -> {- Msg.error(this, "Unexpected error caching memory: ", e);- synchronized (this) {- pendingByLoc.remove(lower);- }- return ExceptionUtils.rethrow(e);- });- pendingByLoc.put(lower, new PendingRead(span, futureStored));- fence.include(futureStored);- }- }-- /**- * {@inheritDoc}- *- * @implNote In some circumstances, it may actually be less efficient to split a request,- * especially if the split only saves a few bytes. The logic required to efficiently- * handle those circumstances would require a bit of calibration based on empirical- * measures, so until such a change becomes necessary, the naive splitting logic- * remains.- */- @Override- public CompletableFuture<byte[]> readMemory(long addr, int len) {- AssertionError defaultErr =- new AssertionError("No data available even after a successful read?");- AtomicReference<Throwable> exc = new AtomicReference<>(defaultErr);- //Msg.debug(this, "Reading " + len + " bytes at " + Long.toUnsignedString(addr, 16));- return waitForReads(addr, len).handle((v, e) -> {- int available = memory.contiguousAvailableAfter(addr);- if (available == 0) {- if (e == null) {- // TODO: This is happening. Fix it!- throw new AssertionError("No data available at " +- Long.toUnsignedString(addr, 16) + " even after a successful read?");- }- else {- return ExceptionUtils.rethrow(e);- }- }- if (e != null && !isTimeout(e)) {- Msg.error(this,- "Some reads requested by the cache failed. Returning a partial result: " +- exc.get());- }- byte[] result = new byte[Math.min(len, available)];- memory.getData(addr, result);- return result;- });- }-- /**- * Update target memory cache by some out-of-band means- *- * @param address the offset of the address- * @param data the contents to cache- */- public void updateMemory(long address, byte[] data) {- /*Msg.debug(this, "Memory Cache updated at " + address + ": " +- NumericUtilities.convertBytesToString(data));*/- memory.putData(address, data);- }-- /**- * Reset the cache- *- * The next read command is guaranteed to be forwarded in its entirety.- */- public void clear() {- List<PendingRead> toCancel;- synchronized (this) {- //Msg.debug(this, "Memory Cache cleared");- memory.clear();- toCancel = List.copyOf(pendingByLoc.values());- pendingByLoc.clear();- }- for (PendingRead pendingRead : toCancel) {- pendingRead.future.cancel(true);- }- }-- protected boolean isTimeout(Throwable e) {- e = AsyncUtils.unwrapThrowable(e);- if (e instanceof TimeoutException) {- return true;- }- return false;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/MemoryReader.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/MemoryReader.javadeleted file mode 100644index cac770070f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/MemoryReader.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.memory;--import java.util.concurrent.CompletableFuture;--/**- * The functional interface for reads from a cached memory- *- * @see CachedMemory- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface MemoryReader {- /**- * Read target memory- *- * If cached, any cached regions are removed from the request. If this results in non-contiguous- * regions, each generates a new request, forwarded to the wrapped read method.- */- // TODO: Use ByteBuffer instead?- public CompletableFuture<byte[]> readMemory(long address, int length);-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/MemoryWriter.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/MemoryWriter.javadeleted file mode 100644index f19645afb5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/memory/MemoryWriter.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.memory;--import java.util.concurrent.CompletableFuture;--/**- * The functional interface for writes to a cached memory- *- * @see CachedMemory- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface MemoryWriter {- /**- * Write target memory- *- * If cached, the given write command is immediately forwarded to the wrapped write, and the- * cache is updated so that subsequent reads within the same region do not get forwarded.- */- // TODO: Use ByteBuffer instead?- public CompletableFuture<Void> writeMemory(long address, byte[] data);-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAccessConditioned.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAccessConditioned.javadeleted file mode 100644index cc5c42d0db..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAccessConditioned.java+++ /dev/null@@ -1,42 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * A target object which may not be accessible- *- * <p>- * Depending on the state of the debugger, it may not be able to process commands for certain target- * objects. Objects which may not be accessible should support this interface. Note, that the- * granularity of accessibility is the entire object, including its children (excluding links). If,- * e.g., an object can process memory commands but not control commands, it should be separated into- * two objects.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Access")-public interface TargetAccessConditioned extends TargetObject {- String ACCESSIBLE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "accessible";-- @TargetAttributeType(name = ACCESSIBLE_ATTRIBUTE_NAME, required = true, hidden = true)- public default boolean isAccessible() {- return getTypedAttributeNowByName(ACCESSIBLE_ATTRIBUTE_NAME, Boolean.class, true);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetActiveScope.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetActiveScope.javadeleted file mode 100644index 009970807a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetActiveScope.java+++ /dev/null@@ -1,42 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * An object made active- *- * <p>- * "Active" here describes which object in a given class the target should operate on- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("ActiveScope")-public interface TargetActiveScope extends TargetObject {-- /**- * Set the given object as the target's active object for the given type- *- * @param obj the object to setActive- * @return a future which completes upon successfully changing focus.- */- CompletableFuture<Void> requestActivation(TargetObject obj);--}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAttachable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAttachable.javadeleted file mode 100644index ad59e673fc..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAttachable.java+++ /dev/null@@ -1,29 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * An object, usually process, to which the debugger can attach- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Attachable")-public interface TargetAttachable extends TargetObject {- // These are fairly opaque-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAttacher.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAttacher.javadeleted file mode 100644index 6c948a59f3..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAttacher.java+++ /dev/null@@ -1,123 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Set;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.util.CollectionUtils;-import ghidra.dbg.util.CollectionUtils.AbstractEmptySet;--/**- * An object which is capable of attaching to a {@link TargetAttachable}- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Attacher")-public interface TargetAttacher extends TargetObject {-- public interface TargetAttachKindSet extends Set<TargetAttachKind> {-- public static class EmptyTargetAttachKindSet extends AbstractEmptySet<TargetAttachKind>- implements TargetAttachKindSet {- // Nothing- }-- public static class ImmutableTargetAttachKindSet extends- CollectionUtils.AbstractNSet<TargetAttachKind> implements TargetAttachKindSet {-- public ImmutableTargetAttachKindSet(TargetAttachKind... kinds) {- super(kinds);- }-- public ImmutableTargetAttachKindSet(Set<TargetAttachKind> set) {- super(set);- }- }-- TargetAttachKindSet EMPTY = new EmptyTargetAttachKindSet();-- public static TargetAttachKindSet of() {- return EMPTY;- }-- public static TargetAttachKindSet of(TargetAttachKind... kinds) {- return new ImmutableTargetAttachKindSet(kinds);- }-- public static TargetAttachKindSet copyOf(Set<TargetAttachKind> set) {- return new ImmutableTargetAttachKindSet(set);- }- }-- enum TargetAttachKind {- /**- * Use a {@link TargetAttachable} object- */- BY_OBJECT_REF,- /**- * Use the id of some object- */- BY_ID,- }-- String SUPPORTED_ATTACH_KINDS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "supported_attach_kinds";-- /**- * Get the kinds of multi-stepping implemented by the debugger- *- * <p>- * Different debuggers provide varying methods of attaching. This attribute describes which are- * supported. NOTE: This should be replaced by generic method invocation.- *- * @return the set of supported attach operations- */- @TargetAttributeType(- name = SUPPORTED_ATTACH_KINDS_ATTRIBUTE_NAME,- required = true,- hidden = true)- public default TargetAttachKindSet getSupportedAttachKinds() {- return getTypedAttributeNowByName(SUPPORTED_ATTACH_KINDS_ATTRIBUTE_NAME,- TargetAttachKindSet.class, TargetAttachKindSet.of());- }-- /**- * Attach to the given {@link TargetAttachable}- *- * <p>- * This is mostly applicable to user-space contexts, in which case, this usually means to attach- * to a process.- *- * @param attachable the object or reference to attach to- * @return a future which completes when the command is confirmed- */- public CompletableFuture<Void> attach(TargetAttachable attachable);-- /**- * Attach to the given id- *- * <p>- * This is mostly applicable to user-space contexts, in which case, this usually means to attach- * to a process using its OS-assigned process id.- *- * @param pid the identifier for and object to attach to- * @return a future which completes when the command is confirmed- */- public CompletableFuture<Void> attach(long pid);-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointLocation.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointLocation.javadeleted file mode 100644index 98ec553fc9..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointLocation.java+++ /dev/null@@ -1,69 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.program.model.address.AddressRange;--/**- * The location of a breakpoint- *- * <p>- * If the native debugger does not separate the concepts of specification and location, then- * breakpoint objects should implement both the specification and location interfaces. If the- * location is user-togglable independent of its specification, it should implement- * {@link TargetTogglable} as well.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("BreakpointLocation")-public interface TargetBreakpointLocation extends TargetObject {-- String RANGE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "range";- String SPEC_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "spec";-- /**- * The range covered by this location- *- * <p>- * Typically, watchpoints (or access breakpoints) have a length, so the range would cover all- * addresses in the variable being watched. Execution breakpoints likely have a "length" of 1,- * meaning they cover only the address of the trap.- *- * @return the address range of the location- */- @TargetAttributeType(name = RANGE_ATTRIBUTE_NAME, hidden = true)- public default AddressRange getRange() {- return getTypedAttributeNowByName(RANGE_ATTRIBUTE_NAME, AddressRange.class, null);- }-- /**- * Get a reference to the specification which generated this breakpoint.- *- * <p>- * If the debugger does not separate specifications from actual breakpoints, then the- * "specification" is this breakpoint. Otherwise, the specification is identified by an- * attribute, usually a link.- *- * @return the reference to the specification- */- @TargetAttributeType(name = SPEC_ATTRIBUTE_NAME, required = true, hidden = true)- public default TargetBreakpointSpec getSpecification() {- return getTypedAttributeNowByName(SPEC_ATTRIBUTE_NAME, TargetBreakpointSpec.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointLocationContainer.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointLocationContainer.javadeleted file mode 100644index 6d0d45d2de..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointLocationContainer.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * A place for breakpoint locations to reside- *- * <p>- * This is just a marker interface for finding where a target's breakpoints are given. In some- * models, notably GDB, the locations belong to a global set of specifications. The only way to- * indicate that a location applies to a target is for it to be a successor of that target, at least- * by linking. To ease discovery, the breakpoint location container for the target must be a- * canonical successor of the target. The locations in the container may be canonical or links.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("BreakpointLocationContainer")-public interface TargetBreakpointLocationContainer extends TargetObject {- // Nothing here aside from a marker-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointSpec.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointSpec.javadeleted file mode 100644index 31c1306b78..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointSpec.java+++ /dev/null@@ -1,176 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Collection;-import java.util.List;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebugModelConventions;-import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetBreakpointSpecContainer.TargetBreakpointKindSet;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * The specification of a breakpoint applied to a target object- *- * <p>- * Note that a single specification could result in several locations, or no locations at all. For- * example, a breakpoint placed on a function within a module which has not been loaded ("pending"- * in GDB's nomenclature), will not have any location. On the other hand, a breakpoint expressed by- * line number in a C++ template or a C macro could resolve to many addresses. The children of this- * object include the resolved {@link TargetBreakpointLocation}s. If the debugger does not share- * this same concept, then its breakpoints should implement both the specification and the location;- * the specification need not have any children.- *- * <p>- * This object extends {@link TargetTogglable} for a transitional period only. Implementations whose- * breakpoint specifications can be toggled should declare this interface explicitly. When the- * specification is user togglable, toggling it should effectively toggle all locations -- whether- * or not the locations are user togglable.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("BreakpointSpec")-public interface TargetBreakpointSpec extends TargetObject, /*@Transitional*/ TargetTogglable {-- /**- * The kinds of breakpoints understood by Ghidra. Note these must match with those in- * {@code TraceBreakpointKind}.- */- public enum TargetBreakpointKind {- /**- * A read breakpoint, likely implemented in hardware- */- READ,- /**- * A write breakpoint, likely implemented in hardware- */- WRITE,- /**- * An execution breakpoint implemented in hardware, i.e., without modifying the target's- * program memory- */- HW_EXECUTE,- /**- * An execution breakpoint implemented in software, i.e., by modifying the target's program- * memory- */- SW_EXECUTE;- }-- String CONTAINER_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "container";- String EXPRESSION_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "expression";- String KINDS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "kinds";- String AS_BPT_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "bpt";-- /**- * Get the container of this breakpoint.- *- * <p>- * While it is most common for a breakpoint specification to be an immediate child of its- * container, that is not necessarily the case. This method is a reliable and type-safe means of- * obtaining that container.- *- * @return a reference to the container- */- @TargetAttributeType(name = CONTAINER_ATTRIBUTE_NAME, required = true, hidden = true)- public default TargetBreakpointSpecContainer getContainer() {- return getTypedAttributeNowByName(CONTAINER_ATTRIBUTE_NAME,- TargetBreakpointSpecContainer.class,- null);- }-- /**- * Get the user-specified expression describing the breakpoint- *- * <p>- * Depending on the underlying debugger, this could be a variety of forms, e.g., source file and- * line number, module and symbol, address.- *- * @return the expression- */- @TargetAttributeType(name = EXPRESSION_ATTRIBUTE_NAME, required = true, hidden = true)- public default String getExpression() {- return getTypedAttributeNowByName(EXPRESSION_ATTRIBUTE_NAME, String.class, "");- }-- /**- * Get the kinds of breakpoint- *- * @return the kinds- */- @TargetAttributeType(name = KINDS_ATTRIBUTE_NAME, required = true, hidden = true)- public default TargetBreakpointKindSet getKinds() {- return getTypedAttributeNowByName(KINDS_ATTRIBUTE_NAME, TargetBreakpointKindSet.class,- TargetBreakpointKindSet.EMPTY);- }-- /**- * Add an action to execute locally when this breakpoint traps execution- *- * <p>- * Note that unlike other parts of this API, the breakpoint specification implementation must- * keep a strong reference to its actions. Adding the same action a second time may cause- * undefined behavior. Ideally, the implementation would at least detect this condition and log- * a warning.- *- * @param action the action to execute- */- public void addAction(TargetBreakpointAction action);-- /**- * Remove an action from this breakpoint- *- * @param action the action to remove- */- public void removeAction(TargetBreakpointAction action);-- public interface TargetBreakpointAction {- /**- * An effective breakpoint from this specification trapped execution- *- * @param spec the breakpoint specification- * @param trapped the object whose execution was trapped- * @param frame the innermost stack frame, if available, of the trapped object- * @param breakpoint the effective breakpoint that actually trapped execution- */- void breakpointHit(TargetBreakpointSpec spec, TargetObject trapped, TargetStackFrame frame,- TargetBreakpointLocation breakpoint);- }-- /**- * Get the locations created by this specification.- *- * <p>- * While it is most common for locations to be immediate children of the specification, that is- * not necessarily the case.- *- * @implNote By default, this method collects all successor locations ordered by path.- * Overriding that behavior is not yet supported.- * @return the effective breakpoints- */- public default CompletableFuture< //- ? extends Collection<? extends TargetBreakpointLocation>> getLocations() {- if (this instanceof TargetBreakpointLocation) {- return CompletableFuture.completedFuture(List.of((TargetBreakpointLocation) this));- }- return DebugModelConventions.collectSuccessors(this, TargetBreakpointLocation.class);- }-- // TODO: Make hit count part of the common interface?-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointSpecContainer.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointSpecContainer.javadeleted file mode 100644index fdf30000b7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetBreakpointSpecContainer.java+++ /dev/null@@ -1,147 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Set;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.CollectionUtils.AbstractEmptySet;-import ghidra.dbg.util.CollectionUtils.AbstractNSet;-import ghidra.program.model.address.*;--/**- * A container for breakpoint specifications and/or locations- *- * <p>- * This interface provides for the placement (creation) of breakpoints and as a listening point for- * breakpoint events. Typically, it is implemented by an object whose elements are breakpoints.- *- * <p>- * TODO: Rename this to {@code TargetBreakpointOperations}. Conventionally, it is a container of- * breakpoints, but it doesn't technically have to be. A client searching for the breakpoint- * (location) container should use {@link TargetObjectSchema#searchForCanonicalContainer(Class)},- * passing {@link TargetBreakpointLocation}. A client seeking to place breakpoints should use- * {@link TargetObjectSchema#searchForSuitable(Class, java.util.List)}, passing- * {@link TargetBreakpointSpecContainer}.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("BreakpointSpecContainer")-public interface TargetBreakpointSpecContainer extends TargetObject {-- String SUPPORTED_BREAK_KINDS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "supported_breakpoint_kinds";-- public interface TargetBreakpointKindSet extends Set<TargetBreakpointKind> {- public static class EmptyTargetBreakpointKindSet- extends AbstractEmptySet<TargetBreakpointKind> implements TargetBreakpointKindSet {- // Nothing- }-- public static class ImmutableTargetBreakpointKindSet- extends AbstractNSet<TargetBreakpointKind>- implements TargetBreakpointKindSet {-- public ImmutableTargetBreakpointKindSet(TargetBreakpointKind... kinds) {- super(kinds);- }-- public ImmutableTargetBreakpointKindSet(Set<TargetBreakpointKind> set) {- super(set);- }- }-- TargetBreakpointKindSet EMPTY = new EmptyTargetBreakpointKindSet();-- public static TargetBreakpointKindSet of() {- return EMPTY;- }-- public static TargetBreakpointKindSet of(TargetBreakpointKind... kinds) {- return new ImmutableTargetBreakpointKindSet(kinds);- }-- public static TargetBreakpointKindSet copyOf(Set<TargetBreakpointKind> set) {- return new ImmutableTargetBreakpointKindSet(set);- }- }-- /**- * Get the kinds of supported breakpoints- *- * <p>- * Different debuggers have differing vocabularies of breakpoints, and may only support a subset- * of those recognized by Ghidra. This attribute describes those supported.- *- * @return the set of supported kinds- */- @TargetAttributeType(- name = SUPPORTED_BREAK_KINDS_ATTRIBUTE_NAME,- required = true,- hidden = true)- public default TargetBreakpointKindSet getSupportedBreakpointKinds() {- return getTypedAttributeNowByName(SUPPORTED_BREAK_KINDS_ATTRIBUTE_NAME,- TargetBreakpointKindSet.class, TargetBreakpointKindSet.of());- }-- /**- * Specify a breakpoint having the given expression and kinds- *- * <p>- * Certain combinations of kinds and expression may not be reasonable. In those cases, the- * debugger may choose to reject, split, and/or adjust the request.- *- * @param expression the expression, in the native debugger's syntax- * @param kinds the desired set of kinds- * @return a future which completes when the request is processed- */- public CompletableFuture<Void> placeBreakpoint(String expression,- Set<TargetBreakpointKind> kinds);-- /**- * Specify a breakpoint having the given range and kinds- *- * <p>- * Certain combinations of kinds and range may not be reasonable. In those cases, the debugger- * may choose to reject, split, and/or adjust the request.- *- * @param range the range of addresses for the breakpoint- * @param kinds the desired set of kinds- * @return a future which completes when the request is processed- */- public CompletableFuture<Void> placeBreakpoint(AddressRange range,- Set<TargetBreakpointKind> kinds);-- /**- * Specify a breakpoint having the given address and kinds- *- * <p>- * Certain combinations of kinds may not be reasonable. In those cases, the debugger may choose- * to reject, split, and/or adjust the request.- *- * @param expression the expression, in the native debugger's syntax- * @param kinds the desired set of kinds- * @return a future which completes when the request is processed- */- public default CompletableFuture<Void> placeBreakpoint(Address address,- Set<TargetBreakpointKind> kinds) {- return placeBreakpoint(new AddressRangeImpl(address, address), kinds);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetCmdLineLauncherEx.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetCmdLineLauncherEx.javadeleted file mode 100644index 5f41954fc6..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetCmdLineLauncherEx.java+++ /dev/null@@ -1,80 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.target.TargetMethod.ParameterDescription;-import ghidra.dbg.target.TargetMethod.TargetParameterMap;--@Deprecated(forRemoval = true, since = "11.2")-public interface TargetCmdLineLauncherEx extends TargetLauncher {- String CMDLINE_ARGS_NAME = "args";-- /**- * The {@code args} parameter- */- ParameterDescription<String> PARAMETER_CMDLINE_ARGS = ParameterDescription.create(- String.class,- CMDLINE_ARGS_NAME, true, "", "Command Line", "space-separated command-line arguments");-- /**- * A map of parameters suitable for invoking {@link #launch(List)}- */- TargetParameterMap PARAMETERS = TargetMethod.makeParameters(PARAMETER_CMDLINE_ARGS);-- /**- * Check if the given image path contains spaces, and surround it in double quotes ({@code "})- * if necessary.- *- * <p>- * Without the quotes the launcher will likely confuse the spaces for separating arguments. When- * constructing the command-line to launch a program, this method must be used, even if the- * image is the only "argument."- *- * @param imagePath the path to the image on the target platform.- * @return the path, possibly surrounded in quotes.- */- static String quoteImagePathIfSpaces(String imagePath) {- if (imagePath.contains(" ")) {- return '"' + imagePath + '"';- }- return imagePath;- }-- @Override- default public TargetParameterMap getParameters() {- return PARAMETERS;- }-- /**- * Launch a target using the given arguments- *- * <p>- * This is mostly applicable to user-space contexts, in which case, this usually means to launch- * a new process with the given arguments, where the first argument is the path to the- * executable image on the target host's file system.- *- * @param args the arguments- * @return a future which completes when the command has been processed- */- @Override- public default CompletableFuture<Void> launch(Map<String, ?> args) {- return launch(args);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetConfigurable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetConfigurable.javadeleted file mode 100644index 30dfebbaff..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetConfigurable.java+++ /dev/null@@ -1,81 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.HashMap;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetMethod.ParameterDescription;--/**- * A target with writable configuration options- *- * <p>- * In general, the options are also stored as attributes, so that the current values are retrievable- * by the client. Note that not every attribute denotes a writable option. The list of configurable- * options, along with a description of each, is retrieved using {@link #getConfigurableOptions()}.- *- * <p>- * Options should be close to their scope of applicability. For example, if an object affects the- * whole model, it should be an option of the root, or perhaps an option of a top-level "Options"- * object. If an option affects an object's elements, that option should be on the containing- * object. If an option affects a singular object, that option should probably be on that object- * itself.- *- * <p>- * Furthermore, writing an option should not be the means of triggering an action. Though certainly,- * the model may react to their modification. Actions, in general, should instead be exposed as- * {@link TargetMethod}s.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Configurable")-public interface TargetConfigurable extends TargetObject {-- String BASE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "base";-- /**- * Write a single option to this object- *- * <p>- * TODO: This should probably be replaced with a {@code configure(Map<String,Object> options)}- * method. That should also make it easy to validate the arguments using the same mechanisms as- * for {@link TargetMethod#invoke(Map)}.- *- * @param key the name of the option, typically corresponding to the same-named attribute- * @param value the value to assign the option, typically conforming to the attribute schema- * @return a future which completes when the change is processed.- * @throws {@link DebuggerIllegalArgumentException} if the key is not writable, or if the value- * is not valid.- */- public CompletableFuture<Void> writeConfigurationOption(String key, Object value);-- /**- * Get the map of writable configuration options- *- * <p>- * TODO: Implement this properly in all subclasses to advertise their parameters. Then remove- * this default implementation.- *- * @return a map of names to option descriptions- */- public default Map<String, ParameterDescription<?>> getConfigurableOptions() {- return new HashMap<>();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetConsole.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetConsole.javadeleted file mode 100644index 1c68e2fa1e..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetConsole.java+++ /dev/null@@ -1,59 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.nio.charset.Charset;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.lifecycle.Experimental;--/**- * A user-facing console- *- * <p>- * This could be a CLI for the native debugger, or I/O for a target, or anything else the model- * might like to expose in terminal-like fashion.- *- * <p>- * This is still an experimental concept and has not been implemented in any model. While it seems- * like an abstract case of {@link TargetInterpreter}, their specifications don't seem to line up.- * E.g., implementing the CLI as a {@link TargetConsole} requires the server to buffer and parse- * line input; whereas, implementing the CLI as a {@link TargetInterpreter} requires the client to- * parse line input.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Console")-public interface TargetConsole extends TargetObject {- Charset CHARSET = Charset.forName("utf-8");-- /**- * For console output notifications, indicates whether it is normal or error output- */- public static enum Channel {- STDOUT, STDERR;- }-- /**- * Write data to the console's input- *- * @param data the data, often utf-8-encoded text- * @return a future which completes when the data is sent- */- public CompletableFuture<Void> write(byte[] data);-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDataTypeMember.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDataTypeMember.javadeleted file mode 100644index 4b1d11b2b5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDataTypeMember.java+++ /dev/null@@ -1,92 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.util.TargetDataTypeConverter;--/**- * A member of another data type- *- * <p>- * This is usually the child of a {@link TargetNamedDataType}, and its role in determined- * conventionally by the actual type of the parent, and of this member's key.- *- * <p>- * TODO: Document the conventions. Most, if not all, are implemented in- * {@link TargetDataTypeConverter}.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("TypeMember")-public interface TargetDataTypeMember extends TargetObject {-- String POSITION_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "position";- String MEMBER_NAME_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "member_name";- String OFFSET_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "offset";- String DATA_TYPE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "data_type";-- /**- * The position of the member in the composite- *- * <p>- * A position of -1 implies the parent is not a composite or this member's role is special,- * e.g., the return type of a function.- *- * @return the position- */- @TargetAttributeType(name = POSITION_ATTRIBUTE_NAME, hidden = true)- default int getPosition() {- return getTypedAttributeNowByName(POSITION_ATTRIBUTE_NAME, Integer.class, -1);- }-- /**- * The name of the member in the composite- *- * @return the name- */- @TargetAttributeType(name = MEMBER_NAME_ATTRIBUTE_NAME, required = true, hidden = true)- default String getMemberName() {- return getTypedAttributeNowByName(MEMBER_NAME_ATTRIBUTE_NAME, String.class, "");- }-- /**- * The offset of the member in the composite- *- * <p>- * For structs, this should be the offset in bytes from the base of the struct. For unions, this- * should likely be 0. For others, this should be absent or -1.- *- * @return the offset- */- @TargetAttributeType(name = OFFSET_ATTRIBUTE_NAME, hidden = true)- default long getOffset() {- return getTypedAttributeNowByName(OFFSET_ATTRIBUTE_NAME, Long.class, -1L);- }-- /**- * The type of this member- *- * @return the type- */- @TargetAttributeType(name = DATA_TYPE_ATTRIBUTE_NAME, required = true, hidden = true)- default TargetDataType getDataType() {- return getTypedAttributeNowByName(DATA_TYPE_ATTRIBUTE_NAME, TargetDataType.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDataTypeNamespace.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDataTypeNamespace.javadeleted file mode 100644index 1e270351f9..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDataTypeNamespace.java+++ /dev/null@@ -1,52 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Collection;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebugModelConventions;-import ghidra.dbg.DebuggerTargetObjectIface;--/**- * A container of data types- *- * <p>- * The debugger should present these in as granular of units as possible. Consider a desktop- * application, for example. The debugger should present each module as a namespace rather than the- * entire target (or worse, the entire session) as a single namespace.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("DataTypeNamespace")-public interface TargetDataTypeNamespace extends TargetObject {-- /**- * Get the types in this namespace- *- * <p>- * While it is most common for types to be immediate children of the namespace, that is not- * necessarily the case.- *- * @implNote By default, this method collects all successor types ordered by path. Overriding- * that behavior is not yet supported.- * @return the types- */- default CompletableFuture<? extends Collection<? extends TargetNamedDataType>> getTypes() {- return DebugModelConventions.collectSuccessors(this, TargetNamedDataType.class);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDeletable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDeletable.javadeleted file mode 100644index 7255bc7050..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDeletable.java+++ /dev/null@@ -1,37 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * An object which can be removed by the user- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Deletable")-public interface TargetDeletable extends TargetObject {-- /**- * Remove the object- *- * @return a future which completes when the request is processed- */- public CompletableFuture<Void> delete();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDetachable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDetachable.javadeleted file mode 100644index 2cce59d0d6..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetDetachable.java+++ /dev/null@@ -1,37 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * A target which can be detached from the debugger- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Detachable")-public interface TargetDetachable extends TargetObject {-- /**- * Detach from this target- *- * @return a future which completes when the request is processed- */- public CompletableFuture<Void> detach();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetEnvironment.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetEnvironment.javadeleted file mode 100644index 20e4582bb5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetEnvironment.java+++ /dev/null@@ -1,116 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * Provides information about a given target object- *- * <p>- * This is mostly a marker interface so that the client knows where to look for information about a- * target. This may be attached to the entire session, or it may be attached to individual targets- * in a session. The information is generally encoded as string-valued attributes, for which this- * interface provides convenient accessors. The form of the strings is not strictly specified. They- * should generally just take verbatim whatever string the host debugger would use to describe the- * platform. It is up to the client to interpret the information into an equivalent specification in- * the UI/database.- *- * @implNote to simplify the automatic choice of mapper when recording a trace, it is required to- * update a target's environment attributes before reporting that it has started. Relaxing- * this requirement is TODO. Note that targets which do not support- * {@link TargetExecutionStateful} are assumed started by virtue of their creation.- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Environment")-public interface TargetEnvironment extends TargetObject {-- String ARCH_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "arch";- String DEBUGGER_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "debugger";- String OS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "os";- String ENDIAN_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "endian";-- /**- * Get a description of the target architecture- *- * <p>- * This should be as specific a description of the processor as possible. Ideally, the processor- * family is apparent in the description. The client will interpret this to determine the- * appropriate Instruction Set Architecture and any nuances in the processor's behavior. For- * example {@code family:version:variant}. If the debugger has its own format for these- * descriptors, please use it.- *- * @return the target architecture- */- @TargetAttributeType(name = ARCH_ATTRIBUTE_NAME, hidden = true)- default String getArchitecture() {- return getTypedAttributeNowByName(ARCH_ATTRIBUTE_NAME, String.class, "");- }-- /**- * Get a description of the debugger- *- * <p>- * This should be as specific a description of the debugger as possible. Ideally, the debugger's- * name is apparent in the description. The client may use this to properly interpret the other- * environment descriptors. For example {@code GNU gdb (GDB) 8.0}. While version and additional- * platform information may be presented, clients should avoid relying on it, esp., to account- * for nuances in debugger behavior. The model implementation (i.e., the "agent") is responsible- * for presenting a model consistent with the debugger's behavior.- *- * @return the host debugger- */- @TargetAttributeType(name = DEBUGGER_ATTRIBUTE_NAME, hidden = true)- default String getDebugger() {- return getTypedAttributeNowByName(DEBUGGER_ATTRIBUTE_NAME, String.class, "");- }-- /**- * Get a description of the target operating system- *- * <p>- * This should be as specific a description of the operating system as possible. Ideally, the OS- * name is apparent in the description. The client will interpret this to determine the- * appropriate Application Binary Interface. For example {@code GNU/Linux}. The client may also- * use this to decide how to interpret other information present in the model, e.g., file system- * paths.- *- * @return the target operating system- */- @TargetAttributeType(name = OS_ATTRIBUTE_NAME, hidden = true)- default String getOperatingSystem() {- return getTypedAttributeNowByName(OS_ATTRIBUTE_NAME, String.class, "");- }-- /**- * Get the endianness of the target- *- * <p>- * In most cases, a simple "little" or "big" should do, but there may exist cases where code is- * in one form and data is in another. For those, choose something recognizable to someone- * writing an opinion for tracing the target. TODO: Formalize those conventions?- *- * @return the target endianness- */- @TargetAttributeType(name = ENDIAN_ATTRIBUTE_NAME, hidden = true)- default String getEndian() {- return getTypedAttributeNowByName(ENDIAN_ATTRIBUTE_NAME, String.class, "");- }-- // TODO: Devices? File System?-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetEventScope.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetEventScope.javadeleted file mode 100644index 47f312f584..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetEventScope.java+++ /dev/null@@ -1,119 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * An object that can emit events affecting itself and its successors- *- * <p>- * Most often, this interface is supported by the (root) session.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("EventScope")-public interface TargetEventScope extends TargetObject {-- String EVENT_OBJECT_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "event_thread";-- public enum TargetEventType {- /**- * The session has stopped for an unspecified reason- */- STOPPED(true),- /**- * The session is running for an unspecified reason- *- * <p>- * Note that execution state changes are communicated via {@link TargetExecutionStateful},- * since the sessiopn may specify such state on a per-target and/or per-thread basis.- */- RUNNING(false),- /**- * A new target process was created by this session- *- * <p>- * If the new process is part of the session, too, it must be passed as a parameter.- */- PROCESS_CREATED(false),- /**- * A target process in this session has exited- */- PROCESS_EXITED(false),- /**- * A new target thread was created by this session- *- * <p>- * The new thread must be part of the session, too, and must be given as the event thread.- */- THREAD_CREATED(false),- /**- * A target thread in this session has exited- */- THREAD_EXITED(false),- /**- * The session has stopped, because one if its targets was trapped by a breakpoint- *- * <p>- * If the breakpoint (specification) is part of the session, too, it must be passed as a- * parameter. The trapped target must also be passed as a parameter.- */- BREAKPOINT_HIT(true),- /**- * The session has stopped, because a stepping command has completed- *- * <p>- * The target completing the command must also be passed as a parameter, unless it is the- * event thread. If it is a thread, it must be given as the event thread.- */- STEP_COMPLETED(true),- /**- * The session has stopped, because one if its targets was trapped on an exception- *- * <p>- * The trapped target must also be passed as a parameter, unless it is the event thread. If- * it is a thread, it must be given as the event thread.- */- EXCEPTION(false),- /**- * The session has stopped, because one of its targets was trapped on a signal- *- * <p>- * The trapped target must also be passed as a parameter, unless it is the event thread. If- * it is a thread, it must be given as the event thread.- */- SIGNAL(false);-- public final boolean impliesStop;-- private TargetEventType(boolean impliesStop) {- this.impliesStop = impliesStop;- }- }-- /**- * If applicable, get the thread producing the last reported event- *- * @return the thread or reference- */- @TargetAttributeType(name = EVENT_OBJECT_ATTRIBUTE_NAME, hidden = true)- public default TargetThread getEventThread() {- return getTypedAttributeNowByName(EVENT_OBJECT_ATTRIBUTE_NAME, TargetThread.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetExecutionStateful.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetExecutionStateful.javadeleted file mode 100644index 79f54f754d..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetExecutionStateful.java+++ /dev/null@@ -1,150 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * An object which has an execution life cycle- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("ExecutionStateful")-public interface TargetExecutionStateful extends TargetObject {-- String STATE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "state";-- /**- * The execution state of a debug target object- */- public enum TargetExecutionState {- /**- * The object has been created, but it not yet alive- *- * <p>- * This may apply, e.g., to a GDB "Inferior," which has no yet been used to launch or attach- * to a process.- */- INACTIVE(false, false, false, false),-- /**- * The object is alive, but its execution state is unspecified- *- * <p>- * Implementations should use {@link #STOPPED} and {@link #RUNNING} whenever possible. For- * some objects, e.g., a process, this is conventionally determined by its parts, e.g.,- * threads: A process is running when <em>any</em> of its threads are running. It is stopped- * when <em>all</em> of its threads are stopped. For the clients' sakes, all models should- * implement these conventions internally.- */- ALIVE(true, false, false, false),-- /**- * The object is alive, but not executing- */- STOPPED(true, false, true, false),-- /**- * The object is alive and executing- *- * <p>- * "Running" is loosely defined. For example, with respect to a thread, it may indicate the- * thread is currently executing, waiting on an event, or scheduled for execution. It does- * not necessarily mean it is executing on a CPU at this exact moment.- */- RUNNING(true, true, false, false),-- /**- * The object is no longer alive- *- * <p>- * The object still exists but no longer represents something alive. This could be used for- * stale handles to objects which may still be queried (e.g., for a process exit code), or- * e.g., a GDB "Inferior," which could be re-used to launch or attach to another process.- */- TERMINATED(false, false, false, true);-- private final boolean alive;- private final boolean running;- private final boolean stopped;- private final boolean terminated;-- private TargetExecutionState(boolean alive, boolean running, boolean stopped, boolean terminated) {- this.alive = alive;- this.running = running;- this.stopped = stopped;- this.terminated = terminated;- }-- /**- * Check if this state implies the object is alive- *- * @return true if alive- */- public boolean isAlive() {- return alive;- }-- /**- * Check if this state implies the object is running- *- * @return true if running- */- public boolean isRunning() {- return running;- }-- /**- * Check if this state implies the object is stopped- *- * @return true if stopped- */- public boolean isStopped() {- return stopped;- }-- /**- * Check if this state implies the object was terminated- *- * @return true if terminated- */- public boolean isTerminated() {- return terminated;- }-- /**- * Check if this state is ambiguous- *- * @return true if terminated- */- public boolean isUnknown() {- return !stopped && !running && !terminated;- }- }-- /**- * Get the current execution state of this object- *- * @return the state- */- @TargetAttributeType(name = STATE_ATTRIBUTE_NAME, required = true, hidden = true)- public default TargetExecutionState getExecutionState() {- return getTypedAttributeNowByName(STATE_ATTRIBUTE_NAME, TargetExecutionState.class,- TargetExecutionState.INACTIVE);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetFocusScope.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetFocusScope.javadeleted file mode 100644index b5d530333a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetFocusScope.java+++ /dev/null@@ -1,77 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebugModelConventions;-import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * An object having a designated "focus"- *- * <p>- * Focus is usually communicated via various UI hints, but also semantically implies that actions- * taken within this scope apply to the focused object. The least confusing option is to implement- * this at the root, but that need not always be the case.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("FocusScope")-public interface TargetFocusScope extends TargetObject {-- String FOCUS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "focus";-- /**- * Focus on the given object- *- * <p>- * {@code obj} must be successor of this scope. The debugger may reject or ignore the request- * for any reason. If the debugger cannot focus the given object, it should attempt to do so for- * each ancestor until it succeeds or reaches this focus scope.- *- * @param obj the object to receive focus- * @return a future which completes upon successfully changing focus.- */- CompletableFuture<Void> requestFocus(TargetObject obj);-- /**- * Get the focused object in this scope- *- * <p>- * Note that client UIs should be careful about event loops and user intuition when listening- * for changes of this attribute. The client should avoid calling- * {@link #requestFocus(TargetObject)} in response. Perhaps the simplest way is to only request- * focus when the selected object has actually changed. The debugger may "adjust" the focus. For- * example, when focusing a thread, the debugger may instead focus a particular frame in that- * thread (a successor). Or, when focusing a memory region, the debugger may only focus the- * owning process (an ancestor). The suggested strategy (a work in progress) is the "same level,- * same type" rule. It may be appropriate to highlight the actual focused object to cue the user- * in, but the user's selection should remain at the same level. If an ancestor or successor- * receives focus, leave the user's selection as is. If a sibling element or one of its- * successors receives focus, select that sibling. A similar rule applies to "cousin" elements,- * so long as they have the same type. In most other cases, it's appropriate to select the- * focused element. TODO: Implement this rule in {@link DebugModelConventions}- *- * @return a reference to the focused object or {@code null} if no object is focused.- */- @TargetAttributeType(name = FOCUS_ATTRIBUTE_NAME, required = true, hidden = true)- default TargetObject getFocus() {- return getTypedAttributeNowByName(FOCUS_ATTRIBUTE_NAME, TargetObject.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetInterpreter.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetInterpreter.javadeleted file mode 100644index 52d7fc252c..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetInterpreter.java+++ /dev/null@@ -1,76 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * A command interpreter, usually that of a native debugger- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Interpreter")-public interface TargetInterpreter extends TargetObject {-- String PROMPT_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "prompt";-- /**- * Execute an interpreter command- *- * <p>- * Usually, this means executing a command as if typed into the debugger's CLI. Thus, the- * meaning of the command will depend on the debugger. As such, this method is discouraged for- * scripts that intend to be debugger agnostic. On the other hand, this is often a very useful- * feature for a user interface.- *- * @param cmd the command to issue to the CLI- * @return a future that completes when the command has completed execution- */- public CompletableFuture<Void> execute(String cmd);-- /**- * Execute an interpreter command, capturing the output- *- * <p>- * This works the same as {@link #execute(String)}, but instead of writing the output to the- * console, it is captured. This method is discouraged for scripts that intend to be debugger- * agnostic.- *- * @param cmd the command to issue to the CLI- * @return a future that completes with the captured output- */- public CompletableFuture<String> executeCapture(String cmd);-- /**- * Get the prompt for user input- *- * <p>- * Generally, this should indicate to the user the command language and/or state of the- * interpreter. For some debuggers, this may change as the interpreter context changes. For- * example, the {@code dbgeng.dll} interpreter provides a prompt indicating the effective- * instruction set architecture for the current thread.- *- * @return the current prompt- */- @TargetAttributeType(name = PROMPT_ATTRIBUTE_NAME, required = true, hidden = true)- public default String getPrompt() {- return getTypedAttributeNowByName(PROMPT_ATTRIBUTE_NAME, String.class, ">");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetInterruptible.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetInterruptible.javadeleted file mode 100644index a66f2183b1..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetInterruptible.java+++ /dev/null@@ -1,45 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;--/**- * A target that can be interrupted- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Interruptible")-public interface TargetInterruptible extends TargetObject {-- /**- * Interrupt the target object- *- * <p>- * Typically, this breaks, i.e., stops, all target objects in scope of the receiver. Note the- * command completes when the interrupt has been sent, whether or not it actually stopped- * anything. Users wishing to confirm execution has stopped should wait for the target object to- * enter the {@link TargetExecutionState#STOPPED} state. Depending on the temperament of the- * debugger and the target, it may be necessary to send multiple interrupts.- *- * @return a future which completes when the interrupt has been sent- */- public CompletableFuture<Void> interrupt();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetKillable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetKillable.javadeleted file mode 100644index ebd599ec8c..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetKillable.java+++ /dev/null@@ -1,37 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * A target which can be killed (terminated)- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Killable")-public interface TargetKillable extends TargetObject {-- /**- * Kill this target- *- * @return a future which completes upon successfully terminating the target- */- public CompletableFuture<Void> kill();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetLauncher.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetLauncher.javadeleted file mode 100644index a10a0403b7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetLauncher.java+++ /dev/null@@ -1,165 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.io.*;-import java.util.*;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetMethod.ParameterDescription;-import ghidra.dbg.target.TargetMethod.TargetParameterMap;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * An interface which indicates this object is capable of launching targets- *- * <p>- * The targets this launcher creates ought to appear in its successors.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Launcher")-public interface TargetLauncher extends TargetObject {-- /**- * An interface which provides default implementations for command-line launchers- *- * <p>- * This interface should only be used by implementors. It is not necessarily marshalled by- * remote clients. Clients should instead interrogate {@link TargetLauncher} for its supported- * parameters.- *- * <p>- * For the sake of parameter marshalling, the implementation must still set- * {@link TargetMethod#PARAMETERS_ATTRIBUTE_NAME} explicitly, usually in its constructor.- */- interface TargetCmdLineLauncher extends TargetLauncher {- String CMDLINE_ARGS_NAME = "args";-- /**- * The {@code args} parameter- */- ParameterDescription<String> PARAMETER_CMDLINE_ARGS = ParameterDescription.create(- String.class,- CMDLINE_ARGS_NAME, true, "", "Command Line", "space-separated command-line arguments");-- /**- * A map of parameters suitable for invoking {@link #launch(List)}- */- TargetParameterMap PARAMETERS = TargetMethod.makeParameters(PARAMETER_CMDLINE_ARGS);-- /**- * Check if the given image path contains spaces, and surround it in double quotes- * ({@code "}) if necessary.- *- * <p>- * Without the quotes the launcher will likely confuse the spaces for separating arguments.- * When constructing the command-line to launch a program, this method must be used, even if- * the image is the only "argument."- *- * @param imagePath the path to the image on the target platform.- * @return the path, possibly surrounded in quotes.- */- static String quoteImagePathIfSpaces(String imagePath) {- if (imagePath.contains(" ")) {- return '"' + imagePath + '"';- }- return imagePath;- }-- @Override- default public TargetParameterMap getParameters() {- return PARAMETERS;- }-- /**- * Launch a target using the given arguments- *- * <p>- * This is mostly applicable to user-space contexts, in which case, this usually means to- * launch a new process with the given arguments, where the first argument is the path to- * the executable image on the target host's file system.- *- * @param args the arguments- * @return a future which completes when the command has been processed- */- public CompletableFuture<Void> launch(List<String> args);-- /**- * @see #launch(List)- */- public default CompletableFuture<Void> launch(String... args) {- return launch(Arrays.asList(args));- }-- @Override- public default CompletableFuture<Void> launch(Map<String, ?> args) {- return launch(CmdLineParser.tokenize(PARAMETER_CMDLINE_ARGS.get(args)));- }- }-- class CmdLineParser extends StreamTokenizer {- public static List<String> tokenize(String cmdLine) {- return new CmdLineParser(cmdLine).tokens();- }-- public CmdLineParser(Reader r) {- super(r);- resetSyntax();- wordChars(0, 255);- whitespaceChars(' ', ' ');- quoteChar('"');- }-- public CmdLineParser(String cmdLine) {- this(new StringReader(cmdLine));- }-- public List<String> tokens() {- List<String> list = new ArrayList<>();-- try {- while (StreamTokenizer.TT_EOF != nextToken()) {- list.add(sval);- }- }- catch (IOException e) {- throw new AssertionError(e);- }-- return list;- }- }-- @TargetAttributeType(- name = TargetMethod.PARAMETERS_ATTRIBUTE_NAME,- required = true,- hidden = true)- default public TargetParameterMap getParameters() {- return TargetMethod.getParameters(this);- }-- /**- * Launch a target using the given arguments- *- * @param args the map of arguments.- * @return a future which completes when the command is completed- */- public CompletableFuture<Void> launch(Map<String, ?> args);--}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMemory.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMemory.javadeleted file mode 100644index 0644758cf0..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMemory.java+++ /dev/null@@ -1,94 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.program.model.address.Address;--/**- * The memory model of a target object- *- * <p>- * This interface provides methods for reading and writing target memory. It should use addresses- * produced by the provided address factory. The convention for modeling valid addresses is to have- * children supporting {@link TargetMemoryRegion}. If no such children exist, then the client should- * assume no address is valid. Thus, for the client to confidently access any memory, at least one- * child region must exist. It may present the memory's entire address space in a single region.- *- * <p>- * TODO: Decide convention: should a single region appear in multiple locations? If it does, does it- * imply that region's contents are common to all memories possessing it? Or, should contents be- * distinguished by the memory objects? I'm leaning toward the latter. Duplicate locations for- * regions may just be an efficiency bit, if used at all. This decision is primarily because, at the- * moment, read and write belong to the memory interface, not the region.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Memory")-public interface TargetMemory extends TargetObject {-- /**- * Read memory at the given address- *- * <p>- * If the target architecture is not a byte-per-address, then the implementation should- * interpret each unit in bytes using the target space's native byte order.- *- * <p>- * TODO: This circumstance has not been well-tested, as non-x86 architectures are left for- * future implementation.- *- * @param address the address to start reading at- * @param length the number of bytes to read- * @return a future which completes with the read data- */- public CompletableFuture<byte[]> readMemory(Address address, int length);-- /**- * Write memory at the given address- *- * <p>- * If the target architecture is not a byte-per-address, then the implementation should- * interpret each unit in bytes using the memory space's native byte order.- *- * <p>- * TODO: This circumstance has not been well-tested, as non-x86 architectures are left for- * future implementation.- *- * @param address the address to start writing at- * @param data the data to write- * @return a future which completes upon successfully writing- */- public CompletableFuture<Void> writeMemory(Address address, byte[] data);-- /**- * Get the regions of valid addresses- *- * <p>- * This is a convenience, exactly equivalent to getting all children supporting the- * {@link TargetMemoryRegion} interface.- *- * @return the collection of child regions- */- @SuppressWarnings({ "unchecked", "rawtypes" })- public default CompletableFuture<? extends Map<String, ? extends TargetMemoryRegion>> getRegions() {- return fetchChildrenSupporting((Class) TargetMemoryRegion.class);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMemoryRegion.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMemoryRegion.javadeleted file mode 100644index b928dcffcd..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMemoryRegion.java+++ /dev/null@@ -1,89 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.program.model.address.AddressRange;--@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("MemoryRegion")-public interface TargetMemoryRegion extends TargetObject {- String RANGE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "range";- String READABLE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "readable";- String WRITABLE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "writable";- String EXECUTABLE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "executable";- String MEMORY_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "memory";-- /**- * Get the address range representing this region- *- * @return the range- */- @TargetAttributeType(name = RANGE_ATTRIBUTE_NAME, required = true, hidden = true)- public default AddressRange getRange() {- return getTypedAttributeNowByName(RANGE_ATTRIBUTE_NAME, AddressRange.class, null);- }-- /**- * Check if this region is readable- *- * @return true if read is permitted- */- @TargetAttributeType(name = READABLE_ATTRIBUTE_NAME, required = true, hidden = true)- public default boolean isReadable() {- return getTypedAttributeNowByName(READABLE_ATTRIBUTE_NAME, Boolean.class, false);- }-- /**- * Check if this region is writable- *- * @return true if write is permitted- */- @TargetAttributeType(name = WRITABLE_ATTRIBUTE_NAME, required = true, hidden = true)- public default boolean isWritable() {- return getTypedAttributeNowByName(WRITABLE_ATTRIBUTE_NAME, Boolean.class, false);- }-- /**- * Check if this region is executable- *- * @return true if execute is permitted- */- @TargetAttributeType(name = EXECUTABLE_ATTRIBUTE_NAME, required = true, hidden = true)- public default boolean isExecutable() {- return getTypedAttributeNowByName(EXECUTABLE_ATTRIBUTE_NAME, Boolean.class, false);- }-- // TODO: Should probably just have getFlags() and "flags" attribute-- // TODO: Other flags? "committed", "reserved", etc?-- /**- * Get the memory for this region.- *- * <p>- * While it is most common for a region to be an immediate child of its containing memory, that- * is not necessarily the case. This method is a reliable and type-safe means of obtaining that- * memory.- *- * @return a reference to the memory- */- @TargetAttributeType(name = MEMORY_ATTRIBUTE_NAME, required = true, fixed = true, hidden = true)- public default TargetMemory getMemory() {- return getTypedAttributeNowByName(MEMORY_ATTRIBUTE_NAME, TargetMemory.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetModule.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetModule.javadeleted file mode 100644index 1f2e047bb5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetModule.java+++ /dev/null@@ -1,63 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.program.model.address.AddressRange;--/**- * A binary module loaded by the target and/or debugger- *- * <p>- * If the debugger cares to parse the modules for section information, those sections should be- * presented as successors to the module.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Module")-public interface TargetModule extends TargetObject {-- String RANGE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "range";- String MODULE_NAME_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "module_name";-- /**- * Get the range containing all mapped sections of this module- *- * <p>- * The minimum address should be the base address. The maximum address is the largest address- * mapped to any section belonging to this module. This attribute is especially important if- * sections are not given in the model. This attribute communicates the range which <em>may</em>- * belong to the module.- *- * @return the base address, or {@code null}- */- @TargetAttributeType(name = RANGE_ATTRIBUTE_NAME, required = true, hidden = true)- public default AddressRange getRange() {- return getTypedAttributeNowByName(RANGE_ATTRIBUTE_NAME, AddressRange.class, null);- }-- /**- * Get the name of the module as defined by the target platform- *- * @return the module name- */- @TargetAttributeType(name = MODULE_NAME_ATTRIBUTE_NAME, required = true, hidden = true)- public default String getModuleName() {- return getTypedAttributeNowByName(MODULE_NAME_ATTRIBUTE_NAME, String.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetModuleContainer.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetModuleContainer.javadeleted file mode 100644index 030d3921f3..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetModuleContainer.java+++ /dev/null@@ -1,66 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.lifecycle.Experimental;--/**- * A place for modules to reside- *- * <p>- * Also a hint interface which helps the user of the client locate modules which apply to a given- * target object- *- * <p>- * TODO: Experiment with the idea of "synthetic modules" as presented by {@code dbgeng.dll}. Is- * there a similar idea in GDB? This could allow us to expose Ghidra's symbol table and types to the- * native debugger.- *- * <p>- * TODO: Rename this to {@code TargetModuleOperations}. Conventionally, it is a container of- * modules, but it doesn't technically have to be. If we don't eventually go forward with synthetic- * modules, then we could remove this interface altogether. A client searching for the module- * container should use {@link TargetObjectSchema#searchForCanonicalContainer(Class)}.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("ModuleContainer")-public interface TargetModuleContainer extends TargetObject {-- String SUPPORTS_SYNTHETIC_MODULES_ATTRIBUTE_NAME =- PREFIX_INVISIBLE + "supports_synthetic_modules";-- @TargetAttributeType(- name = SUPPORTS_SYNTHETIC_MODULES_ATTRIBUTE_NAME,- fixed = true,- hidden = true)- @Experimental- public default boolean supportsSyntheticModules() {- return getTypedAttributeNowByName(SUPPORTS_SYNTHETIC_MODULES_ATTRIBUTE_NAME, Boolean.class,- false);- }-- @Experimental- public default CompletableFuture<? extends TargetModule> addSyntheticModule(String name) {- throw new UnsupportedOperationException();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetNamedDataType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetNamedDataType.javadeleted file mode 100644index e0c8f99c08..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetNamedDataType.java+++ /dev/null@@ -1,129 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Collection;-import java.util.concurrent.CompletableFuture;--import com.google.gson.JsonElement;-import com.google.gson.JsonObject;--import ghidra.dbg.DebugModelConventions;-import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.util.TargetDataTypeConverter;--/**- * A data type that would have a name in Ghidra's data type manager- *- * <ul>- * <li>{@code enum}</li>- * <li>Function signature</li>- * <li>{@code struct}</li>- * <li>{@code typedef}</li>- * <li>{@code union}</li>- * </ul>- *- * <p>- * Other types, e.g., pointers, arrays, are modeled as attributes.- *- * <p>- * See {@link TargetDataTypeConverter} to get a grasp of the conventions- *- * @param <T> the type of this object- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("DataType")-public interface TargetNamedDataType extends TargetObject, TargetDataType {-- enum NamedDataTypeKind {- ENUM, FUNCTION, STRUCT, TYPEDEF, UNION;- }-- String NAMED_DATA_TYPE_KIND_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "type_kind";- String ENUM_BYTE_LENGTH_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "byte_length";- String NAMESPACE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "namespace";-- String FUNCTION_RETURN_INDEX = "return";- String FUNCTION_PARAMETER_DIM = "param";-- @Override- default JsonElement toJson() {- JsonObject object = new JsonObject();- object.addProperty("path", getJoinedPath("."));- return object;- }-- /**- * Get the members of this data type in order.- *- * <p>- * While it is most common for members to be immediate children of the type, that is not- * necessarily the case.- *- * @implNote By default, this method collects all successor members ordered by path. Overriding- * that behavior is not yet supported.- * @return the members- */- default CompletableFuture<? extends Collection<? extends TargetDataTypeMember>> getMembers() {- return DebugModelConventions.collectSuccessors(this, TargetDataTypeMember.class);- }-- /**- * Get the namespace for this data type.- *- * <p>- * While it is most common for a data type to be an immediate child of its namespace, that is- * not necessarily the case. This method is a reliable and type-safe means of obtaining that- * namespace.- *- * @return a reference to the namespace- */- @TargetAttributeType(- name = NAMESPACE_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- default TargetDataTypeNamespace getNamespace() {- return getTypedAttributeNowByName(NAMESPACE_ATTRIBUTE_NAME, TargetDataTypeNamespace.class,- null);- }-- /**- * Get the kind of this data type- *- * @return the kind- */- @TargetAttributeType(- name = NAMED_DATA_TYPE_KIND_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- default NamedDataTypeKind getTypeKind() {- return getTypedAttributeNowByName(NAMED_DATA_TYPE_KIND_ATTRIBUTE_NAME,- NamedDataTypeKind.class, null);- }-- @TargetAttributeType(- name = ENUM_BYTE_LENGTH_ATTRIBUTE_NAME,- fixed = true,- hidden = true)- default Integer getEnumByteLength() {- return getTypedAttributeNowByName(ENUM_BYTE_LENGTH_ATTRIBUTE_NAME, Integer.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetObject.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetObject.javadeleted file mode 100644index ce8c240842..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetObject.java+++ /dev/null@@ -1,1105 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.*;-import java.util.Map.Entry;-import java.util.concurrent.CompletableFuture;-import java.util.stream.Collectors;--import ghidra.async.AsyncFence;-import ghidra.async.AsyncUtils;-import ghidra.dbg.*;-import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;-import ghidra.dbg.error.DebuggerModelTypeException;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.util.PathUtils;-import ghidra.dbg.util.PathUtils.PathComparator;-import ghidra.dbg.util.PathUtils.TargetObjectKeyComparator;-import ghidra.dbg.util.ValueUtils;-import ghidra.lifecycle.Internal;--/**- * A handle to a target object in a debugger- *- * <p>- * This object supports querying for and obtaining the interfaces which constitute what the object- * is and define how the client may interact with it. The object may also have children, e.g., a- * process should likely have threads.- *- * <p>- * This interface is the focal point of the "debug target model." A debugger may present itself as- * an arbitrary directory of "target objects." The root object is typically the debugger's session,- * and one its attributes is a collection for its attached targets. These objects, including the- * root object, may implement any number of interfaces extending {@link TargetObject}. These- * interfaces comprise the type and behavior of the object. An object's children comprise its- * elements (for collection-like objects) and attributes. Every object in the directory has a path.- * Each element ("key") in the path identifies an index (if the child is an element) or a name (if- * the child is an attribute). It is the implementation's responsibility to ensure each object's- * path correctly identifies that same object in the model directory. The root has the empty path.- * Every object must have a unique path; thus, every object must have a unique key among its- * sibling.- *- * <p>- * The objects are arranged in a directory with links permitted. Links come in the form of- * object-valued attributes or elements where the path does not match the object value's path. Thus,- * the overall structure remains a tree, but by resolving links, the model may be treated as a- * directed graph, likely containing cycles. See {@link PathUtils#isLink(List, String, List)}.- *- * <p>- * The implementation must guarantee that distinct {@link TargetObject}s from the same model do not- * share the same path. That is, checking for object identity is sufficient to check that two- * variables refer to the same object.- *- * <p>- * Various conventions govern where the client/user should search to obtain a given interface in the- * context of some target object. For example, if the user is interacting with a thread, and wishes- * to access that thread's memory, it needs to follow a given search order to find the appropriate- * target object(s), if they exist, implementing the desired interface. See- * {@link DebugModelConventions#findSuitable(Class, TargetObject)} and- * {@link DebugModelConventions#findInAggregate(Class, TargetObject)} for details. In summary, the- * order is:- *- * <ol>- * <li><b>The object itself:</b> Test if the context target object supports the desired interface.- * If it does, take it.</li>- * <li><b>Aggregate objects:</b> If the object is marked with {@link TargetAggregate}, collect all- * attributes supporting the desired interface. If there are any, take them. This step is applied- * recursively if any child attribute is also marked with {@link TargetAggregate}.</li>- * <li><b>Ancestry:</b> Apply these same steps to the object's (canonical) parent, recursively.</li>- * </ol>- *- * <p>- * For some situations, exactly one object is required. In that case, take the first obtained by- * applying the above rules. In other situations, multiple objects may be acceptable. Again, apply- * the rules until a sufficient collection of objects is obtained. If an object is in conflict with- * another, take the first encountered. This situation may be appropriate if, e.g., multiple target- * memories present disjoint regions. There should not be conflicts among sibling. If there are,- * then either the model or the query is not sound. The order siblings considered should not matter.- * These rules are incubating and are implemented in {@link DebugModelConventions}.- *- * <p>- * This relatively free structure and corresponding conventions allow for debuggers to present a- * model which closely reflects the structure of its session. For example, the following structure- * may be presented by a user-space debugger for a desktop operating system:- *- * <ul>- * <li>"Session" : {@link TargetAccessConditioned}, {@link TargetInterpreter},- * {@link TargetAttacher}, {@link TargetLauncher}, {@link TargetInterruptible}</li>- * <ul>- * <li>"Process 789" : {@link TargetAggregate}, {@link TargetDetachable}, {@link TargetKillable},- * {@link TargetResumable}</li>- * <ul>- * <li>"Threads" : {@link TargetObject}</li>- * <ul>- * <li>"Thread 1" : {@link TargetExecutionStateful}, {@link TargetSteppable}</li>- * <ul>- * <li>"Registers" : {@link TargetRegisterBank}</li>- * <ul>- * <li>"r1" : {@link TargetRegister}</li>- * <li>...</li>- * </ul>- * </ul>- * <li>...more threads</li>- * </ul>- * <li>"Memory" : {@link TargetMemory}</li>- * <ul>- * <li>"[0x00400000:0x00401234]" : {@link TargetMemoryRegion}</li>- * <li>...more regions</li>- * </ul>- * <li>"Modules" : {@link TargetModuleContainer}</li>- * <ul>- * <li>"/usr/bin/echo" : {@link TargetModule}</li>- * <ul>- * <li>".text" ({@link TargetSection})</li>- * <li>...more sections</li>- * <li>"Namespace" : {@link TargetSymbolNamespace}</li>- * <ul>- * <li>"main" : {@link TargetSymbol}</li>- * <li>"astruct" : {@link TargetNamedDataType}</li>- * <li>...more symbols and types</li>- * </ul>- * </ul>- * <li>...more modules</li>- * </ul>- * </ul>- * <li>"Environment": {@link TargetEnvironment}</li>- * <ul>- * <li>"Process 321" : {@link TargetAttachable}</li>- * <li>...more processes</li>- * </ul>- * </ul>- * </ul>- *- * <p>- * TODO: Should I have a different type for leaf vs. branch objects? Attribute-/element-only- * objects?- *- * <p>- * Note that several methods of this interface and its sub-types return {@link CompletableFuture},- * because they are actions which may be transported over a network, or otherwise require- * asynchronous communication with a debugger. The documentation may say these methods return an- * object or throw an exception. In those cases, unless otherwise noted, this actually means the- * future will complete with that object, or complete exceptionally. Specifying this in every- * instance is just pedantic.- *- * <p>- * Assuming Trace RMI is successful, this interface will face a serious identity crisis. It will no- * longer serve its purpose as a proper Java interface, and instead will only serve as a type name- * in the object-model schema, which survives in the trace database. For some of the interfaces, we- * already have defined equivalent interfaces in the trace object manager. We will probably port- * additional interfaces over and eventually remove all of these.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface TargetObject extends Comparable<TargetObject> {-- Set<Class<? extends TargetObject>> ALL_INTERFACES =- Set.of(TargetAccessConditioned.class, TargetActivatable.class, TargetActiveScope.class,- TargetAggregate.class, TargetAttachable.class, TargetAttacher.class,- TargetBreakpointLocation.class, TargetBreakpointLocationContainer.class,- TargetBreakpointSpec.class, TargetBreakpointSpecContainer.class,- TargetConfigurable.class, TargetConsole.class, TargetDataTypeMember.class,- TargetDataTypeNamespace.class, TargetDeletable.class, TargetDetachable.class,- TargetEnvironment.class, TargetEventScope.class, TargetExecutionStateful.class,- TargetFocusScope.class, TargetInterpreter.class, TargetInterruptible.class,- TargetKillable.class, TargetLauncher.class, TargetMemory.class,- TargetMemoryRegion.class, TargetMethod.class, TargetModule.class,- TargetModuleContainer.class, TargetNamedDataType.class, TargetProcess.class,- TargetRegister.class, TargetRegisterBank.class, TargetRegisterContainer.class,- TargetResumable.class, TargetSection.class, TargetSectionContainer.class,- TargetStack.class, TargetStackFrame.class, TargetSteppable.class, TargetSymbol.class,- TargetSymbolNamespace.class, TargetThread.class, TargetTogglable.class);- Map<String, Class<? extends TargetObject>> INTERFACES_BY_NAME = initInterfacesByName();-- /**- * Initializer for {@link #INTERFACES_BY_NAME}- *- * @return interfaces indexed by name- */- @Internal- static Map<String, Class<? extends TargetObject>> initInterfacesByName() {- return ALL_INTERFACES.stream()- .collect(- Collectors.toUnmodifiableMap(DebuggerObjectModel::requireIfaceName, i -> i));- }-- static List<Class<? extends TargetObject>> getInterfacesByName(Collection<String> names) {- return names.stream()- .filter(INTERFACES_BY_NAME::containsKey)- .map(INTERFACES_BY_NAME::get)- .collect(Collectors.toList());- }-- /**- * A conventional prefix of hidden attributes defined by the {@code TargetObject} interfaces- *- * <p>- * When the "hidden" field of attributes can be overridden, this prefix should be removed- */- String PREFIX_INVISIBLE = "_";-- String DISPLAY_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "display";- String SHORT_DISPLAY_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "short_display";- String KIND_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "kind";- String ORDER_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "order";-- // TODO: Should these belong to a new TargetValue interface?- String MODIFIED_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "modified";- String TYPE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "type";- String VALUE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "value";-- enum Protected {- ;- protected static final Map<Class<? extends TargetObject>, Collection<Class<? extends TargetObject>>> INTERFACES_BY_CLASS =- new HashMap<>();- protected static final Map<Class<? extends TargetObject>, Collection<String>> INTERFACE_NAMES_BY_CLASS =- new HashMap<>();-- /**- * Get all {@link DebuggerTargetObjectIface}-annotated interfaces in the given class's- * hierarchy.- *- * @param cls the class- */- protected static Collection<Class<? extends TargetObject>> getInterfacesOf(- Class<? extends TargetObject> cls) {- return INTERFACES_BY_CLASS.computeIfAbsent(cls, Protected::doGetInterfacesOf);- }-- protected static Collection<Class<? extends TargetObject>> doGetInterfacesOf(- Class<? extends TargetObject> cls) {- List<Class<? extends TargetObject>> result = new ArrayList<>();- doCollectInterfaces(cls, result);- return result;- }-- protected static void doCollectInterfaces(Class<?> cls,- Collection<Class<? extends TargetObject>> result) {- if (TargetObject.class == cls) {- return;- }- if (!TargetObject.class.isAssignableFrom(cls)) {- return;- }- if (cls.isInterface()) {- result.add(cls.asSubclass(TargetObject.class));- }- Class<?> sup = cls.getSuperclass();- if (sup != null) {- doCollectInterfaces(sup, result);- }- for (Class<?> si : cls.getInterfaces()) {- doCollectInterfaces(si, result);- }- }-- public static Collection<String> getInterfaceNamesOf(Class<? extends TargetObject> cls) {- return INTERFACE_NAMES_BY_CLASS.computeIfAbsent(cls, Protected::doGetInterfaceNamesOf);- }-- protected static Collection<String> doGetInterfaceNamesOf(- Class<? extends TargetObject> cls) {- List<String> result = new ArrayList<>();- for (Class<? extends TargetObject> iface : getInterfacesOf(cls)) {- DebuggerTargetObjectIface annot =- iface.getAnnotation(DebuggerTargetObjectIface.class);- if (annot == null) {- continue;- }- result.add(annot.value());- }- result.sort(Comparator.naturalOrder());- return result;- }- }-- /**- * Check for target object equality- *- * <p>- * Because interfaces cannot provide default implementations of {@link #equals(Object)}, this- * methods provides a means of quickly implementing it within a class. Because (model, path)- * uniquely identifies an object, there should never be a need to perform more comparison than- * is provided here.- *- * <p>- * TODO: Since refs are no longer a thing, is custom equality needed at all? Seems object- * identity would be sufficient.- *- * @param obj the other object- * @return true if they are equal- */- default boolean doEquals(Object obj) {- if (this == obj) {- return true;- }- if (!(obj instanceof TargetObject)) {- return false;- }- TargetObject that = (TargetObject) obj;- return this.getModel() == that.getModel() && Objects.equals(this.getPath(), that.getPath());- }-- /**- * Pre-compute this object's hash code- *- * <p>- * Because interfaces cannot provide default implementations of {@link #hashCode()}, this method- * provides a means of quickly implementing it within a class. Because (model, path) is- * immutable and uniquely identifes an object, this hash should be pre-computed a construction.- * There should never be a need to incorporate more fields into the hash than is incorporated- * here.- *- * <p>- * TODO: Since refs are no longer a thing, is custom equality needed at all? Seems object- * identity would be sufficient.- *- * @return the hash- */- default int computeHashCode() {- return System.identityHashCode(getModel()) * 31 + Objects.hash(getPath().toArray());- }-- /**- * {@inheritDoc}- *- * <p>- * A friendly reminder to override- *- * @see #doEquals(Object)- */- @Override- boolean equals(Object obj);-- /**- * {@inheritDoc}- *- * <p>- * A friendly reminder to override- *- * @see #computeHashCode()- */- @Override- int hashCode();-- /**- * {@inheritDoc}- *- * <p>- * Along with {@link #doEquals(Object)} and {@link #computeHashCode()}, these obey the Rule of- * Three, comparing first the objects' models (by name, then identity), then their paths. Like- * the other methods, this incorporates everything that constitutes a unique target object.- * There should never be a need to override or otherwise extend this.- */- @Override- default int compareTo(TargetObject that) {- if (this == that) {- return 0;- }- DebuggerObjectModel thisModel = this.getModel();- DebuggerObjectModel thatModel = that.getModel();- if (thisModel != thatModel) {- if (thisModel == null) {- return -1;- }- if (thatModel == null) {- return 1;- }- int result = thisModel.toString().compareTo(thatModel.toString());- if (result == 0) {- return Integer.compare(System.identityHashCode(thisModel),- System.identityHashCode(thatModel));- }- return result;- }- return PathComparator.KEYED.compare(this.getPath(), that.getPath());- }-- /**- * Get the model to which this object belongs- *- * @return the model- */- public DebuggerObjectModel getModel();-- /**- * Get the path (i.e., list of names from root to this object).- *- * <p>- * Every object must have a unique path. Keys in the path which are indices, i.e., which- * navigate the elements, are enclosed in brackets @{code []}. Keys which navigate attributes- * are simply the attribute name.- *- * <p>- * More than just a location, the path provides a hint to the object's scope of applicability.- * For example, a {@link TargetMemory} attribute of a process is assumed accessible to every- * thread of that process, since those threads are descendants.- *- * @return the canonical path of the object- */- public List<String> getPath();-- /**- * Get the path joined by the given separator- *- * <p>- * Note that no check is applied to guarantee the path separator does not appear in an element- * name. Conventionally, `.` should be the separator. The separator is omitted before indices.- *- * @see #getPath()- * @param sep the path separator- * @return the joined path- */- public default String getJoinedPath(String sep) {- return PathUtils.toString(getPath(), sep);- }-- /**- * Get the key for this object- *- * <p>- * The object's key should be that assigned by the actual debugger, if applicable. If this is an- * element, the key should include the brackets {@code []}. If it is an attribute, it should- * simply be the name.- *- * @return the key, or {@code null} if this is the root- */- public default String getName() {- return PathUtils.getKey(getPath());- }-- /**- * Get the index for this object, omitting the brackets- *- * @return they index, or {@code null} if this is the root- * @throws IllegalArgumentException if this object's key is not an index- */- public default String getIndex() {- return PathUtils.getIndex(getPath());- }-- /**- * Check if this is the root target debug object- *- * @return true if root, false otherwise- */- public default boolean isRoot() {- return getPath().isEmpty();- }-- /**- * Get this object's canonical parent- *- * @return the parent or {@code null} if this is the root- */- public TargetObject getParent();-- /**- * Get an informal name identifying the type of this object- *- * <p>- * This is an informal notion of type and may only be used for visual styling, logging, or other- * informational purposes. Scripts should not rely on this to predict behavior, but instead on- * {@link #as(Class)}, {@link #getInterfaces()}, or {@link #getSchema()}.- *- * @return an informal name of this object's type- */- public String getTypeHint();-- /**- * Get this object's schema- *- * @return the schema- */- public default TargetObjectSchema getSchema() {- return EnumerableTargetObjectSchema.OBJECT;- }-- /**- * Get the interfaces this object actually supports, and that the client recognizes- *- * @implNote Proxy implementations should likely override this method.- *- * @return the set of interfaces- */- public default Collection<? extends Class<? extends TargetObject>> getInterfaces() {- return Protected.getInterfacesOf(getClass());- }-- /**- * Get the interface names this object actually supports- *- * <p>- * When this object is a proxy, this set must include the names of all interfaces reported by- * the agent, whether or not they are recognized by the client.- *- * @return the set of interface names- */- public default Collection<String> getInterfaceNames() {- return Protected.doGetInterfaceNamesOf(getClass());- }-- /**- * Check that this object is still valid- *- * <p>- * In general, an invalid object should be disposed by the user immediately on discovering it is- * invalid. See {@link DebuggerModelListener#invalidated(TargetObject, TargetObject, String)}- * for a means of reacting to object invalidation. Nevertheless, it is acceptable to access- * stale attributes and element keys, for informational purposes only. Implementors must reject- * all commands, including fetches, on an invalid object by throwing an- * {@link IllegalStateException}.- *- * @return true if valid, false if invalid- */- public boolean isValid();-- /**- * Fetch all the attributes of this object- *- * <p>- * Attributes are usually keyed by a string, and the types are typically not uniform. Some- * attributes are primitives, while others are other target objects.- *- * @param refresh true to invalidate all caches involved in handling this request- * @return a future which completes with a name-value map of attributes- */- public default CompletableFuture<? extends Map<String, ?>> fetchAttributes(- RefreshBehavior refresh) {- return getModel().fetchObjectAttributes(getPath(), refresh);- }-- /**- * Fetch all attributes of this object, without refreshing- *- * @see #fetchAttributes(RefreshBehavior)- */- public default CompletableFuture<? extends Map<String, ?>> fetchAttributes() {- return fetchAttributes(RefreshBehavior.REFRESH_NEVER);- }-- /**- * Fetch an attribute by name- *- * @see #fetchAttributes()- * @see PathUtils#isInvocation(String)- * @implNote for attributes representing method invocations, the name will not likely be in the- * map given by {@link #fetchAttributes()}. It will be generated upon request. The- * implementation should cache the generated attribute until the attribute cache is- * refreshed. TODO: Even if the method is likely to return a different value on its- * next invocation? Yes, I think so. The user should manually refresh in those cases.- * @return a future which completes with the attribute or with {@code null} if the attribute- * does not exist- */- public default CompletableFuture<?> fetchAttribute(String name) {- if (!PathUtils.isInvocation(name)) {- return fetchAttributes().thenApply(m -> m.get(name));- }- Map<String, ?> cached = getCachedAttributes();- if (cached.containsKey(name)) {- return CompletableFuture.completedFuture(cached.get(name));- }- // TODO: Make a type for the invocation and parse arguments better?- Entry<String, String> invocation = PathUtils.parseInvocation(name);- return fetchAttribute(invocation.getKey()).thenCompose(obj -> {- if (!(obj instanceof TargetMethod)) {- throw new DebuggerModelTypeException(invocation.getKey() + " is not a method");- }- TargetMethod method = (TargetMethod) obj;- // Just blindly invoke and let it sort it out- return method.invoke(Map.of("arg", invocation.getValue()));- });- }-- /**- * Get the cached elements of this object- *- * @see #getCallbackElements()- * @return the map of indices to element references- */- public Map<String, ? extends TargetObject> getCachedElements();-- /**- * Get the cached elements of this object synchronized with the callbacks- *- * <p>- * Whereas {@link #getCachedElements()} gets the map of elements <em>right now</em>, it's- * possible that view of elements is far ahead of the callback processing queue. This view is of- * the elements as the change callbacks have been processed so far. When accessing this from the- * {@link DebuggerModelListener#elementsChanged(TargetObject, Collection, Map)} callback, this- * map will have just had the given delta applied to it.- *- * <p>- * <b>WARNING:</b>The returned map must only be accessed by the callback thread.- *- * @return the map of indices to element references- */- public Map<String, ? extends TargetObject> getCallbackElements();-- /**- * Fetch all the elements of this object- *- * <p>- * Elements are usually keyed numerically, but allows strings for flexibility. The values are- * target objects, typically uniform in type, and so generally share the same attributes. The- * keys must omit the brackets {@code []}. Implementations should ensure that the elements are- * presented in order by key -- not necessarily lexicographically. To ensure clients can easily- * maintain correct sorting, the recommendation is to present the keys as follows: Keys should- * be the numeric value encoded as strings in base 10 or base 16 as appropriate, using the least- * number of digits needed. While rarely used, a comma-separated list of indices may be- * presented. Key comparators should separate the indices, attempt to convert each to a number,- * and then sort using the left-most indices first. Indices which cannot be converted to numbers- * should be sorted lexicographically. It is the implementation's responsibility to ensure all- * indices follow a consistent scheme.- *- * @param refresh true to invalidate all caches involved in handling this request- * @return a future which completes with a index-value map of elements- */- public default CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchElements(- RefreshBehavior refresh) {- return getModel().fetchObjectElements(getPath(), refresh);- }-- /**- * Fetch all elements of this object, without refreshing- *- * @see #fetchElements(RefreshBehavior)- */- public default CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchElements() {- return fetchElements(RefreshBehavior.REFRESH_NEVER);- }-- /**- * Fetch an element by its index, omitting the brackets- *- * @return a future which completes with the element or with {@code null} if it does not exist- */- public default CompletableFuture<? extends TargetObject> fetchElement(String index) {- return getModel().fetchModelObject(PathUtils.index(getPath(), index));- }-- /**- * Fetch all children (elements and attributes) of this object- *- * <p>- * Note that keys for element indices here must contain the brackets {@code []} to distinguish- * them from attribute names.- *- * @see #fetchElements()- * @see #fetchAttributes()- *- * @param refresh true to invalidate all caches involved in handling this request- * @return a future which completes with a name-value map of children- */- public default CompletableFuture<? extends Map<String, ?>> fetchChildren(- RefreshBehavior refresh) {- AsyncFence fence = new AsyncFence();- Map<String, Object> children = new TreeMap<>(TargetObjectKeyComparator.CHILD);- fence.include(fetchElements(refresh).thenAccept(elements -> {- for (Map.Entry<String, ?> ent : elements.entrySet()) {- children.put(PathUtils.makeKey(ent.getKey()), ent.getValue());- }- }));- fence.include(fetchAttributes(refresh).thenAccept(children::putAll));- return fence.ready().thenApply(__ -> children);- }-- /**- * Fetch all children of this object, without refreshing- *- * @see #fetchChildren(boolean)- */- public default CompletableFuture<? extends Map<String, ?>> fetchChildren() {- return fetchChildren(RefreshBehavior.REFRESH_NEVER);- }-- /**- * Fetch a child (element or attribute) by key (index or name, respectively)- *- * <p>- * Indices are distinguished from names by the presence or absence of brackets {@code []}. If- * the key is a bracket-enclosed index, this will retrieve an element, otherwise, it will- * retrieve an attribute.- *- * @see #fetchAttribute(String)- * @see #fetchElement(String)- * @return a future which completes with the child- */- public default CompletableFuture<?> fetchChild(String key) {- if (PathUtils.isIndex(key)) {- return fetchElement(PathUtils.parseIndex(key));- }- return fetchAttribute(key);- }-- /**- * Fetch the children (elements and attributes) of this object which support the requested- * interface- *- * <p>- * If no children support the given interface, the result is the empty set.- *- * @param <T> the requested interface- * @param iface the class of the requested interface- * @return a future which completes with a name-value map of children supporting the given- * interface- */- public default <T extends TargetObject> //- CompletableFuture<? extends Map<String, ? extends T>> fetchChildrenSupporting(Class<T> iface) {- return fetchChildren().thenApply(m -> m.entrySet()- .stream()- .filter(e -> iface.isAssignableFrom(e.getValue().getClass()))- .collect(Collectors.toMap(Entry::getKey, e -> iface.cast(e.getValue()))));- }-- /**- * Fetch the value at the given sub-path from this object- *- * <p>- * Extend this reference's path with the given sub-path and request that value from the same- * model.- *- * @param sub the sub-path to the value- * @return a future which completes with the value or with {@code null} if the path does not- * exist- */- public default CompletableFuture<?> fetchValue(List<String> sub) {- return getModel().fetchModelObject(PathUtils.extend(getPath(), sub));- }-- /**- * @see #fetchValue(List)- */- public default CompletableFuture<?> fetchValue(String... sub) {- return fetchValue(List.of(sub));- }-- /**- * Fetch the successor object at the given sub-path from this object- *- * <p>- * Extend this reference's path with the given sub-path and request that object from the same- * model. Note unlike {@link #fetchValue(List)}, this can return objects which have been- * created, but not yet added to the model.- *- * @param sub the sub-path to the successor- * @return a future which completes with the object or with {@code null} if it does not exist- */- public default CompletableFuture<? extends TargetObject> fetchSuccessor(List<String> sub) {- return getModel().fetchModelObject(PathUtils.extend(getPath(), sub));- }-- /**- * @see #fetchSuccessor(List)- */- public default CompletableFuture<? extends TargetObject> fetchSuccessor(String... sub) {- return fetchSuccessor(List.of(sub));- }-- /**- * Get the cached successor of this object- *- * <p>- * Extend this object's path with the given sub-path, and search the model's cache for it.- *- * @param sub the sub-path to the successor- * @return the successor or {@code null} if it doesn't exist in the cache- */- public default TargetObject getSuccessor(List<String> sub) {- return getModel().getModelObject(PathUtils.extend(getPath(), sub));- }-- /**- * @see #getSuccessor(List)- */- public default TargetObject getSuccessor(String... sub) {- return getSuccessor(List.of(sub));- }-- /**- * Fetch the attributes of a successor to this object- *- * @param sub the sub-path to the successor whose attributes to list- * @return a future map of attributes- */- public default CompletableFuture<? extends Map<String, ?>> fetchSubAttributes(- List<String> sub) {- return getModel().fetchObjectAttributes(PathUtils.extend(getPath(), sub));- }-- /**- * @see #fetchSubAttributes(List)- */- public default CompletableFuture<? extends Map<String, ?>> fetchSubAttributes(String... sub) {- return fetchSubAttributes(List.of(sub));- }-- /**- * Fetch the attribute of a successor object, using a sub-path from this object- *- * <p>- * Extends this object's path with the given sub-path and request that attribute from the same- * model.- *- * @param sub the sub-path to the attribute- * @return a future which completes with the value or with {@code null} if it does not exist- */- public default CompletableFuture<?> fetchSubAttribute(List<String> sub) {- return getModel().fetchObjectAttribute(PathUtils.extend(getPath(), sub));- }-- /**- * @see #fetchSubAttribute(List)- */- public default CompletableFuture<?> fetchSubAttribute(String... sub) {- return fetchSubAttribute(List.of(sub));- }-- /**- * Fetch the elements of a successor to this object- *- * @param sub the sub-path to the successor whose elements to list- * @return a future map of elements- */- public default CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchSubElements(- List<String> sub) {- return getModel().fetchObjectElements(PathUtils.extend(getPath(), sub));- }-- /**- * @see #fetchSubElements(List)- */- public default CompletableFuture<? extends Map<String, ? extends TargetObject>> fetchSubElements(- String... sub) {- return fetchSubElements(List.of(sub));- }-- /**- * Get a description of the object, suitable for display in the UI- *- * @return the display description- */- @TargetAttributeType(name = DISPLAY_ATTRIBUTE_NAME, hidden = true)- public default String getDisplay() {- return getTypedAttributeNowByName(DISPLAY_ATTRIBUTE_NAME, String.class, getName());- }-- /**- * Get a brief description of the object, suitable for display in the UI- *- * @return the display description- */- @TargetAttributeType(name = SHORT_DISPLAY_ATTRIBUTE_NAME, hidden = true)- public default String getShortDisplay() {- return getTypedAttributeNowByName(SHORT_DISPLAY_ATTRIBUTE_NAME, String.class, getDisplay());- }-- /**- * Get a hint to the "kind" of object this represents- *- * <p>- * This is useful when the native debugger presents a comparable tree-like model. If this object- * is simply proxying an object from that model, and that model provides additional type- * information that would not otherwise be encoded in this model.- *- * @return the kind of the object- */- @TargetAttributeType(name = KIND_ATTRIBUTE_NAME, fixed = true, hidden = true)- public default String getKind() {- return getTypedAttributeNowByName(KIND_ATTRIBUTE_NAME, String.class, getDisplay());- }-- /**- * A custom ordinal for positioning this item on screen- *- * <p>- * Ordinarily, children are ordered by key, attributes followed by elements. The built-in- * comparator does a decent job ordering them, so long as indices keep a consistent format among- * siblings. In some cases, however, especially with query-style methods, the same objects (and- * thus keys) need to be presented with an alternative ordering. This attribute can be used by- * model implementations to recommend an alternative ordering, where siblings are instead sorted- * according to this ordinal.- *- * @return the recommended display position for this element- */- @TargetAttributeType(name = ORDER_ATTRIBUTE_NAME, hidden = true)- public default Integer getOrder() {- return getTypedAttributeNowByName(ORDER_ATTRIBUTE_NAME, Integer.class, null);- }-- /**- * For values, check if it was "recently" modified- *- * <p>- * TODO: This should probably be moved to a new {@code TargetObject} interface.- *- * <p>- * "Recently" generally means since (or as a result of ) the last event affecting a target in- * the same scope. This is mostly used as a UI hint, to bring the user's attention to modified- * values.- *- * @return true if modified, false if not- */- @TargetAttributeType(name = MODIFIED_ATTRIBUTE_NAME, hidden = true)- public default Boolean isModified() {- return getTypedAttributeNowByName(MODIFIED_ATTRIBUTE_NAME, Boolean.class, null);- }-- /**- * For values, get the type of the value- *- * <p>- * TODO: This should probably be moved to a new {@code TargetObject} interface. How does this- * differ from "kind" when both are present? Can this be a {@link TargetNamedDataType} instead?- * Though, I suppose that would imply the object is a value in the target execution state, e.g.,- * a register, variable, field, etc.- *- * @return the name of the type- */- @TargetAttributeType(name = TYPE_ATTRIBUTE_NAME, hidden = true)- public default String getType() {- return getTypedAttributeNowByName(TYPE_ATTRIBUTE_NAME, String.class, null);- }-- /**- * For values, get the actual value- *- * <p>- * TODO: This should probably be moved to a new {@code TargetObject} interface.- *- * @return the value- */- @TargetAttributeType(name = VALUE_ATTRIBUTE_NAME, hidden = true)- public default Object getValue() {- return getCachedAttribute(VALUE_ATTRIBUTE_NAME);- }-- /**- * Refresh the children of this object- *- * <p>- * The default fetch implementations follow the prescription of- * {@link TargetObjectSchema#getElementResyncMode()} and- * {@link TargetObjectSchema#getAttributeResyncMode()}. The client may call this method when,- * for unknown reasons, the respective cache(s) are out of sync with the target debugger. Such- * circumstances indicate an implementation error, but this method may provide a means to- * recover. When a {@code refresh} parameter is set, the model should be aggressive in updating- * its respective cache(s).- *- * @param refreshAttributes ask the model to refresh attributes, querying the debugger if needed- * @param refreshElements as the model to refresh elements, querying the debugger if needed- * @return a future which completes when the children are updated.- */- CompletableFuture<Void> resync(RefreshBehavior refreshAttributes,- RefreshBehavior refreshElements);-- /**- * Refresh the elements of this object- *- * @return a future which completes when the children are updated.- */- default CompletableFuture<Void> resync() {- return resync(RefreshBehavior.REFRESH_NEVER, RefreshBehavior.REFRESH_ALWAYS);- }-- /**- * Get the (usually opaque) identifier that the underlying connection uses for this object- *- * <p>- * The opaque identifier should implement proper {@link Object#hashCode()} and- * {@link Object#equals(Object)}, so that paired with the model, it forms a unique key for this- * target object. It should also implement {@link Object#toString()}; however, it is for- * debugging or informational purposes only. It is common for this identifier to be the object's- * path.- *- * @return the identifier- */- public Object getProtocolID();-- /**- * Get this same object, cast to the requested interface, if supported- *- * <p>- * This differs from Java-style casting in two ways: 1) The receiver cannot be {@code null}, and- * 2) It throws a different exception. Server-side proxy implementations must marshall the- * {@link DebuggerModelTypeException} to the client; whereas, for {@link ClassCastException}, it- * may simply report "Server-side Error," because that exception may have been thrown by an- * unrelated cast.- *- * @param <T> the requested interface- * @param iface the class of the requested interface- * @return the same object, cast to the interface- * @throws DebuggerModelTypeException if the interface is not supported by this object- */- public default <T extends TargetObject> T as(Class<T> iface) {- return DebuggerObjectModel.requireIface(iface, this, getPath());- }-- /**- * Get the cached attributes of this object- *- * @see #getCallbackAttributes()- * @return the cached name-value map of attributes- */- public Map<String, ?> getCachedAttributes();-- /**- * Get the cached attributes of this object synchronized with the callbacks- *- * <p>- * Whereas {@link #getCachedAttributes()} gets the map of attributes <em>right now</em>, it's- * possible that view of attributes if far ahead of the callback processing queue. This view is- * of the attributes as the change callbacks have been processed so far. When accessing this- * from the {@link DebuggerModelListener#attributesChanged(TargetObject, Collection, Map)}- * callback, this map will have just had the given delta applied to it.- *- * <p>- * <b>WARNING:</b>The returned map must only be accessed by the callback thread.- *- * @return the cached name-value map of attributes- */- public Map<String, ?> getCallbackAttributes();-- /**- * Get the named attribute from the cache- *- * @param name the name of the attribute- * @return the value- */- public default Object getCachedAttribute(String name) {- return getCachedAttributes().get(name);- }-- /**- * Cast the named attribute to the given type, if possible- *- * <p>- * If the attribute value is {@code null} or cannot be cast to the given type, the fallback- * value is returned.- *- * @param <T> the expected type of the attribute- * @param name the name of the attribute- * @param cls the class giving the expected type- * @param fallback the fallback value- * @return the value casted to the expected type, or the fallback value- */- public default <T> T getTypedAttributeNowByName(String name, Class<T> cls, T fallback) {- Object obj = getCachedAttribute(name);- TargetObjectSchema schema = getSchema();- boolean required = schema.getAttributeSchema(name).isRequired();- return ValueUtils.expectType(obj, cls, this, name, fallback, required);- }-- /**- * Search the model for a suitable-related object of the given interface- *- * @see TargetObjectSchema#searchForSuitable(Class, List)- * @param <T> the expected type of the interface- * @param cls the class giving the expected type- * @return the found object, or null- */- public default <T extends TargetObject> T getCachedSuitable(Class<T> cls) {- if (cls == TargetObject.class) {- return cls.cast(this);- }- List<String> found = getModel().getRootSchema().searchForSuitable(cls, getPath());- if (found == null) {- return null;- }- return cls.cast(getModel().getModelValue(found));- }-- /**- * Invalidate caches associated with this object, other than those for cached children- *- * <p>- * Some objects, e.g., memories and register banks, may have caches to reduce requests and- * callbacks. This method should clear such caches, if applicable, but <em>must not</em> clear- * caches of elements or attributes.- *- * <p>- * In the case of a proxy, the proxy must invalidate all local caches, as well as request the- * remote object invalidate its caches. In this way, all caches between the user and the actual- * data, no matter where they are hosted, are invalidated.- *- * @return a future which completes when the caches are invalidated- */- public default CompletableFuture<Void> invalidateCaches() {- return AsyncUtils.nil();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetObjectPath.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetObjectPath.javadeleted file mode 100644index 6d79dba944..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetObjectPath.java+++ /dev/null@@ -1,125 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.*;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.util.PathUtils;-import ghidra.dbg.util.PathUtils.PathComparator;--@Deprecated(forRemoval = true, since = "11.2")-public class TargetObjectPath implements Comparable<TargetObjectPath> {- protected final DebuggerObjectModel model;- protected final List<String> keyList;- protected final int hash;-- public TargetObjectPath(DebuggerObjectModel model, List<String> keyList) {- this.model = model;- this.keyList = keyList;- this.hash = Objects.hash(model, keyList);- }-- @Override- public boolean equals(Object obj) {- if (this == obj) {- return true;- }- if (!(obj instanceof TargetObjectPath)) {- return false;- }- TargetObjectPath that = (TargetObjectPath) obj;- return this.getModel() == that.getModel() &&- Objects.equals(this.getKeyList(), that.getKeyList());- }-- @Override- public int hashCode() {- return hash;- }-- @Override- public int compareTo(TargetObjectPath that) {- if (this == that) {- return 0;- }- DebuggerObjectModel thisModel = this.getModel();- DebuggerObjectModel thatModel = that.getModel();- if (thisModel != thatModel) {- if (thisModel == null) {- return -1;- }- if (thatModel == null) {- return 1;- }- int result = thisModel.toString().compareTo(thatModel.toString());- if (result == 0) {- return Integer.compare(- System.identityHashCode(thisModel),- System.identityHashCode(thatModel));- }- return result;- }- return PathComparator.KEYED.compare(this.getKeyList(), that.getKeyList());- }-- @Override- public String toString() {- return String.format("<%s in %s>", toPathString(), model);- }-- public DebuggerObjectModel getModel() {- return model;- }-- public List<String> getKeyList() {- return keyList;- }-- public String name() {- return PathUtils.getKey(keyList);- }-- public String index() {- return PathUtils.getIndex(keyList);- }-- public boolean isRoot() {- return keyList.isEmpty();- }-- public CompletableFuture<TargetObject> fetch() {- return model.fetchModelObject(getKeyList()).thenApply(obj -> obj);- }-- public String toPathString() {- return PathUtils.toString(keyList);- }-- public TargetObjectPath parent() {- List<String> pkl = PathUtils.parent(keyList);- return pkl == null ? null : new TargetObjectPath(model, pkl);- }-- public TargetObjectPath successor(List<String> subKeyList) {- return new TargetObjectPath(model, PathUtils.extend(keyList, subKeyList));- }-- public TargetObjectPath successor(String... subKeyList) {- return successor(Arrays.asList(subKeyList));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetProcess.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetProcess.javadeleted file mode 100644index c9f3310053..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetProcess.java+++ /dev/null@@ -1,43 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * A marker interface which indicates a process, usually on a host operating system- *- * <p>- * If this object does not support {@link TargetExecutionStateful}, then its mere existence in the- * model implies that it is {@link TargetExecutionState#ALIVE}. TODO: Should allow association via- * convention to a different {@link TargetExecutionStateful}, but that may have to wait until- * schemas are introduced.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Process")-public interface TargetProcess extends TargetObject {-- String PID_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "pid";-- @TargetAttributeType(name = PID_ATTRIBUTE_NAME, hidden = true)- public default Long getPid() {- return getTypedAttributeNowByName(PID_ATTRIBUTE_NAME, Long.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegister.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegister.javadeleted file mode 100644index bd0fc294ce..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegister.java+++ /dev/null@@ -1,125 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.util.PathUtils;--/**- * This is a description of a register- *- * <p>- * There are two conventions for presenting registers and their values:- *- * <ol>- * <li><b>Descriptions separated from values:</b> In this convention, the target presents one- * {@link TargetRegisterContainer}, and in it the various {@link TargetRegister}s, perhaps organized- * into groups. Each {@link TargetRegister} is then just an abstract description of the register,- * notably its name and size. Values are read and written using the- * {@link TargetRegisterBank#readRegister(TargetRegister)} and- * {@link TargetRegisterBank#writeRegister(TargetRegister, byte[])} methods, and related convenience- * methods. The {@link TargetRegisterBank} is the suitable bank for the desired object, usually a- * thread or frame.</li>- * <li><b>Descriptions and values together:</b> In this convention, the- * {@link TargetRegisterContainer} is the same object as the {@link TargetRegisterBank}, and so its'- * replicated for every object that has registers. The registers may be presented in groups under- * the container/bank. Each register provides its name (i.e., its index or key), its size, and its- * value (in the {@value TargetObject#VALUE_ATTRIBUTE_NAME} attribute).</li>- * </ol>- *- * <p>- * Despite the apparent efficiencies of presenting the descriptions only once, we are gravitating- * toward the descriptions-and-values together convention. This simplifies the client and- * model-inspection code a bit and will make things easier if we ever deal with targets having mixed- * architectures. If we settle on this convention, we will probably remove the- * {@link TargetRegisterContainer} interface in favor of using {@link TargetRegisterBank}. We may- * also formally introduce a {@code TargetRegisterGroup} interface.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Register")-public interface TargetRegister extends TargetObject {-- String CONTAINER_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "container";- String BIT_LENGTH_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "length";-- /**- * Get the container of this register.- *- * <p>- * While it is most common for a register descriptor to be an immediate child of its container,- * that is not necessarily the case. In fact, some models may present sub-registers as children- * of another register. This method is a reliable and type-safe means of obtaining the- * container.- *- * @return a reference to the container- */- @TargetAttributeType(- name = CONTAINER_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- default TargetRegisterContainer getContainer() {- return getTypedAttributeNowByName(CONTAINER_ATTRIBUTE_NAME, TargetRegisterContainer.class,- null);- }-- /**- * Get the length, in bits, of the register- *- * @return the length of the register- */- @TargetAttributeType(- name = BIT_LENGTH_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- default int getBitLength() {- return getTypedAttributeNowByName(BIT_LENGTH_ATTRIBUTE_NAME, Integer.class, 0);- }-- /**- * Get the length, in bytes, of the register- *- * <p>- * For registers whose bit lengths are not a multiple of 8, this should be the minimum number of- * bytes required to bit all the bits, i.e., it should divide by 8 rounding up.- *- * @return the length of the register- */- default int getByteLength() {- return (getBitLength() + 7) / 8;- }-- /**- * Get the name of this register- *- * <p>- * TODO: Instead of overriding getIndex, we should introduce getRegisterName.- */- @Override- public default String getIndex() {- return PathUtils.isIndex(getPath()) ? PathUtils.getIndex(getPath())- : PathUtils.getKey(getPath());- }-- // TODO: Any typical type assignment or structure definition?- // TODO: (Related) Should describe if typically a pointer?-- // TODO: What if the register is memory-mapped? Probably map client-side.-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegisterBank.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegisterBank.javadeleted file mode 100644index 5f3512c800..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegisterBank.java+++ /dev/null@@ -1,215 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.*;-import java.util.Map.Entry;-import java.util.concurrent.CompletableFuture;-import java.util.stream.Collectors;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.error.DebuggerRegisterAccessException;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.util.Msg;--/**- * A bank of registers on the debug target- *- * <p>- * The bank allows access to registers' <em>values</em>; whereas, a {@link TargetRegisterContainer}- * allows reflection of the registers' names and structures.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("RegisterBank")-public interface TargetRegisterBank extends TargetObject {-- String DESCRIPTIONS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "descriptions";- // TODO: Remove this stopgap once we implement register-value replay- String REGISTERVALS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "register_values";-- /**- * Get the object describing the registers in this bank- *- * <p>- * TODO: {@link TargetRegisterContainer} ought to be removed. However, some models present a- * complex structure for their register banks and containers, splitting the set into, e.g.,- * User, Vector, etc. I suspect the simplest way for a client to accommodate this is to use- * {@link TargetObjectSchema#searchFor(Class, boolean)}, passing {@link TargetRegister}. The- * "canonical container" concept doesn't really work here, as that will yield each set, rather- * than the full descriptions container.- *- * @return a future which completes with object- */- @TargetAttributeType(name = DESCRIPTIONS_ATTRIBUTE_NAME)- public default TargetRegisterContainer getDescriptions() {- return getTypedAttributeNowByName(DESCRIPTIONS_ATTRIBUTE_NAME,- TargetRegisterContainer.class, null);- }-- /**- * Read the given registers- *- * <p>- * The value of each register is given as a byte array in big-endian order, <em>no matter the- * byte order of the target platform</em>.- *- * <p>- * <b>WARNING:</b> the implementation is not required to have any understanding of the register- * structure. In particular, caches are not aware of child registers. To avoid the issue, it is- * highly recommended to only read and write base registers.- *- * @param registers the registers to read- * @return a future which completes with a name-value map of the values read- */- public default CompletableFuture<? extends Map<String, byte[]>> readRegisters(- Collection<TargetRegister> registers) {- return readRegistersNamed(- registers.stream().map(TargetRegister::getIndex).collect(Collectors.toSet()));- }-- /**- * Write the given registers- *- * <p>- * The value of each register is given as a byte array in big-endian order, <em>no matter the- * byte order of the target platform</em>.- *- * <p>- * <b>WARNING:</b> the implementation is not required to have any understanding of the register- * structure. In particular, caches are not aware of child registers. To avoid the issue, it is- * highly recommended to only read and write base registers.- *- * @param values the register-value map to write- * @return a future which completes upon successfully writing all given registers- */- public default CompletableFuture<Void> writeRegisters(Map<TargetRegister, byte[]> values) {- Map<String, byte[]> named = new LinkedHashMap<>();- for (Entry<TargetRegister, byte[]> ent : values.entrySet()) {- named.put(ent.getKey().getIndex(), ent.getValue());- }- return writeRegistersNamed(named);- }-- /**- * Read the named registers- *- * @see #readRegisters(Collection)- * @param names the names of registers to read- * @return a future which completes with a name-value map of the values read- * @throws DebuggerRegisterAccessException if a named register does not exist- */- public CompletableFuture<? extends Map<String, byte[]>> readRegistersNamed(- Collection<String> names);-- /**- * Write the named registers- *- * @see #writeRegistersNamed(Map)- * @param values the name-value map to write- * @return a future which completes upon successfully writing all given registers- * @throws DebuggerRegisterAccessException if a named register does not exist- */- public CompletableFuture<Void> writeRegistersNamed(Map<String, byte[]> values);-- /**- * Read the named registers- *- * @see #readRegistersNamed(Collection)- */- public default CompletableFuture<? extends Map<String, byte[]>> readRegistersNamed(- String... names) {- return readRegistersNamed(List.of(names));- }-- /**- * Read the given register- *- * @see #readRegisters(Collection)- * @param register the register to read- * @return a future which completes with the value read- */- public default CompletableFuture<byte[]> readRegister(TargetRegister register) {- return readRegister(register.getIndex());- }-- /**- * Write the given register- *- * @see #writeRegistersNamed(Map)- * @param register the register to write- * @param value the value to write- * @return a future which completes upon successfully writing the register- */- public default CompletableFuture<Void> writeRegister(TargetRegister register, byte[] value) {- return writeRegistersNamed(Map.of(register.getIndex(), value));- }-- /**- * Read the named register- *- * @see #readRegisters(Collection)- * @param name the name of the register to read- * @return a future which completes with the value read- */- public default CompletableFuture<byte[]> readRegister(String name) {- return readRegistersNamed(List.of(name)).thenApply(m -> m.get(name));- }-- /**- * Write the named register- *- * @see #writeRegistersNamed(Map)- * @param name the name of the register to write- * @param value the value to write- * @return a future which completes upon successfully writing the register- */- public default CompletableFuture<Void> writeRegister(String name, byte[] value) {- return writeRegistersNamed(Map.of(name, value));- }-- /**- * Get a view of the locally-cached register values, if available- *- * <p>- * If caching is not done locally, this returns the empty map.- *- * @return the cached register values- */- public default Map<String, byte[]> getCachedRegisters() {- return Map.of();- }-- /**- * Clear the register cache- *- * <p>- * To avoid duplicate requests for the same registers, proxies are encouraged to implement a- * write-through register cache. If the proxy does so, then calling this method must flush that- * cache. If no cache is used, then no action is necessary.- *- * @deprecated Override {@link #invalidateCaches()} instead- */- @Deprecated- public default void clearRegisterCache() {- invalidateCaches().exceptionally(e -> {- Msg.error(this, "Error clearing register caches");- return null;- });- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegisterContainer.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegisterContainer.javadeleted file mode 100644index 7066278fa7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetRegisterContainer.java+++ /dev/null@@ -1,58 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Collection;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebugModelConventions;-import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetObjectSchema;--/**- * A container of register descriptions- *- * <p>- * TODO: Remove this. It really doesn't add anything that can't be discovered via the schema. A- * client searching for a register (description) container should use- * {@link TargetObjectSchema#searchForCanonicalContainer(Class)}, or discover the bank first, and- * ask for its descriptions.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("RegisterContainer")-public interface TargetRegisterContainer extends TargetObject {-- /**- * Get the register descriptions in this container- *- * <p>- * While it is most common for registers to be immediate children of the container, that is not- * necessarily the case. In fact, some models may present sub-registers as children of another- * register. This method must return all registers (including sub-registers, if applicable) in- * the container.- *- * @implNote By default, this method collects all successor registers ordered by path.- * Overriding that behavior is not yet supported.- * @return the register descriptions- * @deprecated I don't think this has any actual utility.- */- @Deprecated(forRemoval = true)- default CompletableFuture<? extends Collection<? extends TargetRegister>> getRegisters() {- return DebugModelConventions.collectSuccessors(this, TargetRegister.class);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetResumable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetResumable.javadeleted file mode 100644index 6d07b602fa..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetResumable.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * A target which can be resumed, i.e., continued- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Resumable")-public interface TargetResumable extends TargetObject {-- /**- * Resume execution of this object- *- * <p>- * Note, this would be called "continue" if it weren't a Java reserved word :( .- *- * @return a future which completes upon successful resumption- */- public CompletableFuture<Void> resume();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSection.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSection.javadeleted file mode 100644index cbe48d6a1a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSection.java+++ /dev/null@@ -1,83 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.program.model.address.Address;-import ghidra.program.model.address.AddressRange;--/**- * An allocated section of a binary module- *- * <p>- * Note that the model should only present those sections which are allocated in memory. Otherwise- * strange things may happen, such as zero-length ranges (which AddressRange hates), or overlapping- * ranges (which Trace hates).- *- * <p>- * TODO: Present all sections, but include isAllocated?- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Section")-public interface TargetSection extends TargetObject {-- String MODULE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "module";- String RANGE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "range";-- /**- * Get the module to which this section belongs- *- * @return the owning module- */- @TargetAttributeType(name = MODULE_ATTRIBUTE_NAME, required = true, fixed = true, hidden = true)- public default TargetModule getModule() {- return getTypedAttributeNowByName(MODULE_ATTRIBUTE_NAME, TargetModule.class, null);- }-- // TODO: Should there be a getSectionName(), like getModuleName()- // in case getIndex() isn't accurate?-- /**- * Get the range of addresses comprising the section- *- * @return the range- */- @TargetAttributeType(name = RANGE_ATTRIBUTE_NAME, required = true, fixed = true)- public default AddressRange getRange() {- return getTypedAttributeNowByName(RANGE_ATTRIBUTE_NAME, AddressRange.class, null);- }-- /**- * Get the lowest address in the section- *- * @return the start- */- public default Address getStart() {- return getRange().getMinAddress();- }-- /**- * Get the highest address (inclusive) in the section- *- * @return the end- */- public default Address getEnd() {- return getRange().getMaxAddress();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSectionContainer.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSectionContainer.javadeleted file mode 100644index f01416115c..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSectionContainer.java+++ /dev/null@@ -1,32 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;--/**- * A place for breakpoint locations to reside- *- * <p>- * This is just a marker interface for finding where a target's sections are given.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("SectionContainer")-public interface TargetSectionContainer extends TargetObject {- // Nothing here aside from a marker-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetStack.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetStack.javadeleted file mode 100644index 2cb585b29f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetStack.java+++ /dev/null@@ -1,55 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Collection;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebugModelConventions;-import ghidra.dbg.DebuggerTargetObjectIface;--/**- * Represents the execution stack, as unwound into frames by the debugger- *- * <p>- * Conventionally, if the debugger can also unwind register values, then each frame should present a- * register bank. Otherwise, the same object presenting this stack should present the register bank.- *- * <p>- * TODO: Probably remove this. It serves only as a container of {@link TargetStackFrame}, which can- * be discovered using the schema.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Stack")-public interface TargetStack extends TargetObject {-- /**- * Get the frames in this stack- *- * <p>- * While it is most common for frames to be immediate children of the stack, that is not- * necessarily the case.- *- * @implNote By default, this method collects all successor frames ordered by path. Overriding- * that behavior is not yet supported.- * @return the stack frames- */- default CompletableFuture<? extends Collection<? extends TargetStackFrame>> getFrames() {- return DebugModelConventions.collectSuccessors(this, TargetStackFrame.class);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetStackFrame.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetStackFrame.javadeleted file mode 100644index 8f9109d01b..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetStackFrame.java+++ /dev/null@@ -1,45 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.program.model.address.Address;--/**- * One frame (call record) of an execution stack- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("StackFrame")-public interface TargetStackFrame extends TargetObject {-- String PC_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "pc";-- /**- * Get the program counter for the frame- *- * <p>- * Note for some platforms, this may differ from the value in the program counter register.- *- * @return a future completing with the address of the executing (or next) instruction.- */- @TargetAttributeType(name = PC_ATTRIBUTE_NAME, required = true, hidden = true)- public default Address getProgramCounter() {- return getTypedAttributeNowByName(PC_ATTRIBUTE_NAME, Address.class, Address.NO_ADDRESS);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSteppable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSteppable.javadeleted file mode 100644index 281ac61ff9..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSteppable.java+++ /dev/null@@ -1,231 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Map;-import java.util.Set;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.util.CollectionUtils;-import ghidra.dbg.util.CollectionUtils.AbstractEmptySet;--/**- * A target whose execution can be single stepped- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Steppable")-public interface TargetSteppable extends TargetObject {-- public interface TargetStepKindSet extends Set<TargetStepKind> {-- public static class EmptyTargetStepKindSet extends AbstractEmptySet<TargetStepKind>- implements TargetStepKindSet {- // Nothing- }-- public static class ImmutableTargetStepKindSet- extends CollectionUtils.AbstractNSet<TargetStepKind> implements TargetStepKindSet {-- public ImmutableTargetStepKindSet(TargetStepKind... kinds) {- super(kinds);- }-- public ImmutableTargetStepKindSet(Set<TargetStepKind> set) {- super(set);- }- }-- TargetStepKindSet EMPTY = new EmptyTargetStepKindSet();-- public static TargetStepKindSet of() {- return EMPTY;- }-- public static TargetStepKindSet of(TargetStepKind... kinds) {- return new ImmutableTargetStepKindSet(kinds);- }-- public static TargetStepKindSet copyOf(Set<TargetStepKind> set) {- return new ImmutableTargetStepKindSet(set);- }- }-- enum TargetStepKind {- /**- * Step out of the current function.- *- * <p>- * In more detail: step until the object has executed the return instruction that returns- * from the current frame.- */- FINISH,- /**- * Step a single instruction- *- * <p>- * In more detail: trap after execution of exactly the next instruction. If the instruction- * is a function call, stepping will descend into the function.- */- INTO,- /**- * Step to the next line of source code.- *- * <p>- * In more detail: if the debugger is a source-based debugger and it has access to debug- * information that includes line numbers, step until execution reaches an instruction- * generated by a line of source code other than the line which generated the instruction- * about to be executed.- */- LINE,- /**- * Step over a function call.- *- * <p>- * In more detail: if the instruction to be executed is a function call, step until the- * object returns from that call, but before it executes the instruction following the call.- * Otherwise, behave the same as a single step.- */- OVER,- /**- * Step over a function call, to the next line of source code- *- * <p>- * In more detail: if the debugger is a source-based debugger and it has access to debug- * information that includes line numbers, step (over function calls) until execution- * reaches an instruction generated by a line of source code other than the line which- * generated the instruction about to be executed.- */- OVER_LINE,- /**- * Skip an instruction.- *- * <p>- * In more detail: advance the program counter to the next instruction without actually- * executing the current instruction.- */- SKIP,- /**- * Skip the remainder of the current function.- *- * <p>- * In more detail: remove the current stack frame and position the program counter as if the- * current function had just returned, i.e., the instruction following the function call.- * Note it is up to the client user to set the appropriate registers to a given return- * value, if desired.- */- RETURN,- /**- * Step out of a loop.- *- * <p>- * To avoid runaway execution, stepping should cease if execution returns from the current- * frame.- *- * <p>- * In more detail: if the instruction to be executed is a backward jump, step until- * execution reaches the following instruction in the same stack frame. Alternatively, if- * the debugger is a source-based debugger and it has access to debug information that- * includes line numbers, it may step until execution reaches an instruction generated by a- * line of source code after the line which generated the instruction about to be executed.- */- UNTIL,- /**- * Step until some condition is met.- */- EXTENDED,- }-- String SUPPORTED_STEP_KINDS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "supported_step_kinds";-- /**- * Get the kinds of multi-stepping implemented by the debugger- *- * <p>- * Different debuggers may provide similar, but slightly different vocabularies of stepping.- * This method queries the connected debugger for its supported step kinds.- *- * @return the set of supported multi-step operations- */- @TargetAttributeType(- name = SUPPORTED_STEP_KINDS_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- public default TargetStepKindSet getSupportedStepKinds() {- return getTypedAttributeNowByName(SUPPORTED_STEP_KINDS_ATTRIBUTE_NAME,- TargetStepKindSet.class, TargetStepKindSet.of());- }-- /**- * Step/resume the object until some condition is met- *- * <p>- * A step command may complete with {@link UnsupportedOperationException} despite the- * implementation reporting its kind as supported. This may happen if the current execution- * context prevents its implementation, e.g., debug information is not available for the current- * frame. In many cases, with some expense, the client user can synthesize the desired stepping- * using information it knows in combination with other step kinds, breakpoints, etc.- *- * <p>- * The step command completes when the object is running, and not when it has actually completed- * the step. If, as is usual, the step completes immediately, then the object will immediately- * stop again. If, on the other hand, the single instruction comprises a system call, and the- * debugger is limited to user space, then the step may not immediately complete, if ever. A- * client user wishing to wait for the actual step completion should wait for this object to- * re-enter the {@link TargetExecutionState#STOPPED} state.- *- * <p>- * More nuances may be at play depending on the connected debugger and the target platform. For- * example, the debugger may still be reporting some other event, e.g., module load, and may- * stop before completing the step. Or, e.g., for GDB on Linux x86_64, a thread interrupted- * during a {@code SYSCALL} will have {@code RIP} pointing at the following instruction. When- * the {@code SYSCALL} returns, and that step completes, {@code RIP} will still point to that- * same instruction. As a general note, we do not intend to "overcome" these nuances. Instead,- * we strive to ensure the view presented by this API (and thus by the Ghidra UI) reflects- * exactly the view presented by the connected debugger, nuances and all.- *- * @return a future which completes when the object is stepping- */- public CompletableFuture<Void> step(TargetStepKind kind);-- /**- * Step a target using the given arguments- *- * @param args the map of arguments.- * @return a future which completes when the command is completed- */- public default CompletableFuture<Void> step(Map<String, ?> args) {- return step(TargetStepKind.INTO);- }-- /**- * Step a single instruction- *- * <p>- * This convenience is exactly equivalent to calling {@code step(TargetStepKind.INTO)}- *- * @see #step(TargetStepKind)- * @see TargetStepKind#INTO- */- public default CompletableFuture<Void> step() {- return step(TargetStepKind.INTO);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSymbol.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSymbol.javadeleted file mode 100644index aef2067acb..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSymbol.java+++ /dev/null@@ -1,156 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.util.TargetDataTypeConverter;-import ghidra.program.model.address.Address;-import ghidra.program.model.data.DataType;-import ghidra.program.model.data.DataTypeManager;--/**- * The description of a debugging symbol- *- * @see TargetSymbolNamespace- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Symbol")-public interface TargetSymbol extends TargetObject {-- String DATA_TYPE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "data_type";- String SIZE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "size";- String NAMESPACE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "namespace";-- /**- * Get the type of this symbol- *- * @return a future completing with the type- */- @TargetAttributeType(name = DATA_TYPE_ATTRIBUTE_NAME, fixed = true, hidden = true)- public default TargetDataType getDataType() {- return getTypedAttributeNowByName(DATA_TYPE_ATTRIBUTE_NAME, TargetDataType.class,- TargetDataType.UNDEFINED1);- }-- /**- * Get the type of this symbol converted to a Ghidra data type- *- * @return a future completing with the type- */- public default CompletableFuture<DataType> getGhidraDataType(- TargetDataTypeConverter converter) {- return converter.convertTargetDataType(getDataType()).thenApply(dt -> dt);- }-- /**- * Get the type of this symbol converted to a Ghidra data type- *- * <p>- * WARNING: Each call to this variant creates a new {@link TargetDataTypeConverter}, and so does- * not take full advantage of its internal cache.- *- * @see #getGhidraDataType(TargetDataTypeConverter)- */- public default CompletableFuture<DataType> getGhidraDataType(DataTypeManager dtm) {- return getGhidraDataType(new TargetDataTypeConverter(dtm));- }-- /**- * Get the type of this symbol converted to a Ghidra data type, without using a- * {@link DataTypeManager}- *- * <p>- * It is better to use variants with a {@link DataTypeManager} directly, rather than using no- * manager and cloning to one later. The former will select types suited to the data- * organization of the destination manager. Using no manager and cloning later will use- * fixed-size types.- *- * @see #getGhidraDataType(DataTypeManager)- */- public default CompletableFuture<DataType> getGhidraDataType() {- return getGhidraDataType((DataTypeManager) null);- }-- /**- * Determine whether the symbol has a constant value- *- * <p>- * Constant symbols include but are not limited to C enumeration constants. Otherwise, the- * symbol's value refers to an address, which stores a presumably non-constant value.- *- * @return true if constant, or false if not or unspecified- */- public default boolean isConstant() {- return getValue().isConstantAddress();- }-- /**- * Get the value of the symbol- *- * <p>- * If the symbol is a constant, then the returned address will be in the constant space.- *- * @return the address or constant value of the symbol, or {@link Address#NO_ADDRESS} if- * unspecified- */- @Override- // NB. TargetObject defines this attribute- public default Address getValue() {- return getTypedAttributeNowByName(VALUE_ATTRIBUTE_NAME, Address.class, Address.NO_ADDRESS);- }-- /**- * If known, get the size of the symbol in bytes- *- * <p>- * The size of a symbol is usually not required at runtime, so a user should be grateful if this- * is known. If it is not known, or the symbol does not have a size, this method returns 0.- *- * @return the size of the symbol, or 0 if unspecified- */- @TargetAttributeType(- name = SIZE_ATTRIBUTE_NAME,- fixed = true,- hidden = true)- public default long getSize() {- return getTypedAttributeNowByName(SIZE_ATTRIBUTE_NAME, Long.class, 0L);- }-- /**- * Get the namespace for this symbol.- *- * <p>- * While it is most common for a symbol to be an immediate child of its namespace, that is not- * necessarily the case. This method is a reliable and type-safe means of obtaining that- * namespace.- *- * @return a reference to the namespace- */- @TargetAttributeType(- name = NAMESPACE_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- public default TargetSymbolNamespace getNamespace() {- return getTypedAttributeNowByName(NAMESPACE_ATTRIBUTE_NAME, TargetSymbolNamespace.class,- null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSymbolNamespace.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSymbolNamespace.javadeleted file mode 100644index bff41f6161..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetSymbolNamespace.java+++ /dev/null@@ -1,52 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.Collection;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebugModelConventions;-import ghidra.dbg.DebuggerTargetObjectIface;--/**- * A container of symbols- *- * <p>- * The debugger should present these in as granular of units as possible. Consider a desktop- * application, for example. The debugger should present each module as a namespace rather than the- * entire target (or worse, the entire session) as a single namespace.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("SymbolNamespace")-public interface TargetSymbolNamespace extends TargetObject {-- /**- * Get the symbols in this namespace.- *- * <p>- * While it is most common for symbols to be immediate children of the namespace, that is not- * necessarily the case.- *- * @implNote By default, this method collects all successor symbols ordered by path. Overriding- * that behavior is not yet supported.- * @return the types- */- default CompletableFuture<? extends Collection<? extends TargetSymbol>> getSymbols() {- return DebugModelConventions.collectSuccessors(this, TargetSymbol.class);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetThread.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetThread.javadeleted file mode 100644index f919bd1607..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetThread.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * A marker interface which indicates a thread, usually within a process- *- * <p>- * This object must be associated with a suitable {@link TargetExecutionStateful}. In most cases,- * the object should just implement it.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Thread")-public interface TargetThread extends TargetObject {-- String TID_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "tid";-- @TargetAttributeType(name = TID_ATTRIBUTE_NAME, hidden = true)- public default Long getTid() {- return getTypedAttributeNowByName(TID_ATTRIBUTE_NAME, Long.class, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetTogglable.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetTogglable.javadeleted file mode 100644index 6d6309b48e..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetTogglable.java+++ /dev/null@@ -1,62 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.schema.TargetAttributeType;--/**- * An object which can be toggled- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Togglable")-public interface TargetTogglable extends TargetObject {-- String ENABLED_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "enabled";-- /**- * Check if the object is enabled- *- * @return true if enabled, false otherwise- */- @TargetAttributeType(name = ENABLED_ATTRIBUTE_NAME, required = true, hidden = true)- public default boolean isEnabled() {- return getTypedAttributeNowByName(ENABLED_ATTRIBUTE_NAME, Boolean.class, false);- }-- /**- * Disable this object- */- public CompletableFuture<Void> disable();-- /**- * Enable this object- */- public CompletableFuture<Void> enable();-- /**- * Enable or disable this object- *- * @param enabled true to enable, false to disable- */- public default CompletableFuture<Void> toggle(boolean enabled) {- return enabled ? enable() : disable();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/AnnotatedSchemaContext.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/AnnotatedSchemaContext.javadeleted file mode 100644index 81ac2179d5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/AnnotatedSchemaContext.java+++ /dev/null@@ -1,447 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target.schema;--import java.lang.reflect.*;-import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.stream.Collectors;-import java.util.stream.Stream;--import org.apache.commons.lang3.StringUtils;-import org.apache.commons.lang3.reflect.TypeUtils;--import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;-import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.target.TargetMethod;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.DefaultTargetObjectSchema.DefaultAttributeSchema;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema.MinimalSchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.AttributeSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.util.Msg;-import utilities.util.reflection.ReflectionUtilities;--@Deprecated(forRemoval = true, since = "11.2")-public class AnnotatedSchemaContext extends DefaultSchemaContext {-- public static class AnnotatedAttributeSchema extends DefaultAttributeSchema {- protected final Class<?> javaClass;-- public AnnotatedAttributeSchema(String name, SchemaName schema, boolean isRequired,- boolean isFixed, boolean isHidden, Class<?> javaClass) {- super(name, schema, isRequired, isFixed, isHidden);- this.javaClass = javaClass;- }-- public AnnotatedAttributeSchema lower(AnnotatedAttributeSchema that) {- if (this.javaClass.isAssignableFrom(that.javaClass)) {- return that;- }- if (that.javaClass.isAssignableFrom(this.javaClass)) {- return this;- }- throw new IllegalArgumentException("Cannot find lower of " + this.javaClass + " and " +- that.javaClass + ". They are unrelated.");- }- }-- static <T> Stream<Class<? extends T>> filterBounds(Class<T> base, Stream<Class<?>> bounds) {- return bounds.filter(base::isAssignableFrom).map(c -> c.asSubclass(base));- }-- static Stream<Class<?>> resolveUpperBounds(Class<? extends TargetObject> cls, Type type) {- if (type == null) {- return Stream.empty();- }- if (type instanceof Class<?>) {- return Stream.of((Class<?>) type);- }- if (type instanceof ParameterizedType) {- ParameterizedType pt = (ParameterizedType) type;- return resolveUpperBounds(cls, pt.getRawType());- }- if (type instanceof WildcardType) {- WildcardType wt = (WildcardType) type;- return Stream.of(TypeUtils.getImplicitUpperBounds(wt))- .flatMap(t -> resolveUpperBounds(cls, t));- }- if (type instanceof TypeVariable) {- TypeVariable<?> tv = (TypeVariable<?>) type;- Object decl = tv.getGenericDeclaration();- if (decl instanceof Class<?>) {- Class<?> declCls = (Class<?>) decl;- Map<TypeVariable<?>, Type> args = TypeUtils.getTypeArguments(cls, declCls);- Type argTv = args.get(tv);- if (argTv != null) {- return resolveUpperBounds(cls, argTv);- }- }- return Stream.of(TypeUtils.getImplicitBounds(tv))- .flatMap(t -> resolveUpperBounds(cls, t));- }- /**- * NB. This method is always called with a type taken from "T extends TargetObject" So, an- * array should never be possible.- */- throw new AssertionError("Cannot handle type: " + type);- }-- static Set<Class<? extends TargetObject>> getBoundsOfFetchElements(- Class<? extends TargetObject> cls) {- try {- Method method =- cls.getMethod("fetchElements", new Class<?>[] { RefreshBehavior.class });- Type ret = method.getGenericReturnType();- Map<TypeVariable<?>, Type> argsCf =- TypeUtils.getTypeArguments(ret, CompletableFuture.class);- Type typeCfT = argsCf.get(CompletableFuture.class.getTypeParameters()[0]);-- Map<TypeVariable<?>, Type> argsMap = TypeUtils.getTypeArguments(typeCfT, Map.class);- Type typeCfMapV = argsMap.get(Map.class.getTypeParameters()[1]);-- return filterBounds(TargetObject.class, resolveUpperBounds(cls, typeCfMapV))- .collect(Collectors.toSet());- }- catch (NoSuchMethodException | SecurityException e) {- throw new AssertionError(e);- }- }-- static Set<Class<? extends TargetObject>> getBoundsOfObjectAttributeGetter(- Class<? extends TargetObject> cls, Method getter) {- Class<?> retCls = getter.getReturnType();- if (TargetObject.class.isAssignableFrom(retCls)) {- return Set.of(retCls.asSubclass(TargetObject.class));- }- // NB. Caller does check for primitive- throw new IllegalArgumentException("Getter " + getter +- " for attribute must return primitive or subclass of " + TargetObject.class);- }-- protected final Map<Class<? extends TargetObject>, SchemaName> namesByClass =- new LinkedHashMap<>();- protected final Map<Class<? extends TargetObject>, TargetObjectSchema> schemasByClass =- new LinkedHashMap<>();-- /**- * Get the schema name for an annotated target object class- *- * @param cls the class- * @return the schema name- */- public SchemaName nameFromAnnotatedClass(Class<? extends TargetObject> cls) {- synchronized (namesByClass) {- TargetObjectSchemaInfo info = cls.getAnnotation(TargetObjectSchemaInfo.class);- if (info == null) {- // TODO: Compile-time validation?- DebuggerTargetObjectIface iface =- cls.getAnnotation(DebuggerTargetObjectIface.class);- if (iface == null) {- Msg.warn(this, "Class " + cls + " is not annotated with @" +- TargetObjectSchemaInfo.class.getSimpleName());- }- return EnumerableTargetObjectSchema.OBJECT.getName();- }- return namesByClass.computeIfAbsent(cls, c -> {- String name = info.name();- if (name.equals("")) {- return new SchemaName(cls.getSimpleName());- }- return new SchemaName(name);- });- }- }-- protected void addPublicMethodsFromClass(SchemaBuilder builder,- Class<? extends TargetObject> declCls, Class<? extends TargetObject> cls) {- for (Method declMethod : declCls.getDeclaredMethods()) {- int mod = declMethod.getModifiers();- if (!Modifier.isPublic(mod)) {- continue;- }-- TargetAttributeType at = declMethod.getAnnotation(TargetAttributeType.class);- if (at == null) {- continue;- }-- // In case it was overridden with a more-specific return type- Method method;- try {- method = cls.getMethod(declMethod.getName(), declMethod.getParameterTypes());- }- catch (NoSuchMethodException | SecurityException e) {- throw new AssertionError(e);- }-- AttributeSchema attrSchema;- try {- attrSchema = attributeSchemaFromAnnotatedMethod(declCls, method, at);- }- catch (IllegalArgumentException e) {- throw new IllegalArgumentException(- "Could not get schema name for attribute accessor " + method + " in " + cls, e);- }- if (attrSchema != null) {- builder.addAttributeSchema(attrSchema, declMethod);- }- }- }-- protected void addExportedTargetMethodsFromClass(SchemaBuilder builder,- Class<? extends TargetObject> declCls, Class<? extends TargetObject> cls) {- for (Method declMethod : declCls.getDeclaredMethods()) {- int mod = declMethod.getModifiers();- if (!Modifier.isPublic(mod)) {- continue;- }-- TargetMethod.Export export = declMethod.getAnnotation(TargetMethod.Export.class);- if (export == null) {- continue;- }-- AttributeSchema exists = builder.getAttributeSchema(export.value());- if (exists != null) {- continue;- }-- SchemaName snMethod = new SchemaName("Method");- if (getSchemaOrNull(snMethod) == null) {- builder(snMethod)- .addInterface(TargetMethod.class)- .setDefaultElementSchema(EnumerableTargetObjectSchema.VOID.getName())- .addAttributeSchema(- new DefaultAttributeSchema(TargetObject.DISPLAY_ATTRIBUTE_NAME,- EnumerableTargetObjectSchema.STRING.getName(), true, true, true),- "default")- .addAttributeSchema(- new DefaultAttributeSchema(TargetMethod.RETURN_TYPE_ATTRIBUTE_NAME,- EnumerableTargetObjectSchema.TYPE.getName(), true, true, true),- "default")- .addAttributeSchema(- new DefaultAttributeSchema(TargetMethod.PARAMETERS_ATTRIBUTE_NAME,- EnumerableTargetObjectSchema.MAP_PARAMETERS.getName(), true, true,- true),- "default")- .setDefaultAttributeSchema(AttributeSchema.DEFAULT_VOID)- .buildAndAdd();- }-- builder.addAttributeSchema(- new DefaultAttributeSchema(export.value(), snMethod, true, true, true), declMethod);- }- }-- protected TargetObjectSchema fromAnnotatedClass(Class<? extends TargetObject> cls) {- synchronized (namesByClass) {- SchemaName name = nameFromAnnotatedClass(cls);- TargetObjectSchema enumerable = MinimalSchemaContext.INSTANCE.getSchemaOrNull(name);- if (enumerable != null) {- throw new IllegalArgumentException("Class " + cls + " is assigned name " + name +- ". This usually means it's missing the @" +- TargetObjectSchemaInfo.class.getSimpleName() +- " annotation, or that the class was referenced by accident.");- }- return schemasByClass.computeIfAbsent(cls, c -> {- SchemaBuilder builder = builderForClass(cls, name);-- return builder.buildAndAdd();- });- }- }-- /**- * Get a populated builder for an annotated target object class- *- * @param cls the class- * @return the builder- */- public SchemaBuilder builderForClass(Class<? extends TargetObject> cls) {- return builderForClass(cls, nameFromAnnotatedClass(cls));- }-- /**- * Get a populated builder for an annotated target object class- *- * @param cls the class- * @param name a custom name for the schema- * @return the builder- */- public SchemaBuilder builderForClass(Class<? extends TargetObject> cls, SchemaName name) {- TargetObjectSchemaInfo info = cls.getAnnotation(TargetObjectSchemaInfo.class);- if (info == null) {- throw new IllegalArgumentException("Class " + cls + " is not annotated with @" +- TargetObjectSchemaInfo.class.getSimpleName());- }- SchemaBuilder builder = builder(name);-- Set<Class<?>> allParents = ReflectionUtilities.getAllParents(cls);- for (Class<?> parent : allParents) {- DebuggerTargetObjectIface ifaceAnnot =- parent.getAnnotation(DebuggerTargetObjectIface.class);- if (ifaceAnnot != null) {- builder.addInterface(parent.asSubclass(TargetObject.class));- }- }-- builder.setCanonicalContainer(info.canonicalContainer());- builder.setElementResyncMode(info.elementResync());- builder.setAttributeResyncMode(info.attributeResync());-- boolean sawDefaultElementType = false;- for (TargetElementType et : info.elements()) {- if (et.index().equals("")) {- sawDefaultElementType = true;- }- builder.addElementSchema(et.index(), nameFromClass(et.type()), et);- }- if (!sawDefaultElementType) {- Set<Class<? extends TargetObject>> bounds = getBoundsOfFetchElements(cls);- if (bounds.size() != 1) {- // TODO: Compile-time validation?- throw new IllegalArgumentException(- "Could not identify unique element class (" + bounds + ") for " + cls);- }- Class<? extends TargetObject> bound = bounds.iterator().next();- SchemaName schemaName;- try {- schemaName = nameFromClass(bound);- }- catch (IllegalArgumentException e) {- throw new IllegalArgumentException(- "Could not get schema name from bound " + bound + " of " + cls +- ".fetchElements()",- e);- }- builder.setDefaultElementSchema(schemaName);- }-- addPublicMethodsFromClass(builder, cls, cls);- for (Class<?> parent : allParents) {- if (TargetObject.class.isAssignableFrom(parent)) {- addPublicMethodsFromClass(builder, parent.asSubclass(TargetObject.class), cls);- }- }- for (TargetAttributeType at : info.attributes()) {- AnnotatedAttributeSchema attrSchema = attributeSchemaFromAnnotation(at);- AttributeSchema exists = builder.getAttributeSchema(attrSchema.getName());- if (exists != null) {- attrSchema = attrSchema.lower((AnnotatedAttributeSchema) exists);- }- builder.replaceAttributeSchema(attrSchema, at);- }- addExportedTargetMethodsFromClass(builder, cls, cls);- for (Class<?> parent : allParents) {- if (TargetObject.class.isAssignableFrom(parent)) {- addExportedTargetMethodsFromClass(builder, parent.asSubclass(TargetObject.class),- cls);- }- }- return builder;- }-- protected String attributeNameFromBean(String beanName, boolean isBool) {- beanName = isBool ? StringUtils.removeStartIgnoreCase(beanName, "is")- : StringUtils.removeStartIgnoreCase(beanName, "get");- if (beanName.equals("")) {- throw new IllegalArgumentException("Attribute getter must have a name");- }- return beanName.replaceAll("([A-Z]+)([A-Z][a-z])", "$1_$2")- .replaceAll("([a-z])([A-Z])", "$1_$2")- .toLowerCase();- }-- protected AnnotatedAttributeSchema attributeSchemaFromAnnotation(TargetAttributeType at) {- return new AnnotatedAttributeSchema(at.name(), nameFromClass(at.type()), at.required(),- at.fixed(), at.hidden(), at.type());- }-- protected AttributeSchema attributeSchemaFromAnnotatedMethod(Class<? extends TargetObject> cls,- Method method, TargetAttributeType at) {- if (method.getParameterCount() != 0) {- // TODO: Compile-time validation?- throw new IllegalArgumentException("Non-getter method " + method +- " is annotated with @" + TargetAttributeType.class.getSimpleName());- }- String name = at.name();- Class<?> ret = method.getReturnType();- if (name.equals("")) {- name = attributeNameFromBean(method.getName(),- EnumerableTargetObjectSchema.BOOL.getTypes().contains(ret));- }- SchemaName primitiveName = EnumerableTargetObjectSchema.nameForPrimitive(ret);- if (primitiveName != null) {- return new AnnotatedAttributeSchema(name, primitiveName, at.required(), at.fixed(),- at.hidden(), ret);- }- Set<Class<? extends TargetObject>> bounds = getBoundsOfObjectAttributeGetter(cls, method);- if (bounds.size() != 1) {- // TODO: Compile-time validation?- throw new IllegalArgumentException(- "Could not identify unique attribute class for method " + method + ": " + bounds);- }- Class<? extends TargetObject> bound = bounds.iterator().next();- return new AnnotatedAttributeSchema(name, nameFromClass(bound),- at.required(), at.fixed(), at.hidden(), bound);- }-- protected SchemaName nameFromClass(Class<?> cls) {- SchemaName name = EnumerableTargetObjectSchema.nameForPrimitive(cls);- if (name != null) {- return name;- }- if (TargetObject.class.isAssignableFrom(cls)) {- return nameFromAnnotatedClass(cls.asSubclass(TargetObject.class));- }- throw new IllegalArgumentException("Cannot figure schema from class: " + cls);- }-- protected void fillDependencies() {- while (fillDependenciesRound()) {- // Action is side-effect of predicate- }- }-- protected boolean fillDependenciesRound() {- Set<Class<? extends TargetObject>> classes = new HashSet<>(namesByClass.keySet());- classes.removeAll(schemasByClass.keySet());- if (classes.isEmpty()) {- return false;- }- for (Class<? extends TargetObject> cls : classes) {- fromAnnotatedClass(cls);- }- return true;- }-- /**- * Get the schema for an annotated target object class- *- * <p>- * This will ensure all the schemas of the given class' dependencies are constructed and added- * to the context.- *- * @param cls the class- * @return the schema- */- public TargetObjectSchema getSchemaForClass(Class<? extends TargetObject> cls) {- TargetObjectSchema schema = fromAnnotatedClass(cls);- fillDependencies();- return schema;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetAttributeType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetAttributeType.javadeleted file mode 100644index 68d5f96cb4..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetAttributeType.java+++ /dev/null@@ -1,82 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target.schema;--import java.lang.annotation.*;--import ghidra.dbg.target.TargetObject;--/**- * A schema annotation to describe a model attribute.- *- * <p>- * It can be used in {@link TargetObjectSchemaInfo#attributes()} or be applied to a public, possibly- * inherited, getter method for the attribute.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@Target(ElementType.METHOD)-@Retention(RetentionPolicy.RUNTIME)-public @interface TargetAttributeType {- /**- * The name of the attribute- *- * <p>- * When used in {@link TargetObjectSchemaInfo#attributes()}, the default {@code ""} matches any- * attribute name and should rarely, if ever, be used. When applied to a getter, the default- * indicates the name should be derived from the method name, by removing {@code get}, and- * converting from {@code CamelCase} to {@code lower_case_with_underscores}.- *- * @return the attribute name- */- String name() default "";-- /**- * The Java class best representing the attribute's type.- *- * <p>- * When applied to a getter, {@code type} can be omitted. In that case, the getter's return type- * will be used to derive the attribute's schema instead.- *- * @return the type- */- Class<?> type() default TargetObject.class;-- /**- * True if the attribute must be set before the object exists.- *- * @return true if required, false if optional- */- boolean required() default false;-- /**- * True if the attribute can only be set once.- *- * @return true if fixed/final/immutable, false if mutable- */- boolean fixed() default false;-- /**- * Whether or not this attribute should be displayed by default- *- * <p>- * This is purely a UI hint and has no other semantic consequences.- *- * @return true if hidden, false if visible- */- boolean hidden() default false;-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetElementType.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetElementType.javadeleted file mode 100644index cfb76de67a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetElementType.java+++ /dev/null@@ -1,32 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target.schema;--import java.lang.annotation.*;--import ghidra.dbg.target.TargetObject;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@Target({})-@Retention(RetentionPolicy.RUNTIME)-public @interface TargetElementType {- String index() default "";-- Class<?> type() default TargetObject.class;-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetObjectSchemaInfo.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetObjectSchemaInfo.javadeleted file mode 100644index fccf379dee..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetObjectSchemaInfo.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target.schema;--import java.lang.annotation.*;--import ghidra.dbg.target.schema.TargetObjectSchema.ResyncMode;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-@Target(ElementType.TYPE)-@Retention(RetentionPolicy.RUNTIME)-public @interface TargetObjectSchemaInfo {- String name() default "";-- boolean canonicalContainer() default false;-- TargetElementType[] elements() default {};-- ResyncMode elementResync() default ResyncMode.NEVER;-- TargetAttributeType[] attributes() default {};-- ResyncMode attributeResync() default ResyncMode.NEVER;-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/CollectionUtils.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/CollectionUtils.javadeleted file mode 100644index 7b715bf4a8..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/CollectionUtils.java+++ /dev/null@@ -1,376 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.util.*;-import java.util.function.*;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public enum CollectionUtils {- ;-- public abstract static class AbstractImmutableList<T> extends AbstractList<T> {- @Override- public void add(int index, T element) {- throw new UnsupportedOperationException();- }-- @Override- public boolean add(T e) {- throw new UnsupportedOperationException();- }-- @Override- public boolean addAll(Collection<? extends T> c) {- throw new UnsupportedOperationException();- }-- @Override- public boolean addAll(int index, Collection<? extends T> c) {- throw new UnsupportedOperationException();- }-- @Override- public boolean remove(Object o) {- throw new UnsupportedOperationException();- }-- @Override- public T remove(int index) {- throw new UnsupportedOperationException();- }-- @Override- public boolean removeAll(Collection<?> c) {- throw new UnsupportedOperationException();- }-- @Override- public boolean removeIf(Predicate<? super T> filter) {- throw new UnsupportedOperationException();- }-- @Override- protected void removeRange(int fromIndex, int toIndex) {- throw new UnsupportedOperationException();- }-- @Override- public boolean retainAll(Collection<?> c) {- throw new UnsupportedOperationException();- }-- @Override- public void clear() {- throw new UnsupportedOperationException();- }-- @Override- public void replaceAll(UnaryOperator<T> operator) {- throw new UnsupportedOperationException();- }-- @Override- public T set(int index, T element) {- throw new UnsupportedOperationException();- }-- @Override- public void sort(Comparator<? super T> c) {- throw new UnsupportedOperationException();- }- }-- public abstract static class AbstractImmutableSet<T> extends AbstractSet<T> {- @Override- public boolean add(T e) {- throw new UnsupportedOperationException();- }-- @Override- public boolean addAll(Collection<? extends T> c) {- throw new UnsupportedOperationException();- }-- @Override- public void clear() {- throw new UnsupportedOperationException();- }-- @Override- public boolean remove(Object o) {- throw new UnsupportedOperationException();- }-- @Override- public boolean retainAll(Collection<?> c) {- throw new UnsupportedOperationException();- }- }-- public abstract static class AbstractImmutableMap<K, V> extends AbstractMap<K, V> {- }-- public static class AbstractEmptyMap<K, V> extends AbstractMap<K, V> {- @Override- public Set<Entry<K, V>> entrySet() {- return Set.of();- }- }-- public static class AbstractEmptyList<T> extends AbstractList<T> {- @Override- public T get(int index) {- throw new ArrayIndexOutOfBoundsException(index);- }-- @Override- public int size() {- return 0;- }- }-- public static class AbstractEmptySet<T> extends AbstractImmutableSet<T> {- @Override- public Iterator<T> iterator() {- return Collections.emptyIterator();- }-- @Override- public int size() {- return 0;- }- }-- public static class AbstractNList<T> extends AbstractImmutableList<T> {- protected final List<T> wrapped;-- @SafeVarargs- public AbstractNList(T... elems) {- this.wrapped = List.of(elems);- }-- public AbstractNList(Collection<T> col) {- this.wrapped = List.copyOf(col);- }-- @Override- public T get(int index) {- return wrapped.get(index);- }-- @Override- public int size() {- return wrapped.size();- }- }-- public static class AbstractNSet<T> extends AbstractImmutableSet<T> {- protected final Set<T> wrapped;-- @SafeVarargs- public AbstractNSet(T... elems) {- this.wrapped = Set.of(elems);- }-- public AbstractNSet(Collection<T> col) {- this.wrapped = Set.copyOf(col);- }-- @Override- public Iterator<T> iterator() {- return wrapped.iterator();- }-- @Override- public int size() {- return wrapped.size();- }- }-- public static class AbstractNMap<K, V> extends AbstractImmutableMap<K, V> {- protected final Map<K, V> wrapped;-- public AbstractNMap(Map<K, V> map) {- this.wrapped = Collections.unmodifiableMap(new LinkedHashMap<>(map));- }-- @Override- public Set<Entry<K, V>> entrySet() {- return wrapped.entrySet();- }- }-- public static <K, V> Collection<V> getAllExisting(Map<K, V> map, Collection<K> keys) {- List<V> result = new ArrayList<>();- for (K k : keys) {- if (map.containsKey(k)) {- result.add(map.get(k));- }- }- return result;- }-- public static class Delta<T, U extends T> {- public static final Delta<?, ?> EMPTY = new Delta<>(Map.of(), Map.of());- public static final BiPredicate<Object, Object> SAME = (a, b) -> a == b;- public static final BiPredicate<Object, Object> EQUAL = Objects::equals;-- @SuppressWarnings("unchecked")- public static final <T, U extends T> Delta<T, U> empty() {- return (Delta<T, U>) EMPTY;- }-- public static final <T, U extends T> Delta<T, U> create(Map<String, T> removed,- Map<String, U> added) {- return new Delta<>(removed, added);- }-- public static final <T, U extends T> Delta<T, U> create(Collection<String> removedKeys,- Map<String, U> added) {- Map<String, T> removedNull = new HashMap<>();- for (String key : removedKeys) {- removedNull.put(key, null);- }- return new Delta<>(removedNull, added);- }-- protected static final <T> void retainKeys(Map<String, T> mutable, Collection<String> keys,- Map<String, T> removed) {- for (Iterator<Map.Entry<String, T>> eit = mutable.entrySet().iterator(); eit- .hasNext();) {- Map.Entry<String, T> oldEnt = eit.next();- if (!keys.contains(oldEnt.getKey())) {- removed.put(oldEnt.getKey(), oldEnt.getValue());- eit.remove();- }- }- }-- protected static final <T> void removeKeys(Map<String, T> mutable, Collection<String> keys,- Map<String, T> removed) {- for (String r : keys) {- if (mutable.containsKey(r)) {- removed.put(r, mutable.remove(r));- }- }- }-- protected static final <T, U extends T> void putEntries(Map<String, T> mutable,- Map<String, U> entries, Map<String, T> removed, Map<String, U> added,- BiPredicate<? super T, ? super U> equals) {- for (Map.Entry<String, U> e : entries.entrySet()) {- String key = e.getKey();- U newVal = e.getValue();- if (!mutable.containsKey(key)) {- mutable.put(key, newVal);- added.put(key, newVal);- continue;- }- T oldVal = mutable.get(key);- if (!equals.test(oldVal, newVal)) {- mutable.put(key, newVal);- removed.put(key, oldVal);- added.put(key, newVal);- }- }- }-- public static final <T, U extends T> Delta<T, U> computeAndSet(Map<String, T> mutable,- Map<String, U> desired, BiPredicate<? super T, ? super U> equals) {- Map<String, T> removed = new LinkedHashMap<>();- Map<String, U> added = new LinkedHashMap<>();- retainKeys(mutable, desired.keySet(), removed);- putEntries(mutable, desired, removed, added, equals);- return create(removed, added);- }-- /*public static final <T, U extends T> Delta<T, U> computeAndSet(Map<String, T> mutable,- Map<String, U> desired) {- return computeAndSet(mutable, desired, SAME);- }*/-- public static final <T, U extends T> Delta<T, U> apply(Map<String, T> mutable,- Collection<String> removed, Map<String, U> added,- BiPredicate<? super T, ? super U> equals) {- if (removed.isEmpty() && added.isEmpty()) {- return empty();- }-- Map<String, T> fRemoved = new LinkedHashMap<>();- Map<String, U> fAdded = new LinkedHashMap<>();- removeKeys(mutable, removed, fRemoved);- putEntries(mutable, added, fRemoved, fAdded, equals);- return create(fRemoved, fAdded);- }-- /*public static final <T, U extends T> Delta<T, U> apply(Map<String, T> mutable,- Collection<String> removed, Map<String, U> added) {- return apply(mutable, removed, added, SAME);- }*/-- public static final void applyToKeys(Set<String> mutable, Collection<String> removed,- Map<String, ?> added) {- mutable.removeAll(removed);- mutable.addAll(added.keySet());- }-- public final Map<String, T> removed;- public final Map<String, U> added;- private volatile Set<String> keysRemoved;- // TODO: Moved?-- protected Delta(Map<String, T> removed, Map<String, U> added) {- this.removed = removed;- this.added = added;- }-- @Override- public String toString() {- return "<Delta removed=" + removed + ", added=" + added + ">";- }-- public boolean isEmpty() {- return removed.isEmpty() && added.isEmpty();- }-- public Delta<T, U> apply(Map<String, T> mutable,- BiPredicate<Object, Object> equals) {- return apply(mutable, removed.keySet(), added, equals);- }-- public Delta<T, U> apply(Map<String, T> mutable) {- return apply(mutable, SAME);- }-- public void applyToKeys(Set<String> mutable) {- applyToKeys(mutable, removed.keySet(), added);- }-- public Set<String> getKeysRemoved() {- if (keysRemoved != null) {- return keysRemoved;- }- Set<String> temp = new LinkedHashSet<>(removed.keySet());- temp.removeAll(added.keySet());- keysRemoved = temp;- return keysRemoved;- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ConfigurableFactory.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ConfigurableFactory.javadeleted file mode 100644index d4e2234fc2..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ConfigurableFactory.java+++ /dev/null@@ -1,171 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.lang.annotation.*;-import java.lang.reflect.Field;-import java.util.LinkedHashMap;-import java.util.Map;-import java.util.Map.Entry;-import java.util.concurrent.CompletableFuture;-import java.util.function.Consumer;-import java.util.function.Supplier;--import ghidra.framework.options.SaveState;-import ghidra.framework.plugintool.AutoConfigState.ConfigFieldCodec;-import ghidra.framework.plugintool.AutoConfigState.ConfigStateField;-import ghidra.util.Msg;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public interface ConfigurableFactory<T> {- @Retention(RetentionPolicy.RUNTIME)- @Target(ElementType.TYPE)- public @interface FactoryDescription {- String brief();-- String htmlDetails();- }-- @Retention(RetentionPolicy.RUNTIME)- @Target(ElementType.FIELD)- public @interface FactoryOption {- /**- * The text to display next to the option- *- * @return- */- String value();- }-- public interface Property<T> {- Class<T> getValueClass();-- T getValue();-- void setValue(T value);-- boolean isEnabled();-- void setEnabled(boolean enabled);-- static <T> Property<T> fromAccessors(Class<T> cls, Supplier<T> getter, Consumer<T> setter) {- return new Property<T>() {- boolean enabled = true;-- @Override- public Class<T> getValueClass() {- return cls;- }-- @Override- public T getValue() {- return getter.get();- }-- @Override- public void setValue(T value) {- setter.accept(value);- }-- @Override- public boolean isEnabled() {- return enabled;- }-- @Override- public void setEnabled(boolean enabled) {- this.enabled = enabled;- }- };- }- }-- /**- * Build the object- *- * Note, if the object requires some initialization, esp., if that such methods are not exposed- * via {@code T}, then this method should invoke them. Preferably, the returned future should- * not complete until initialization is complete.- *- * @return a future which completes with the built and initialized object.- */- CompletableFuture<? extends T> build();-- default String getBrief() {- FactoryDescription annot = getClass().getAnnotation(FactoryDescription.class);- if (annot == null) {- return "Class: " + getClass().getSimpleName();- }- return annot.brief();- }-- default String getHtmlDetails() {- FactoryDescription annot = getClass().getAnnotation(FactoryDescription.class);- if (annot == null) {- return "Un-described factory: " + getClass().getName();- }- return annot.htmlDetails();- }-- default Map<String, Property<?>> getOptions() {- Map<String, Property<?>> result = new LinkedHashMap<>();- for (Field f : getClass().getFields()) {- FactoryOption annot = f.getAnnotation(FactoryOption.class);- if (annot == null) {- continue;- }- try {- result.put(annot.value(), (Property<?>) f.get(this));- }- catch (Throwable e) {- Msg.error(this, "Could not process option: " + f.getName(), e);- }- }- return result;- }-- default void writeConfigState(SaveState saveState) {- for (Entry<String, Property<?>> opt : getOptions().entrySet()) {- Property<?> property = opt.getValue();- @SuppressWarnings({ "unchecked", "rawtypes" })- ConfigFieldCodec<Object> codec = (ConfigFieldCodec) ConfigStateField- .getCodecByType(property.getValueClass());- if (codec == null) {- continue;- }- codec.write(saveState, opt.getKey(), property.getValue());- }- }-- default void readConfigState(SaveState saveState) {- for (Entry<String, Property<?>> opt : getOptions().entrySet()) {- @SuppressWarnings({ "unchecked", "rawtypes" })- Property<Object> property = (Property) opt.getValue();- ConfigFieldCodec<?> codec = ConfigStateField- .getCodecByType(property.getValueClass());- if (codec == null) {- continue;- }- Object read = codec.read(saveState, opt.getKey(), null);- if (read != null) {- property.setValue(read);- }- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ConversionUtils.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ConversionUtils.javadeleted file mode 100644index d903252f13..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ConversionUtils.java+++ /dev/null@@ -1,55 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.math.BigInteger;-import java.util.Arrays;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public enum ConversionUtils {- ;- /**- * Converts a given big integer into a 2's-complement big-endian byte array- *- * If the value requires fewer than {@code length} bytes, the more-significant bytes of the- * result are filled according to the sign of the value. If the value requires more than- * {@code length} bytes, the more-significant bytes of the value are truncated.- *- * @param length the number of bytes in the output byte array- * @param value the input value to convert- * @return the resulting byte array- */- public static byte[] bigIntegerToBytes(int length, BigInteger value) {- byte[] bytes = value.toByteArray();- if (length == bytes.length) {- return bytes;- }- byte[] result = new byte[length];- if (value.signum() < 0) {- Arrays.fill(result, (byte) -1);- }- if (length < bytes.length) {- System.arraycopy(bytes, bytes.length - length, result, 0, length);- }- else {- System.arraycopy(bytes, 0, result, length - bytes.length, bytes.length);- }- return result;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/DebuggerCallbackReorderer.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/DebuggerCallbackReorderer.javadeleted file mode 100644index eaeaf2a29d..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/DebuggerCallbackReorderer.java+++ /dev/null@@ -1,384 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.util.*;-import java.util.Map.Entry;-import java.util.concurrent.CompletableFuture;--import ghidra.async.AsyncFence;-import ghidra.async.AsyncUtils;-import ghidra.dbg.DebuggerModelClosedReason;-import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.error.DebuggerMemoryAccessException;-import ghidra.dbg.target.*;-import ghidra.dbg.target.TargetConsole.Channel;-import ghidra.dbg.target.TargetEventScope.TargetEventType;-import ghidra.program.model.address.Address;-import ghidra.program.model.address.AddressRange;-import ghidra.util.Msg;--/**- * A mechanism for re-ordering model callbacks- *- * <p>- * When this is added to the model, {@code replay} must be true, or behavior of the mechanism is- * undefined.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class DebuggerCallbackReorderer implements DebuggerModelListener {-- private class ObjectRecord {- private final TargetObject obj;- private final CompletableFuture<TargetObject> addedToParent = new CompletableFuture<>();- private final CompletableFuture<TargetObject> complete;-- ObjectRecord(TargetObject obj) {- this.obj = obj;- TargetObject parent = obj.getParent();- ObjectRecord parentRecord;- synchronized (records) {- parentRecord = parent == null ? null : records.get(parent);- }- if (parentRecord == null) {- complete = addedToParent.thenApply(this::completed);- }- else {- complete = parentRecord.complete.thenCompose(__ -> addedToParent)- .thenApply(this::completed);- }- }-- TargetObject completed(TargetObject obj) {- synchronized (records) {- records.remove(obj);- }- // NB. We should already be on the clientExecutor- Map<String, ?> attributes = obj.getCallbackAttributes();- if (!attributes.isEmpty()) {- defensive(() -> listener.attributesChanged(obj, List.of(), Map.copyOf(attributes)),- "attributesChanged(r)");- }- Map<String, ? extends TargetObject> elements = obj.getCallbackElements();- if (!elements.isEmpty()) {- defensive(() -> listener.elementsChanged(obj, List.of(), Map.copyOf(elements)),- "elementsChanged(r)");- }- return obj;- }-- void added() {- if (!addedToParent.isDone()) {- addedToParent.complete(obj);- }- }-- void removed() {- if (!addedToParent.isDone()) {- addedToParent.cancel(false);- }- }-- public void cancel() {- addedToParent.cancel(false);- complete.cancel(false);- }- }-- private final DebuggerModelListener listener;-- private final Map<TargetObject, ObjectRecord> records = new HashMap<>();- private CompletableFuture<Void> lastEvent = AsyncUtils.nil();-- private volatile boolean disposed = false;-- public DebuggerCallbackReorderer(DebuggerModelListener listener) {- this.listener = listener;- }-- private void defensive(Runnable r, String cb) {- try {- r.run();- }- catch (Throwable t) {- Msg.error(this, "Listener " + listener + " caused exception processing " + cb, t);- }- }-- @Override- public void catastrophic(Throwable t) {- if (disposed) {- return;- }- listener.catastrophic(t);- }-- @Override- public void modelClosed(DebuggerModelClosedReason reason) {- if (disposed) {- return;- }- listener.modelClosed(reason);- }-- @Override- public void modelOpened() {- if (disposed) {- return;- }- listener.modelOpened();- }-- @Override- public void modelStateChanged() {- if (disposed) {- return;- }- listener.modelStateChanged();- }-- @Override- public void created(TargetObject object) {- if (disposed) {- return;- }- //System.err.println("created object='" + object.getJoinedPath(".") + "'");- synchronized (records) {- records.put(object, new ObjectRecord(object));- }- defensive(() -> listener.created(object), "created");- }-- @Override- public void invalidated(TargetObject object, TargetObject branch, String reason) {- if (disposed) {- return;- }- ObjectRecord remove;- synchronized (records) {- remove = records.remove(object);- }- if (remove != null) {- remove.removed();- }- defensive(() -> listener.invalidated(object, branch, reason), "invalidated");- }-- @Override- public void rootAdded(TargetObject root) {- if (disposed) {- return;- }- defensive(() -> listener.rootAdded(root), "rootAdded");- synchronized (records) {- records.get(root).added();- }- }-- @Override- public void attributesChanged(TargetObject object, Collection<String> removed,- Map<String, ?> added) {- if (disposed) {- return;- }- //System.err.println("attributesChanged object=" + object.getJoinedPath(".") + ",removed=" +- // removed + ",added=" + added);- ObjectRecord record;- synchronized (records) {- record = records.get(object);- }- if (record == null) {- defensive(() -> listener.attributesChanged(object, removed, added),- "attributesChanged");- }- // Removed taken care of via invalidation- for (Entry<String, ?> ent : added.entrySet()) {- //System.err.println(" " + ent.getKey());- Object val = ent.getValue();- if (val instanceof TargetObject) {- TargetObject obj = (TargetObject) val;- if (!PathUtils.isLink(object.getPath(), ent.getKey(), obj.getPath())) {- ObjectRecord rec;- synchronized (records) {- rec = records.get(obj);- }- if (rec != null) {- rec.added();- }- }- }- }- }-- @Override- public void elementsChanged(TargetObject object, Collection<String> removed,- Map<String, ? extends TargetObject> added) {- if (disposed) {- return;- }- //System.err.println("elementsChanged object=" + object.getJoinedPath(".") + ",removed=" +- // removed + ",added=" + added);- ObjectRecord record;- synchronized (records) {- record = records.get(object);- }- if (record == null) {- defensive(() -> listener.elementsChanged(object, removed, added), "elementsChanged");- }- // Removed taken care of via invalidation- for (Entry<String, ? extends TargetObject> ent : added.entrySet()) {- //System.err.println(" " + ent.getKey());- TargetObject obj = ent.getValue();- if (!PathUtils.isElementLink(object.getPath(), ent.getKey(), obj.getPath())) {- ObjectRecord rec;- synchronized (records) {- rec = records.get(obj);- }- if (rec != null) {- rec.added();- }- }- }- }-- private void orderedOnObjects(Collection<TargetObject> objects, Runnable r, String cb) {- AsyncFence fence = new AsyncFence();- fence.include(lastEvent);- synchronized (records) {- for (TargetObject obj : objects) {- ObjectRecord record = records.get(obj);- if (record != null) {- fence.include(record.complete);- }- }- }- lastEvent = fence.ready().thenAccept(__ -> {- defensive(r, cb);- }).exceptionally(ex -> {- Msg.error(this, "Callback " + cb + " dropped for error in dependency", ex);- return null;- });- }-- @Override- public void breakpointHit(TargetObject container, TargetObject trapped, TargetStackFrame frame,- TargetBreakpointSpec spec, TargetBreakpointLocation breakpoint) {- if (disposed) {- return;- }- List<TargetObject> args = frame == null- ? List.of(container, trapped, spec, breakpoint)- : List.of(container, trapped, frame, spec, breakpoint);- orderedOnObjects(args, () -> {- listener.breakpointHit(container, trapped, frame, spec, breakpoint);- }, "breakpointHit");- }-- @Override- public void consoleOutput(TargetObject console, Channel channel, byte[] data) {- if (disposed) {- return;- }- orderedOnObjects(List.of(console), () -> {- listener.consoleOutput(console, channel, data);- }, "consoleOutput");- }-- private Collection<TargetObject> gatherObjects(Collection<?>... collections) {- Set<TargetObject> objs = new HashSet<>();- for (Collection<?> col : collections) {- for (Object val : col) {- if (val instanceof TargetObject) {- objs.add((TargetObject) val);- }- }- }- return objs;- }-- @Override- public void event(TargetObject object, TargetThread eventThread, TargetEventType type,- String description, List<Object> parameters) {- if (disposed) {- return;- }- List<TargetObject> objs = eventThread == null- ? List.of(object)- : List.of(object, eventThread);- orderedOnObjects(gatherObjects(objs, parameters), () -> {- listener.event(object, eventThread, type, description, parameters);- }, "event(" + type + ") " + description);- }-- @Override- public void invalidateCacheRequested(TargetObject object) {- if (disposed) {- return;- }- orderedOnObjects(List.of(object), () -> {- listener.invalidateCacheRequested(object);- }, "invalidateCacheRequested");- }-- @Override- public void memoryReadError(TargetObject memory, AddressRange range,- DebuggerMemoryAccessException e) {- if (disposed) {- return;- }- orderedOnObjects(List.of(memory), () -> {- listener.memoryReadError(memory, range, e);- }, "invalidateCacheRequested");- }-- @Override- public void memoryUpdated(TargetObject memory, Address address, byte[] data) {- if (disposed) {- return;- }- orderedOnObjects(List.of(memory), () -> {- listener.memoryUpdated(memory, address, data);- }, "invalidateCacheRequested");- }-- @Override- public void registersUpdated(TargetObject bank, Map<String, byte[]> updates) {- if (disposed) {- return;- }- orderedOnObjects(List.of(bank), () -> {- listener.registersUpdated(bank, updates);- }, "invalidateCacheRequested");- }-- public void dispose() {- disposed = true;- Set<ObjectRecord> volRecs;- synchronized (records) {- volRecs = Set.copyOf(records.values());- records.clear();- }- for (ObjectRecord rec : volRecs) {- rec.cancel();- }- }-- public CompletableFuture<Void> flushEvents() {- return lastEvent.thenApply(v -> v);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/HandlerMap.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/HandlerMap.javadeleted file mode 100644index 5adf25ddba..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/HandlerMap.java+++ /dev/null@@ -1,98 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.util.LinkedHashMap;-import java.util.function.BiConsumer;-import java.util.function.BiFunction;--/**- * A means of dynamically binding method calls to one of many registered handlers by sub-type- *- * A handler is a method accepting a sub-type and a custom argument. The handler can be assigned to- * handle any sub-type of its first argument. When the {@link #handle(Object, Object)} method of- * this map is called, it invokes the mapped handler, or throws {@link IllegalArgumentException} if- * there is not a handler for the given object type. The passed type must exactly match the type of- * the registered handler. This abstraction is a useful replacement for {@code instanceof} checks in- * an {@code if-else-if} series.- *- * @param <T> the root type for all handlers and passed objects- * @param <A> the type of custom additional argument- * @param <R> the type of result returned by the handler- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- * Anymore, the use case this supported can be accomplished with Java's new switch- * statements on types.- */-@Deprecated(forRemoval = true, since = "11.2")-public class HandlerMap<T, A, R> {- private LinkedHashMap<Class<? extends T>, BiFunction<?, ? super A, ? extends R>> map =- new LinkedHashMap<>();-- /**- * Add a handler to the map- *- * @param cls the type assigned to this handler- * @param handler the handler- * @return the previous handler, if any, otherwise {@code null}- */- @SuppressWarnings("unchecked")- public <U extends T> BiFunction<? super U, ? super A, ? extends R> put(Class<U> cls,- BiFunction<? super U, ? super A, ? extends R> handler) {- return (BiFunction<? super U, ? super A, ? extends R>) map.put(cls, handler);- }-- /**- * Add a void handler to the map- *- * Note that this wraps the {@link BiConsumer} in a {@link BiFunction}. If the handler is- * replaced, the {@link BiFunction} is returned instead of the {@link BiConsumer}.- *- * @param cls the type assigned to this handler- * @param handler the handler- * @return the previous handler, if any, otherwise {@code null}- */- public <U extends T> BiFunction<? super U, ? super A, ? extends R> putVoid(Class<U> cls,- BiConsumer<? super U, ? super A> handler) {- return put(cls, (u, a) -> {- handler.accept(u, a);- return null;- });- }-- /**- * Invoke the a handler for the given object- *- * The given object's type is reflected to determine the appropriate handler to call. The- * object's type must exactly match one of the handlers' assigned types. Being a subclass of an- * assigned type does not constitute a match. The type and the custom argument are then passed- * to the handler. If there is no match, an {@link IllegalArgumentException} is thrown.- *- * @param t the object to handle- * @param a the custom additional argument, often {@code null}- * @return a future- * @throws IllegalArgumentException if no handler is assigned to the given object's type- */- public R handle(T t, A a) {- @SuppressWarnings("unchecked")- BiFunction<T, A, ? extends R> function =- (BiFunction<T, A, ? extends R>) map.get(t.getClass());- if (function != null) {- //Msg.debug(this, "Handling: " + t);- return function.apply(t, a);- }- throw new IllegalArgumentException("No handler for " + t);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathPredicates.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathPredicates.javadeleted file mode 100644index 7d8ece9f19..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathPredicates.java+++ /dev/null@@ -1,487 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.stream.Collectors;-import java.util.stream.IntStream;--import ghidra.async.AsyncFence;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.PathUtils.PathComparator;-import ghidra.util.ReversedListIterator;--/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.- */-@Deprecated(since = "11.2")-public interface PathPredicates {- PathPredicates EMPTY = new PathPredicates() {- @Override- public PathPredicates or(PathPredicates that) {- return that;- }-- @Override- public boolean matches(List<String> path) {- return false;- }-- @Override- public boolean successorCouldMatch(List<String> path, boolean strict) {- return false;- }-- @Override- public boolean ancestorMatches(List<String> path, boolean strict) {- return false;- }-- @Override- public boolean ancestorCouldMatchRight(List<String> path, boolean strict) {- return false;- }-- @Override- public Set<String> getNextKeys(List<String> path) {- return Set.of();- }-- @Override- public Set<String> getNextNames(List<String> path) {- return Set.of();- }-- @Override- public Set<String> getNextIndices(List<String> path) {- return Set.of();- }-- @Override- public Set<String> getPrevKeys(List<String> path) {- return Set.of();- }-- @Override- public List<String> getSingletonPath() {- return null;- }-- @Override- public PathPattern getSingletonPattern() {- return null;- }-- @Override- public Collection<PathPattern> getPatterns() {- return List.of();- }-- @Override- public PathPredicates removeRight(int count) {- return this;- }-- @Override- public PathPredicates applyKeys(Align align, List<String> keys) {- return this;- }-- @Override- public boolean isEmpty() {- return true;- }- };-- enum Align {- LEFT {- @Override- <T> ListIterator<T> iterator(List<T> list) {- return list.listIterator();- }- },- RIGHT {- @Override- <T> ListIterator<T> iterator(List<T> list) {- return new ReversedListIterator<>(list.listIterator(list.size()));- }- };-- abstract <T> ListIterator<T> iterator(List<T> list);- }-- static boolean keyMatches(String pat, String key) {- if (key.equals(pat)) {- return true;- }- if ("[]".equals(pat)) {- return PathUtils.isIndex(key);- }- if ("".equals(pat)) {- return PathUtils.isName(key);- }- return false;- }-- static boolean anyMatches(Set<String> pats, String key) {- return pats.stream().anyMatch(p -> keyMatches(p, key));- }-- static PathPredicates pattern(String... keyPatterns) {- return new PathPattern(List.of(keyPatterns));- }-- static PathPredicates pattern(List<String> keyPatterns) {- return new PathPattern(keyPatterns);- }-- static PathPredicates parse(String pattern) {- return new PathPattern(PathUtils.parse(pattern));- }-- PathPredicates or(PathPredicates that);-- /**- * Check if the entire path passes- *- * @param path the path to check- * @return true if it matches, false otherwise- */- boolean matches(List<String> path);-- /**- * Check if the given path <em>could</em> have a matching successor- *- * <p>- * This essentially checks if the given path is a viable prefix to the matcher.- *- * @implNote this method could become impractical for culling queries if we allow too- * sophisticated of patterns. Notably, to allow an "any number of keys" pattern, e.g.,- * akin to {@code /src/**{@literal /}*.c} in file system path matchers. Anything- * starting with "src" could have a successor that matches.- *- *- * @param path the path (prefix) to check- * @param strict true to exclude the case where {@link #matches(List)} would return true- * @return true if a successor could match, false otherwise- */- boolean successorCouldMatch(List<String> path, boolean strict);-- /**- * Check if the given path has an ancestor that matches- *- * @param path the path to check- * @param strict true to exclude the case where {@link #matches(List)} would return true- * @return true if an ancestor matches, false otherwise- */- boolean ancestorMatches(List<String> path, boolean strict);-- /**- * Check if the given path <em>could</em> have a matching ancestor, right to left- *- * <p>- * This essentially checks if the given path is a viable postfix to the matcher.- *- * @param path the path (postfix) to check- * @param strict true to exclude the case where {@link #matches(List)} would return true- * @return true if an ancestor could match, false otherwise- */- boolean ancestorCouldMatchRight(List<String> path, boolean strict);-- /**- * Get the patterns for the next possible key- *- * <p>- * If a successor of the given path cannot match this pattern, the empty set is returned.- *- * @param path the ancestor path- * @return a set of patterns where indices are enclosed in brackets ({@code [])- */- Set<String> getNextKeys(List<String> path);-- /**- * Get the patterns for the next possible name- *- * <p>- * If a successor of the given path cannot match this pattern, the empty set is returned. If the- * pattern could accept a name next, get all patterns describing those names- *- * @param path the ancestor path- * @return a set of patterns- */- Set<String> getNextNames(List<String> path);-- /**- * Assuming a successor of path could match, get the patterns for the next possible index- *- * <p>- * If a successor of the given path cannot match this pattern, the empty set is returned. If the- * pattern could accept an index next, get all patterns describing those indices- *- * @param path the ancestor path- * @return a set of patterns, without brackets ({@code [])- */- Set<String> getNextIndices(List<String> path);-- /**- * Get the patterns for the previous possible key (right-to-left matching)- *- * <p>- * If an ancestor of the given path cannot match this pattern, the empty set is returned.- *- * @param path the successor path- * @return a set of patterns where indices are enclosed in brackets ({@code [])- */- Set<String> getPrevKeys(List<String> path);-- /**- * If this predicate is known to match only one path, i.e., no wildcards, get that path- *- * @return the singleton path, or {@code null}- */- List<String> getSingletonPath();-- /**- * If this predicate consists of a single pattern, get that pattern- *- * @return the singleton pattern, or {@code null}- */- PathPattern getSingletonPattern();-- /**- * Get the patterns of this predicate- *- * @return the patterns- */- Collection<PathPattern> getPatterns();-- /**- * Remove count elements from the right- *- * @param count the number of elements to remove- * @return the resulting predicates- */- PathPredicates removeRight(int count);-- default NavigableMap<List<String>, ?> getCachedValues(TargetObject seed) {- return getCachedValues(List.of(), seed);- }-- default NavigableMap<List<String>, ?> getCachedValues(List<String> path, Object val) {- NavigableMap<List<String>, Object> result = new TreeMap<>(PathComparator.KEYED);- getCachedValues(result, path, val);- return result;- }-- default void getCachedValues(Map<List<String>, Object> result, List<String> path, Object val) {- if (matches(path)) {- result.put(path, val);- }- if (val instanceof TargetObject && successorCouldMatch(path, true)) {- TargetObject cur = (TargetObject) val;- Set<String> nextNames = getNextNames(path);- if (!nextNames.isEmpty()) {- for (Map.Entry<String, ?> ent : cur.getCachedAttributes().entrySet()) {- Object value = ent.getValue();- String name = ent.getKey();- if (!anyMatches(nextNames, name)) {- continue;- }- getCachedValues(result, PathUtils.extend(path, name), value);- }- }- Set<String> nextIndices = getNextIndices(path);- if (!nextIndices.isEmpty()) {- for (Map.Entry<String, ?> ent : cur.getCachedElements().entrySet()) {- Object obj = ent.getValue();- String index = ent.getKey();- if (!anyMatches(nextIndices, index)) {- continue;- }- getCachedValues(result, PathUtils.index(path, index), obj);- }- }- }- }-- default NavigableMap<List<String>, TargetObject> getCachedSuccessors(TargetObject seed) {- NavigableMap<List<String>, TargetObject> result = new TreeMap<>(PathComparator.KEYED);- getCachedSuccessors(result, List.of(), seed);- return result;- }-- default void getCachedSuccessors(Map<List<String>, TargetObject> result,- List<String> path, TargetObject cur) {- if (matches(path)) {- result.put(path, cur);- }- if (successorCouldMatch(path, true)) {- Set<String> nextNames = getNextNames(path);- if (nextNames.equals(PathMatcher.WILD_SINGLETON)) {- for (Map.Entry<String, ?> ent : cur.getCachedAttributes().entrySet()) {- if (!(ent.getValue() instanceof TargetObject obj)) {- continue;- }- String name = ent.getKey();- getCachedSuccessors(result, PathUtils.extend(path, name), obj);- }- }- else {- for (String name : nextNames) {- if (!(cur.getCachedAttribute(name) instanceof TargetObject obj)) {- continue;- }- getCachedSuccessors(result, PathUtils.extend(path, name), obj);- }- }-- Set<String> nextIndices = getNextIndices(path);- if (nextIndices.equals(PathMatcher.WILD_SINGLETON)) {- for (Map.Entry<String, ? extends TargetObject> ent : cur.getCachedElements()- .entrySet()) {- TargetObject obj = ent.getValue();- if (obj == null) {- return;- }- String index = ent.getKey();- getCachedSuccessors(result, PathUtils.index(path, index), obj);- }- }- else {- Map<String, ? extends TargetObject> elements = cur.getCachedElements();- for (String index : nextIndices) {- TargetObject obj = elements.get(index);- if (obj == null) {- return;- }- getCachedSuccessors(result, PathUtils.index(path, index), obj);- }- }- }- }-- default CompletableFuture<NavigableMap<List<String>, TargetObject>> fetchSuccessors(- TargetObject seed) {- NavigableMap<List<String>, TargetObject> result = new TreeMap<>(PathComparator.KEYED);- return fetchSuccessors(result, List.of(), seed).thenApply(__ -> result);- }-- default CompletableFuture<Void> fetchSuccessors(Map<List<String>, TargetObject> result,- List<String> path, TargetObject cur) {- AsyncFence fence = new AsyncFence();- if (matches(path)) {- synchronized (result) {- result.put(path, cur);- }- }- if (successorCouldMatch(path, true)) {- Set<String> nextNames = getNextNames(path);- if (!nextNames.isEmpty()) {- fence.include(cur.fetchAttributes().thenCompose(attrs -> {- AsyncFence aFence = new AsyncFence();- for (Map.Entry<String, ?> ent : attrs.entrySet()) {- Object value = ent.getValue();- if (!(value instanceof TargetObject)) {- continue;- }- String name = ent.getKey();- if (!anyMatches(nextNames, name)) {- continue;- }- TargetObject obj = (TargetObject) value;- aFence.include(- fetchSuccessors(result, PathUtils.extend(path, name), obj));- }- return aFence.ready();- }));- }- Set<String> nextIndices = getNextIndices(path);- if (!nextIndices.isEmpty()) {- fence.include(cur.fetchElements().thenCompose(elems -> {- AsyncFence eFence = new AsyncFence();- for (Map.Entry<String, ? extends TargetObject> ent : elems.entrySet()) {- TargetObject obj = ent.getValue();- String index = ent.getKey();- if (!anyMatches(nextIndices, index)) {- continue;- }- eFence.include(- fetchSuccessors(result, PathUtils.index(path, index), obj));- }- return eFence.ready();- }));- }- }- return fence.ready();- }-- /**- * Substitute wildcards from left to right for the given list of keys- *- * <p>- * Takes each pattern and substitutes its wildcards for the given indices, according to the- * given alignment. This object is unmodified, and the result is returned.- *- * <p>- * If there are fewer wildcards in a pattern than given, only the first keys are taken. If there- * are fewer keys than wildcards in a pattern, then the remaining wildcards are left in the- * resulting pattern. In this manner, the left-most wildcards are substituted for the left-most- * indices, or the right-most wildcards are substituted for the right-most indices, depending on- * the alignment.- *- * @param align the end to align- * @param keys the keys to substitute- * @return the pattern or matcher with the applied substitutions- */- PathPredicates applyKeys(Align align, List<String> keys);-- default PathPredicates applyKeys(Align align, String... keys) {- return applyKeys(align, List.of(keys));- }-- default PathPredicates applyKeys(String... keys) {- return applyKeys(Align.LEFT, keys);- }-- default PathPredicates applyIntKeys(int radix, Align align, List<Integer> keys) {- return applyKeys(align,- keys.stream().map(k -> Integer.toString(k, radix)).collect(Collectors.toList()));- }-- default PathPredicates applyIntKeys(int radix, Align align, int... keys) {- return applyKeys(align,- IntStream.of(keys)- .mapToObj(k -> Integer.toString(k, radix))- .collect(Collectors.toList()));- }-- default PathPredicates applyIntKeys(int... keys) {- return applyIntKeys(10, Align.LEFT, keys);- }-- /**- * Test if any patterns are contained here- *- * <p>- * Note that the presence of a pattern does not guarantee the presence of a matching object.- * However, the absence of any pattern does guarantee no object can match.- *- * @return- */- boolean isEmpty();-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathUtils.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathUtils.javadeleted file mode 100644index 5b522f7329..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathUtils.java+++ /dev/null@@ -1,601 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.nio.CharBuffer;-import java.util.*;-import java.util.regex.Matcher;-import java.util.regex.Pattern;--import ghidra.dbg.target.TargetObject;--/**- * A collection of utilities for examining and manipulating debug object paths- *- * <p>- * Paths are merely lists of strings where each part indicates an attribute name or element index.- * Element indices are enclosed in brackets {@code []}, may be multidimensional, and may be any type- * encoded as a string. Method invocations contain {@code (...)}. The root object has the empty- * path.- *- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.- */-@Deprecated(since = "11.2")-public enum PathUtils {- ;-- /**- * Comparators for keys, i.e., strings in a path- */- public enum TargetObjectKeyComparator implements Comparator<String> {- /**- * Sort keys by attribute name, lexicographically.- */- ATTRIBUTE {- @Override- public int compare(String o1, String o2) {- return o1.compareTo(o2);- }- },- /**- * Sort keys by element index.- *- * <p>- * Element indices may be multidimensional, in which case the dimensions are separated by- * commas, and sorting prioritizes the left-most dimensions. Where indices (or dimensions- * thereof) appear to be numeric, they are sorted as such. Otherwise, they are sorted- * lexicographically. Numeric types can be encoded in hexadecimal. While decimal is typical- * you may run into difficulties if those numbers are too large, as the implementation must- * assume numeric types are hexadecimal.- *- * @implNote The only way I can think to resolve the numeric encoding issue is to examine- * all keys before even selecting a comparator. As is, a comparator can only see- * two keys at a time, and has no context to what it's actually sorting.- */- ELEMENT {- @Override- public int compare(String o1, String o2) {- String[] p1 = o1.split(",");- String[] p2 = o2.split(",");- int min = Math.min(p1.length, p2.length);- for (int i = 0; i < min; i++) {- int c = ELEMENT_DIM.compare(p1[i], p2[i]);- if (c != 0) {- return c;- }- }- return Integer.compare(p1.length, p2.length);- }- },- /**- * Sort keys by element index, allowing only one dimension.- *- * <p>- * Please use {@link #ELEMENT}, unless you really know you need this instead.- */- ELEMENT_DIM {- @Override- public int compare(String o1, String o2) {- Long l1 = null;- Long l2 = null;- try {- l1 = Long.parseLong(o1, 16);- }- catch (NumberFormatException e) {- }- try {- l2 = Long.parseLong(o2, 16);- }- catch (NumberFormatException e) {- }- if (l1 != null && l2 != null) {- return l1.compareTo(l2);- }- if (l1 != null) { // Want numbers first, so l1 < l2- return -1;- }- if (l2 != null) {- return 1;- }- return o1.compareTo(o2);- }- },- /**- * Sort keys by element or index as appropriate, placing elements first.- */- CHILD {- @Override- public int compare(String o1, String o2) {- boolean ii1 = o1.startsWith("[") && o1.endsWith("]");- boolean ii2 = o2.startsWith("[") && o2.endsWith("]");- if (ii1 && ii2) {- return ELEMENT.compare(o1.substring(1, o1.length() - 1),- o2.substring(1, o2.length() - 1));- }- if (ii1) {- return -1;- }- if (ii2) {- return 1;- }- return ATTRIBUTE.compare(o1, o2);- }- }- }-- /**- * Comparators for paths- */- public enum PathComparator implements Comparator<List<String>> {- /**- * Sort paths by key, prioritizing the left-most, i.e., top-most, keys.- *- * <p>- * If one path is a prefix to the other, the prefix is "less than" the other.- */- KEYED {- @Override- public int compare(List<String> o1, List<String> o2) {- int min = Math.min(o1.size(), o2.size());- for (int i = 0; i < min; i++) {- String e1 = o1.get(i);- String e2 = o2.get(i);- int c = e1.compareTo(e2);- if (c != 0) {- return c;- }- }- return Integer.compare(o1.size(), o2.size());- }- },- /**- * Sort paths by length, longest first, then as in {@link #KEYED}.- */- LONGEST_FIRST {- @Override- public int compare(List<String> o1, List<String> o2) {- int c;- c = Integer.compare(o2.size(), o1.size());- if (c != 0) {- return c;- }- return KEYED.compare(o1, o2);- }- }- }-- protected static class PathParser {- protected final static Pattern LBRACKET = Pattern.compile("\\[");- protected final static Pattern RBRACKET = Pattern.compile("\\]");- protected final static Pattern BRACKETED = Pattern.compile("\\[.*?\\]");- protected final static Pattern LPAREN = Pattern.compile("\\(");- protected final static Pattern RPAREN = Pattern.compile("\\)");-- protected final CharBuffer buf;- protected final Pattern sep;-- protected final List<String> result = new ArrayList<>();-- protected PathParser(CharSequence path, String sepRE) {- buf = CharBuffer.wrap(path);- sep = Pattern.compile(sepRE);- }-- protected String match(Pattern pat) {- Matcher mat = pat.matcher(buf);- if (!mat.lookingAt()) {- throw new IllegalArgumentException("Expecting " + pat + ", but had " + buf);- }- String tok = mat.group();- int length = mat.end() - mat.start();- buf.position(buf.position() + length);- return tok;- }-- protected void advanceParenthesized() {- while (buf.hasRemaining()) {- if (RPAREN.matcher(buf).lookingAt()) {- buf.get();- break;- }- else if (LPAREN.matcher(buf).lookingAt()) {- buf.get();- advanceParenthesized();- }- else {- buf.get();- }- }- }-- protected String parseName() {- int p = buf.position();- while (buf.hasRemaining()) {- if (sep.matcher(buf).lookingAt()) {- break;- }- else if (LBRACKET.matcher(buf).lookingAt()) {- break;- }- else if (LPAREN.matcher(buf).lookingAt()) {- buf.get();- advanceParenthesized();- }- else {- buf.get();- }- }- int e = buf.position();- buf.position(p);- String tok = buf.subSequence(0, e - p).toString();- buf.position(e);- return tok;- }-- protected String parseNext() {- if (sep.matcher(buf).lookingAt()) {- match(sep);- return parseName();- }- if (LBRACKET.matcher(buf).lookingAt()) {- return match(BRACKETED);- }- throw new IllegalArgumentException(- "Expected " + sep + " or " + LBRACKET + ", but had " + buf);- }-- protected List<String> parse() {- String first = parseName();- if (first.length() != 0) {- result.add(first);- }- while (buf.hasRemaining()) {- result.add(parseNext());- }- return result;- }- }-- public static List<String> parse(String path, String sepRE) {- return new PathParser(path, sepRE).parse();- }-- public static List<String> parse(String path) {- return parse(path, "\\.");- }-- public static String toString(List<String> path, String sep) {- StringBuilder sb = new StringBuilder();- boolean first = true;- for (String e : path) {- if (!isIndex(e) && !first) {- sb.append(sep);- }- first = false;- sb.append(e);- }- return sb.toString();- }-- public static String toString(List<String> path) {- return toString(path, ".");- }-- /**- * Extend a path with a given key, usually attribute name- *- * @param path the parent path- * @param key the key to append- * @return the resulting extended path- */- public static List<String> extend(List<String> path, String key) {- List<String> result = new ArrayList<>(path.size() + 1);- result.addAll(path);- result.add(key);- return List.copyOf(result);- }-- /**- * Extend a path with another sub-path- *- * @param path the parent path- * @param sub the sub-path to the successor- * @return the resulting extended path- */- public static List<String> extend(List<String> path, List<String> sub) {- List<String> result = new ArrayList<>(path.size() + sub.size());- result.addAll(path);- result.addAll(sub);- return List.copyOf(result);- }-- /**- * Encode the given index in decimal, without brackets- *- * @param i the numeric index- * @return the encoded index- */- public static String makeIndex(long i) {- return Long.toString(i);- }-- /**- * Encode the given index in decimal, without brackets- *- * @param i the numeric index- * @return the encoded index- */- public static String makeIndex(int i) {- return Integer.toString(i);- }-- /**- * Encode the given index as a key- *- * <p>- * When indexing elements, no brackets are needed. The brackets become necessary when used as a- * key, e.g., when specifying an index within a path, or as keys in a map of all children.- *- * @param index the index- * @return the key, specifying an element.- */- public static String makeKey(String index) {- return "[" + index + "]";- }-- /**- * Extend a path with a given index- *- * <p>- * This is equivalent to calling {@code extend(path, makeKey(index))}.- *- * @param path the parent path- * @param index the index to append- * @return the resulting extended path- */- public static List<String> index(List<String> path, String index) {- return extend(path, makeKey(index));- }-- /**- * Obtain the parent path of this path- *- * <p>- * This merely removes the last element of the path. If the given path refers to the root,- * {@code null} is returned.- *- * @param path the child path- * @return the parent path or {@code null}- */- public static List<String> parent(List<String> path) {- if (path.isEmpty()) {- return null;- }- return path.subList(0, path.size() - 1);- }-- /**- * Obtain the key of the object to which the given path refers- *- * <p>- * This is merely the final right-most key in the path. If the given path refers to the root,- * {@code null} is returned.- *- * @param path the object's path- * @return the key of the object- */- public static String getKey(List<String> path) {- if (path.isEmpty()) {- return null;- }- return path.get(path.size() - 1);- }-- /**- * Parse an index value from a key- *- * <p>- * Where key is the form {@code [index]}, this merely returns {@code index}.- *- * @param key the key- * @return the index- * @throws IllegalArgumentException if key is not of the required form- */- public static String parseIndex(String key) {- if (isIndex(key)) {- return key.substring(1, key.length() - 1);- }- throw new IllegalArgumentException("Index keys must be of the form '[index]'. Got " + key);- }-- /**- * Obtain the index of the object to which the given path refers- *- * <p>- * This merely parses the index from the final right-most key in the path. It is roughly- * equivalent to calling {@code parseIndex(getKey(path))}.- *- * @see #getKey(List)- * @see #parseIndex(String)- * @see #index(List, String)- * @param path the object's path- * @return the index of the object- * @throws IllegalArgumentException if key is not of the required form- */- public static String getIndex(List<String> path) {- String key = getKey(path);- return key == null ? null : parseIndex(key);- }-- /**- * Check if the given key is a bracketed index- *- * @param key the key to check- * @return true if it is an index- */- public static boolean isIndex(String key) {- return key == null ? false : key.startsWith("[") && key.endsWith("]");- }-- /**- * Check if the final right-most key of the given path is a bracketed index- *- * @param path the path to check- * @return true if the final key is an index- */- public static boolean isIndex(List<String> path) {- return isIndex(getKey(path));- }-- /**- * Check if the given key is an attribute name, i.e., not an index- *- * @param key the key to check- * @return true if it is an attribute name- */- public static boolean isName(String key) {- return key == null ? false : !isIndex(key);- }-- /**- * Check if the final right-most key of the given path is an attribute name- *- * @param path the path to check- * @return true if the final key is an attribute name- */- public static boolean isName(List<String> path) {- return isName(getKey(path));- }-- /**- * Check if the first path refers to an ancestor of the second path- *- * <p>- * Equivalently, check if the second path refers to a successor of the second path- *- * <p>- * This effectively checks that ancestor is a prefix of successor. By this definition, every- * path is technically an ancestor and successor of itself. If you do not desire that behavior,- * check that the two paths are not equal first.- *- * @param ancestor the first path- * @param successor the second path- * @return true if ancestor is, in fact, an ancestor of successor- */- public static boolean isAncestor(List<String> ancestor, List<String> successor) {- if (ancestor.size() > successor.size()) {- return false;- }- return Objects.equals(ancestor, successor.subList(0, ancestor.size()));- }-- /**- * Assuming the first path is an ancestor of the second, compute the relative path from the- * first to the second.- *- * @param ancestor the ancestor (from)- * @param successor the successor (to)- * @return the relative path- */- public static List<String> relativize(List<String> ancestor, List<String> successor) {- if (!isAncestor(ancestor, successor)) {- throw new IllegalArgumentException("First must be an ancestor of the second");- }- return successor.subList(ancestor.size(), successor.size());- }-- /**- * Check whether a given object-valued attribute is a link.- *- * <p>- * Consider an object {@code O} with an object-valued attribute {@code a}. {@code a}'s value is- * a link, iff its path does <em>not</em> match that generated by extending {@code O}'s path- * with {@code a}'s name.- *- * @param parentPath the path of the parent object of the given attribute- * @param name the name of the given attribute- * @param attributePath the canonical path of the attribute's object value- * @return true if the value is a link (i.e., it's object has a different path)- */- public static boolean isLink(List<String> parentPath, String name, List<String> attributePath) {- return !Objects.equals(extend(parentPath, name), attributePath);- }-- /**- * Check whether a given element is a link.- *- * <p>- * Consider an object {@code O} with an element {@code [1]}. {@code [1]}'s value is a link, iff- * its path does <em>not</em> match that generated by extending {@code O}'s path with- * {@code [1]}'s key.- *- * @param parentPath the path of the parent object of the given element- * @param index the index of the given element- * @param elementPath the canonical path of the element- * @return true if the value is a link (i.e., it's object has a different path)- */- public static boolean isElementLink(List<String> parentPath, String index,- List<String> elementPath) {- return !Objects.equals(index(parentPath, index), elementPath);- }-- /**- * Check whether a given attribute should be displayed.- *- * @param key the key of the given attribute- * @return true if hidden- */- public static boolean isHidden(String key) {- return key.startsWith(TargetObject.PREFIX_INVISIBLE);- }-- /**- * Check whether a given path key represents a method invocation.- *- * <p>- * This really just checks if the key ends in {@code )}.- *- * @param key the key- * @return true if an invocation, false if not- */- public static boolean isInvocation(String key) {- return key.endsWith(")");- }-- /**- * Get the name and parameters expression of the method from an invocation.- *- * <p>- * TODO: We need a more formal model for method invocation in paths. Probably shouldn't return a- * map entry once we have that specified, either.- *- * @param name the name, which must be in the form {@code method(params)}- * @return the method name- */- public static Map.Entry<String, String> parseInvocation(String name) {- if (!isInvocation(name)) {- throw new IllegalArgumentException(- "Invocation keys must be of the form 'method(params)'. Got " + name);- }- int i = name.indexOf('(');- if (i == -1) {- throw new IllegalArgumentException(- "Invocation keys must be of the form 'method(params)'. Got " + name);- }- return Map.entry(name.substring(0, i), name.substring(i + 1, name.length() - 1));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PrefixMap.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PrefixMap.javadeleted file mode 100644index f4811bb095..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PrefixMap.java+++ /dev/null@@ -1,67 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.util.LinkedHashMap;-import java.util.Map;--import utility.function.ExceptionalFunction;--/**- * A utility for parsing strings into objects- *- * This utility is suited to controlling a command-line application via its input and output- * streams. The application is expected to display command results, statuses, events, etc., by- * printing one line per item. This utility provides a straightforward mechanism for selecting a- * line parser by examining the first characters.- *- * The prefix-to-constructor map is populated by calling {@link #put(Object, ExceptionalFunction)}- * and other methods inherited from {@link Map}. The function is typically a constructor reference.- * When parsing a line, the prefixes are examined in the order added. If a matching prefix is found,- * it is removed from the line and the tail is passed to the corresponding constructor. If the tail- * starts with a comma, it is also removed. The constructed instance is then returned to the caller.- *- * @param <T> the base class for the parser types- * @param <E> the base class for checked exceptions that must be handled by callers- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class PrefixMap<T, E extends Exception>- extends LinkedHashMap<String, ExceptionalFunction<? super String, ? extends T, E>> {-- /**- * Construct a representation of the given line by selecting and invoking a constructor- *- * @param line the line to parse- * @return the object of the mapped type as parsed by its constructor or {@code null} if the- * line does not match a prefix- * @throws E if the constructor throws an exception- */- public T construct(String line) throws E {- for (java.util.Map.Entry<String, ExceptionalFunction<? super String, ? extends T, E>> ent : entrySet()) {- String prefix = ent.getKey();- if (line.startsWith(prefix)) {- String tail = line.substring(prefix.length());- if (tail.startsWith(",")) {- tail = tail.substring(1);- }- ExceptionalFunction<? super String, ? extends T, E> cons = ent.getValue();- return cons.apply(tail);- }- }- return null;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/TargetDataTypeConverter.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/TargetDataTypeConverter.javadeleted file mode 100644index 2d52267c5b..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/TargetDataTypeConverter.java+++ /dev/null@@ -1,496 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.concurrent.ExecutionException;-import java.util.function.Function;-import java.util.stream.Collectors;--import ghidra.async.AsyncFence;-import ghidra.dbg.attributes.*;-import ghidra.dbg.target.TargetDataTypeMember;-import ghidra.dbg.target.TargetNamedDataType;-import ghidra.dbg.util.PathUtils.TargetObjectKeyComparator;-import ghidra.program.model.data.*;-import ghidra.util.Msg;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public class TargetDataTypeConverter {- protected static class ConvertedMember {- protected final TargetDataTypeMember member;- protected final DataType type;-- public ConvertedMember(TargetDataTypeMember member, DataType type) {- this.member = member;- this.type = type;- }- }-- protected abstract static class TwoPhased<T> {- public static <T> TwoPhased<T> completedTwo(T val) {- TwoPhased<T> result = new TwoPhased<>() {- @Override- protected void doStart() {- completeOne(val);- completeTwo();- }- };- result.start();- return result;- }-- protected final CompletableFuture<T> one = new CompletableFuture<>();- protected final CompletableFuture<T> two = new CompletableFuture<>();-- protected final Set<TwoPhased<?>> deps = new HashSet<>();-- protected boolean started = false;-- public void start() {- synchronized (this) {- if (started) {- return;- }- started = true;- }- doStart();- }-- protected abstract void doStart();-- protected void chainExc(CompletableFuture<?> chain) {- chain.exceptionally(ex -> {- completeExceptionally(ex);- return null;- });- }-- protected void chainExc(TwoPhased<?> chain) {- chainExc(chain.one);- chainExc(chain.two);- }-- public void completeOne(T val) {- one.complete(val);- }-- public void completeTwo() {- if (!one.isDone()) {- throw new IllegalStateException("Phase one hasn't completed");- }- try {- two.complete(one.get());- }- catch (InterruptedException e) {- throw new AssertionError(e);- }- catch (ExecutionException e) {- two.completeExceptionally(e.getCause());- }- }-- public void completeExceptionally(Throwable ex) {- one.completeExceptionally(ex);- two.completeExceptionally(ex);- }-- public <U> TwoPhased<U> thenApply(Function<? super T, ? extends U> func) {- TwoPhased<T> tp = this;- return new TwoPhased<>() {- @Override- protected void doStart() {- deps.add(tp);- chainExc(tp.one.thenAccept(t -> completeOne(func.apply(t))));- chainExc(tp.two.thenAccept(__ -> completeTwo()));- }- };- }-- private void collectDeps(Set<TwoPhased<?>> allDeps) {- for (TwoPhased<?> d : deps) {- if (allDeps.add(d)) {- d.collectDeps(allDeps);- }- }- }-- protected CompletableFuture<T> depTwos() {- Set<TwoPhased<?>> allDeps = new HashSet<>();- collectDeps(allDeps);- return CompletableFuture- .allOf(allDeps.stream().map(tp -> tp.two).toArray(CompletableFuture[]::new))- .thenCompose(__ -> two);- }- }-- protected final DataTypeManager dtm;- protected final Map<TargetDataType, TwoPhased<? extends DataType>> types = new HashMap<>();-- protected boolean explainedOffsetDisagreement = false;-- protected class TwoPhasedComposite<T extends CompositeDataTypeImpl>- extends TwoPhased<T> {-- protected final T type;- protected final TargetNamedDataType tNamed;-- protected final Map<String, ConvertedMember> subs =- new TreeMap<>(TargetObjectKeyComparator.ELEMENT);-- public TwoPhasedComposite(T type, TargetNamedDataType tNamed) {- this.type = type;- this.tNamed = tNamed;- }-- @Override- protected synchronized void doStart() {- one.complete(type);- try {- chainExc(tNamed.getMembers().thenAccept(this::procMembers));- }- catch (Throwable e) {- completeExceptionally(e);- }- }-- private void procMembers(Collection<? extends TargetDataTypeMember> members) {- // TODO: Figure out attributes- AsyncFence fence = new AsyncFence();- for (TargetDataTypeMember f : members) {- TwoPhased<? extends DataType> dep = convertTwoPhased(f.getDataType());- deps.add(dep);- fence.include(dep.two.thenAccept(tField -> {- subs.put(f.getIndex(), new ConvertedMember(f, tField));- }));- }- chainExc(fence.ready().thenAccept(this::procSubs));- }-- protected void procSubs(Void __) {- for (Map.Entry<String, ConvertedMember> s : subs.entrySet()) {- ConvertedMember conv = s.getValue();- DataTypeComponent component =- type.add(conv.type, -1, conv.member.getMemberName(), null);- long fOff = conv.member.getOffset();- int cOff = component.getOffset();- if (fOff != -1 && fOff != cOff) {- Msg.warn(this, "Offset disagreement during conversion of " +- conv.member + ". " + fOff + " != " + cOff);- explainOffsetDisagreement();- }- }- completeTwo();- }- }-- public TargetDataTypeConverter() {- this(null);- }-- public TargetDataTypeConverter(DataTypeManager dtm) {- this.dtm = dtm;- }-- protected synchronized void explainOffsetDisagreement() {- if (!explainedOffsetDisagreement) {- explainedOffsetDisagreement = true;- Msg.warn(this, "Offset disagreement happens likely because the destination " +- "data type manager has a pointer size different than the source target.");- }- }-- public CompletableFuture<? extends DataType> convertTargetDataType(TargetDataType type) {- return convertTwoPhased(type).depTwos();- }-- protected TwoPhased<? extends DataType> convertTwoPhased(TargetDataType type) {- TwoPhased<? extends DataType> conv;- synchronized (types) {- conv = types.get(type);- if (conv != null) {- return conv;- }- conv = doConvertTargetDataType(type);- types.put(type, conv);- }- conv.start();- return conv;- }-- /**- * TODO- *- * Diagnostic only, please.- *- * @return- */- public Set<TargetDataType> getPendingOne() {- synchronized (types) {- return types.entrySet()- .stream()- .filter(e -> !e.getValue().one.isDone())- .map(e -> e.getKey())- .collect(Collectors.toSet());- }- }-- /**- * TODO- *- * Diagnostic only, please.- *- * @return- */- public Set<TargetDataType> getPendingTwo() {- synchronized (types) {- return types.entrySet()- .stream()- .filter(e -> !e.getValue().two.isDone())- .map(e -> e.getKey())- .collect(Collectors.toSet());- }- }-- protected TwoPhased<? extends DataType> doConvertTargetDataType(TargetDataType type) {- if (type instanceof TargetNamedDataType) {- TargetNamedDataType tNamed = (TargetNamedDataType) type;- return convertTargetNamedDataType(tNamed);- }- if (type instanceof TargetArrayDataType) {- TargetArrayDataType tArray = (TargetArrayDataType) type;- return convertTargetArrayDataType(tArray);- }- if (type instanceof TargetBitfieldDataType) {- TargetBitfieldDataType tBitfield = (TargetBitfieldDataType) type;- return convertTargetBitfieldDataType(tBitfield);- }- if (type instanceof TargetPointerDataType) {- TargetPointerDataType tPointer = (TargetPointerDataType) type;- return convertTargetPointerDataType(tPointer);- }- if (type instanceof TargetPrimitiveDataType) {- TargetPrimitiveDataType tPrimitive = (TargetPrimitiveDataType) type;- return convertTargetPrimitiveDataType(tPrimitive);- }- throw new AssertionError("Do not know how to convert " + type);- }-- protected TwoPhased<? extends DataType> convertTargetNamedDataType(- TargetNamedDataType type) {- /**- * NOTE: Convention is named data types are each indexed (in the parent namespace) with its- * defining keyword (or something close), e.g., "struct myStruct", not just "myStruct".- * Whatever the case, the actual type name cannot contain spaces and should be the final- * space-separated token in its index. It can be the sole token, but the index must be- * unique within the namespace.- */- String parts[] = type.getIndex().split("\\s+");- String name = parts[parts.length - 1];- switch (type.getTypeKind()) {- case ENUM:- return convertTargetEnumDataType(name, type);- case FUNCTION:- return convertTargetFunctionDataType(name, type);- case STRUCT:- return convertTargetStructDataType(name, type);- case TYPEDEF:- return convertTargetTypedefDataType(name, type);- case UNION:- return convertTargetUnionDataType(name, type);- default:- throw new AssertionError("Do not know how to convert " + type);- }- }-- protected TwoPhased<EnumDataType> convertTargetEnumDataType(String name,- TargetNamedDataType tEnum) {- return new TwoPhased<>() {- final EnumDataType type =- new EnumDataType(CategoryPath.ROOT, name, tEnum.getTypedAttributeNowByName(- TargetNamedDataType.ENUM_BYTE_LENGTH_ATTRIBUTE_NAME, Integer.class, 4), dtm);-- @Override- protected void doStart() {- completeOne(type);- chainExc(tEnum.getMembers().thenAccept(this::procMembers));- }-- private void procMembers(Collection<? extends TargetDataTypeMember> members) {- for (TargetDataTypeMember c : members) {- type.add(c.getMemberName(), c.getPosition());- }- completeTwo();- }- };- }-- protected TwoPhased<FunctionDefinitionDataType> convertTargetFunctionDataType(String name,- TargetNamedDataType tFunction) {- return new TwoPhased<>() {- final Map<String, ParameterDefinitionImpl> args =- new TreeMap<>(TargetObjectKeyComparator.ELEMENT);- final FunctionDefinitionDataType type =- new FunctionDefinitionDataType(name, dtm);-- @Override- protected void doStart() {- completeOne(type);- chainExc(tFunction.getMembers().thenAccept(this::procMembers));- }-- private void procMembers(Collection<? extends TargetDataTypeMember> members) {- AsyncFence fence = new AsyncFence();- for (TargetDataTypeMember p : members) {- TwoPhased<? extends DataType> dep = convertTwoPhased(p.getDataType());- deps.add(dep);- fence.include(dep.two.thenAccept(t -> {- if (TargetNamedDataType.FUNCTION_RETURN_INDEX.equals(p.getIndex())) {- type.setReturnType(t);- }- else {- args.put(p.getIndex(),- new ParameterDefinitionImpl(p.getMemberName(), t, null));- }- }));- }- chainExc(fence.ready().thenAccept(this::procArgs));- }-- private void procArgs(Void __) {- type.setArguments(args.values().toArray(new ParameterDefinitionImpl[args.size()]));- completeTwo();- }- };- }-- protected TwoPhased<StructureDataType> convertTargetStructDataType(String name,- TargetNamedDataType tStruct) {- return new TwoPhasedComposite<>(new StructureDataType(name, 0, dtm), tStruct);- }-- protected TwoPhased<UnionDataType> convertTargetUnionDataType(String name,- TargetNamedDataType tUnion) {- return new TwoPhasedComposite<>(new UnionDataType(CategoryPath.ROOT, name, dtm), tUnion);- }-- protected TwoPhased<TypedefDataType> convertTargetTypedefDataType(String name,- TargetNamedDataType tTypedef) {- return new TwoPhased<>() {- @Override- protected void doStart() {- chainExc(tTypedef.getMembers().thenAccept(this::procMembers));- }-- private void procMembers(Collection<? extends TargetDataTypeMember> members) {- if (members.isEmpty()) {- Msg.warn(this, "Typedef did not provide definition. Defaulting.");- procDef(DataType.DEFAULT);- procTwo(null);- return;- }- if (members.size() != 1) {- Msg.warn(this, "Typedef provided multiple definitions. Taking first.");- }- TargetDataTypeMember d = members.iterator().next();- TwoPhased<? extends DataType> dep = convertTwoPhased(d.getDataType());- deps.add(dep);- chainExc(dep.one.thenAccept(this::procDef));- chainExc(dep.two.thenAccept(this::procTwo));- }-- private void procDef(DataType cDef) {- completeOne(new TypedefDataType(CategoryPath.ROOT, name, cDef, dtm));- }-- private void procTwo(DataType __) {- completeTwo();- }- };- }-- protected TwoPhased<ArrayDataType> convertTargetArrayDataType(- TargetArrayDataType tArray) {- return convertTwoPhased(tArray.getElementType()).thenApply(cElem -> {- return new ArrayDataType(cElem, tArray.getElementCount(), cElem.getLength(), dtm);- });- }-- protected static class ConvertedTargetBitfieldDataType extends BitFieldDataType {- protected ConvertedTargetBitfieldDataType(DataType baseDataType, int bitSize, int bitOffset)- throws InvalidDataTypeException {- super(baseDataType, bitSize, bitOffset);- }- }-- protected TwoPhased<ConvertedTargetBitfieldDataType> convertTargetBitfieldDataType(- TargetBitfieldDataType tBitfield) {- return convertTwoPhased(tBitfield.getFieldType()).thenApply(cField -> {- // TODO: Test these on the reference SCTL implementation.- // There's probably corrections on both sides of this interface- try {- return new ConvertedTargetBitfieldDataType(cField, tBitfield.getBitLength(),- tBitfield.getLeastBitPosition());- }- catch (InvalidDataTypeException e) {- throw new AssertionError(e);- }- });- }-- protected TwoPhased<PointerDataType> convertTargetPointerDataType(- TargetPointerDataType tPointer) {- TwoPhased<PointerDataType> cPointer =- convertTwoPhased(tPointer.getReferentType()).thenApply(cRef -> {- return new PointerDataType(cRef, dtm);- });- // The pointer can complete even though the referent is incomplete- cPointer.one.thenAccept(__ -> cPointer.completeTwo());- return cPointer;- }-- protected TwoPhased<DataType> convertTargetPrimitiveDataType(- TargetPrimitiveDataType tPrimitive) {- return TwoPhased.completedTwo(doConvertTargetPrimitiveDataType(tPrimitive));- }-- protected DataType doConvertTargetPrimitiveDataType(TargetPrimitiveDataType tPrimitive) {- switch (tPrimitive.getKind()) {- case UNDEFINED:- return Undefined.getUndefinedDataType(tPrimitive.getLength());- case VOID:- if (tPrimitive.getLength() != 0) {- Msg.warn(this, "Ignoring non-zero length for void data type");- }- return VoidDataType.dataType;- case UINT:- return AbstractIntegerDataType.getUnsignedDataType(tPrimitive.getLength(), dtm);- case SINT:- return AbstractIntegerDataType.getSignedDataType(tPrimitive.getLength(), dtm);- case FLOAT:- // TODO: lookup by length must use "raw" encoding size since "aligned" lengths- // may be duplicated across different float types.- return AbstractFloatDataType.getFloatDataType(tPrimitive.getLength(), dtm);- case COMPLEX:- return AbstractComplexDataType.getComplexDataType(tPrimitive.getLength(), dtm);- }- throw new IllegalArgumentException("Do not know how to convert " + tPrimitive);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ValueUtils.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ValueUtils.javadeleted file mode 100644index 5328727eed..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ValueUtils.java+++ /dev/null@@ -1,49 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import ghidra.util.Msg;--/**- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.- */-@Deprecated(forRemoval = true, since = "11.2")-public enum ValueUtils {- ;- public static final boolean INCLUDE_STACK = false;-- public static void reportErr(Object val, Class<?> cls, Object logObj, String attributeName) {- String message =- "expected " + cls.getSimpleName() + " for " + attributeName + ", but got " + val;- if (INCLUDE_STACK) {- Msg.error(logObj, message, new Throwable());- }- else {- Msg.error(logObj, message);- }- }-- public static <T> T expectType(Object val, Class<T> cls, Object logObj, String attributeName,- T fallback, boolean required) {- if (val == null || !cls.isAssignableFrom(val.getClass())) {- if (val != null || required) {- reportErr(val, cls, logObj, attributeName);- }- return fallback;- }- return cls.cast(val);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/resources/agent.log4j.xml b/Ghidra/Debug/Framework-Debugging/src/main/resources/agent.log4j.xmldeleted file mode 100644index 3f75fa4f4d..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/resources/agent.log4j.xml+++ /dev/null@@ -1,28 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>--<!--- Basic Log4j configuration.-- Note the 'packages' attribute; this is required if an appender needs to reference a class- in the codebase. For this configuration it's necessary for the 'logPanel' appender, which- references LogPanelAppender.java.--->-<Configuration monitorInterval="30" xmlns:xi="http://www.w3.org/2001/XInclude" packages="log">- <Appenders>- <xi:include href="log4j-appender-console.xml"/>- <xi:include href="log4j-appender-logpanel.xml"/>- </Appenders>-- <Loggers>- <Logger name="db" level="DEBUG"/>- <Logger name="docking" level="DEBUG"/>- <Logger name="ghidra" level="DEBUG"/>- <Logger name="reverse" level="DEBUG"/>- <Logger name="util" level="DEBUG"/>-- <Root level="ALL">- <AppenderRef ref="console" level="DEBUG"/>- <AppenderRef ref="logPanel" level="DEBUG"/>- </Root>- </Loggers>-</Configuration>diff --git a/Ghidra/Debug/Framework-Debugging/src/main/resources/log4j-appender-console.xml b/Ghidra/Debug/Framework-Debugging/src/main/resources/log4j-appender-console.xmldeleted file mode 100644index f1e2365c18..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/resources/log4j-appender-console.xml+++ /dev/null@@ -1,9 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>--<!-- Log4j appender that writes messages to the console. -->-<Console- name="console"- target="SYSTEM_OUT">- <PatternLayout pattern="%-5p %m (%c{1}) %ex %n"/>-</Console>-diff --git a/Ghidra/Debug/Framework-Debugging/src/main/resources/log4j-appender-logpanel.xml b/Ghidra/Debug/Framework-Debugging/src/main/resources/log4j-appender-logpanel.xmldeleted file mode 100644index ce2a41dcee..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/main/resources/log4j-appender-logpanel.xml+++ /dev/null@@ -1,7 +0,0 @@-<?xml version="1.0" encoding="UTF-8"?>--<!-- Log4j appender that writes messages to the {@link LogPanelAppender}. -->-<LogPanelAppender name="logPanel">- <PatternLayout pattern="%-5p %m %ex"/>-</LogPanelAppender>-diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/agent/DefaultDebuggerObjectModelTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/agent/DefaultDebuggerObjectModelTest.javadeleted file mode 100644index 78826c2619..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/agent/DefaultDebuggerObjectModelTest.java+++ /dev/null@@ -1,349 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.agent;--import static ghidra.lifecycle.Unfinished.TODO;-import static org.junit.Assert.*;--import java.util.*;-import java.util.concurrent.CompletableFuture;--import org.apache.commons.lang3.tuple.ImmutablePair;-import org.apache.commons.lang3.tuple.Pair;-import org.junit.Test;--import generic.Unique;-import ghidra.async.AsyncTestUtils;-import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetRegisterBank;-import ghidra.dbg.testutil.*;-import ghidra.dbg.testutil.AttributesChangedListener.AttributesChangedInvocation;-import ghidra.dbg.testutil.ElementsChangedListener.ElementsChangedInvocation;-import ghidra.dbg.testutil.InvalidatedListener.InvalidatedInvocation;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.AddressFactory;-import ghidra.program.model.address.AddressSpace;--public class DefaultDebuggerObjectModelTest implements AsyncTestUtils {-- public static class FakeTargetObject extends DefaultTargetObject<TargetObject, TargetObject> {- public FakeTargetObject(AbstractDebuggerObjectModel model, TargetObject parent,- String name) {- super(model, parent, name, "Fake");- }- }-- public static class FakeTargetRegisterBank extends FakeTargetObject- implements TargetRegisterBank {-- public FakeTargetRegisterBank(AbstractDebuggerObjectModel model, TargetObject parent,- String name) {- super(model, parent, name);- }-- @Override- public CompletableFuture<? extends Map<String, byte[]>> readRegistersNamed(- Collection<String> names) {- throw new UnsupportedOperationException();- }-- @Override- public CompletableFuture<Void> writeRegistersNamed(Map<String, byte[]> values) {- throw new UnsupportedOperationException();- }- }-- /**- * Functionally identical to a Fake, but intrinsically different- */- public static class PhonyTargetObject extends DefaultTargetObject<TargetObject, TargetObject> {- public PhonyTargetObject(AbstractDebuggerObjectModel model, TargetObject parent,- String name) {- super(model, parent, name, "Phony");- }- }-- public static class FakeDebuggerObjectModel extends AbstractDebuggerObjectModel {- DefaultTargetModelRoot root = new DefaultTargetModelRoot(this, "Root");-- public FakeDebuggerObjectModel() {- addModelRoot(root);- }-- @Override- public CompletableFuture<? extends TargetObject> fetchModelRoot() {- return CompletableFuture.completedFuture(root);- }-- @Override- public AddressFactory getAddressFactory() {- return TODO();- }-- @Override- public AddressSpace getAddressSpace(String name) {- return TODO();- }- }-- static class OffThreadTargetObject extends DefaultTargetObject<TargetObject, TargetObject> {- public OffThreadTargetObject(AbstractDebuggerObjectModel model, TargetObject parent,- String name, String typeHint) {- super(model, parent, name, typeHint);- }-- @Override- public CompletableFuture<TargetObject> fetchElement(String name) {- return CompletableFuture.supplyAsync(() -> null)- .thenCompose(v -> super.fetchElement(name));- }- }-- FakeDebuggerObjectModel model = new FakeDebuggerObjectModel();-- @Test- public void testGetModelObjectLen0() throws Throwable {- assertEquals(model.root, waitOn(model.fetchModelValue()));- }-- @Test- public void testGetModelObjectLen1() throws Throwable {- FakeTargetObject a = new FakeTargetObject(model, model.root, "A");- model.root.changeAttributes(List.of(), Map.of("A", a), "Test");-- assertEquals(a, waitOn(model.fetchModelValue("A")));- }-- @Test- public void testGetModelObjectLen1NoExist() throws Throwable {- FakeTargetObject a = new FakeTargetObject(model, model.root, "A");- model.root.changeAttributes(List.of(), Map.of("A", a), "Test");-- assertEquals(null, waitOn(model.fetchModelValue("NoA")));- }-- @Test- public void testGetModelObjectLen2() throws Throwable {- FakeTargetObject a = new FakeTargetObject(model, model.root, "A");- model.root.changeAttributes(List.of(), Map.of("A", a), "Test");-- FakeTargetObject b = new FakeTargetObject(model, a, "[B]");- a.changeElements(List.of(), List.of(b), "Test");-- assertEquals(b, waitOn(model.fetchModelValue("A", "[B]")));- }-- @Test- public void testGetModelObjectLen2NoExist() throws Throwable {- FakeTargetObject a = new FakeTargetObject(model, model.root, "A");- model.root.changeAttributes(List.of(), Map.of("A", a), "Test");-- FakeTargetObject b = new FakeTargetObject(model, a, "[B]");- a.changeElements(List.of(), List.of(b), "Test");-- assertEquals(null, waitOn(model.fetchModelValue("NoA", "[B]")));- assertEquals(null, waitOn(model.fetchModelValue("NoA", "[NoB]")));- assertEquals(null, waitOn(model.fetchModelValue("A", "[NoB]")));- }-- @Test- public void testElementReplacement() throws Throwable {- ElementsChangedListener elemL = new ElementsChangedListener();- InvalidatedListener invL = new InvalidatedListener();- model.addModelListener(elemL);- model.addModelListener(invL);- TargetObjectAddedWaiter waiter = new TargetObjectAddedWaiter(model);-- FakeTargetObject fakeA = new FakeTargetObject(model, model.root, "[A]");- model.root.setElements(List.of(fakeA), "Init");- assertEquals(fakeA, waitOn(waiter.wait(PathUtils.parse("[A]"))));- waitOn(model.flushEvents());- elemL.clear();- invL.clear();-- PhonyTargetObject phonyA = new PhonyTargetObject(model, model.root, "[A]");-- // mere creation causes removal of old- waitOn(elemL.count.waitUntil(c -> c >= 1));- ElementsChangedInvocation changed1 = Unique.assertOne(elemL.invocations);- assertSame(model.root, changed1.parent);- assertEquals(Set.of("A"), changed1.removed);- assertTrue(changed1.added.isEmpty());-- waitOn(invL.count.waitUntil(c -> c >= 1));- InvalidatedInvocation invalidated = Unique.assertOne(invL.invocations);- assertSame(fakeA, invalidated.object);-- elemL.clear();- invL.clear();- model.root.setElements(List.of(phonyA), "Replace");-- assertSame(phonyA, waitOn(model.fetchModelValue("[A]")));- assertFalse(fakeA.isValid());-- waitOn(elemL.count.waitUntil(c -> c >= 1));- ElementsChangedInvocation changed2 = Unique.assertOne(elemL.invocations);- assertSame(model.root, changed2.parent);- assertSame(phonyA, Unique.assertOne(changed2.added.values()));- assertTrue(changed2.removed.isEmpty());- waiter.close();- }-- @Test- public void testAttributeReplacement() throws Throwable {- AttributesChangedListener attrL = new AttributesChangedListener();- model.addModelListener(attrL);-- String str1 = new String("EqualStrings");- String str2 = new String("EqualStrings");- model.root.setAttributes(Map.of("a", str1), "Init");- waitOn(model.flushEvents());-- /**- * Note: mere object creation will cause "prior removal," so we'll do this test just with- * primitives. Should not cause replacement, since str1 and str2 are equal.- */- attrL.clear();- model.root.setAttributes(Map.of("a", str2), "Replace");- waitOn(model.flushEvents());-- // Verify str1 was not replaced with str2- assertSame(str1, waitOn(model.fetchModelValue("a")));- assertEquals(0, attrL.invocations.size());-- // Now, with prior removal- // TODO: Should I permit custom equality check?- attrL.clear();- model.root.setAttributes(Map.of(), "Clear");- model.root.setAttributes(Map.of("a", str2), "Replace");- waitOn(model.flushEvents());-- assertEquals(2, attrL.invocations.size());- AttributesChangedInvocation changed = attrL.invocations.get(0);- assertEquals(model.root, changed.parent);- assertEquals("a", Unique.assertOne(changed.removed));- assertEquals(0, changed.added.size());- changed = attrL.invocations.get(1);- assertEquals(model.root, changed.parent);- assertSame(str2, Unique.assertOne(changed.added.values()));- assertEquals(0, changed.removed.size());- }-- @Test- public void testInvalidation() throws Throwable {- InvalidatedListener invL = new InvalidatedListener();- model.addModelListener(invL);-- FakeTargetObject fakeA = new FakeTargetObject(model, model.root, "A");- model.root.setAttributes(Map.of("A", fakeA), "Init");-- FakeTargetObject fakeA1 = new FakeTargetObject(model, fakeA, "[1]");- FakeTargetObject fakeA2 = new FakeTargetObject(model, fakeA, "[2]");- fakeA.setElements(List.of(fakeA1, fakeA2), "Init");- waitOn(model.flushEvents());- invL.clear();-- model.root.setAttributes(Map.of(), "Clear");-- waitOn(invL.count.waitValue(3));- }-- public static class EventRecordingListener implements DebuggerModelListener {- List<Pair<String, TargetObject>> record = new ArrayList<>();-- @Override- public void created(TargetObject object) {- record.add(new ImmutablePair<>("created", object));- }-- @Override- public void elementsChanged(TargetObject parent, Collection<String> removed,- Map<String, ? extends TargetObject> added) {- for (TargetObject elem : added.values()) {- record.add(new ImmutablePair<>("addedElem", elem));- }- }-- @Override- public void attributesChanged(TargetObject parent, Collection<String> removed,- Map<String, ?> added) {- for (Object attr : added.values()) {- if (attr instanceof TargetObject) {- record.add(new ImmutablePair<>("addedAttr", (TargetObject) attr));- }- }- }-- @Override- public void rootAdded(TargetObject root) {- record.add(new ImmutablePair<>("rootAdded", root));- }-- @Override- public void registersUpdated(TargetObject bank, Map<String, byte[]> updates) {- record.add(new ImmutablePair<>("registersUpdated", bank));- }- }-- @Test- public void testCreationAndModelListenerWithoutReplay() throws Throwable {- EventRecordingListener listener = new EventRecordingListener();- model.addModelListener(listener, false);- waitOn(model.flushEvents());- waitOn(model.fetchModelRoot());- listener.record.clear();-- FakeTargetObject fakeA = new FakeTargetObject(model, model.root, "A");- FakeTargetRegisterBank fakeA1rb = new FakeTargetRegisterBank(model, fakeA, "[1]");- fakeA1rb.broadcast().registersUpdated(fakeA1rb, Map.of());- fakeA.setElements(List.of(fakeA1rb), "Init");- model.root.setAttributes(List.of(fakeA), Map.of(), "Init");-- waitOn(model.flushEvents());-- assertEquals(List.of(- new ImmutablePair<>("created", fakeA),- new ImmutablePair<>("created", fakeA1rb),- new ImmutablePair<>("registersUpdated", fakeA1rb),- new ImmutablePair<>("addedElem", fakeA1rb),- new ImmutablePair<>("addedAttr", fakeA)),- listener.record);- }-- @Test- public void testAddListenerWithReplay() throws Throwable {-- FakeTargetObject fakeA = new FakeTargetObject(model, model.root, "A");- FakeTargetRegisterBank fakeA1rb = new FakeTargetRegisterBank(model, fakeA, "[1]");- fakeA1rb.broadcast().registersUpdated(fakeA1rb, Map.of());- fakeA.setElements(List.of(fakeA1rb), "Init");- model.root.setAttributes(List.of(fakeA), Map.of(), "Init");- EventRecordingListener listener = new EventRecordingListener();- model.addModelListener(listener, true);-- waitOn(model.flushEvents());-- assertEquals(List.of(- new ImmutablePair<>("created", model.root),- new ImmutablePair<>("created", fakeA),- new ImmutablePair<>("created", fakeA1rb),- new ImmutablePair<>("addedElem", fakeA1rb),- new ImmutablePair<>("addedAttr", fakeA),- new ImmutablePair<>("rootAdded", model.root)),- listener.record);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/memory/CachedMemoryTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/memory/CachedMemoryTest.javadeleted file mode 100644index 03ff5b30e8..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/memory/CachedMemoryTest.java+++ /dev/null@@ -1,373 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.memory;--import static org.junit.Assert.*;--import java.util.Deque;-import java.util.LinkedList;-import java.util.concurrent.*;--import org.junit.Test;--public class CachedMemoryTest {-- static class RequestRecord<T> {- final CompletableFuture<T> future = new CompletableFuture<>();- final long address;-- public RequestRecord(long address) {- this.address = address;- }- }-- static class ReadRequestRecord extends RequestRecord<byte[]> {- final int length;-- public ReadRequestRecord(long address, int length) {- super(address);- this.length = length;- }- }-- static class WriteRequestRecord extends RequestRecord<Void> {- final byte[] data;-- public WriteRequestRecord(long address, byte[] data) {- super(address);- this.data = data;- }- }-- static class TestMemoryReaderWriter implements MemoryReader, MemoryWriter {- Deque<RequestRecord<?>> earlies = new LinkedList<>();- Deque<RequestRecord<?>> requests = new LinkedList<>();-- @Override- public CompletableFuture<byte[]> readMemory(long address, int length) {- RequestRecord<?> early = earlies.poll();- if (early != null) {- ReadRequestRecord req = (ReadRequestRecord) early;- assertEquals(req.address, address);- assertEquals(req.length, length);- return req.future;- }- ReadRequestRecord req = new ReadRequestRecord(address, length);- requests.add(req);- return req.future;- }-- @Override- public CompletableFuture<Void> writeMemory(long address, byte[] data) {- WriteRequestRecord req = new WriteRequestRecord(address, data);- requests.add(req);- return req.future;- }-- public void expectEarlyRead(long address, byte[] data) {- ReadRequestRecord req = new ReadRequestRecord(address, data.length);- req.future.complete(data);- earlies.add(req);- }-- public ReadRequestRecord assertPollRead() {- return (ReadRequestRecord) requests.remove();- }-- public WriteRequestRecord assertPollWrite() {- return (WriteRequestRecord) requests.remove();- }- }-- protected TestMemoryReaderWriter memory = new TestMemoryReaderWriter();-- byte[] inc(int len) {- byte[] result = new byte[len];- inc(result, 0, len, 0);- return result;- }-- void inc(byte[] arr, int off, int len, int start) {- for (int i = 0; i < len; i++) {- arr[off + i] = (byte) (i + start);- }- }-- @Test- public void testSingleRead() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);- CompletableFuture<byte[]> future = cache.readMemory(1234, 90);-- ReadRequestRecord rec = memory.assertPollRead();- assertEquals(1234, rec.address);- assertEquals(90, rec.length);-- rec.future.complete(inc(90));- byte[] arr = future.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(inc(90), arr);- }-- @Test- public void testSingleReadIncludesMax() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);- CompletableFuture<byte[]> future = cache.readMemory(-4, 4);-- ReadRequestRecord rec = memory.assertPollRead();- assertEquals(-4, rec.address);- assertEquals(4, rec.length);-- rec.future.complete(new byte[] { 1, 2, 3, 4 });- byte[] arr = future.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(new byte[] { 1, 2, 3, 4 }, arr);- }-- @Test- public void testSingleReadCompletedEarly() throws Exception {- memory.expectEarlyRead(1234, inc(90));-- CachedMemory cache = new CachedMemory(memory, memory);- CompletableFuture<byte[]> future = cache.readMemory(1234, 90);- byte[] arr = future.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(inc(90), arr);- }-- @Test- public void testOverlappingSequentialReads() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(1234, 100);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(1234, req1.address);- assertEquals(100, req1.length);- req1.future.complete(inc(100));- byte[] firstArr = first.get(1000, TimeUnit.MILLISECONDS);-- CompletableFuture<byte[]> second = cache.readMemory(1284, 100);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(1334, req2.address);- assertEquals(50, req2.length);- req2.future.complete(inc(50));- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(inc(100), firstArr);-- byte[] dinc = new byte[100];- inc(dinc, 0, 50, 50);- inc(dinc, 50, 50, 0);- assertArrayEquals(dinc, secondArr);- }-- @Test- public void testOverlappingParallelReads() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(1234, 100);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(1234, req1.address);- assertEquals(100, req1.length);-- CompletableFuture<byte[]> second = cache.readMemory(1284, 100);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(1334, req2.address);- assertEquals(50, req2.length);-- req1.future.complete(inc(100));- req2.future.complete(inc(50));- byte[] firstArr = first.get(1000, TimeUnit.MILLISECONDS);- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(inc(100), firstArr);-- byte[] dinc = new byte[100];- inc(dinc, 0, 50, 50);- inc(dinc, 50, 50, 0);- assertArrayEquals(dinc, secondArr);- }-- @Test- public void testSameStartsGrowingParallelReads() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(1234, 50);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(1234, req1.address);- assertEquals(50, req1.length);-- CompletableFuture<byte[]> second = cache.readMemory(1234, 100);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(1284, req2.address);- assertEquals(50, req2.length);-- assertFalse(first.isDone());- req1.future.complete(inc(50));- byte[] firstArr = first.get(1000, TimeUnit.MILLISECONDS);-- assertFalse(second.isDone());- req2.future.complete(inc(50));- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(inc(50), firstArr);-- byte[] dinc = new byte[100];- inc(dinc, 0, 50, 0);- inc(dinc, 50, 50, 0);- assertArrayEquals(dinc, secondArr);- }-- @Test- public void testLargeOffsetsParallelReads() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(0x8000_0000_0000_0000L, 100);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(0x8000_0000_0000_0000L, req1.address);- assertEquals(100, req1.length);-- CompletableFuture<byte[]> second = cache.readMemory(0x8000_0000_0000_0000L + 50, 100);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(0x8000_0000_0000_0000L + 100, req2.address);- assertEquals(50, req2.length);-- req1.future.complete(inc(100));- req2.future.complete(inc(50));- byte[] firstArr = first.get(1000, TimeUnit.MILLISECONDS);- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(inc(100), firstArr);-- byte[] dinc = new byte[100];- inc(dinc, 0, 50, 50);- inc(dinc, 50, 50, 0);- assertArrayEquals(dinc, secondArr);- }-- @Test- public void testErroneousRead() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(0, 100);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(0, req1.address);- assertEquals(100, req1.length);-- Throwable sentinel = new AssertionError("Sentinel");- req1.future.completeExceptionally(sentinel);- try {- first.get(1000, TimeUnit.MILLISECONDS);- fail();- }- catch (ExecutionException e) {- assertEquals(sentinel, e.getCause());- }-- CompletableFuture<byte[]> second = cache.readMemory(50, 100);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(50, req2.address);- assertEquals(100, req2.length);- req2.future.complete(inc(100));- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);-- assertArrayEquals(inc(100), secondArr);- }-- @Test- public void testPartialResult() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(0, 100);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(0, req1.address);- assertEquals(100, req1.length);-- req1.future.complete(inc(50)); // request was for 100!- byte[] firstArr = first.get(1000, TimeUnit.MILLISECONDS);- assertArrayEquals(inc(50), firstArr);-- CompletableFuture<byte[]> second = cache.readMemory(25, 75);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(50, req2.address);- assertEquals(50, req2.length);-- req2.future.complete(inc(50));- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);-- byte[] dinc = new byte[75];- inc(dinc, 0, 25, 25);- inc(dinc, 25, 50, 0);- assertArrayEquals(dinc, secondArr);- }-- @Test- public void testDisjointParallellFirstErrs() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(0, 25);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(0, req1.address);- assertEquals(25, req1.length);-- CompletableFuture<byte[]> second = cache.readMemory(50, 25);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(50, req2.address);- assertEquals(25, req2.length);-- Throwable sentinel = new AssertionError("Sentinel");- req1.future.completeExceptionally(sentinel);- try {- first.get(0, TimeUnit.MILLISECONDS);- fail();- }- catch (ExecutionException e) {- assertEquals(sentinel, e.getCause());- }-- req2.future.complete(inc(25));- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);- assertArrayEquals(inc(25), secondArr);- }-- @Test- public void testPartialFromErr() throws Exception {- CachedMemory cache = new CachedMemory(memory, memory);-- CompletableFuture<byte[]> first = cache.readMemory(50, 50);- ReadRequestRecord req1 = memory.assertPollRead();- assertEquals(50, req1.address);- assertEquals(50, req1.length);-- CompletableFuture<byte[]> second = cache.readMemory(0, 100);- ReadRequestRecord req2 = memory.assertPollRead();- assertEquals(0, req2.address);- assertEquals(50, req2.length);-- Throwable sentinel = new AssertionError("Sentinel");- req1.future.completeExceptionally(sentinel);- try {- first.get(0, TimeUnit.MILLISECONDS);- fail();- }- catch (ExecutionException e) {- assertEquals(sentinel, e.getCause());- }- // First should still succeed partially- req2.future.complete(inc(50));- byte[] secondArr = second.get(1000, TimeUnit.MILLISECONDS);- assertArrayEquals(inc(50), secondArr);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/AbstractTestTargetRegisterBank.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/AbstractTestTargetRegisterBank.javadeleted file mode 100644index 17d92f957d..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/AbstractTestTargetRegisterBank.java+++ /dev/null@@ -1,159 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.math.BigInteger;-import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.function.Consumer;--import ghidra.dbg.error.DebuggerRegisterAccessException;-import ghidra.dbg.target.TargetRegisterBank;-import ghidra.dbg.target.TargetRegisterContainer;-import ghidra.dbg.util.PathUtils;-import ghidra.pcode.utils.Utils;-import ghidra.program.model.address.Address;--public abstract class AbstractTestTargetRegisterBank<P extends TestTargetObject>- extends DefaultTestTargetObject<TestTargetObject, P>- implements TargetRegisterBank, TargetRegisterContainer {-- // TODO: Remove the separate descriptors idea- protected final TestTargetRegisterContainer descs;- public final Map<String, byte[]> regVals = new HashMap<>();-- public AbstractTestTargetRegisterBank(P parent, String name, String typeHint,- TestTargetRegisterContainer regs) {- super(parent, name, typeHint);- this.descs = regs;- this.descs.addBank(this);- changeAttributes(List.of(), Map.of(- DESCRIPTIONS_ATTRIBUTE_NAME, this),- "Initialized");- initializeValues();- }-- public abstract TestTargetThread getThread();-- @Override- public CompletableFuture<? extends Map<String, byte[]>> readRegistersNamed(- Collection<String> names) {- if (!descs.getDescs().keySet().containsAll(names)) {- throw new DebuggerRegisterAccessException("No such register");- }- Map<String, byte[]> result = new LinkedHashMap<>();- for (String n : names) {- byte[] v = regVals.get(n);- if (v == null) {- v = descs.getDescs().get(n).defaultValue();- }- result.put(n, v);- }- populateObjectValues(result, "Read registers");- return model.gateFuture(descs.getModel().future(result).thenApply(__ -> {- broadcast().registersUpdated(this, result);- return result;- }));- }-- protected CompletableFuture<Void> writeRegs(Map<String, byte[]> values,- Consumer<Address> setPC) {- if (!descs.getDescs().keySet().containsAll(values.keySet())) {- throw new DebuggerRegisterAccessException("No such register");- }- Map<String, byte[]> updates = new LinkedHashMap<>();- CompletableFuture<Void> future = descs.getModel().future(null);- for (Map.Entry<String, byte[]> ent : values.entrySet()) {- String n = ent.getKey();- TestTargetRegister desc = descs.getDescs().get(n);- byte[] v = desc.normalizeValue(ent.getValue());- regVals.put(n, v);- updates.put(n, v);- if (desc.isPC()) {- future.thenAccept(__ -> {- setPC.accept(desc.parseAddress(v));- });- }- }- populateObjectValues(updates, "Write registers");- future.thenAccept(__ -> {- broadcast().registersUpdated(this, updates);- });- return model.gateFuture(future);- }-- protected void addObjectValues(Collection<TestTargetRegister> descs, String reason) {- Set<TestTargetRegisterValue> objVals = new HashSet<>();- for (TestTargetRegister rd : descs) {- if (attributes.containsKey(rd.getName())) {- continue;- }- TestTargetRegisterValue tv = new TestTargetRegisterValue(this, rd, (BigInteger) null);- objVals.add(tv);- }- changeAttributes(List.of(), objVals, Map.of(), reason);- }-- protected void removeObjectValues(Collection<TestTargetRegister> descs, String reason) {- List<String> toRemove = new ArrayList<>();- for (TestTargetRegister rd : descs) {- toRemove.add(PathUtils.parseIndex(rd.getName()));- }- changeAttributes(toRemove, Map.of(), reason);- }-- protected void populateObjectValues(Map<String, byte[]> values, String reason) {- Set<TestTargetRegisterValue> objVals = new HashSet<>();- for (Map.Entry<String, byte[]> ent : values.entrySet()) {- TestTargetRegister rd = descs.getDescs().get(ent.getKey());- byte[] value = ent.getValue();- TestTargetRegisterValue tv = new TestTargetRegisterValue(this, rd,- value == null ? null : Utils.bytesToBigInteger(value, rd.byteLength, true, false));- objVals.add(tv);- }- changeAttributes(List.of(), objVals, Map.of(), reason);- }-- protected void initializeValues() {- Map<String, byte[]> values = new HashMap<>();- for (TestTargetRegister desc : descs.getDescs().values()) {- values.put(desc.getIndex(), null);- }- populateObjectValues(values, "Populate");- }-- public void setFromBank(AbstractTestTargetRegisterBank<?> bank) {- //Map<String, byte[]> updates = new HashMap<>();- //updates.putAll(bank.regVals);- regVals.putAll(bank.regVals);- for (Iterator<String> kit = regVals.keySet().iterator(); kit.hasNext();) {- String key = kit.next();- if (bank.regVals.containsKey(key)) {- continue;- }- //updates.put(key, regs.getDescs().get(key).defaultValue());- kit.remove();- }- }-- public void addRegisterDescs(Collection<TestTargetRegister> added, String reason) {- addObjectValues(added, reason);- }-- public void removeRegisterDescs(Collection<TestTargetRegister> removed, String reason) {- removeObjectValues(removed, reason);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/EmptyDebuggerObjectModel.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/EmptyDebuggerObjectModel.javadeleted file mode 100644index 1a294b44e5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/EmptyDebuggerObjectModel.java+++ /dev/null@@ -1,46 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import ghidra.dbg.agent.AbstractDebuggerObjectModel;-import ghidra.dbg.agent.SpiTargetObject;-import ghidra.program.model.address.*;--public class EmptyDebuggerObjectModel extends AbstractDebuggerObjectModel {- public final AddressSpace ram = new GenericAddressSpace("ram", 64, AddressSpace.TYPE_RAM, 0);- public final AddressSpace ram3 =- new GenericAddressSpace("ram3", 64, AddressSpace.TYPE_RAM, 0);- protected final AddressFactory factory =- new DefaultAddressFactory(new AddressSpace[] { ram, ram3 });-- @Override- public AddressFactory getAddressFactory() {- return factory;- }-- public Address addr(long off) {- return ram.getAddress(off);- }-- public AddressRange range(long min, long max) {- return new AddressRangeImpl(addr(min), addr(max));- }-- @Override- public void addModelRoot(SpiTargetObject root) {- super.addModelRoot(root);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerModelBuilder.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerModelBuilder.javadeleted file mode 100644index d2271df762..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerModelBuilder.java+++ /dev/null@@ -1,124 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.nio.ByteBuffer;-import java.util.function.Function;--import ghidra.program.model.address.Address;-import ghidra.program.model.address.AddressRange;--@Deprecated(forRemoval = true, since = "11.3")-public class TestDebuggerModelBuilder {- public TestDebuggerModelFactory testFactory = new TestDebuggerModelFactory();- public TestDebuggerObjectModel testModel;-- public TestTargetProcess testProcess1;- public TestTargetThread testThread1;- public TestTargetThread testThread2;- public AbstractTestTargetRegisterBank<?> testBank1;- public AbstractTestTargetRegisterBank<?> testBank2;-- public TestTargetProcess testProcess3;- public TestTargetThread testThread3;- public TestTargetThread testThread4;- public AbstractTestTargetRegisterBank<?> testBank3;- public AbstractTestTargetRegisterBank<?> testBank4;-- public TestTargetRegister testRegisterPC;- public TestTargetRegister testRegisterSP;-- protected TestDebuggerObjectModel newModel(String typeHint) {- return new TestDebuggerObjectModel(typeHint);- }-- public void createTestModel() {- createTestModel("Session");- }-- public void createTestModel(String typeHint) {- testModel = newModel(typeHint);- }-- public Address addr(long offset) {- return testModel.addr(offset);- }-- public AddressRange rng(long min, long max) {- return testModel.range(min, max);- }-- public byte[] arr(int... e) {- byte[] result = new byte[e.length];- for (int i = 0; i < e.length; i++) {- result[i] = (byte) e[i];- }- return result;- }-- public ByteBuffer buf(int... e) {- return ByteBuffer.wrap(arr(e));- }-- public void createTestProcessesAndThreads() {- testProcess1 = testModel.addProcess(1);- testThread1 = testProcess1.addThread(1);- testThread2 = testProcess1.addThread(2);-- testProcess3 = testModel.addProcess(3, testModel.ram3);- testThread3 = testProcess3.addThread(3);- testThread4 = testProcess3.addThread(4);- }-- /**- * Create register banks according to a convention.- *- * Whatever the convention, it ought to be the same throughout the model, or at least within a- * container. This applies the same convention (as defined by -func-) to all test threads.- *- * @param func a function which creates one bank for a given thread- */- public void applyThreadRegisterBankConvention(- Function<TestTargetThread, AbstractTestTargetRegisterBank<?>> func) {- testBank1 = func.apply(testThread1);- testBank2 = func.apply(testThread2);- testBank3 = func.apply(testThread3);- testBank4 = func.apply(testThread4);- }-- /**- * Create register banks which are direct attributes of the threads.- */- public void createTestThreadRegisterBanks() {- applyThreadRegisterBankConvention(t -> t.addRegisterBank());- }-- /**- * Create register banks which are the top frame of stacks attributed to the threads.- */- public void createTestThreadStacksAndFramesAreRegisterBanks() {- applyThreadRegisterBankConvention(t -> t.addStack().pushFrameIsBank(addr(0x00400000)));- }-- /**- * Create register banks which are attributes of the top frame of stacks attributed to the- * threads.- */- public void createTestThreadStacksAndFramesHaveRegisterBanks() {- applyThreadRegisterBankConvention(- t -> t.addStack().pushFrameHasBank(addr(0x00400000)).getBank());- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerModelFactory.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerModelFactory.javadeleted file mode 100644index dd088f5e59..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerModelFactory.java+++ /dev/null@@ -1,64 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.Deque;-import java.util.LinkedList;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerModelFactory;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.util.ConfigurableFactory.FactoryDescription;--@FactoryDescription(brief = "Mocked Client", htmlDetails = TestDebuggerModelFactory.FAKE_DETAILS)-public class TestDebuggerModelFactory implements DebuggerModelFactory {- public static final String FAKE_DETAILS = "A 'connection' to a fake debugger";- public static final String FAKE_DETAILS_HTML =- "<html><b>Description:</b> A 'connection' to a fake debugger";- public static final String FAKE_OPTION_NAME = "Test String";- public static final String FAKE_DEFAULT = "Default test string";-- protected final Deque<CompletableFuture<DebuggerObjectModel>> buildQueue =- new LinkedList<>();-- @FactoryOption(FAKE_OPTION_NAME)- public final Property<String> testStringOption =- Property.fromAccessors(String.class, this::getTestString, this::setTestString);-- private String testString = FAKE_DEFAULT;-- public TestDebuggerModelFactory() {- }-- public String getTestString() {- return testString;- }-- public void setTestString(String testString) {- this.testString = testString;- }-- @Override- public CompletableFuture<? extends DebuggerObjectModel> build() {- CompletableFuture<DebuggerObjectModel> future = new CompletableFuture<>();- buildQueue.offer(future);- return future;- }-- public CompletableFuture<DebuggerObjectModel> pollBuild() {- return buildQueue.poll();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerObjectModel.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerObjectModel.javadeleted file mode 100644index a2e82d98da..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestDebuggerObjectModel.java+++ /dev/null@@ -1,268 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.io.IOException;-import java.util.Set;-import java.util.concurrent.*;--import org.jdom.JDOMException;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.program.model.address.*;-import ghidra.program.model.lang.Register;--// TODO: Refactor with other Fake and Test model stuff.-public class TestDebuggerObjectModel extends EmptyDebuggerObjectModel {- public static final String TEST_MODEL_STRING = "Test Model";- protected static final int DELAY_MILLIS = 250;-- // TODO: Should this be tunable?- public static final Executor DELAYED_EXECUTOR =- CompletableFuture.delayedExecutor(DELAY_MILLIS, TimeUnit.MILLISECONDS);-- enum FutureMode {- ASYNC, DELAYED;- }-- public static final XmlSchemaContext SCHEMA_CTX;- public static final TargetObjectSchema ROOT_SCHEMA;- static {- try {- SCHEMA_CTX = XmlSchemaContext.deserialize(- EmptyDebuggerObjectModel.class.getResourceAsStream("test_schema.xml"));- ROOT_SCHEMA = SCHEMA_CTX.getSchema(SCHEMA_CTX.name("Test"));- }- catch (IOException | JDOMException e) {- throw new AssertionError(e);- }- }-- public final TestTargetSession session;-- protected int invalidateCachesCount;-- public TestDebuggerObjectModel() {- this("Session");- }-- public TestDebuggerObjectModel(String rootHint) {- this.session = newTestTargetSession(rootHint);- addModelRoot(session);- }-- protected TestTargetSession newTestTargetSession(String rootHint) {- return new TestTargetSession(this, rootHint, getRootSchema());- }-- protected TestTargetEnvironment newTestTargetEnvironment(TestTargetSession session) {- return new TestTargetEnvironment(session);- }-- protected TestTargetProcessContainer newTestTargetProcessContainer(TestTargetSession session) {- return new TestTargetProcessContainer(session);- }-- protected TestTargetProcess newTestTargetProcess(TestTargetProcessContainer container, int pid,- AddressSpace space) {- return new TestTargetProcess(container, pid, space);- }-- protected TestTargetBreakpointContainer newTestTargetBreakpointContainer(- TestTargetProcess process) {- return new TestTargetBreakpointContainer(process);- }-- protected TestTargetBreakpoint newTestTargetBreakpoint(TestTargetBreakpointContainer container,- int num, AddressRange range, Set<TargetBreakpointKind> kinds) {- return new TestTargetBreakpoint(container, num, range, kinds);- }-- protected TestTargetMemory newTestTargetMemory(TestTargetProcess process, AddressSpace space) {- return new TestTargetMemory(process, space);- }-- protected TestTargetMemoryRegion newTestTargetMemoryRegion(TestTargetMemory memory, String name,- AddressRange range, String flags) {- return new TestTargetMemoryRegion(memory, name, range, flags);- }-- protected TestTargetModuleContainer newTestTargetModuleContainer(TestTargetProcess process) {- return new TestTargetModuleContainer(process);- }-- protected TestTargetModule newTestTargetModule(TestTargetModuleContainer container, String name,- AddressRange range) {- return new TestTargetModule(container, name, range);- }-- protected TestTargetSectionContainer newTestTargetSectionContainer(TestTargetModule module) {- return new TestTargetSectionContainer(module);- }-- protected TestTargetSection newTestTargetSection(TestTargetSectionContainer container,- String name, AddressRange range) {- return new TestTargetSection(container, name, range);- }-- protected TestTargetSymbolNamespace newTestTargetSymbolNamespace(TestTargetModule module) {- return new TestTargetSymbolNamespace(module);- }-- protected TestTargetSymbol newTestTargetSymbol(TestTargetSymbolNamespace namespace, String name,- Address address, long size, TargetDataType dataType) {- return new TestTargetSymbol(namespace, name, address, size, dataType);- }-- protected TestTargetDataTypeNamespace newTestTargetDataTypeNamespace(TestTargetModule module) {- return new TestTargetDataTypeNamespace(module);- }-- protected TestTargetTypedefDataType newTestTargetTypedefDataType(- TestTargetDataTypeNamespace namespace, String name, TargetDataType defDataType) {- return new TestTargetTypedefDataType(namespace, name, defDataType);- }-- protected TestTargetTypedefDef newTestTargetTypedefDef(TestTargetTypedefDataType typedef,- TargetDataType dataType) {- return new TestTargetTypedefDef(typedef, dataType);- }-- protected TestTargetRegisterContainer newTestTargetRegisterContainer(- TestTargetProcess process) {- return new TestTargetRegisterContainer(process);- }-- protected TestTargetRegister newTestTargetRegister(TestTargetRegisterContainer container,- Register register) {- return TestTargetRegister.fromLanguageRegister(container, register);- }-- protected TestTargetRegister newTestTargetRegister(TestTargetRegisterContainer container,- String index, Register register) {- return TestTargetRegister.fromLanguageRegister(container, index, register);- }-- protected TestTargetThreadContainer newTestTargetThreadContainer(TestTargetProcess process) {- return new TestTargetThreadContainer(process);- }-- protected TestTargetThread newTestTargetThread(TestTargetThreadContainer container, int tid) {- return new TestTargetThread(container, tid);- }-- protected TestTargetRegisterBankInThread newTestTargetRegisterBankInThread(- TestTargetThread thread) {- return new TestTargetRegisterBankInThread(thread);- }-- protected TestTargetStack newTestTargetStack(TestTargetThread thread) {- return new TestTargetStack(thread);- }-- protected TestTargetStackFrameNoRegisterBank newTestTargetStackFrameNoRegisterBank(- TestTargetStack stack, int level, Address pc) {- return new TestTargetStackFrameNoRegisterBank(stack, level, pc);- }-- protected TestTargetStackFrameHasRegisterBank newTestTargetStackFrameHasRegisterBank(- TestTargetStack stack, int level, Address pc) {- return new TestTargetStackFrameHasRegisterBank(stack, level, pc);- }-- protected TestTargetRegisterBankInFrame newTestTargetRegisterBankInFrame(- TestTargetStackFrameHasRegisterBank frame) {- return new TestTargetRegisterBankInFrame(frame);- }-- protected TestTargetStackFrameIsRegisterBank newTestTargetStackFrameIsRegisterBank(- TestTargetStack stack, int level, Address pc) {- return new TestTargetStackFrameIsRegisterBank(stack, level, pc);- }-- protected TestTargetInterpreter newTestTargetInterpreter(TestTargetSession session) {- return new TestTargetInterpreter(session);- }-- protected TestMimickJavaLauncher newTestMimickJavaLauncher(TestTargetSession session) {- return new TestMimickJavaLauncher(session);- }-- public Executor getClientExecutor() {- return clientExecutor;- }-- @Override- public TargetObjectSchema getRootSchema() {- return ROOT_SCHEMA;- }-- @Override- public String toString() {- return TEST_MODEL_STRING;- }-- @Override // TODO: Give test writer control of addModelRoot- public CompletableFuture<? extends TargetObject> fetchModelRoot() {- return future(session);- }-- @Override- public CompletableFuture<Void> close() {- session.invalidateSubtree(session, "Model closed");- return future(null).thenCompose(__ -> super.close());- }-- public TestTargetProcess addProcess(int pid) {- return addProcess(pid, ram);- }-- public TestTargetProcess addProcess(int pid, AddressSpace space) {- return session.addProcess(pid, space);- }-- public void removeProcess(TestTargetProcess process) {- session.removeProcess(process);- }-- public <T> CompletableFuture<T> future(T t) {- return CompletableFuture.supplyAsync(() -> t, getClientExecutor());- }-- public CompletableFuture<Void> requestFocus(TargetObject obj) {- return session.requestFocus(obj);- }-- @Override- public synchronized void invalidateAllLocalCaches() {- invalidateCachesCount++;- }-- public synchronized int clearInvalidateCachesCount() {- int result = invalidateCachesCount;- invalidateCachesCount = 0;- return result;- }-- public DebuggerModelListener fire() {- return broadcast();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestMimickJavaLauncher.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestMimickJavaLauncher.javadeleted file mode 100644index 2e8926a5fa..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestMimickJavaLauncher.java+++ /dev/null@@ -1,65 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.async.AsyncUtils;-import ghidra.dbg.target.TargetLauncher;-import ghidra.dbg.target.TargetMethod;-import ghidra.dbg.target.TargetMethod.ParameterDescription;-import ghidra.dbg.target.TargetMethod.TargetParameterMap;--public class TestMimickJavaLauncher- extends DefaultTestTargetObject<TestTargetObject, TestTargetObject>- implements TargetLauncher {-- public TestMimickJavaLauncher(TestTargetObject parent) {- super(parent, "Java Launcher", "Launcher");-- setAttributes(- List.of(), Map.of(TargetMethod.PARAMETERS_ATTRIBUTE_NAME, TargetParameterMap.ofEntries(- Map.entry("Home",- ParameterDescription.create(String.class, "Home", false,- "/opt/java-17-amazon-corretto", "Home", "")),- Map.entry("Launcher",- ParameterDescription.create(String.class, "Launcher", false, "java", "Launcher",- "")),- Map.entry("Main",- ParameterDescription.create(String.class, "Main", false, "hw.HelloWorld",- "Main", "")),- Map.entry("Options",- ParameterDescription.create(String.class, "Options", false, "", "Options", "")),- Map.entry("Suspend",- ParameterDescription.create(Boolean.class, "Suspend", false, true, "Suspend",- "")),- Map.entry("Quote",- ParameterDescription.create(String.class, "Quote", false, "\"", "Quote", "")))),- "Initialized");- }-- @Override- public TargetParameterMap getParameters() {- return TargetMethod.getParameters(this);- }-- @Override- public CompletableFuture<Void> launch(Map<String, ?> args) {- return AsyncUtils.nil(); // TODO: Queue and allow test to complete it?- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetBreakpoint.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetBreakpoint.javadeleted file mode 100644index 4d15f853d1..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetBreakpoint.java+++ /dev/null@@ -1,73 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.*;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.target.*;-import ghidra.dbg.target.TargetBreakpointSpecContainer.TargetBreakpointKindSet;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.*;--public class TestTargetBreakpoint- extends DefaultTestTargetObject<TestTargetBreakpoint, TestTargetBreakpointContainer>- implements TargetBreakpointSpec, TargetBreakpointLocation, TargetDeletable {-- public TestTargetBreakpoint(TestTargetBreakpointContainer parent, int num, AddressRange range,- Set<TargetBreakpointKind> kinds) {- super(parent, PathUtils.makeKey(PathUtils.makeIndex(num)), "Breakpoint");-- changeAttributes(List.of(), Map.of(- SPEC_ATTRIBUTE_NAME, this,- RANGE_ATTRIBUTE_NAME, range,- ENABLED_ATTRIBUTE_NAME, true,- EXPRESSION_ATTRIBUTE_NAME, range.getMinAddress().toString(),- KINDS_ATTRIBUTE_NAME, TargetBreakpointKindSet.copyOf(kinds)),- "Initialized");- }-- @Override- public void addAction(TargetBreakpointAction action) {- throw new UnsupportedOperationException();- }-- @Override- public void removeAction(TargetBreakpointAction action) {- throw new UnsupportedOperationException();- }-- @Override- public CompletableFuture<Void> disable() {- changeAttributes(List.of(), Map.of(- ENABLED_ATTRIBUTE_NAME, false //- ), "Disabled Breakpoint");- return getModel().future(null);- }-- @Override- public CompletableFuture<Void> enable() {- changeAttributes(List.of(), Map.of(- ENABLED_ATTRIBUTE_NAME, true //- ), "Enabled Breakpoint");- return getModel().future(null);- }-- @Override- public CompletableFuture<Void> delete() {- return parent.deleteBreakpoint(this);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetBreakpointContainer.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetBreakpointContainer.javadeleted file mode 100644index 71b299ede5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetBreakpointContainer.java+++ /dev/null@@ -1,69 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.concurrent.atomic.AtomicInteger;--import ghidra.dbg.target.TargetBreakpointLocationContainer;-import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;-import ghidra.dbg.target.TargetBreakpointSpecContainer;-import ghidra.program.model.address.AddressRange;--// TODO: Test some other breakpoint conventions:-// A1) 1-1 spec-loc, where spec is loc is breakpoint (DONE)-// A2) 1-n spec-loc, where locs are children of spec-// B1) container per process (DONE)-// B2) container per session--public class TestTargetBreakpointContainer- extends DefaultTestTargetObject<TestTargetBreakpoint, TestTargetProcess>- implements TargetBreakpointSpecContainer, TargetBreakpointLocationContainer {-- protected static final TargetBreakpointKindSet ALL_KINDS =- TargetBreakpointKindSet.of(TargetBreakpointKind.values());-- protected final AtomicInteger counter = new AtomicInteger();-- public TestTargetBreakpointContainer(TestTargetProcess parent) {- super(parent, "Breakpoints", "BreakpointContainer");-- changeAttributes(List.of(), Map.of(- SUPPORTED_BREAK_KINDS_ATTRIBUTE_NAME, ALL_KINDS //- ), "Initialized");- }-- @Override- public CompletableFuture<Void> placeBreakpoint(String expression,- Set<TargetBreakpointKind> kinds) {- throw new UnsupportedOperationException();- }-- @Override- public CompletableFuture<Void> placeBreakpoint(AddressRange range,- Set<TargetBreakpointKind> kinds) {- TestTargetBreakpoint bpt =- getModel().newTestTargetBreakpoint(this, counter.getAndIncrement(), range, kinds);- changeElements(List.of(), List.of(bpt), "Breakpoint Added");- return getModel().future(null);- }-- public CompletableFuture<Void> deleteBreakpoint(TestTargetBreakpoint bpt) {- changeElements(List.of(bpt.getIndex()), List.of(), "Breakpoint Deleted");- return getModel().future(null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetDataTypeMember.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetDataTypeMember.javadeleted file mode 100644index 38f7ee4c34..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetDataTypeMember.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.TargetDataTypeMember;--public class TestTargetDataTypeMember- extends DefaultTestTargetObject<TestTargetObject, TestTargetNamedDataType<?>>- implements TargetDataTypeMember {-- public TestTargetDataTypeMember(TestTargetTypedefDataType parent, String key, int position,- long offset,- String memberName, TargetDataType dataType, String typeHint) {- super(parent, key, typeHint);-- changeAttributes(List.of(), Map.of(- POSITION_ATTRIBUTE_NAME, position,- MEMBER_NAME_ATTRIBUTE_NAME, memberName,- OFFSET_ATTRIBUTE_NAME, offset,- DATA_TYPE_ATTRIBUTE_NAME, dataType //- ), "Initialized");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetDataTypeNamespace.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetDataTypeNamespace.javadeleted file mode 100644index a42394d0ff..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetDataTypeNamespace.java+++ /dev/null@@ -1,38 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;--import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.TargetDataTypeNamespace;--public class TestTargetDataTypeNamespace- extends DefaultTestTargetObject<TestTargetNamedDataType<?>, TestTargetObject>- implements TargetDataTypeNamespace {-- public TestTargetDataTypeNamespace(TestTargetObject parent) {- super(parent, "Types", "DataTypeNamespace");- }-- public TestTargetTypedefDataType addTypedefDataType(String name,- TargetDataType defDataType) {- TestTargetTypedefDataType dataType =- getModel().newTestTargetTypedefDataType(this, name, defDataType);- changeElements(List.of(), List.of(dataType), "Added typedef " + name);- return dataType;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetEnvironment.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetEnvironment.javadeleted file mode 100644index e231d9d7e9..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetEnvironment.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.target.TargetEnvironment;--public class TestTargetEnvironment- extends DefaultTestTargetObject<TestTargetSession, TestTargetObject>- implements TargetEnvironment {-- public TestTargetEnvironment(TestTargetSession parent) {- super(parent, "Environment", "Environment");-- changeAttributes(List.of(), Map.of(- ARCH_ATTRIBUTE_NAME, "test-arch",- DEBUGGER_ATTRIBUTE_NAME, "test-debugger",- OS_ATTRIBUTE_NAME, "test-os" //- ), "Initialized");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetInterpreter.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetInterpreter.javadeleted file mode 100644index 1a5c8756bb..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetInterpreter.java+++ /dev/null@@ -1,101 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.*;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.target.TargetConsole.Channel;-import ghidra.dbg.target.TargetInterpreter;--public class TestTargetInterpreter- extends DefaultTestTargetObject<TestTargetObject, TestTargetSession>- implements TargetInterpreter {-- public class ExecuteCall<T> extends CompletableFuture<T> {- public final String cmd;-- public ExecuteCall(String cmd) {- this.cmd = cmd;- }- }-- private final Deque<ExecuteCall<Void>> queueExecute = new LinkedList<>();- private final Deque<ExecuteCall<String>> queueExecuteCapture = new LinkedList<>();-- public TestTargetInterpreter(TestTargetSession parent) {- super(parent, "Interpreter", "Interpreter");- changeAttributes(List.of(), Map.of(- DISPLAY_ATTRIBUTE_NAME, "Test Debugger",- PROMPT_ATTRIBUTE_NAME, "TEST>>" //- ), "Initialized");- }-- @Override- public CompletableFuture<Void> execute(String cmd) {- synchronized (queueExecute) {- ExecuteCall<Void> f = new ExecuteCall<>(cmd);- queueExecute.offer(f);- return f;- }- }-- @Override- public CompletableFuture<String> executeCapture(String cmd) {- synchronized (queueExecuteCapture) {- ExecuteCall<String> f = new ExecuteCall<>(cmd);- queueExecuteCapture.offer(f);- return f;- }- }-- public void setDisplay(String display) {- changeAttributes(List.of(), Map.of(- DISPLAY_ATTRIBUTE_NAME, display //- ), "Display changed");- }-- public void setPrompt(String prompt) {- changeAttributes(List.of(), Map.of(- PROMPT_ATTRIBUTE_NAME, prompt //- ), "Prompt changed");- }-- public void output(Channel channel, String line) {- broadcast().consoleOutput(this, channel, line + "\n");- }-- public void clearCalls() {- synchronized (queueExecute) {- queueExecute.clear();- }- synchronized (queueExecuteCapture) {- queueExecuteCapture.clear();- }- }-- public ExecuteCall<Void> pollExecute() {- synchronized (queueExecute) {- return queueExecute.poll();- }- }-- public ExecuteCall<String> pollExecuteCapture() {- synchronized (queueExecuteCapture) {- return queueExecuteCapture.poll();- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetMemory.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetMemory.javadeleted file mode 100644index 49e25bfe9f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetMemory.java+++ /dev/null@@ -1,94 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import static org.junit.Assert.assertEquals;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.target.TargetAccessConditioned;-import ghidra.dbg.target.TargetMemory;-import ghidra.generic.util.datastruct.SemisparseByteArray;-import ghidra.program.model.address.*;--public class TestTargetMemory- extends DefaultTestTargetObject<TestTargetMemoryRegion, TestTargetProcess>- implements TargetMemory, TargetAccessConditioned {-- protected final SemisparseByteArray memory = new SemisparseByteArray();- protected final AddressSpace space;-- public TestTargetMemory(TestTargetProcess parent, AddressSpace space) {- super(parent, "Memory", "Memory");- this.space = space;- changeAttributes(List.of(), Map.of(- ACCESSIBLE_ATTRIBUTE_NAME, true //- ), "Initialized");- }-- public void getMemory(Address address, byte[] data) {- assertEquals(space, address.getAddressSpace());- memory.getData(address.getOffset(), data);- }-- @Override- public CompletableFuture<byte[]> readMemory(Address address, int length) {- byte[] data = new byte[length];- getMemory(address, data);- CompletableFuture<byte[]> future = getModel().future(data);- future.thenAccept(__ -> {- broadcast().memoryUpdated(this, address, data);- });- return future;- }-- public void setMemory(Address address, byte[] data) {- assertEquals(space, address.getAddressSpace());- memory.putData(address.getOffset(), data);- }-- @Override- public CompletableFuture<Void> writeMemory(Address address, byte[] data) {- setMemory(address, data);- CompletableFuture<Void> future = getModel().future(null);- future.thenAccept(__ -> {- broadcast().memoryUpdated(this, address, data);- });- return future;- }-- public TestTargetMemoryRegion addRegion(String name, AddressRange range, String flags) {- TestTargetMemoryRegion region =- getModel().newTestTargetMemoryRegion(this, name, range, flags);- changeElements(List.of(), List.of(region), "Add test region: " + range);- return region;- }-- public void removeRegion(TestTargetMemoryRegion region) {- changeElements(List.of(region.getIndex()), List.of(),- "Remove test region: " + region.getRange());- }-- public boolean setAccessible(boolean accessible) {- boolean old = isAccessible();- changeAttributes(List.of(), Map.ofEntries(- Map.entry(ACCESSIBLE_ATTRIBUTE_NAME, accessible)),- "Set Test Memory Accessibility");- return old;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetMemoryRegion.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetMemoryRegion.javadeleted file mode 100644index 38828db3a7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetMemoryRegion.java+++ /dev/null@@ -1,41 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.target.TargetMemoryRegion;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.AddressRange;--public class TestTargetMemoryRegion- extends DefaultTestTargetObject<TestTargetObject, TestTargetMemory>- implements TargetMemoryRegion {-- public TestTargetMemoryRegion(TestTargetMemory parent, String name, AddressRange range,- String flags) {- super(parent, PathUtils.makeKey(name), "MemoryRegion");-- changeAttributes(List.of(), Map.of(- MEMORY_ATTRIBUTE_NAME, parent,- RANGE_ATTRIBUTE_NAME, range,- READABLE_ATTRIBUTE_NAME, flags.contains("r"),- WRITABLE_ATTRIBUTE_NAME, flags.contains("w"),- EXECUTABLE_ATTRIBUTE_NAME, flags.contains("x") //- ), "Initialized");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetModule.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetModule.javadeleted file mode 100644index ce777124ce..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetModule.java+++ /dev/null@@ -1,51 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.target.TargetModule;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.AddressRange;--public class TestTargetModule- extends DefaultTestTargetObject<TestTargetObject, TestTargetModuleContainer>- implements TargetModule {-- public final TestTargetSectionContainer sections;- public final TestTargetSymbolNamespace symbols;- public final TestTargetDataTypeNamespace types;-- public TestTargetModule(TestTargetModuleContainer parent, String name, AddressRange range) {- super(parent, PathUtils.makeKey(name), "Module");- sections = getModel().newTestTargetSectionContainer(this);- symbols = getModel().newTestTargetSymbolNamespace(this);- types = getModel().newTestTargetDataTypeNamespace(this);-- changeAttributes(List.of(), Map.of(- RANGE_ATTRIBUTE_NAME, range,- MODULE_NAME_ATTRIBUTE_NAME, name,- sections.getName(), sections,- symbols.getName(), symbols,- types.getName(), types //- ), "Initialized");- }-- public TestTargetSection addSection(String name, AddressRange range) {- return sections.addSection(name, range);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetModuleContainer.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetModuleContainer.javadeleted file mode 100644index 97f9d96996..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetModuleContainer.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;--import ghidra.dbg.target.TargetModuleContainer;-import ghidra.program.model.address.AddressRange;--public class TestTargetModuleContainer- extends DefaultTestTargetObject<TestTargetModule, TestTargetProcess>- implements TargetModuleContainer {-- public TestTargetModuleContainer(TestTargetProcess parent) {- super(parent, "Modules", "ModuleContainer");- }-- public TestTargetModule addModule(String name, AddressRange range) {- TestTargetModule module = getModel().newTestTargetModule(this, name, range);- changeElements(List.of(), List.of(module), "Add test module: " + name);- return module;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetNamedDataType.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetNamedDataType.javadeleted file mode 100644index 0a4c3583c8..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetNamedDataType.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.target.TargetNamedDataType;-import ghidra.dbg.util.PathUtils;--public abstract class TestTargetNamedDataType<M extends TestTargetDataTypeMember>- extends DefaultTestTargetObject<M, TestTargetDataTypeNamespace>- implements TargetNamedDataType {-- public TestTargetNamedDataType(TestTargetDataTypeNamespace parent, String name,- NamedDataTypeKind kind, String typeHint) {- super(parent, PathUtils.makeKey(name), typeHint);-- changeAttributes(List.of(), Map.of(- NAMED_DATA_TYPE_KIND_ATTRIBUTE_NAME, kind //- ), "Initialized");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetProcess.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetProcess.javadeleted file mode 100644index 1a5d58f943..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetProcess.java+++ /dev/null@@ -1,68 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.target.TargetAggregate;-import ghidra.dbg.target.TargetProcess;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.AddressRange;-import ghidra.program.model.address.AddressSpace;--public class TestTargetProcess extends- DefaultTestTargetObject<TestTargetProcessContainer, TestTargetObject>- implements TargetProcess, TargetAggregate {- public final TestTargetBreakpointContainer breaks;- public final TestTargetMemory memory;- public final TestTargetModuleContainer modules;- public final TestTargetRegisterContainer regs;- public final TestTargetThreadContainer threads;-- public TestTargetProcess(DefaultTestTargetObject<?, ?> parent, int pid, AddressSpace space) {- super(parent, PathUtils.makeKey(PathUtils.makeIndex(pid)), "Process");- breaks = getModel().newTestTargetBreakpointContainer(this);- memory = getModel().newTestTargetMemory(this, space);- modules = getModel().newTestTargetModuleContainer(this);- regs = getModel().newTestTargetRegisterContainer(this);- threads = getModel().newTestTargetThreadContainer(this);-- changeAttributes(List.of(), List.of(- breaks,- memory,- modules,- regs,- threads),- Map.of(), "Initialized");- }-- public TestTargetModule addModule(String name, AddressRange range) {- return modules.addModule(name, range);- }-- public TestTargetMemoryRegion addRegion(String name, AddressRange range, String flags) {- return memory.addRegion(name, range, flags);- }-- public TestTargetThread addThread(int tid) {- return threads.addThread(tid);- }-- public void removeThreads(TestTargetThread... threads) {- this.threads.removeThreads(threads);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetProcessContainer.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetProcessContainer.javadeleted file mode 100644index 3521be23b4..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetProcessContainer.java+++ /dev/null@@ -1,39 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.program.model.address.AddressSpace;--public class TestTargetProcessContainer- extends DefaultTestTargetObject<TestTargetProcess, TestTargetSession> {- public TestTargetProcessContainer(TestTargetSession parent) {- super(parent, "Processes", "Processes");- }-- public TestTargetProcess addProcess(int pid, AddressSpace space) {- TestTargetProcess proc = getModel().newTestTargetProcess(this, pid, space);- changeElements(List.of(), List.of(proc), Map.of(), "Test Process Added");- return proc;- }-- public void removeProcess(TestTargetProcess process) {- changeElements(List.of(process.getIndex()), List.of(),- "Test Process Removed: " + process.getPid());- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegister.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegister.javadeleted file mode 100644index 9fbf26f81d..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegister.java+++ /dev/null@@ -1,79 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.math.BigInteger;-import java.util.*;--import ghidra.dbg.target.TargetRegister;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.Address;-import ghidra.program.model.lang.Register;--public class TestTargetRegister- extends DefaultTestTargetObject<TestTargetObject, TestTargetRegisterContainer>- implements TargetRegister {-- public static TestTargetRegister fromLanguageRegister(TestTargetRegisterContainer parent,- String index, Register register) {- return new TestTargetRegister(parent, PathUtils.makeKey(index),- (register.getBitLength() + 7) / 8, register.isProgramCounter());- }-- public static TestTargetRegister fromLanguageRegister(- TestTargetRegisterContainer parent, Register register) {- return fromLanguageRegister(parent, register.getName(), register);- }-- protected final int byteLength;- protected final boolean isPC;-- public TestTargetRegister(TestTargetRegisterContainer parent, String name, int byteLength,- boolean isPC) {- super(parent, name, "Register");- this.byteLength = byteLength;- this.isPC = isPC;-- changeAttributes(List.of(), Map.of(- CONTAINER_ATTRIBUTE_NAME, parent,- BIT_LENGTH_ATTRIBUTE_NAME, byteLength * 8),- "Initialized");- }-- public byte[] normalizeValue(byte[] value) {- if (value.length == byteLength) {- return value;- }- if (value.length < byteLength) {- byte[] result = new byte[byteLength];- System.arraycopy(value, 0, result, byteLength - value.length, value.length);- return result;- }- return Arrays.copyOfRange(value, value.length - byteLength, value.length);- }-- public byte[] defaultValue() {- return new byte[byteLength];- }-- public boolean isPC() {- return isPC;- }-- public Address parseAddress(byte[] v) {- return model.getAddress("ram", new BigInteger(1, v).longValue());- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterBankInFrame.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterBankInFrame.javadeleted file mode 100644index be1ee2d5f5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterBankInFrame.java+++ /dev/null@@ -1,38 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.Map;-import java.util.concurrent.CompletableFuture;--public class TestTargetRegisterBankInFrame extends- AbstractTestTargetRegisterBank<TestTargetStackFrameHasRegisterBank> {-- public TestTargetRegisterBankInFrame(TestTargetStackFrameHasRegisterBank parent) {- super(parent, "RegisterBank", "RegisterBank",- parent.getParent().getParent().getParent().getParent().regs);- }-- @Override- public TestTargetThread getThread() {- return parent.getParent().getParent();- }-- @Override- public CompletableFuture<Void> writeRegistersNamed(Map<String, byte[]> values) {- return writeRegs(values, parent::setPC);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterBankInThread.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterBankInThread.javadeleted file mode 100644index 5e39bd984c..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterBankInThread.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.Map;-import java.util.concurrent.CompletableFuture;--public class TestTargetRegisterBankInThread extends- AbstractTestTargetRegisterBank<TestTargetThread> {-- public TestTargetRegisterBankInThread(TestTargetThread parent) {- super(parent, "RegisterBank", "RegisterBank",- parent.getParent().getParent().regs);- }-- @Override- public TestTargetThread getThread() {- return parent;- }-- @Override- public CompletableFuture<Void> writeRegistersNamed(Map<String, byte[]> values) {- return writeRegs(values, addr -> {- // Drop this frame-only attribute on the floor- });- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterContainer.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterContainer.javadeleted file mode 100644index 8d756805e2..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterContainer.java+++ /dev/null@@ -1,106 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.*;-import java.util.function.Predicate;--import ghidra.dbg.target.TargetRegisterContainer;-import ghidra.dbg.util.CollectionUtils.Delta;-import ghidra.program.model.lang.Language;-import ghidra.program.model.lang.Register;--public class TestTargetRegisterContainer- extends DefaultTestTargetObject<TestTargetRegister, TestTargetProcess>- implements TargetRegisterContainer {-- private final Set<AbstractTestTargetRegisterBank<?>> banks = new HashSet<>();-- public TestTargetRegisterContainer(TestTargetProcess parent) {- super(parent, "Registers", "RegisterContainer");- }-- public Map<String, TestTargetRegister> getDescs() {- return elements;- }-- public List<TestTargetRegister> addRegistersFromLanguage(Language language,- Predicate<Register> predicate) {- List<TestTargetRegister> add = new ArrayList<>();- for (Register register : language.getRegisters()) {- if (!predicate.test(register)) {- continue;- }- add.add(getModel().newTestTargetRegister(this, register));- }- String reason = "Added registers from Ghidra language: " + language;- changeElements(List.of(), add, reason);- List<AbstractTestTargetRegisterBank<?>> banks;- synchronized (this.banks) {- banks = List.copyOf(this.banks);- }- for (AbstractTestTargetRegisterBank<?> bank : banks) {- bank.addRegisterDescs(add, reason);- }- return add;- }-- public TestTargetRegister addRegister(Register register) {- TestTargetRegister tr =- getModel().newTestTargetRegister(this, Objects.requireNonNull(register));- doAddRegister(tr, register);- return tr;- }-- protected void doAddRegister(TestTargetRegister tr, Register register) {- String reason = "Added " + register + " from Ghidra language";- changeElements(List.of(), List.of(tr), reason);- List<AbstractTestTargetRegisterBank<?>> banks;- synchronized (this.banks) {- banks = List.copyOf(this.banks);- }- for (AbstractTestTargetRegisterBank<?> bank : banks) {- bank.addRegisterDescs(List.of(tr), reason);- }- }-- public TestTargetRegister addRegister(String index, Register register) {- TestTargetRegister tr =- getModel().newTestTargetRegister(this, index, Objects.requireNonNull(register));- doAddRegister(tr, register);- return tr;- }-- public Delta<TestTargetRegister, TestTargetRegister> removeRegister(Register register,- String reason) {- Delta<TestTargetRegister, TestTargetRegister> result =- changeElements(List.of(register.getName()), List.of(), reason);- List<AbstractTestTargetRegisterBank<?>> banks;- synchronized (this.banks) {- banks = List.copyOf(this.banks);- }- for (AbstractTestTargetRegisterBank<?> bank : banks) {- bank.removeRegisterDescs(result.removed.values(), reason);- }- return result;- }-- public void addBank(AbstractTestTargetRegisterBank<?> bank) {- synchronized (this.banks) {- this.banks.add(bank);- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterValue.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterValue.javadeleted file mode 100644index 7d95925ed7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetRegisterValue.java+++ /dev/null@@ -1,63 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.math.BigInteger;-import java.util.List;-import java.util.Map;--import ghidra.dbg.target.TargetRegister;-import ghidra.dbg.util.PathUtils;-import ghidra.pcode.utils.Utils;--public class TestTargetRegisterValue- extends DefaultTestTargetObject<TestTargetObject, AbstractTestTargetRegisterBank<?>>- implements TargetRegister {-- public final TestTargetRegister desc;-- public TestTargetRegisterValue(AbstractTestTargetRegisterBank<?> parent,- TestTargetRegister desc, BigInteger value) {- this(parent, desc,- value == null ? null : Utils.bigIntegerToBytes(value, desc.byteLength, true));- }-- public TestTargetRegisterValue(AbstractTestTargetRegisterBank<?> parent,- TestTargetRegister desc, byte[] value) {- super(parent, PathUtils.parseIndex(desc.getName()), "Register");- this.desc = desc;-- if (value == null) {- changeAttributes(List.of(), Map.of(- CONTAINER_ATTRIBUTE_NAME, parent,- BIT_LENGTH_ATTRIBUTE_NAME, desc.byteLength * 8),- "Populated");- }- else {- changeAttributes(List.of(), Map.of(- CONTAINER_ATTRIBUTE_NAME, parent,- BIT_LENGTH_ATTRIBUTE_NAME, desc.byteLength * 8,- VALUE_ATTRIBUTE_NAME, value),- "Initialized");- }- }-- public void setValue(BigInteger value) {- changeAttributes(List.of(), Map.of(- VALUE_ATTRIBUTE_NAME, Utils.bigIntegerToBytes(value, desc.byteLength, true)),- "Set value");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSection.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSection.javadeleted file mode 100644index 84ac47b6f5..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSection.java+++ /dev/null@@ -1,38 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.target.TargetSection;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.AddressRange;--public class TestTargetSection- extends DefaultTestTargetObject<TestTargetObject, TestTargetSectionContainer>- implements TargetSection {-- public TestTargetSection(TestTargetSectionContainer parent, String name,- AddressRange range) {- super(parent, PathUtils.makeKey(name), "Section");-- changeAttributes(List.of(), Map.of(- RANGE_ATTRIBUTE_NAME, range,- MODULE_ATTRIBUTE_NAME, parent.getParent() //- ), "Initialized");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSectionContainer.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSectionContainer.javadeleted file mode 100644index 0b33a7c9c3..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSectionContainer.java+++ /dev/null@@ -1,36 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;--import ghidra.dbg.target.TargetSectionContainer;-import ghidra.program.model.address.AddressRange;--public class TestTargetSectionContainer- extends DefaultTestTargetObject<TestTargetSection, TestTargetModule>- implements TargetSectionContainer {-- public TestTargetSectionContainer(TestTargetModule parent) {- super(parent, "Sections", "SectionContainer");- }-- public TestTargetSection addSection(String name, AddressRange range) {- TestTargetSection section = getModel().newTestTargetSection(this, name, range);- changeElements(List.of(), List.of(section), "Add test section: " + name);- return section;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSession.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSession.javadeleted file mode 100644index a67d79fc4f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSession.java+++ /dev/null@@ -1,96 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.async.AsyncUtils;-import ghidra.dbg.agent.DefaultTargetModelRoot;-import ghidra.dbg.target.*;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.program.model.address.AddressSpace;--public class TestTargetSession extends DefaultTargetModelRoot- implements TestTargetObject, TargetActiveScope, TargetFocusScope, TargetEventScope,- TargetLauncher {-- public final TestTargetEnvironment environment;- public final TestTargetProcessContainer processes;- public final TestTargetInterpreter interpreter;- public final TestMimickJavaLauncher mimickJavaLauncher;-- public TestTargetSession(TestDebuggerObjectModel model, String rootHint) {- this(model, rootHint, EnumerableTargetObjectSchema.OBJECT);- }-- public TestTargetSession(TestDebuggerObjectModel model, String rootHint,- TargetObjectSchema schema) {- super(model, rootHint, schema);- environment = model.newTestTargetEnvironment(this);- processes = model.newTestTargetProcessContainer(this);- interpreter = model.newTestTargetInterpreter(this);- mimickJavaLauncher = model.newTestMimickJavaLauncher(this);-- changeAttributes(List.of(),- List.of(environment, processes, interpreter, mimickJavaLauncher), Map.of(),- "Initialized");- }-- public TestTargetProcess addProcess(int pid, AddressSpace space) {- return processes.addProcess(pid, space);- }-- public void removeProcess(TestTargetProcess process) {- processes.removeProcess(process);- }-- @Override- public TestDebuggerObjectModel getModel() {- return (TestDebuggerObjectModel) super.getModel();- }-- @Override- public CompletableFuture<Void> requestActivation(TargetObject obj) {- return model.gateFuture(getModel().future(null).thenAccept(__ -> {- changeAttributes(List.of(), List.of(), Map.of(FOCUS_ATTRIBUTE_NAME, obj),- "Activation requested");- }));- }-- @Override- public CompletableFuture<Void> requestFocus(TargetObject obj) {- return model.gateFuture(getModel().future(null).thenAccept(__ -> {- changeAttributes(List.of(), List.of(), Map.of(FOCUS_ATTRIBUTE_NAME, obj),- "Focus requested");- }));- }-- public void simulateStep(TestTargetThread eventThread) {- eventThread.setState(TargetExecutionState.RUNNING);- broadcast().event(this, eventThread, TargetEventType.STEP_COMPLETED,- "Test thread completed a step", List.of());- eventThread.setState(TargetExecutionState.STOPPED);- }-- @Override- public CompletableFuture<Void> launch(Map<String, ?> args) {- return AsyncUtils.nil();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStack.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStack.javadeleted file mode 100644index 6618097990..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStack.java+++ /dev/null@@ -1,65 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.ArrayList;-import java.util.List;--import ghidra.dbg.target.TargetStack;-import ghidra.program.model.address.Address;--public class TestTargetStack extends DefaultTestTargetObject<TestTargetStackFrame, TestTargetThread>- implements TargetStack {-- public TestTargetStack(TestTargetThread parent) {- super(parent, "Stack", "Stack");- }-- protected <T extends TestTargetStackFrame> T pushFrame(T frame) {- List<TestTargetStackFrame> list = new ArrayList<>((elements.values()));- list.add(frame);- for (int i = list.size() - 1; i > 1; i--) {- list.get(i).setFromFrame(list.get(i - 1));- }- changeElements(List.of(), List.of(frame), "Pushed test frame");- return frame;- }-- public TestTargetStackFrameNoRegisterBank pushFrameNoBank(Address pc) {- return pushFrame(- getModel().newTestTargetStackFrameNoRegisterBank(this, elements.size(), pc));- }-- /**- * Push a new frame onto the stack where the register bank is a child attribute- *- * @return the "new" highest-indexed frame, into which old data was pushed- */- public TestTargetStackFrameHasRegisterBank pushFrameHasBank(Address pc) {- return pushFrame(- getModel().newTestTargetStackFrameHasRegisterBank(this, elements.size(), pc));- }-- /**- * Push a new frame onto the stack which is also the registers bank- *- * @return the "new" highest-indexed frame, into which old data was pushed- */- public TestTargetStackFrameIsRegisterBank pushFrameIsBank(Address pc) {- return pushFrame(- getModel().newTestTargetStackFrameIsRegisterBank(this, elements.size(), pc));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrame.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrame.javadeleted file mode 100644index 125f7df94b..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrame.java+++ /dev/null@@ -1,23 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import ghidra.dbg.target.TargetStackFrame;--public interface TestTargetStackFrame extends TestTargetObject, TargetStackFrame {-- void setFromFrame(TestTargetStackFrame that);-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameHasRegisterBank.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameHasRegisterBank.javadeleted file mode 100644index c8dbfd22fd..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameHasRegisterBank.java+++ /dev/null@@ -1,60 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.Address;--public class TestTargetStackFrameHasRegisterBank- extends DefaultTestTargetObject<TestTargetObject, TestTargetStack>- implements TestTargetStackFrame {- protected final TestTargetRegisterBankInFrame bank;- protected Address pc;-- public TestTargetStackFrameHasRegisterBank(TestTargetStack parent, int level, Address pc) {- super(parent, PathUtils.makeKey(PathUtils.makeIndex(level)), "Frame");- bank = getModel().newTestTargetRegisterBankInFrame(this);-- changeAttributes(List.of(), Map.of(- bank.getName(), bank, //- PC_ATTRIBUTE_NAME, this.pc = pc //- ), "Initialized");- }-- @Override- public void setFromFrame(TestTargetStackFrame frame) {- TestTargetStackFrameHasRegisterBank that = (TestTargetStackFrameHasRegisterBank) frame;- this.pc = that.pc;- changeAttributes(List.of(), Map.of(- PC_ATTRIBUTE_NAME, this.pc //- ), "Copied frame");- this.bank.setFromBank(that.bank);- }-- public void setPC(Address pc) {- this.pc = pc;- changeAttributes(List.of(), Map.of(- PC_ATTRIBUTE_NAME, this.pc //- ), "PC Updated");- }-- public TestTargetRegisterBankInFrame getBank() {- return bank;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameIsRegisterBank.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameIsRegisterBank.javadeleted file mode 100644index 7d4f2f151d..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameIsRegisterBank.java+++ /dev/null@@ -1,61 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.Address;--public class TestTargetStackFrameIsRegisterBank- extends AbstractTestTargetRegisterBank<TestTargetStack> implements TestTargetStackFrame {-- protected Address pc;-- public TestTargetStackFrameIsRegisterBank(TestTargetStack parent, int level, Address pc) {- super(parent, PathUtils.makeKey(PathUtils.makeIndex(level)), "Frame",- parent.getParent().getParent().getParent().regs);- setPC(pc);- }-- @Override- public void setFromFrame(TestTargetStackFrame frame) {- TestTargetStackFrameIsRegisterBank that = (TestTargetStackFrameIsRegisterBank) frame;- this.pc = that.pc;- changeAttributes(List.of(), Map.of(- PC_ATTRIBUTE_NAME, this.pc //- ), "Copied frame");- this.setFromBank(that);- }-- @Override- public TestTargetThread getThread() {- return parent.getParent();- }-- public void setPC(Address address) {- changeAttributes(List.of(), Map.of(- PC_ATTRIBUTE_NAME, pc = address //- ), "PC Updated");- }-- @Override- public CompletableFuture<Void> writeRegistersNamed(Map<String, byte[]> values) {- return writeRegs(values, this::setPC);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameNoRegisterBank.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameNoRegisterBank.javadeleted file mode 100644index bba90ef5c2..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetStackFrameNoRegisterBank.java+++ /dev/null@@ -1,51 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.Address;--public class TestTargetStackFrameNoRegisterBank extends- DefaultTestTargetObject<TestTargetObject, TestTargetStack> implements TestTargetStackFrame {- protected Address pc;-- public TestTargetStackFrameNoRegisterBank(TestTargetStack parent, int level, Address pc) {- super(parent, PathUtils.makeKey(PathUtils.makeIndex(level)), "Frame");-- changeAttributes(List.of(), Map.of(- PC_ATTRIBUTE_NAME, this.pc = pc //- ), "Initialized");- }-- @Override- public void setFromFrame(TestTargetStackFrame frame) {- TestTargetStackFrameNoRegisterBank that = (TestTargetStackFrameNoRegisterBank) frame;- this.pc = that.pc;- changeAttributes(List.of(), Map.of(- PC_ATTRIBUTE_NAME, this.pc //- ), "Copied frame");- }-- public void setPC(Address pc) {- this.pc = pc;- changeAttributes(List.of(), Map.of(- PC_ATTRIBUTE_NAME, this.pc //- ), "PC Updated");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSymbol.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSymbol.javadeleted file mode 100644index b9fa05ae33..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSymbol.java+++ /dev/null@@ -1,40 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;--import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.TargetSymbol;-import ghidra.dbg.util.PathUtils;-import ghidra.program.model.address.Address;--public class TestTargetSymbol- extends DefaultTestTargetObject<TestTargetObject, TestTargetSymbolNamespace>- implements TargetSymbol {-- public TestTargetSymbol(TestTargetSymbolNamespace parent, String name, Address address,- long size, TargetDataType dataType) {- super(parent, PathUtils.makeKey(name), "Symbol");-- changeAttributes(List.of(), Map.of(- VALUE_ATTRIBUTE_NAME, address,- DATA_TYPE_ATTRIBUTE_NAME, dataType,- SIZE_ATTRIBUTE_NAME, size //- ), "Initialized");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSymbolNamespace.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSymbolNamespace.javadeleted file mode 100644index b42a600e51..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetSymbolNamespace.java+++ /dev/null@@ -1,39 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;--import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.target.TargetSymbolNamespace;-import ghidra.program.model.address.Address;--public class TestTargetSymbolNamespace- extends DefaultTestTargetObject<TestTargetSymbol, TestTargetObject>- implements TargetSymbolNamespace {-- public TestTargetSymbolNamespace(TestTargetObject parent) {- super(parent, "Symbols", "SymbolNamespace");- }-- public TestTargetSymbol addSymbol(String name, Address address, long size,- TargetDataType dataType) {- TestTargetSymbol symbol =- getModel().newTestTargetSymbol(this, name, address, size, dataType);- changeElements(List.of(), List.of(symbol), "Added symbol " + name);- return symbol;- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetThread.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetThread.javadeleted file mode 100644index b6c2a9bd48..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetThread.java+++ /dev/null@@ -1,88 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import ghidra.async.AsyncUtils;-import ghidra.dbg.target.*;-import ghidra.dbg.util.PathUtils;--public class TestTargetThread- extends DefaultTestTargetObject<TestTargetObject, TestTargetThreadContainer>- implements TargetThread, TargetAggregate, TargetExecutionStateful, TargetSteppable,- TargetResumable, TargetInterruptible, TargetKillable {-- public static final TargetStepKindSet SUPPORTED_KINDS =- TargetStepKindSet.of(TargetStepKind.values());-- public TestTargetThread(TestTargetThreadContainer parent, int tid) {- super(parent, PathUtils.makeKey(PathUtils.makeIndex(tid)), "Thread");- changeAttributes(List.of(), List.of(), Map.of(- STATE_ATTRIBUTE_NAME, TargetExecutionState.STOPPED,- SUPPORTED_STEP_KINDS_ATTRIBUTE_NAME, SUPPORTED_KINDS),- "Initialized");- }-- /**- * Treat this thread as not having frame information, and just expose the registers- *- * @return the created register bank- */- public TestTargetRegisterBankInThread addRegisterBank() {- TestTargetRegisterBankInThread regs = getModel().newTestTargetRegisterBankInThread(this);- changeAttributes(List.of(), List.of(- regs),- Map.of(), "Add Test Register Bank");- return regs;- }-- public TestTargetStack addStack() {- TestTargetStack stack = getModel().newTestTargetStack(this);- changeAttributes(List.of(), List.of(- stack),- Map.of(), "Add Test Stack");- return stack;- }-- public void setState(TargetExecutionState state) {- changeAttributes(List.of(), List.of(), Map.of(- STATE_ATTRIBUTE_NAME, state),- "Changed state");- }-- @Override- public CompletableFuture<Void> step(TargetStepKind kind) {- return AsyncUtils.nil();- }-- @Override- public CompletableFuture<Void> resume() {- return AsyncUtils.nil();- }-- @Override- public CompletableFuture<Void> interrupt() {- return AsyncUtils.nil();- }-- @Override- public CompletableFuture<Void> kill() {- return AsyncUtils.nil();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetThreadContainer.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetThreadContainer.javadeleted file mode 100644index bfb1e93e54..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetThreadContainer.java+++ /dev/null@@ -1,43 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;-import java.util.Map;-import java.util.stream.Collectors;-import java.util.stream.Stream;--import ghidra.dbg.target.TargetObject;--public class TestTargetThreadContainer- extends DefaultTestTargetObject<TestTargetThread, TestTargetProcess> {-- public TestTargetThreadContainer(TestTargetProcess parent) {- super(parent, "Threads", "Threads");- }-- public TestTargetThread addThread(int tid) {- TestTargetThread thread = getModel().newTestTargetThread(this, tid);- changeElements(List.of(), List.of(thread), Map.of(), "Test Thread Added");- return thread;- }-- public void removeThreads(TestTargetThread... threads) {- List<String> indices =- Stream.of(threads).map(TargetObject::getIndex).collect(Collectors.toList());- changeElements(indices, List.of(), Map.of(), "Test Threads Removed");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetTypedefDataType.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetTypedefDataType.javadeleted file mode 100644index dd2694c6f6..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetTypedefDataType.java+++ /dev/null@@ -1,31 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import java.util.List;--import ghidra.dbg.attributes.TargetDataType;--public class TestTargetTypedefDataType- extends TestTargetNamedDataType<TestTargetTypedefDef> {-- public TestTargetTypedefDataType(TestTargetDataTypeNamespace parent, String name,- TargetDataType dataType) {- super(parent, name, NamedDataTypeKind.TYPEDEF, "TypedefType");- changeElements(List.of(), List.of(getModel().newTestTargetTypedefDef(this, dataType)),- "Initialized");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetTypedefDef.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetTypedefDef.javadeleted file mode 100644index e20dff49c9..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetTypedefDef.java+++ /dev/null@@ -1,24 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.model;--import ghidra.dbg.attributes.TargetDataType;--public class TestTargetTypedefDef extends TestTargetDataTypeMember {- public TestTargetTypedefDef(TestTargetTypedefDataType typedef, TargetDataType dataType) {- super(typedef, "[def]", -1, -1, "def", dataType, "TypedefDef");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetLauncherTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetLauncherTest.javadeleted file mode 100644index 0638fbfb0a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetLauncherTest.java+++ /dev/null@@ -1,32 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import static org.junit.Assert.*;--import java.util.List;--import org.junit.Test;--import ghidra.dbg.target.TargetLauncher.CmdLineParser;--public class TargetLauncherTest {- @Test- public void testCmdLineParser() {- assertEquals(List.of("C:\\Windows", "10\\notepad.exe"),- CmdLineParser.tokenize("C:\\Windows 10\\notepad.exe"));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetMethodTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetMethodTest.javadeleted file mode 100644index 5622fabdd2..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/TargetMethodTest.java+++ /dev/null@@ -1,251 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target;--import static org.junit.Assert.*;--import java.lang.invoke.MethodHandles;-import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;--import org.junit.Test;--import ghidra.async.AsyncTestUtils;-import ghidra.async.AsyncUtils;-import ghidra.dbg.error.DebuggerIllegalArgumentException;-import ghidra.dbg.model.*;-import ghidra.dbg.target.TargetMethod.*;--public class TargetMethodTest implements AsyncTestUtils {- @Test- public void testAnnotatedMethodVoid0Args() throws Throwable {- TestDebuggerModelBuilder mb = new TestDebuggerModelBuilder() {- @Override- protected TestDebuggerObjectModel newModel(String typeHint) {- return new TestDebuggerObjectModel(typeHint) {- @Override- protected TestTargetThread newTestTargetThread(- TestTargetThreadContainer container, int tid) {- return new TestTargetThread(container, tid) {- {- changeAttributes(List.of(),- AnnotatedTargetMethod.collectExports(MethodHandles.lookup(),- testModel, this),- "Methods");- }-- @TargetMethod.Export("MyMethod")- public CompletableFuture<Void> myMethod() {- return AsyncUtils.nil();- }- };- }- };- }- };- mb.createTestModel();- mb.createTestProcessesAndThreads();- TargetMethod method = (TargetMethod) mb.testThread1.getCachedAttribute("MyMethod");- assertEquals(Void.class, method.getReturnType());- assertEquals(TargetParameterMap.of(), method.getParameters());- assertNull(waitOn(method.invoke(Map.of())));-- try {- waitOn(method.invoke(Map.ofEntries(Map.entry("p1", "err"))));- fail("Didn't catch extraneous argument");- }- catch (DebuggerIllegalArgumentException e) {- // pass- }- }-- @Test- public void testAnnotatedMethodVoid1ArgBool() throws Throwable {- TestDebuggerModelBuilder mb = new TestDebuggerModelBuilder() {- @Override- protected TestDebuggerObjectModel newModel(String typeHint) {- return new TestDebuggerObjectModel(typeHint) {- @Override- protected TestTargetThread newTestTargetThread(- TestTargetThreadContainer container, int tid) {- return new TestTargetThread(container, tid) {- {- changeAttributes(List.of(),- AnnotatedTargetMethod.collectExports(MethodHandles.lookup(),- testModel, this),- "Methods");- }-- @TargetMethod.Export("MyMethod")- public CompletableFuture<Void> myMethod(- @TargetMethod.Param(- display = "P1",- description = "A boolean param",- name = "p1") boolean b) {- return AsyncUtils.nil();- }- };- }- };- }- };- mb.createTestModel();- mb.createTestProcessesAndThreads();- TargetMethod method = (TargetMethod) mb.testThread1.getCachedAttribute("MyMethod");- assertEquals(Void.class, method.getReturnType());- assertEquals(TargetParameterMap.ofEntries(- Map.entry("p1",- ParameterDescription.create(Boolean.class, "p1", true, null, "P1",- "A boolean param"))),- method.getParameters());- assertNull(waitOn(method.invoke(Map.ofEntries(Map.entry("p1", true)))));-- try {- waitOn(method.invoke(Map.ofEntries(Map.entry("p1", "err"))));- fail("Didn't catch type mismatch");- }- catch (DebuggerIllegalArgumentException e) {- // pass- }-- try {- waitOn(method.invoke(Map.ofEntries(- Map.entry("p1", true),- Map.entry("p2", "err"))));- fail("Didn't catch extraneous argument");- }- catch (DebuggerIllegalArgumentException e) {- // pass- }-- try {- waitOn(method.invoke(Map.ofEntries()));- fail("Didn't catch missing argument");- }- catch (DebuggerIllegalArgumentException e) {- // pass- }- }-- @Test- public void testAnnotatedMethodString1ArgInt() throws Throwable {- TestDebuggerModelBuilder mb = new TestDebuggerModelBuilder() {- @Override- protected TestDebuggerObjectModel newModel(String typeHint) {- return new TestDebuggerObjectModel(typeHint) {- @Override- protected TestTargetThread newTestTargetThread(- TestTargetThreadContainer container, int tid) {- return new TestTargetThread(container, tid) {- {- changeAttributes(List.of(),- AnnotatedTargetMethod.collectExports(MethodHandles.lookup(),- testModel, this),- "Methods");- }-- @TargetMethod.Export("MyMethod")- public CompletableFuture<String> myMethod(- @TargetMethod.Param(- display = "P1",- description = "An int param",- name = "p1") int i) {- return CompletableFuture.completedFuture(Integer.toString(i));- }- };- }- };- }- };- mb.createTestModel();- mb.createTestProcessesAndThreads();- TargetMethod method = (TargetMethod) mb.testThread1.getCachedAttribute("MyMethod");- assertEquals(String.class, method.getReturnType());- assertEquals(TargetParameterMap.ofEntries(- Map.entry("p1",- ParameterDescription.create(Integer.class, "p1", true, null, "P1",- "An int param"))),- method.getParameters());- assertEquals("3", waitOn(method.invoke(Map.ofEntries(Map.entry("p1", 3)))));- }-- @Test- public void testAnnotatedMethodStringManyArgs() throws Throwable {- TestDebuggerModelBuilder mb = new TestDebuggerModelBuilder() {- @Override- protected TestDebuggerObjectModel newModel(String typeHint) {- return new TestDebuggerObjectModel(typeHint) {- @Override- protected TestTargetThread newTestTargetThread(- TestTargetThreadContainer container, int tid) {- return new TestTargetThread(container, tid) {- {- changeAttributes(List.of(),- AnnotatedTargetMethod.collectExports(MethodHandles.lookup(),- testModel, this),- "Methods");- }-- @TargetMethod.Export("MyMethod")- public CompletableFuture<String> myMethod(- @TargetMethod.Param(- display = "I",- description = "An int param",- name = "i") int i,- @TargetMethod.Param(- display = "B",- description = "A boolean param",- name = "b") boolean b,- @TargetMethod.Param(- display = "S",- description = "A string param",- name = "s") String s,- @TargetMethod.Param(- display = "L",- description = "A long param",- name = "l") long l) {- return CompletableFuture- .completedFuture(i + "," + b + "," + s + "," + l);- }- };- }- };- }- };- mb.createTestModel();- mb.createTestProcessesAndThreads();- TargetMethod method = (TargetMethod) mb.testThread1.getCachedAttribute("MyMethod");- assertEquals(String.class, method.getReturnType());- assertEquals(TargetParameterMap.ofEntries(- Map.entry("i",- ParameterDescription.create(Integer.class, "i", true, null, "I",- "An int param")),- Map.entry("b",- ParameterDescription.create(Boolean.class, "b", true, null, "B",- "A boolean param")),- Map.entry("s",- ParameterDescription.create(String.class, "s", true, null, "S",- "A string param")),- Map.entry("l",- ParameterDescription.create(Long.class, "l", true, null, "L",- "A long param"))),- method.getParameters());- assertEquals("3,true,Hello,7", waitOn(method.invoke(Map.ofEntries(- Map.entry("b", true), Map.entry("i", 3), Map.entry("s", "Hello"),- Map.entry("l", 7L)))));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/AnnotatedTargetObjectSchemaTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/AnnotatedTargetObjectSchemaTest.javadeleted file mode 100644index 7de666e507..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/AnnotatedTargetObjectSchemaTest.java+++ /dev/null@@ -1,416 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target.schema;--import static org.junit.Assert.assertEquals;-import static org.junit.Assert.assertTrue;--import java.util.Map;-import java.util.concurrent.CompletableFuture;--import org.junit.Test;--import ghidra.async.AsyncUtils;-import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;-import ghidra.dbg.agent.*;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.DefaultTargetObjectSchema.DefaultAttributeSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.*;--public class AnnotatedTargetObjectSchemaTest {-- protected static SchemaBuilder addBasicAttributes(SchemaBuilder builder) {- builder.addAttributeSchema(new DefaultAttributeSchema("_value",- EnumerableTargetObjectSchema.ANY.getName(), false, false, true), null);- builder.addAttributeSchema(new DefaultAttributeSchema("_type",- EnumerableTargetObjectSchema.STRING.getName(), false, false, true), null);- builder.addAttributeSchema(new DefaultAttributeSchema("_display",- EnumerableTargetObjectSchema.STRING.getName(), false, false, true), null);- builder.addAttributeSchema(new DefaultAttributeSchema("_short_display",- EnumerableTargetObjectSchema.STRING.getName(), false, false, true), null);- builder.addAttributeSchema(new DefaultAttributeSchema("_kind",- EnumerableTargetObjectSchema.STRING.getName(), false, true, true), null);- builder.addAttributeSchema(new DefaultAttributeSchema("_order",- EnumerableTargetObjectSchema.INT.getName(), false, false, true), null);- builder.addAttributeSchema(new DefaultAttributeSchema("_modified",- EnumerableTargetObjectSchema.BOOL.getName(), false, false, true), null);- return builder;- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootPlain extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootPlain(AbstractDebuggerObjectModel model, String typeHint) {- super(model, typeHint);- }- }-- @Test- public void testAnnotatedRootSchemaPlain() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema = ctx.getSchemaForClass(TestAnnotatedTargetRootPlain.class);-- TargetObjectSchema exp = addBasicAttributes(ctx.builder(schema.getName()))- .addInterface(TargetAggregate.class) // Inherited from root- .build();- assertEquals(exp, schema);- }-- @TargetObjectSchemaInfo(elements = @TargetElementType(type = Void.class))- static class TestAnnotatedTargetRootNoElems extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootNoElems(AbstractDebuggerObjectModel model, String typeHint) {- super(model, typeHint);- }- }-- @Test- public void testAnnotatedRootSchemaNoElems() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema = ctx.getSchemaForClass(TestAnnotatedTargetRootNoElems.class);-- TargetObjectSchema exp = addBasicAttributes(ctx.builder(schema.getName()))- .addInterface(TargetAggregate.class) // Inherited from root- .setDefaultElementSchema(EnumerableTargetObjectSchema.VOID.getName())- .build();- assertEquals(exp, schema);- }-- @TargetObjectSchemaInfo(name = "Process")- static class TestAnnotatedTargetProcessStub- extends DefaultTargetObject<TargetObject, TargetObject>- implements TargetProcess {- public TestAnnotatedTargetProcessStub(AbstractDebuggerObjectModel model,- TargetObject parent, String key, String typeHint) {- super(model, parent, key, typeHint);- }- }-- @TargetObjectSchemaInfo(name = "Root")- static class TestAnnotatedTargetRootOverriddenFetchElems extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootOverriddenFetchElems(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @Override- public CompletableFuture<? extends Map<String, TestAnnotatedTargetProcessStub>> fetchElements(- RefreshBehavior refresh) {- return null; // Doesn't matter- }- }-- @Test- public void testAnnotatedRootSchemaOverridenFetchElems() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema =- ctx.getSchemaForClass(TestAnnotatedTargetRootOverriddenFetchElems.class);-- SchemaName schemaProc = ctx.nameFromClass(TestAnnotatedTargetProcessStub.class);-- TargetObjectSchema exp = addBasicAttributes(ctx.builder(schema.getName()))- .addInterface(TargetAggregate.class)- .setDefaultElementSchema(schemaProc)- .build();- assertEquals(exp, schema);- assertEquals("Root", schema.getName().toString());- }-- @TargetObjectSchemaInfo(name = "ProcessContainer")- static class TestAnnotatedProcessContainer- extends DefaultTargetObject<TestAnnotatedTargetProcessStub, TargetObject> {- public TestAnnotatedProcessContainer(AbstractDebuggerObjectModel model, TargetObject parent,- String key, String typeHint) {- super(model, parent, key, typeHint);- }- }-- @Test- public void testAnnotatedSubSchemaElemsByParam() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema = ctx.getSchemaForClass(TestAnnotatedProcessContainer.class);-- SchemaName schemaProc = ctx.nameFromClass(TestAnnotatedTargetProcessStub.class);-- TargetObjectSchema exp = addBasicAttributes(ctx.builder(schema.getName()))- .setDefaultElementSchema(schemaProc)- .build();- assertEquals(exp, schema);- }-- @TargetObjectSchemaInfo(name = "Process")- static class TestAnnotatedTargetProcessParam- extends DefaultTargetObject<TargetObject, TargetObject>- implements TargetProcess {- public TestAnnotatedTargetProcessParam(AbstractDebuggerObjectModel model,- TargetObject parent, String key, String typeHint) {- super(model, parent, key, typeHint);- }- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootWithAnnotatedAttrs extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootWithAnnotatedAttrs(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @TargetAttributeType(name = "int_attribute")- public int getSomeIntAttribute() {- return 0; // Doesn't matter- }-- @TargetAttributeType- public TestAnnotatedTargetProcessParam getSomeObjectAttribute() {- return null; // Doesn't matter- }- }-- @Test- public void testAnnotatedRootSchemaWithAnnotatedAttrs() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema =- ctx.getSchemaForClass(TestAnnotatedTargetRootWithAnnotatedAttrs.class);-- SchemaName schemaProc = ctx.nameFromClass(TestAnnotatedTargetProcessParam.class);-- TargetObjectSchema exp = addBasicAttributes(ctx.builder(schema.getName()))- .addInterface(TargetAggregate.class)- .addAttributeSchema(new DefaultAttributeSchema("int_attribute",- EnumerableTargetObjectSchema.INT.getName(), false, false, false), null)- .addAttributeSchema(new DefaultAttributeSchema("some_object_attribute",- schemaProc, false, false, false), null)- .build();- assertEquals(exp, schema);- assertEquals("TestAnnotatedTargetRootWithAnnotatedAttrs", schema.getName().toString());- }-- @TargetObjectSchemaInfo(- attributes = {- @TargetAttributeType(type = Void.class),- @TargetAttributeType(name = "some_int_attribute", type = Integer.class),- @TargetAttributeType(- name = "some_object_attribute",- type = TestAnnotatedTargetProcessStub.class)- },- elements = {- @TargetElementType(index = "reserved", type = Void.class)- })- static class TestAnnotatedTargetRootWithListedAttrs extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootWithListedAttrs(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }- }-- @Test- public void testAnnotatedRootSchemaWithListedAttrs() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema =- ctx.getSchemaForClass(TestAnnotatedTargetRootWithListedAttrs.class);-- SchemaName schemaProc = ctx.nameFromClass(TestAnnotatedTargetProcessStub.class);-- TargetObjectSchema exp = addBasicAttributes(ctx.builder(schema.getName()))- .addInterface(TargetAggregate.class)- .setDefaultAttributeSchema(new DefaultAttributeSchema("",- EnumerableTargetObjectSchema.VOID.getName(), false, false, false))- .addAttributeSchema(new DefaultAttributeSchema("some_int_attribute",- EnumerableTargetObjectSchema.INT.getName(), false, false, false), null)- .addAttributeSchema(new DefaultAttributeSchema("some_object_attribute",- schemaProc, false, false, false), null)- .addElementSchema("reserved", EnumerableTargetObjectSchema.VOID.getName(), null)- .build();- assertEquals(exp, schema);- assertEquals("TestAnnotatedTargetRootWithListedAttrs", schema.getName().toString());- }-- @TargetObjectSchemaInfo(elementResync = ResyncMode.ONCE, attributeResync = ResyncMode.ALWAYS)- static class TestAnnotatedTargetRootWithResyncModes extends DefaultTargetModelRoot {-- public TestAnnotatedTargetRootWithResyncModes(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }- }-- @Test- public void testAnnotatedRootWithResyuncModes() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema =- ctx.getSchemaForClass(TestAnnotatedTargetRootWithResyncModes.class);-- TargetObjectSchema exp = addBasicAttributes(ctx.builder(schema.getName()))- .addInterface(TargetAggregate.class)- .setElementResyncMode(ResyncMode.ONCE)- .setAttributeResyncMode(ResyncMode.ALWAYS)- .build();- assertEquals(exp, schema);- }-- static class NotAPrimitive {- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootWithAnnotatedAttrsBadType extends DefaultTargetModelRoot {-- public TestAnnotatedTargetRootWithAnnotatedAttrsBadType(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @TargetAttributeType- public NotAPrimitive getSomeErrAttribute() {- return null; // Doesn't matter- }- }-- @Test(expected = IllegalArgumentException.class)- public void testAnnotatedRootSchemaWithAnnotatedAttrsBadType() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- ctx.getSchemaForClass(TestAnnotatedTargetRootWithAnnotatedAttrsBadType.class);- }-- @Test(expected = IllegalArgumentException.class)- public void testNotAnnotated() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- ctx.getSchemaForClass(DefaultTargetObject.class);- }-- static class Dummy {- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootWithAnnotatedAttrsNonUnique<T extends Dummy & TargetProcess & TargetInterpreter>- extends DefaultTargetModelRoot {-- public TestAnnotatedTargetRootWithAnnotatedAttrsNonUnique(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @TargetAttributeType- public T getSomeErrAttribute() {- return null; // Doesn't matter- }- }-- @Test(expected = IllegalArgumentException.class)- public void testAnnotatedRootWithAnnotatedAttrsNonUnique() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- ctx.getSchemaForClass(TestAnnotatedTargetRootWithAnnotatedAttrsNonUnique.class);- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootWithElemsNonUnique<T extends Dummy & TargetProcess & TargetInterpreter>- extends DefaultTargetModelRoot {-- public TestAnnotatedTargetRootWithElemsNonUnique(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @Override- public CompletableFuture<? extends Map<String, ? extends T>> fetchElements(- RefreshBehavior refresh) {- return null; // Doesn't matter- }- }-- @Test(expected = IllegalArgumentException.class)- public void testAnnotatedRootWithElemsNonUnique() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- ctx.getSchemaForClass(TestAnnotatedTargetRootWithElemsNonUnique.class);- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootWithAnnotatedAttrsBadName extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootWithAnnotatedAttrsBadName(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @TargetAttributeType- public int get() {- return 0; // Doesn't matter- }- }-- @Test(expected = IllegalArgumentException.class)- public void testAnnotatedRootSchemaWithAnnotatedAttrsBadName() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- ctx.getSchemaForClass(TestAnnotatedTargetRootWithAnnotatedAttrsBadName.class);- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootWithAnnotatedAttrsBadGetter extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootWithAnnotatedAttrsBadGetter(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @TargetAttributeType- public int getSomeIntAttribute(boolean bogus) {- return 0; // Doesn't matter- }- }-- @Test(expected = IllegalArgumentException.class)- public void testAnnotatedRootSchemaWithAnnotatedAttrsBadGetter() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- ctx.getSchemaForClass(TestAnnotatedTargetRootWithAnnotatedAttrsBadGetter.class);- }-- @TargetObjectSchemaInfo(- attributes = @TargetAttributeType(name = "some_attr", type = NotAPrimitive.class))- static class TestAnnotatedTargetRootWithListedAttrsBadType extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootWithListedAttrsBadType(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }- }-- @Test(expected = IllegalArgumentException.class)- public void testAnnotatedRootSchemaWithListAttrsBadType() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- ctx.getSchemaForClass(TestAnnotatedTargetRootWithListedAttrsBadType.class);- }-- @TargetObjectSchemaInfo- static class TestAnnotatedTargetRootWithExportedTargetMethod extends DefaultTargetModelRoot {- public TestAnnotatedTargetRootWithExportedTargetMethod(AbstractDebuggerObjectModel model,- String typeHint) {- super(model, typeHint);- }-- @TargetMethod.Export("MyMethod")- public CompletableFuture<Void> myMethod() {- return AsyncUtils.nil();- }- }-- @Test- public void testAnnotatedRootSchemaWithExportedTargetMethod() {- AnnotatedSchemaContext ctx = new AnnotatedSchemaContext();- TargetObjectSchema schema =- ctx.getSchemaForClass(TestAnnotatedTargetRootWithExportedTargetMethod.class);-- AttributeSchema methodSchema = schema.getAttributeSchema("MyMethod");- assertEquals(- new DefaultAttributeSchema("MyMethod", new SchemaName("Method"), true, true, true),- methodSchema);- assertTrue(- ctx.getSchema(new SchemaName("Method")).getInterfaces().contains(TargetMethod.class));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/TargetObjectSchemaValidationTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/TargetObjectSchemaValidationTest.javadeleted file mode 100644index 2c2a26932f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/TargetObjectSchemaValidationTest.java+++ /dev/null@@ -1,316 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.target.schema;--import static org.junit.Assert.*;--import java.util.List;-import java.util.Map;-import java.util.concurrent.CompletableFuture;-import java.util.concurrent.ExecutionException;--import org.apache.commons.lang3.exception.ExceptionUtils;-import org.junit.Test;--import ghidra.dbg.agent.*;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.DefaultTargetObjectSchema.DefaultAttributeSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.AttributeSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.program.model.address.AddressFactory;--public class TargetObjectSchemaValidationTest {- protected DefaultSchemaContext ctx = new DefaultSchemaContext();-- protected SchemaName nameRoot = new SchemaName("Root");-- protected SchemaName nameDown1 = new SchemaName("Down1");- protected TargetObjectSchema schemaDown1 = ctx.builder(nameDown1)- .buildAndAdd();-- protected SchemaName nameWReq = new SchemaName("WithRequired");- protected TargetObjectSchema schemaWReq = ctx.builder(nameWReq)- .addAttributeSchema(new DefaultAttributeSchema("req",- EnumerableTargetObjectSchema.ANY.getName(), true, false, false), null)- .buildAndAdd();-- protected AbstractDebuggerObjectModel model = new AbstractDebuggerObjectModel() {- @Override- public CompletableFuture<? extends TargetObject> fetchModelRoot() {- fail();- return null;- }-- @Override- public AddressFactory getAddressFactory() {- fail();- return null;- }- };-- @Test- public void testAttributeSchemaAssignment() {- TargetObjectSchema schemaRoot = ctx.builder(nameRoot)- .addAttributeSchema(new DefaultTargetObjectSchema.DefaultAttributeSchema("my_attr",- nameDown1, false, false, false), null)- .buildAndAdd();-- DefaultTargetModelRoot root = new DefaultTargetModelRoot(model, "Root", schemaRoot);-- DefaultTargetObject<?, ?> control =- new DefaultTargetObject<>(model, root, "control", "Default");- assertNotEquals(schemaDown1, control.getSchema());-- DefaultTargetObject<?, ?> down1 =- new DefaultTargetObject<>(model, root, "my_attr", "Default");-- assertEquals(schemaDown1, down1.getSchema());- }-- @Test- public void testElementSchemaAssignment() {- TargetObjectSchema schemaRoot = ctx.builder(nameRoot)- .addElementSchema("1", nameDown1, null)- .buildAndAdd();-- DefaultTargetModelRoot root = new DefaultTargetModelRoot(model, "Root", schemaRoot);-- DefaultTargetObject<?, ?> control =- new DefaultTargetObject<>(model, root, "[0]", "Default");- assertNotEquals(schemaDown1, control.getSchema());-- DefaultTargetObject<TargetObject, TargetObject> down1 =- new DefaultTargetObject<>(model, root, "[1]", "Default");-- assertEquals(schemaDown1, down1.getSchema());- }-- static class ValidatedModelRoot extends DefaultTargetModelRoot {- public ValidatedModelRoot(AbstractDebuggerObjectModel model, String typeHint,- TargetObjectSchema schema) {- super(model, typeHint, schema);- }-- @Override- public boolean enforcesStrictSchema() {- return true;- }- }-- static class ValidatedObject extends DefaultTargetObject<TargetObject, TargetObject> {- public ValidatedObject(AbstractDebuggerObjectModel model, TargetObject parent, String key,- TargetObjectSchema schema) {- super(model, parent, key, "Object", schema);- }-- public ValidatedObject(AbstractDebuggerObjectModel model, TargetObject parent, String key) {- super(model, parent, key, "Object");- }-- @Override- public boolean enforcesStrictSchema() {- return true;- }- }-- @Test- public void testInterfaceValidation() {- TargetObjectSchema schemaRoot = ctx.builder(nameRoot)- .addInterface(TargetAggregate.class)- .buildAndAdd();-- schemaRoot.validateTypeAndInterfaces(new ValidatedModelRoot(model, "Root", schemaRoot),- List.of(), null, true);- // pass- }-- @Test(expected = AssertionError.class)- public void testInterfaceValidationErr() {- TargetObjectSchema schemaRoot = ctx.builder(nameRoot)- .addInterface(TargetProcess.class)- .buildAndAdd();-- schemaRoot.validateTypeAndInterfaces(new ValidatedModelRoot(model, "Root", schemaRoot),- List.of(), null, true);- }-- protected ValidatedModelRoot createRootAttrWReq() {- TargetObjectSchema schemaRoot = ctx.builder(nameRoot)- .addAttributeSchema(new DefaultTargetObjectSchema.DefaultAttributeSchema("my_attr",- nameWReq, false, false, false), null)- .buildAndAdd();- return new ValidatedModelRoot(model, "Root", schemaRoot);- }-- protected ValidatedModelRoot createRootElemWReq() {- TargetObjectSchema schemaRoot = ctx.builder(nameRoot)- .addElementSchema("1", nameWReq, null)- .buildAndAdd();- return new ValidatedModelRoot(model, "Root", schemaRoot);- }-- protected DefaultTargetObject<?, ?> createWReqCorrect(TargetObject root, String name) {- DefaultTargetObject<?, ?> wreq =- new DefaultTargetObject<>(model, root, name, "Default");-- wreq.changeAttributes(List.of(), Map.of("req", "Hello!"), "Initialized");- return wreq;- }-- protected ValidatedObject createWReqIncorrect(TargetObject root, String name) {- ValidatedObject wreq = new ValidatedObject(model, root, name);- return wreq;- }-- @Test- public void testAttributeValidationAtInsertViaSetAttributes() {- DefaultTargetModelRoot root = createRootAttrWReq();- DefaultTargetObject<?, ?> wreq = createWReqCorrect(root, "my_attr");- root.setAttributes(List.of(wreq), Map.of(), "Initialized");- }-- @Test(expected = AssertionError.class)- public void testAttributeValidationViaFetchAttributesErr()- throws InterruptedException, ExecutionException {- DefaultTargetModelRoot root = createRootAttrWReq();- DefaultTargetObject<?, ?> wreq = createWReqIncorrect(root, "my_attr");- try {- wreq.fetchAttributes().get();- }- catch (ExecutionException e) {- ExceptionUtils.rethrow(e.getCause());- }- }-- @Test- public void testAttributeValidationAtInsertViaChangeAttributes() {- DefaultTargetModelRoot root = createRootAttrWReq();- DefaultTargetObject<?, ?> wreq = createWReqCorrect(root, "my_attr");- root.changeAttributes(List.of(), List.of(wreq), Map.of(), "Initialized");- }-- @Test- public void testAttributeValidationAtInsertViaSetElements() {- DefaultTargetModelRoot root = createRootElemWReq();- DefaultTargetObject<?, ?> wreq = createWReqCorrect(root, "[1]");- root.setElements(List.of(wreq), Map.of(), "Initialized");- }-- @Test- public void testAttributeValidationAtInsertViaChangeElements() {- DefaultTargetModelRoot root = createRootElemWReq();- DefaultTargetObject<?, ?> wreq = createWReqCorrect(root, "[1]");- root.changeElements(List.of(), List.of(wreq), Map.of(), "Initialized");- }-- @Test(expected = AssertionError.class)- public void testValidateRequiredAttributeViaSetErr() {- TargetObjectSchema schema = ctx.builder(new SchemaName("test"))- .addAttributeSchema(new DefaultAttributeSchema("req",- EnumerableTargetObjectSchema.ANY.getName(), true, false, false), null)- .buildAndAdd();- ValidatedObject obj = new ValidatedObject(model, null, "Test", schema);-- obj.setAttributes(List.of(), Map.of("req", "Hello"), "Initialized");- obj.setAttributes(List.of(), Map.of(), "Test");- }-- @Test(expected = AssertionError.class)- public void testValidateRequiredAttributeViaChangeErr() {- TargetObjectSchema schema = ctx.builder(new SchemaName("test"))- .addAttributeSchema(new DefaultAttributeSchema("req",- EnumerableTargetObjectSchema.ANY.getName(), true, false, false), null)- .buildAndAdd();- ValidatedObject obj = new ValidatedObject(model, null, "Test", schema);-- obj.setAttributes(List.of(), Map.of("req", "Hello"), "Initialized");- obj.changeAttributes(List.of("req"), List.of(), Map.of(), "Test");- }-- @Test(expected = AssertionError.class)- public void testValidateFixedAttributeViaSetErr() {- TargetObjectSchema schema = ctx.builder(new SchemaName("test"))- .addAttributeSchema(new DefaultAttributeSchema("fix",- EnumerableTargetObjectSchema.ANY.getName(), false, true, false), null)- .buildAndAdd();- ValidatedObject obj = new ValidatedObject(model, null, "Test", schema);-- obj.setAttributes(List.of(), Map.of("fix", "Hello"), "Initialized");- obj.setAttributes(List.of(), Map.of("fix", "World"), "Test");- }-- @Test(expected = AssertionError.class)- public void testValidateFixedAttributeViaChangeErr() {- TargetObjectSchema schema = ctx.builder(new SchemaName("test"))- .addAttributeSchema(new DefaultAttributeSchema("fix",- EnumerableTargetObjectSchema.ANY.getName(), false, true, false), null)- .buildAndAdd();- ValidatedObject obj = new ValidatedObject(model, null, "Test", schema);-- obj.setAttributes(List.of(), Map.of("fix", "Hello"), "Initialized");- // Removal of fixed attr also forbidden after it's set- obj.changeAttributes(List.of("fix"), List.of(), Map.of(), "Test");- }-- ValidatedObject createRepleteValidatedObject() {- TargetObjectSchema schema = ctx.builder(new SchemaName("test"))- .addAttributeSchema(new DefaultAttributeSchema("_display",- EnumerableTargetObjectSchema.STRING.getName(), true, false, false), null)- .addAttributeSchema(new DefaultAttributeSchema("int",- EnumerableTargetObjectSchema.INT.getName(), false, false, false), null)- .addAttributeSchema(new DefaultAttributeSchema("obj",- EnumerableTargetObjectSchema.OBJECT.getName(), false, false, false), null)- .setDefaultAttributeSchema(AttributeSchema.DEFAULT_VOID)- .buildAndAdd();- ValidatedObject obj = new ValidatedObject(model, null, "Test", schema);- return obj;- }-- @Test- public void testValidateAttributeTypesViaSet() {- ValidatedObject obj = createRepleteValidatedObject();- obj.setAttributes(List.of(), Map.of(- "_display", "Hello",- "int", 5),- "Test");- obj.setAttributes(List.of(), Map.of(- "_display", "World",- "int", 6),- "Test");- }-- @Test- public void testValidateAttributeTypesViaChange() {- ValidatedObject obj = createRepleteValidatedObject();- obj.changeAttributes(List.of(), Map.of("int", 5), "Test");- obj.changeAttributes(List.of(), Map.of("int", 6), "Test");- }-- @Test(expected = AssertionError.class)- public void testValidateAttributeTypesViaSetErr() {- ValidatedObject obj = createRepleteValidatedObject();- obj.setAttributes(List.of(), Map.of(- "_display", "World",- "int", 7.0),- "Test");- }-- @Test(expected = AssertionError.class)- public void testValidateAttributeTypesViaChangeErr() {- ValidatedObject obj = createRepleteValidatedObject();- obj.changeAttributes(List.of(), Map.of("int", 7.0), "Test");- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AbstractInvocationListener.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AbstractInvocationListener.javadeleted file mode 100644index c8ce2b7bb4..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AbstractInvocationListener.java+++ /dev/null@@ -1,35 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.LinkedList;--import ghidra.async.AsyncReference;--public abstract class AbstractInvocationListener<T> {- public final LinkedList<T> invocations = new LinkedList<>();- public final AsyncReference<Integer, Void> count = new AsyncReference<>(0);-- protected void record(T rec) {- invocations.add(rec);- count.set(invocations.size(), null);- }-- public void clear() {- invocations.clear();- count.set(0, null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AddressValidator.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AddressValidator.javadeleted file mode 100644index b5f28de63a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AddressValidator.java+++ /dev/null@@ -1,21 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--public class AddressValidator {- // TODO: Ensure 'Memory' exists before any address/range is in any callback / attribute- // TODO: Should it also verify it is covered by a known region?-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AttributesChangedListener.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AttributesChangedListener.javadeleted file mode 100644index 4bded7eb47..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/AttributesChangedListener.java+++ /dev/null@@ -1,45 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.Collection;-import java.util.Map;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.testutil.AttributesChangedListener.AttributesChangedInvocation;--public class AttributesChangedListener extends- AbstractInvocationListener<AttributesChangedInvocation> implements DebuggerModelListener {- public static class AttributesChangedInvocation {- public final TargetObject parent;- public final Collection<String> removed;- public final Map<String, ?> added;-- public AttributesChangedInvocation(TargetObject parent, Collection<String> removed,- Map<String, ?> added) {- this.parent = parent;- this.removed = removed;- this.added = added;- }- }-- @Override- public void attributesChanged(TargetObject parent, Collection<String> removed,- Map<String, ?> added) {- record(new AttributesChangedInvocation(parent, removed, added));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/CatchOffThread.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/CatchOffThread.javadeleted file mode 100644index 44b1493a18..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/CatchOffThread.java+++ /dev/null@@ -1,46 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import ghidra.util.Msg;--public class CatchOffThread implements AutoCloseable {- protected Throwable caught;-- public void catching(Runnable runnable) {- try {- runnable.run();- }- catch (Throwable e) {- if (caught == null) {- caught = e;- }- Msg.error(this, "Off-thread exception: " + e);- }- }-- @Override- public void close() throws Exception {- if (caught != null) {- if (caught instanceof Exception) {- throw (Exception) caught;- }- else {- throw new AssertionError("Off-thread exception", caught);- }- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DebuggerConsole.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DebuggerConsole.javadeleted file mode 100644index 4a03847b2f..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DebuggerConsole.java+++ /dev/null@@ -1,88 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.io.*;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetConsole.Channel;-import ghidra.dbg.target.TargetInterpreter;-import ghidra.dbg.target.TargetObject;--public class DebuggerConsole extends Thread implements DebuggerModelListener, AutoCloseable {- private final DebuggerObjectModel model;- private final BufferedReader reader;-- private TargetInterpreter interpreter;- private boolean closed = false;-- public DebuggerConsole(DebuggerObjectModel model) {- this.model = model;- this.reader = new BufferedReader(new InputStreamReader(System.in));-- model.addModelListener(this);- setDaemon(true);- start();- }-- @Override- public void consoleOutput(TargetObject console, Channel channel, byte[] data) {- if (console instanceof TargetInterpreter) {- if (interpreter == null) {- System.out.println("Found interpreter: " + console);- interpreter = (TargetInterpreter) console;- }- }- String text = new String(data);- System.out.println(text);- }-- @Override- public void run() {- try {- while (!closed) {- String line = reader.readLine();- if (line == null) {- // NB. EOF happens immediately under Gradle- return;- }- if (interpreter == null) {- System.err.println("Have not found interpreter, yet");- continue;- }- interpreter.execute(line).whenComplete((__, ex) -> {- if (ex != null) {- System.err.println("Command error: " + ex.getMessage());- }- else {- System.out.println("Command finished");- }- });- }- }- catch (IOException e) {- System.err.println("IOException on console: " + e);- }- }-- @Override- public void close() throws Exception {- model.removeModelListener(this);- closed = true;- interrupt();- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/ElementTrackingListener.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/ElementTrackingListener.javadeleted file mode 100644index a38020615d..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/ElementTrackingListener.java+++ /dev/null@@ -1,68 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.*;--import org.apache.commons.lang3.reflect.TypeUtils;-import org.apache.commons.lang3.reflect.Typed;--import ghidra.async.AsyncReference;-import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.PathUtils.TargetObjectKeyComparator;--public class ElementTrackingListener<T extends TargetObject> implements DebuggerModelListener {- public final Class<T> valType;- public final Map<String, T> elements = new TreeMap<>(TargetObjectKeyComparator.ELEMENT);- public final AsyncReference<Integer, Void> size = new AsyncReference<>();- public final Map<String, AsyncReference<T, Void>> waitElems = new HashMap<>();-- public ElementTrackingListener(Class<T> valType) {- this.valType = valType;- }-- @SuppressWarnings({ "rawtypes", "unchecked" })- public ElementTrackingListener(Typed<T> valType) {- this((Class) TypeUtils.getRawType(valType.getType(), null));- }-- public synchronized AsyncReference<T, Void> refElement(String index) {- T elem = elements.get(index);- AsyncReference<T, Void> ref = new AsyncReference<>(elem);- waitElems.put(index, ref);- return ref;- }-- @Override- public synchronized void elementsChanged(TargetObject parent, Collection<String> removed,- Map<String, ? extends TargetObject> added) {- elements.keySet().removeAll(removed);- putAll(added);- }-- public synchronized void putAll(Map<String, ? extends TargetObject> update) {- for (Map.Entry<String, ? extends TargetObject> ent : update.entrySet()) {- T val = valType.cast(ent.getValue());- elements.put(ent.getKey(), val);- AsyncReference<T, Void> ref = waitElems.get(ent.getKey());- if (ref != null) {- ref.set(val, null);- }- }- size.set(elements.size(), null);- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/ElementsChangedListener.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/ElementsChangedListener.javadeleted file mode 100644index 98dd5021b9..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/ElementsChangedListener.java+++ /dev/null@@ -1,45 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.Collection;-import java.util.Map;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.testutil.ElementsChangedListener.ElementsChangedInvocation;--public class ElementsChangedListener extends AbstractInvocationListener<ElementsChangedInvocation>- implements DebuggerModelListener {- public static class ElementsChangedInvocation {- public final TargetObject parent;- public final Collection<String> removed;- public final Map<String, ? extends TargetObject> added;-- public ElementsChangedInvocation(TargetObject parent, Collection<String> removed,- Map<String, ? extends TargetObject> added) {- this.parent = parent;- this.removed = removed;- this.added = added;- }- }-- @Override- public void elementsChanged(TargetObject parent, Collection<String> removed,- Map<String, ? extends TargetObject> added) {- record(new ElementsChangedInvocation(parent, removed, added));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/EventSequenceListener.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/EventSequenceListener.javadeleted file mode 100644index 15c9eaf1b9..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/EventSequenceListener.java+++ /dev/null@@ -1,85 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.*;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetEventScope.TargetEventType;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetThread;--public class EventSequenceListener implements DebuggerModelListener {- public static class EventRecord {- public final TargetObject object;- public final TargetThread eventThread;- public final TargetEventType type;- public final String description;- public final List<Object> parameters;-- public EventRecord(TargetObject object, TargetThread eventThread, TargetEventType type,- String description, List<Object> parameters) {- this.object = object;- this.eventThread = eventThread;- this.type = type;- this.description = description;- this.parameters = parameters;- }-- @Override- public String toString() {- return String.format("<EventRecord obj=%s thread=%s type=%s desc='%s' params=%s",- object, eventThread, type, description, parameters);- }-- @Override- public boolean equals(Object obj) {- if (!(obj instanceof EventRecord)) {- return false;- }- EventRecord that = (EventRecord) obj;- if (!Objects.equals(this.object, that.object)) {- return false;- }- if (!Objects.equals(this.eventThread, that.eventThread)) {- return false;- }- if (!Objects.equals(this.type, that.type)) {- return false;- }- if (!Objects.equals(this.description, that.description)) {- return false;- }- if (!Objects.equals(this.parameters, that.parameters)) {- return false;- }- return true;- }-- @Override- public int hashCode() {- return Objects.hash(object, eventThread, type, description, parameters);- }- }-- public final List<EventRecord> events = new ArrayList<>();-- @Override- public void event(TargetObject object, TargetThread eventThread, TargetEventType type,- String description, List<Object> parameters) {- events.add(new EventRecord(object, eventThread, type, description, parameters));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/InvalidatedListener.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/InvalidatedListener.javadeleted file mode 100644index 2e5c326601..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/InvalidatedListener.java+++ /dev/null@@ -1,45 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.testutil.InvalidatedListener.InvalidatedInvocation;--public class InvalidatedListener extends AbstractInvocationListener<InvalidatedInvocation>- implements DebuggerModelListener {- public static class InvalidatedInvocation {- public final TargetObject object;- public final TargetObject branch;- public final String reason;-- public InvalidatedInvocation(TargetObject object, TargetObject branch, String reason) {- this.object = object;- this.branch = branch;- this.reason = reason;- }-- @Override- public String toString() {- return String.format("<InvalidatedInvocation '%s' because '%s'>", object, reason);- }- }-- @Override- public void invalidated(TargetObject object, TargetObject branch, String reason) {- record(new InvalidatedInvocation(object, branch, reason));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/RegisterUpdateValidator.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/RegisterUpdateValidator.javadeleted file mode 100644index b3197ed4e7..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/RegisterUpdateValidator.java+++ /dev/null@@ -1,20 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--public class RegisterUpdateValidator {- // Ensure updates are for registers that exist in the descriptions-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TargetObjectAddedWaiter.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TargetObjectAddedWaiter.javadeleted file mode 100644index 9e693b2aaa..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TargetObjectAddedWaiter.java+++ /dev/null@@ -1,124 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.*;-import java.util.Map.Entry;-import java.util.concurrent.CompletableFuture;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.*;--public class TargetObjectAddedWaiter- implements DebuggerModelListener, DebuggerModelTestUtils, AutoCloseable {- private final DebuggerCallbackReorderer reorderer = new DebuggerCallbackReorderer(this);- private final Map<List<String>, CompletableFuture<Object>> pathBacklog = new HashMap<>();- private final Map<PathPredicates, CompletableFuture<NavigableMap<List<String>, ?>>> predBacklog =- new HashMap<>();- private final DebuggerObjectModel model;-- public TargetObjectAddedWaiter(DebuggerObjectModel model) {- this.model = model;- model.addModelListener(reorderer, true);- }-- @Override- public void close() throws Exception {- model.removeModelListener(reorderer);- }-- protected void retryBacklogs() {- synchronized (predBacklog) {- // NB. getModelRoot() can be non-null before rootAdded. Use fetch.getNow instead.- TargetObject root = model.fetchModelRoot().getNow(null);- if (root != null) {- for (Iterator<Entry<PathPredicates, CompletableFuture<NavigableMap<List<String>, ?>>>> it =- predBacklog.entrySet().iterator(); it.hasNext();) {- Entry<PathPredicates, CompletableFuture<NavigableMap<List<String>, ?>>> ent =- it.next();- NavigableMap<List<String>, ?> values = ent.getKey().getCachedValues(root);- if (!values.isEmpty()) {- // NB. This is completed with a lock, but tests should just use waitOn- ent.getValue().complete(values);- it.remove();- }- }- }- }- }-- @Override- public void rootAdded(TargetObject root) {- retryBacklogs();- }-- @Override- public void attributesChanged(TargetObject object, Collection<String> removed,- Map<String, ?> added) {- for (Entry<String, ?> ent : added.entrySet()) {- List<String> attrPath = PathUtils.extend(object.getPath(), ent.getKey());- CompletableFuture<Object> cf = pathBacklog.remove(attrPath);- if (cf != null) {- cf.complete(ent.getValue());- }- }- retryBacklogs();- }-- @Override- public void elementsChanged(TargetObject object, Collection<String> removed,- Map<String, ? extends TargetObject> added) {- for (Entry<String, ?> ent : added.entrySet()) {- List<String> elemPath = PathUtils.index(object.getPath(), ent.getKey());- CompletableFuture<Object> cf = pathBacklog.remove(elemPath);- if (cf != null) {- cf.complete(ent.getValue());- }- }- retryBacklogs();- }-- public CompletableFuture<?> wait(List<String> path) {- Objects.requireNonNull(path);- synchronized (pathBacklog) {- Object val = model.getModelValue(path);- if (val != null) {- return CompletableFuture.completedFuture(val);- }- CompletableFuture<Object> promise = new CompletableFuture<>();- pathBacklog.put(path, promise);- return promise;- }- }-- public CompletableFuture<NavigableMap<List<String>, ?>> waitAtLeastOne(- PathPredicates predicates) {- synchronized (predBacklog) {- TargetObject root = model.getModelRoot();- if (root != null) {- NavigableMap<List<String>, ?> result = predicates.getCachedValues(root);- if (!result.isEmpty()) {- return CompletableFuture.completedFuture(result);- }- }- CompletableFuture<NavigableMap<List<String>, ?>> promise = new CompletableFuture<>();- predBacklog.put(predicates, promise);- return promise;- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TargetObjectCreatedWaiter.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TargetObjectCreatedWaiter.javadeleted file mode 100644index 3cefb85e7a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TargetObjectCreatedWaiter.java+++ /dev/null@@ -1,87 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.*;-import java.util.concurrent.CompletableFuture;-import java.util.function.Predicate;-import java.util.stream.Collectors;--import ghidra.dbg.DebuggerModelListener;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetObject;--public class TargetObjectCreatedWaiter implements DebuggerModelListener {- private final Map<List<String>, CompletableFuture<TargetObject>> pathBacklog = new HashMap<>();- private final Map<Predicate<? super TargetObject>, CompletableFuture<Set<TargetObject>>> predBacklog =- new HashMap<>();- private final DebuggerObjectModel model;-- public TargetObjectCreatedWaiter(DebuggerObjectModel model) {- this.model = model;- model.addModelListener(this, false);- }-- @Override- public void created(TargetObject object) {- CompletableFuture<TargetObject> cf;- synchronized (pathBacklog) {- cf = pathBacklog.remove(object.getPath());- }- if (cf != null) {- cf.complete(object);- }- Map<Predicate<? super TargetObject>, CompletableFuture<Set<TargetObject>>> matched;- synchronized (predBacklog) {- matched = predBacklog.entrySet()- .stream()- .filter(e -> e.getKey().test(object))- .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));- predBacklog.keySet().removeAll(matched.keySet());- }- if (!matched.isEmpty()) {- Set<TargetObject> result = Set.of(object);- for (CompletableFuture<Set<TargetObject>> promise : matched.values()) {- promise.complete(result);- }- }- }-- public CompletableFuture<TargetObject> wait(List<String> path) {- synchronized (pathBacklog) {- TargetObject obj = model.getModelObject(path);- if (obj != null) {- return CompletableFuture.completedFuture(obj);- }- CompletableFuture<TargetObject> promise = new CompletableFuture<>();- pathBacklog.put(path, promise);- return promise;- }- }-- public CompletableFuture<Set<TargetObject>> waitAtLeastOne(- Predicate<? super TargetObject> predicate) {- synchronized (predBacklog) {- Set<TargetObject> result = model.getModelObjects(predicate);- if (!result.isEmpty()) {- return CompletableFuture.completedFuture(result);- }- CompletableFuture<Set<TargetObject>> promise = new CompletableFuture<>();- predBacklog.put(predicate, promise);- return promise;- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TestDebuggerModelProvider.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TestDebuggerModelProvider.javadeleted file mode 100644index 4913b0c9f2..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/TestDebuggerModelProvider.java+++ /dev/null@@ -1,101 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.testutil;--import java.util.List;-import java.util.Map;-import java.util.function.Function;--import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.util.PathPredicates;--public interface TestDebuggerModelProvider {- interface ModelHost extends AutoCloseable {- interface WithoutThreadValidation extends AutoCloseable {- }-- Map<String, Object> getFactoryOptions();-- ModelHost build() throws Throwable;-- DebuggerObjectModel buildModel(Map<String, Object> options) throws Throwable;-- DebuggerObjectModel getModel();-- void validateCompletionThread();-- TargetObject getRoot() throws Throwable;-- List<String> getBogusPath();-- boolean hasDetachableProcesses();-- boolean hasInterpreter();-- boolean hasInterruptibleProcesses();-- boolean hasKillableProcesses();-- boolean hasResumableProcesses();-- boolean hasAttachableContainer();-- boolean hasAttacher();-- boolean hasEventScope();-- boolean hasLauncher();-- boolean hasProcessContainer();-- WithoutThreadValidation withoutThreadValidation();-- <T extends TargetObject> T find(Class<T> cls, List<String> seedPath) throws Throwable;-- /**- * Use the schema to find the appropriate path, substituting the given index for a wildcard- * at most once, then get or wait for that object- *- * @param <T> the type of object- * @param cls the class giving the type- * @param index the index when needed- * @param seedPath the seed path for the search. The result will be a successor- * @return the found object, or {@code null} if the schema does not give it- * @throws Throwable if anything goes wrong- */- <T extends TargetObject> T findWithIndex(Class<T> cls, String index, List<String> seedPath)- throws Throwable;-- <T extends TargetObject> T findAny(Class<T> cls, List<String> seedPath) throws Throwable;-- <T extends TargetObject> Map<List<String>, T> findAll(Class<T> cls, List<String> seedPath,- boolean atLeastOne) throws Throwable;-- <T extends TargetObject> Map<List<String>, T> findAll(Class<T> cls, List<String> seedPath,- Function<PathPredicates, PathPredicates> adjustPredicates, boolean atLeastOne)- throws Throwable;-- TargetObject findContainer(Class<? extends TargetObject> cls, List<String> seedPath)- throws Throwable;-- <T extends TargetObject> T suitable(Class<T> cls, List<String> seedPath) throws Throwable;-- TargetObjectAddedWaiter getAddedWaiter();- }-- ModelHost modelHost() throws Throwable;-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/PathPredicatesTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/PathPredicatesTest.javadeleted file mode 100644index 808dc2c21a..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/PathPredicatesTest.java+++ /dev/null@@ -1,41 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import static org.junit.Assert.assertEquals;--import java.util.Set;--import org.junit.Test;--public class PathPredicatesTest {- @Test- public void testGetPrevKeys() {- PathPredicates pred = PathPredicates.parse("Processes[0].Threads[].Stack");-- assertEquals(Set.of("Stack"), pred.getPrevKeys(PathUtils.parse("")));- assertEquals(Set.of("[]"), pred.getPrevKeys(PathUtils.parse("Stack")));- assertEquals(Set.of("Threads"), pred.getPrevKeys(PathUtils.parse("[].Stack")));- assertEquals(Set.of("[0]"), pred.getPrevKeys(PathUtils.parse("Threads[].Stack")));- assertEquals(Set.of("Processes"), pred.getPrevKeys(PathUtils.parse("[0].Threads[].Stack")));- assertEquals(Set.of(), pred.getPrevKeys(PathUtils.parse("Processes[0].Threads[].Stack")));-- assertEquals(Set.of(),- pred.getPrevKeys(PathUtils.parse("Foo.Processes[0].Threads[].Stack")));- assertEquals(Set.of(), pred.getPrevKeys(PathUtils.parse("Foo")));- assertEquals(Set.of(), pred.getPrevKeys(PathUtils.parse("[]")));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/StreamTokenizerExperimentsTest.java b/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/StreamTokenizerExperimentsTest.javadeleted file mode 100644index f8e97be133..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/StreamTokenizerExperimentsTest.java+++ /dev/null@@ -1,67 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.dbg.util;--import static org.junit.Assert.assertEquals;--import java.io.*;-import java.util.ArrayList;-import java.util.List;--import org.junit.Test;--public class StreamTokenizerExperimentsTest {- public static List<String> tokenize(String cmdLine) {- List<String> list = new ArrayList<>();- StreamTokenizer tokenizer =- new StreamTokenizer(new StringReader(cmdLine));- tokenizer.wordChars(0, 255);- tokenizer.whitespaceChars(' ', ' ');- tokenizer.quoteChar('"');-- try {- @SuppressWarnings("unused")- int type;- while (StreamTokenizer.TT_EOF != (type = tokenizer.nextToken())) {- //System.err.println("type=" + type);- list.add(tokenizer.sval);- }- }- catch (IOException e) {- throw new AssertionError(e);- }-- return list;- }-- @Test- public void testStreamTokenizerString() {- assertEquals(List.of("echo", "Hello, World!"), tokenize("echo \"Hello, World!\""));- }-- @Test- public void testStreamTokenizerEscapedQuoteInString() {- assertEquals(List.of("echo", "Hello, \"World!"), tokenize("echo \"Hello, \\\"World!\""));- }-- /**- * Sigh. Escapes are not recognized outside of strings.- */- @Test- public void testStreamTokenizerEscapedSpace() {- assertEquals(List.of("echo", "Hello,\\", "World!"), tokenize("echo Hello,\\ World!"));- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/resources/ghidra/dbg/model/test_schema.xml b/Ghidra/Debug/Framework-Debugging/src/test/resources/ghidra/dbg/model/test_schema.xmldeleted file mode 100644index 8a3eebeb83..0000000000--- a/Ghidra/Debug/Framework-Debugging/src/test/resources/ghidra/dbg/model/test_schema.xml+++ /dev/null@@ -1,422 +0,0 @@-<?xml version="1.0"?>-<context>- <schema name="Test" elementResync="NEVER" attributeResync="ONCE">- <interface name="EventScope" />- <interface name="Launcher" />- <interface name="ActiveScope" />- <interface name="FocusScope" />- <interface name="Aggregate" />- <element schema="VOID" />- <!-- attribute name="_accessible" schema="BOOL" hidden="yes" /-->- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="_state" schema="EXECUTION_STATE" required="yes" hidden="yes" />- <attribute name="_prompt" schema="STRING" required="yes" hidden="yes" />- <attribute name="Environment" schema="Environment" />- <attribute name="Processes" schema="ProcessContainer" required="yes" fixed="yes" />- <attribute name="Interpreter" schema="Interpreter" />- <attribute name="JavaMimic" schema="Launcher" />- <attribute schema="ANY" />- </schema>- <schema name="Environment" elementResync="NEVER" attributeResync="NEVER">- <interface name="Environment" />- <element schema="VOID" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="Arch" schema="STRING" />- <attribute name="Debugger" schema="STRING" />- <attribute name="OS" schema="STRING" />- <attribute schema="ANY" />- </schema>- <schema name="ProcessContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <element schema="Process" />- <attribute name="_event_process" schema="STRING" hidden="yes" />- <attribute name="_event_thread" schema="STRING" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="base" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="Interpreter" elementResync="NEVER" attributeResync="NEVER">- <interface name="Interpreter" />- <element schema="VOID" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="Arch" schema="STRING" />- <attribute name="Debugger" schema="STRING" />- <attribute name="OS" schema="STRING" />- <attribute schema="ANY" />- </schema>- <schema name="Launcher" elementResync="NEVER" attributeResync="NEVER">- <interface name="Launcher" />- <element schema="VOID" />- <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema>- <schema name="Process" elementResync="NEVER" attributeResync="ONCE">- <interface name="Aggregate" />- <interface name="Process" />- <element schema="VOID" />- <attribute name="_pid" schema="LONG" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="Breakpoints" schema="BreakpointContainer" required="yes" fixed="yes" />- <attribute name="Memory" schema="Memory" required="yes" fixed="yes" />- <attribute name="Modules" schema="ModuleContainer" required="yes" fixed="yes" />- <!-- <attribute name="Registers" schema="RegisterContainer" required="yes" fixed="yes" /> -->- <attribute name="Threads" schema="ThreadContainer" required="yes" fixed="yes" />- <attribute name="Devices" schema="OBJECT" />- <attribute name="Environment" schema="OBJECT" />- <attribute name="Handle" schema="OBJECT" />- <attribute name="Id" schema="OBJECT" />- <attribute name="Io" schema="OBJECT" />- <attribute name="Name" schema="OBJECT" />- <attribute schema="ANY" />- </schema>- <schema name="Memory" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Memory" />- <element schema="MemoryRegion" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="ModuleContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="ModuleContainer" />- <element schema="Module" />- <attribute name="_supports_synthetic_modules" schema="BOOL" fixed="yes" hidden="yes" />- <attribute name="_event_process" schema="STRING" hidden="yes" />- <attribute name="_event_thread" schema="STRING" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="ThreadContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <element schema="Thread" />- <attribute name="_event_process" schema="STRING" hidden="yes" />- <attribute name="_event_thread" schema="STRING" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="MemoryRegion" elementResync="NEVER" attributeResync="NEVER">- <interface name="MemoryRegion" />- <element schema="VOID" />- <attribute name="_memory" schema="Memory" />- <attribute name="_range" schema="RANGE" required="yes" hidden="yes" />- <attribute name="_readable" schema="BOOL" required="yes" hidden="yes" />- <attribute name="_writable" schema="BOOL" required="yes" hidden="yes" />- <attribute name="_executable" schema="BOOL" required="yes" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="BaseAddress" schema="ADDRESS" />- <attribute name="EndAddress" schema="ADDRESS" />- <attribute name="RegionSize" schema="STRING" />- <attribute name="AllocationBase" schema="ADDRESS" />- <attribute name="AllocationProtect" schema="STRING" />- <attribute name="Protect" schema="STRING" />- <attribute name="State" schema="STRING" />- <attribute name="Type" schema="STRING" />- <attribute schema="VOID" />- </schema>- <schema name="Thread" elementResync="NEVER" attributeResync="NEVER">- <interface name="Thread" />- <interface name="Aggregate" />- <interface name="ExecutionStateful" />- <interface name="Steppable" />- <interface name="Resumable" />- <interface name="Interruptible" />- <interface name="Killable" />- <element schema="VOID" />- <attribute name="_tid" schema="INT" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="_accessible" schema="BOOL" required="yes" hidden="yes" />- <attribute name="_state" schema="EXECUTION_STATE" required="yes" hidden="yes" />- <attribute name="_supported_step_kinds" schema="SET_STEP_KIND" required="yes" fixed="yes" hidden="yes" />- <attribute name="Stack" schema="Stack" required="yes" fixed="yes" />- <attribute name="RegisterBank" schema="RegisterBank" fixed="yes" />- <attribute name="Environment" schema="OBJECT" />- <attribute name="Id" schema="OBJECT" />- <attribute name="Name" schema="OBJECT" />- <attribute name="_arch" schema="STRING" />- <attribute schema="ANY" />- </schema>- <schema name="Module" elementResync="NEVER" attributeResync="NEVER">- <interface name="Module" />- <element schema="VOID" />- <attribute name="_range" schema="RANGE" required="yes" hidden="yes" />- <attribute name="_module_name" schema="STRING" required="yes" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="BaseAddress" schema="OBJECT" />- <attribute name="ImageName" schema="OBJECT" />- <attribute name="TimeStamp" schema="OBJECT" />- <attribute name="Len" schema="OBJECT" />- <attribute name="Name" schema="OBJECT" />- <attribute name="Size" schema="OBJECT" />- <attribute name="Sections" schema="SectionContainer" />- <attribute schema="ANY" />- </schema>- <schema name="SectionContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="SectionContainer" />- <element schema="Section" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="Section" elementResync="NEVER" attributeResync="NEVER">- <interface name="Section" />- <element schema="VOID" />- <attribute name="_module" schema="Module" hidden="yes" />- <attribute name="_range" schema="RANGE" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="BreakpointContainer" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointSpecContainer" />- <interface name="BreakpointLocationContainer" />- <element schema="Breakpoint" />- <attribute name="_supported_breakpoint_kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="SymbolContainer" canonical="yes" elementResync="ONCE" attributeResync="NEVER">- <interface name="SymbolNamespace" />- <element schema="Symbol" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="RegisterContainer" elementResync="NEVER" attributeResync="NEVER">- <interface name="RegisterContainer" />- <element schema="RegisterDescriptor" />- <attribute name="_descriptions" schema="RegisterContainer" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- </schema>- <schema name="RegisterBank" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="RegisterBank" />- <interface name="RegisterContainer" />- <!-- NB: registers are attributes, not elements here -->- <element schema="VOID" />- <attribute schema="RegisterValue" />- <attribute name="_descriptions" schema="RegisterContainer" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- </schema>- <schema name="Stack" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="Stack" />- <element schema="StackFrame" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="ANY" />- </schema>- <schema name="Breakpoint" canonical="yes" elementResync="NEVER" attributeResync="NEVER">- <interface name="BreakpointSpec" />- <interface name="BreakpointLocation" />- <interface name="Deletable" />- <element schema="OBJECT" />- <attribute name="_enabled" schema="BOOL" required="yes" hidden="yes" />- <attribute name="_expression" schema="STRING" required="yes" hidden="yes" />- <attribute name="_kinds" schema="SET_BREAKPOINT_KIND" required="yes" hidden="yes" />- <attribute name="_container" schema="BreakpointContainer" />- <attribute name="_affects" schema="LIST_OBJECT" hidden="yes" />- <attribute name="_spec" schema="Breakpoint" />- <attribute name="_range" schema="RANGE" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="Type" schema="OBJECT" />- <attribute name="Disposition" schema="OBJECT" />- <attribute name="Pending" schema="OBJECT" />- <attribute name="Times" schema="OBJECT" />- <attribute schema="VOID" />- </schema>- <schema name="StackFrame" elementResync="NEVER" attributeResync="NEVER">- <interface name="StackFrame" />- <element schema="VOID" />- <attribute name="_pc" schema="ADDRESS" required="yes" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="Attributes" schema="StackFrameAttributes" />- <attribute schema="ANY" />- </schema>- <schema name="StackFrameAttributes" elementResync="NEVER" attributeResync="NEVER">- <element schema="VOID" />- <attribute name="_pc" schema="ADDRESS" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute name="FrameNumber" schema="OBJECT" />- <attribute name="FrameOffset" schema="OBJECT" />- <attribute name="FuncTableEntry" schema="OBJECT" />- <attribute name="InstructionOffset" schema="OBJECT" />- <attribute name="ReturnOffset" schema="OBJECT" />- <attribute name="StackOffset" schema="OBJECT" />- <attribute name="Virtual" schema="OBJECT" />- <attribute schema="ANY" />- </schema>- <schema name="Symbol" elementResync="NEVER" attributeResync="NEVER">- <interface name="Symbol" />- <element schema="VOID" />- <attribute name="_namespace" schema="SymbolContainer" />- <attribute name="_data_type" schema="DATA_TYPE" fixed="yes" hidden="yes" />- <attribute name="_size" schema="LONG" fixed="yes" hidden="yes" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ADDRESS" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema>- <schema name="RegisterDescriptor" elementResync="NEVER" attributeResync="NEVER">- <interface name="Register" />- <element schema="VOID" />- <attribute name="_length" schema="INT" fixed="yes" hidden="yes" />- <attribute name="_container" schema="RegisterContainer" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" required="yes" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema>- <schema name="RegisterValue" elementResync="NEVER" attributeResync="NEVER">- <interface name="Register" />- <element schema="VOID" />- <attribute name="_length" schema="INT" fixed="yes" hidden="yes" />- <attribute name="_container" schema="RegisterContainer" />- <attribute name="_modified" schema="BOOL" hidden="yes" />- <attribute name="_display" schema="STRING" hidden="yes" />- <attribute name="_kind" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_short_display" schema="STRING" hidden="yes" />- <attribute name="_value" schema="ANY" required="yes" hidden="yes" />- <attribute name="_type" schema="STRING" hidden="yes" />- <attribute name="_order" schema="INT" hidden="yes" />- <attribute schema="VOID" />- </schema>- <schema name="Method" elementResync="NEVER" attributeResync="NEVER">- <interface name="Method" />- <element schema="VOID" />- <attribute name="_display" schema="STRING" fixed="yes" hidden="yes" />- <attribute name="_return_type" schema="TYPE" fixed="yes" hidden="yes" />- <attribute name="_parameters" schema="MAP_PARAMETERS" fixed="yes" hidden="yes" />- <attribute schema="VOID" />- </schema>-</context>diff --git a/Ghidra/Debug/Framework-TraceModeling/build.gradle b/Ghidra/Debug/Framework-TraceModeling/build.gradleindex 7aec2d3efb..a65ef6d0ce 100644--- a/Ghidra/Debug/Framework-TraceModeling/build.gradle+++ b/Ghidra/Debug/Framework-TraceModeling/build.gradle@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -26,7 +26,7 @@ dependencies {api project(':SoftwareModeling')api project(':Emulation')api project(':ProposedUtils')- api project(':Framework-Debugging')+ api project(':Framework-AsyncComm') // for AsyncReferenceannotationProcessor project(':AnnotationValidator')testImplementation project(':Base')diff --git a/Ghidra/Debug/Framework-TraceModeling/certification.manifest b/Ghidra/Debug/Framework-TraceModeling/certification.manifestindex 7ea17c8468..11e7fa1906 100644--- a/Ghidra/Debug/Framework-TraceModeling/certification.manifest+++ b/Ghidra/Debug/Framework-TraceModeling/certification.manifest@@ -1,4 +1,6 @@##VERSION: 2.0Module.manifest||GHIDRA||||END|README.md||GHIDRA||||END|+data/ExtensionPoint.manifest||GHIDRA||||END|data/tracemodeling.theme.properties||GHIDRA||||END|+src/test/resources/ghidra/dbg/model/test_schema.xml||GHIDRA||||END|diff --git a/Ghidra/Debug/Framework-TraceModeling/data/ExtensionPoint.manifest b/Ghidra/Debug/Framework-TraceModeling/data/ExtensionPoint.manifestnew file mode 100644index 0000000000..2902d85aed--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/data/ExtensionPoint.manifest@@ -0,0 +1 @@+TraceObjectInterfaceFactory\ No newline at end of filediff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeArithmetic.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeArithmetic.javaindex dd90ef2eb5..37a231064d 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeArithmetic.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeArithmetic.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -19,7 +19,6 @@ import java.math.BigInteger;import ghidra.pcode.exec.ConcretionError;import ghidra.pcode.exec.PcodeArithmetic;-import ghidra.pcode.opbehavior.BinaryOpBehavior;import ghidra.program.model.lang.Endian;import ghidra.trace.model.memory.TraceMemoryState;@@ -32,8 +31,7 @@ import ghidra.trace.model.memory.TraceMemoryState;* that it can compute the "state" of a Sleigh expression's value. It essentially works like a* rudimentary taint analyzer: If any part of any input to the expression in tainted, i.e., not* {@link TraceMemoryState#KNOWN}, then the result is {@link TraceMemoryState#UNKNOWN}. This is best- * exemplified in- * {@link #binaryOp(BinaryOpBehavior, int, int, TraceMemoryState, int, TraceMemoryState)}.+ * exemplified in {@link #binaryOp(int, int, int, TraceMemoryState, int, TraceMemoryState)}.*/public enum TraceMemoryStatePcodeArithmetic implements PcodeArithmetic<TraceMemoryState> {/** The singleton instance */diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeExecutorStatePiece.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeExecutorStatePiece.javaindex ba60a5e2ae..7b700d1e90 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeExecutorStatePiece.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TraceMemoryStatePcodeExecutorStatePiece.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -27,7 +27,6 @@ import ghidra.pcode.exec.trace.data.PcodeTraceDataAccess;import ghidra.program.model.address.*;import ghidra.program.model.lang.Register;import ghidra.program.model.mem.MemBuffer;-import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.memory.TraceMemoryState;/**@@ -39,8 +38,9 @@ import ghidra.trace.model.memory.TraceMemoryState;* {@link TraceMemoryStatePcodeArithmetic} as a means of computing the "state" of a Sleigh* expression's value. It essentially works like a rudimentary taint analyzer: If any part of any* input to the expression in tainted, i.e., not {@link TraceMemoryState#KNOWN}, then the result is- * {@link TraceMemoryState#UNKNOWN}. This is best exemplified in {@link #getUnique(long, int)},- * though it's also exemplified in {@link #getFromSpace(TraceMemorySpace, long, int)}.+ * {@link TraceMemoryState#UNKNOWN}. This is best exemplified in+ * {@link #getUnique(long, int, Reason)}, though it's also exemplified in+ * {@link #getFromSpace(AddressSpace, long, int, Reason)}.*/public class TraceMemoryStatePcodeExecutorStatePiece extendsAbstractLongOffsetPcodeExecutorStatePiece<byte[], TraceMemoryState, AddressSpace> {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TracePcodeMachine.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TracePcodeMachine.javaindex 868c651eb7..cbf07f63a1 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TracePcodeMachine.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/pcode/exec/trace/TracePcodeMachine.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -73,8 +73,7 @@ public interface TracePcodeMachine<T> extends PcodeMachine<T> {* @see #writeDown(PcodeTraceAccess)* @param platform the platform whose trace to modify* @param destSnap the destination snap within the trace- * @param threadsSnap the snap at which to find corresponding threads, usually the same as- * {@link #getSnap()}+ * @param threadsSnap the snap at which to find corresponding threads*/default void writeDown(TracePlatform platform, long destSnap, long threadsSnap) {writeDown(new DefaultPcodeTraceAccess(platform, destSnap, threadsSnap));diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/DBTraceUtils.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/DBTraceUtils.javaindex f6c398c70e..c51869e46c 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/DBTraceUtils.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/DBTraceUtils.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,8 +16,7 @@package ghidra.trace.database;import java.lang.reflect.Field;-import java.net.MalformedURLException;-import java.net.URL;+import java.net.*;import java.nio.ByteBuffer;import java.util.Iterator;import java.util.Objects;@@ -93,7 +92,9 @@ public enum DBTraceUtils {// TODO: Should this be in by default?/**- * A codec or URLs+ * A codec for URLs+ *+ * @param <OT> the type of the object whose field is encoded/decoded.*/public static class URLDBFieldCodec<OT extends DBAnnotatedObject>extends AbstractDBFieldCodec<URL, OT, StringField> {@@ -128,10 +129,10 @@ public enum DBTraceUtils {setValue(obj, null);}else {- setValue(obj, new URL(data));+ setValue(obj, new URI(data).toURL());}}- catch (MalformedURLException e) {+ catch (MalformedURLException | URISyntaxException e) {throw new RuntimeException(e);}}@@ -139,6 +140,8 @@ public enum DBTraceUtils {/*** A codec for language IDs+ *+ * @param <OT> the type of the object whose field is encoded/decoded.*/public static class LanguageIDDBFieldCodec<OT extends DBAnnotatedObject>extends AbstractDBFieldCodec<LanguageID, OT, StringField> {@@ -179,6 +182,8 @@ public enum DBTraceUtils {/*** A codec for compiler spec IDs+ *+ * @param <OT> the type of the object whose field is encoded/decoded.*/public static class CompilerSpecIDDBFieldCodec<OT extends DBAnnotatedObject>extends AbstractDBFieldCodec<CompilerSpecID, OT, StringField> {@@ -219,6 +224,8 @@ public enum DBTraceUtils {/*** A (abstract) codec for the offset-snap tuple+ *+ * @param <OT> the type of the object whose field is encoded/decoded.*/public abstract static class AbstractOffsetSnapDBFieldCodec<OT extends DBAnnotatedObject>extends AbstractDBFieldCodec<OffsetSnap, OT, BinaryField> {@@ -301,6 +308,8 @@ public enum DBTraceUtils {/*** A codec for reference types+ *+ * @param <OT> the type of the object whose field is encoded/decoded.*/public static class RefTypeDBFieldCodec<OT extends DBAnnotatedObject>extends AbstractDBFieldCodec<RefType, OT, ByteField> {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManager.javaindex 26b16a9a03..a1ad11989e 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -22,7 +22,6 @@ import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReadWriteLock;import db.DBHandle;-import ghidra.dbg.target.TargetBreakpointLocation;import ghidra.framework.data.OpenMode;import ghidra.program.model.address.*;import ghidra.program.model.lang.Language;@@ -141,7 +140,7 @@ public class DBTraceBreakpointManagerif (trace.getObjectManager().hasSchema()) {return trace.getObjectManager().getObjectsContaining(snap, address,- TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME,+ TraceObjectBreakpointLocation.KEY_RANGE,TraceObjectBreakpointLocation.class);}return delegateRead(address.getAddressSpace(), m -> m.getBreakpointsAt(snap, address),@@ -154,7 +153,7 @@ public class DBTraceBreakpointManagerif (trace.getObjectManager().hasSchema()) {return trace.getObjectManager().getObjectsIntersecting(span, range,- TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME,+ TraceObjectBreakpointLocation.KEY_RANGE,TraceObjectBreakpointLocation.class);}return delegateRead(range.getAddressSpace(), m -> m.getBreakpointsIntersecting(span, range),diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointLocation.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointLocation.javaindex 18152312b4..995417bc87 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointLocation.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointLocation.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,9 +18,6 @@ package ghidra.trace.database.breakpoint;import java.util.*;import java.util.stream.Collectors;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathMatcher;import ghidra.pcode.exec.SleighUtils;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;@@ -29,9 +26,11 @@ import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.breakpoint.*;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;-import ghidra.trace.model.thread.TraceObjectThread;-import ghidra.trace.model.thread.TraceThread;+import ghidra.trace.model.target.iface.TraceObjectTogglable;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.path.PathMatcher;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.thread.*;import ghidra.trace.util.*;import ghidra.util.LockHold;import ghidra.util.exception.DuplicateNameException;@@ -40,19 +39,19 @@ public class DBTraceObjectBreakpointLocationimplements TraceObjectBreakpointLocation, DBTraceObjectInterface {protected static class BreakpointChangeTranslator extends Translator<TraceBreakpoint> {- private static final Map<TargetObjectSchema, Set<String>> KEYS_BY_SCHEMA =+ private static final Map<TraceObjectSchema, Set<String>> KEYS_BY_SCHEMA =new WeakHashMap<>();private final Set<String> keys;protected BreakpointChangeTranslator(DBTraceObject object, TraceBreakpoint iface) {- super(TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME, object, iface);- TargetObjectSchema schema = object.getTargetSchema();+ super(KEY_RANGE, object, iface);+ TraceObjectSchema schema = object.getSchema();synchronized (KEYS_BY_SCHEMA) {keys = KEYS_BY_SCHEMA.computeIfAbsent(schema, s -> Set.of(- schema.checkAliasedAttribute(TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME),- schema.checkAliasedAttribute(TargetObject.DISPLAY_ATTRIBUTE_NAME),- schema.checkAliasedAttribute(TargetTogglable.ENABLED_ATTRIBUTE_NAME),+ schema.checkAliasedAttribute(KEY_RANGE),+ schema.checkAliasedAttribute(KEY_DISPLAY),+ schema.checkAliasedAttribute(TraceObjectTogglable.KEY_ENABLED),schema.checkAliasedAttribute(KEY_COMMENT)));}}@@ -108,7 +107,7 @@ public class DBTraceObjectBreakpointLocation@Overridepublic void setName(Lifespan lifespan, String name) {- object.setValue(lifespan, TargetObject.DISPLAY_ATTRIBUTE_NAME, name);+ object.setValue(lifespan, KEY_DISPLAY, name);}@Override@@ -122,25 +121,28 @@ public class DBTraceObjectBreakpointLocationpublic String getName() {try (LockHold hold = object.getTrace().lockRead()) {String display = TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),- TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, null);+ KEY_DISPLAY, String.class, null);if (display != null) {return display;}- TraceObject container =- object.queryCanonicalAncestorsTargetInterface(TargetBreakpointSpecContainer.class)+ TraceObject spec =+ object.findCanonicalAncestorsInterface(TraceObjectBreakpointSpec.class).findFirst().orElse(null);- if (container == null) {+ if (spec == null) {return ""; // Should be impossible, but maybe not a sane schema}- return container.getCanonicalPath().relativize(object.getCanonicalPath()).toString();+ return spec.getCanonicalPath()+ .parent()+ .relativize(object.getCanonicalPath())+ .toString();}}@Overridepublic void setRange(Lifespan lifespan, AddressRange range) {try (LockHold hold = object.getTrace().lockWrite()) {- object.setValue(lifespan, TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME, range);+ object.setValue(lifespan, KEY_RANGE, range);this.range = range;}}@@ -152,7 +154,7 @@ public class DBTraceObjectBreakpointLocationreturn range;}return range = TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),- TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME, AddressRange.class, range);+ KEY_RANGE, AddressRange.class, range);}}@@ -226,7 +228,7 @@ public class DBTraceObjectBreakpointLocationtry (LockHold hold = object.getTrace().lockWrite()) {if (enabled != isEnabled(snap)) {object.setValue(Lifespan.span(snap, getClearedSnap()),- TargetBreakpointSpec.ENABLED_ATTRIBUTE_NAME, enabled);+ TraceObjectTogglable.KEY_ENABLED, enabled);}Set<TraceBreakpointKind> asSet =kinds instanceof Set<TraceBreakpointKind> yes ? yes : Set.copyOf(kinds);@@ -239,7 +241,7 @@ public class DBTraceObjectBreakpointLocation@Overridepublic void setEnabled(Lifespan lifespan, boolean enabled) {- object.setValue(lifespan, TargetBreakpointSpec.ENABLED_ATTRIBUTE_NAME, enabled);+ object.setValue(lifespan, TraceObjectTogglable.KEY_ENABLED, enabled);}@Override@@ -253,7 +255,7 @@ public class DBTraceObjectBreakpointLocationpublic boolean isEnabled(long snap) {try (LockHold hold = object.getTrace().lockRead()) {Boolean locEn = TraceObjectInterfaceUtils.getValue(object, snap,- TargetBreakpointSpec.ENABLED_ATTRIBUTE_NAME, Boolean.class, null);+ TraceObjectTogglable.KEY_ENABLED, Boolean.class, null);if (locEn != null) {return locEn && getSpecification().isEnabled(snap);}@@ -290,7 +292,7 @@ public class DBTraceObjectBreakpointLocationpublic Set<TraceThread> getThreads() {// TODO: Delete this? It's sort of deprecated out the gate anyway....DBTraceObjectManager manager = object.getManager();- TargetObjectSchema schema = manager.getRootSchema();+ TraceObjectSchema schema = manager.getRootSchema();try (LockHold hold = object.getTrace().lockRead()) {Set<TraceThread> threads =object.queryAncestorsInterface(getLifespan(), TraceObjectThread.class)@@ -299,7 +301,7 @@ public class DBTraceObjectBreakpointLocationreturn threads;}- PathMatcher procMatcher = schema.searchFor(TargetProcess.class, false);+ PathMatcher procMatcher = schema.searchFor(TraceObjectProcess.class, false);return object.getAncestorsRoot(getLifespan(), procMatcher).flatMap(proc -> proc.getSource(object).querySuccessorsInterface(getLifespan(),@@ -412,7 +414,7 @@ public class DBTraceObjectBreakpointLocation}public TraceAddressSpace getTraceAddressSpace() {- return spaceForValue(computeMinSnap(), TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME);+ return spaceForValue(computeMinSnap(), KEY_RANGE);}@Overridediff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointSpec.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointSpec.javaindex f762d0e017..e71c6f2e0a 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointSpec.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/breakpoint/DBTraceObjectBreakpointSpec.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,8 +18,6 @@ package ghidra.trace.database.breakpoint;import java.util.*;import java.util.stream.Collectors;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;import ghidra.trace.database.target.DBTraceObject;@@ -30,7 +28,10 @@ import ghidra.trace.model.breakpoint.*;import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.iface.TraceObjectTogglable;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.util.*;@@ -40,7 +41,7 @@ import ghidra.util.exception.DuplicateNameException;public class DBTraceObjectBreakpointSpecimplements TraceObjectBreakpointSpec, DBTraceObjectInterface {- private static final Map<TargetObjectSchema, Set<String>> KEYS_BY_SCHEMA = new WeakHashMap<>();+ private static final Map<TraceObjectSchema, Set<String>> KEYS_BY_SCHEMA = new WeakHashMap<>();private final DBTraceObject object;private final Set<String> keys;@@ -49,11 +50,11 @@ public class DBTraceObjectBreakpointSpecpublic DBTraceObjectBreakpointSpec(DBTraceObject object) {this.object = object;- TargetObjectSchema schema = object.getTargetSchema();+ TraceObjectSchema schema = object.getSchema();synchronized (KEYS_BY_SCHEMA) {keys = KEYS_BY_SCHEMA.computeIfAbsent(schema,- s -> Set.of(schema.checkAliasedAttribute(TargetBreakpointSpec.KINDS_ATTRIBUTE_NAME),- schema.checkAliasedAttribute(TargetTogglable.ENABLED_ATTRIBUTE_NAME)));+ s -> Set.of(schema.checkAliasedAttribute(TraceObjectBreakpointSpec.KEY_KINDS),+ schema.checkAliasedAttribute(TraceObjectTogglable.KEY_ENABLED)));}}@@ -70,14 +71,14 @@ public class DBTraceObjectBreakpointSpec@Overridepublic void setName(String name) {try (LockHold hold = object.getTrace().lockWrite()) {- object.setValue(getLifespan(), TargetObject.DISPLAY_ATTRIBUTE_NAME, name);+ object.setValue(getLifespan(), TraceObjectInterface.KEY_DISPLAY, name);}}@Overridepublic String getName() {return TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),- TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, "");+ TraceObjectInterface.KEY_DISPLAY, String.class, "");}@Override@@ -136,7 +137,7 @@ public class DBTraceObjectBreakpointSpec@Overridepublic void setEnabled(boolean enabled) {try (LockHold hold = object.getTrace().lockWrite()) {- object.setValue(getLifespan(), TargetBreakpointSpec.ENABLED_ATTRIBUTE_NAME,+ object.setValue(getLifespan(), TraceObjectTogglable.KEY_ENABLED,enabled ? true : null);}}@@ -144,7 +145,7 @@ public class DBTraceObjectBreakpointSpec@Overridepublic boolean isEnabled(long snap) {return TraceObjectInterfaceUtils.getValue(object, snap,- TargetBreakpointSpec.ENABLED_ATTRIBUTE_NAME, Boolean.class, false);+ TraceObjectTogglable.KEY_ENABLED, Boolean.class, false);}@Override@@ -152,7 +153,7 @@ public class DBTraceObjectBreakpointSpec// TODO: More efficient encoding// TODO: Target-Trace mapping is implied by encoded name. Seems bad.try (LockHold hold = object.getTrace().lockWrite()) {- object.setValue(lifespan, TargetBreakpointSpec.KINDS_ATTRIBUTE_NAME,+ object.setValue(lifespan, TraceObjectBreakpointSpec.KEY_KINDS,TraceBreakpointKindSet.encode(kinds));this.kinds = TraceBreakpointKindSet.copyOf(kinds);}@@ -168,7 +169,7 @@ public class DBTraceObjectBreakpointSpec@Overridepublic Set<TraceBreakpointKind> getKinds() {String kindsStr = TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),- TargetBreakpointSpec.KINDS_ATTRIBUTE_NAME, String.class, null);+ TraceObjectBreakpointSpec.KEY_KINDS, String.class, null);if (kindsStr == null) {return kinds;}@@ -184,7 +185,7 @@ public class DBTraceObjectBreakpointSpec@Overridepublic String getExpression() {return TraceObjectInterfaceUtils.getValue(object, getPlacedSnap(),- TargetBreakpointSpec.EXPRESSION_ATTRIBUTE_NAME, String.class, null);+ TraceObjectBreakpointSpec.KEY_EXPRESSION, String.class, null);}@Overridediff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupport.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupport.javaindex 474a79d681..7aa3cf86af 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupport.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupport.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -20,12 +20,6 @@ import java.nio.ByteBuffer;import java.util.List;import java.util.stream.Stream;-import ghidra.dbg.target.TargetRegister;-import ghidra.dbg.target.TargetRegisterContainer;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathMatcher;-import ghidra.dbg.util.PathPredicates.Align;-import ghidra.dbg.util.PathUtils;import ghidra.pcode.utils.Utils;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressSpace;@@ -33,10 +27,13 @@ import ghidra.program.model.lang.Register;import ghidra.program.model.lang.RegisterValue;import ghidra.trace.model.*;import ghidra.trace.model.guest.*;-import ghidra.trace.model.memory.TraceMemoryManager;-import ghidra.trace.model.memory.TraceMemorySpace;+import ghidra.trace.model.memory.*;import ghidra.trace.model.symbol.*;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter.Align;+import ghidra.trace.model.target.path.PathMatcher;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.TraceChangeRecord;import ghidra.trace.util.TraceEvents;import ghidra.util.Msg;@@ -109,7 +106,7 @@ public enum DBTraceObjectRegisterSupport {int getRegisterValueBitLength() throws RegisterValueException {Object objBitLength = registerValue.getParent()- .getValue(registerValue.getMinSnap(), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME)+ .getValue(registerValue.getMinSnap(), TraceObjectRegister.KEY_BITLENGTH).getValue();if (!(objBitLength instanceof Number)) {throw new RegisterValueException(@@ -158,7 +155,7 @@ public enum DBTraceObjectRegisterSupport {protected AddressSpace findRegisterOverlay(TraceObject object) {TraceObject container = object- .queryCanonicalAncestorsTargetInterface(TargetRegisterContainer.class)+ .findCanonicalAncestorsInterface(TraceObjectRegisterContainer.class).findFirst().orElse(null);if (container == null) {@@ -219,11 +216,7 @@ public enum DBTraceObjectRegisterSupport {}protected String getRegisterName(TraceObject registerObject) {- String name = registerObject.getCanonicalPath().key();- if (PathUtils.isIndex(name)) {- return PathUtils.parseIndex(name);- }- return name;+ return KeyPath.parseIfIndex(registerObject.getCanonicalPath().key());}protected void onSpaceAddedCheckTransferObjectToPlatformRegister(TraceObject registerObject,@@ -234,7 +227,7 @@ public enum DBTraceObjectRegisterSupport {return;}for (TraceObjectValue registerValue : it(registerObject.getOrderedValues(Lifespan.ALL,- TargetRegister.VALUE_ATTRIBUTE_NAME, true))) {+ TraceObjectRegister.KEY_VALUE, true))) {transferValueToPlatformRegister(registerValue, platform, mem, register);}}@@ -242,7 +235,7 @@ public enum DBTraceObjectRegisterSupport {protected void onSpaceAddedCheckTransferToPlatformRegisters(TracePlatform platform,TraceObject regContainer, TraceMemorySpace mem) {for (TraceObjectValPath path : it(- regContainer.querySuccessorsTargetInterface(Lifespan.ALL, TargetRegister.class,+ regContainer.findSuccessorsInterface(Lifespan.ALL, TraceObjectRegister.class,true))) {TraceObject registerObject =path.getDestination(platform.getTrace().getObjectManager().getRootObject());@@ -284,7 +277,7 @@ public enum DBTraceObjectRegisterSupport {TraceMemorySpace mem = getMemorySpace(registerObject, label);Address address = mem.getAddressSpace().getOverlayAddress(label.getAddress());for (TraceObjectValue registerValue : it(registerObject.getOrderedValues(- label.getLifespan(), TargetRegister.VALUE_ATTRIBUTE_NAME, true))) {+ label.getLifespan(), TraceObjectRegister.KEY_VALUE, true))) {LazyValues lazy = new LazyValues(registerValue);try {long minSnap = registerValue.getMinSnap();@@ -335,8 +328,8 @@ public enum DBTraceObjectRegisterSupport {protected boolean isRegisterValue(TraceObjectValue objectValue) {TraceObject parent = objectValue.getParent();return parent != null &&- parent.getTargetSchema().getInterfaces().contains(TargetRegister.class) &&- TargetRegister.VALUE_ATTRIBUTE_NAME.equals(objectValue.getEntryKey());+ parent.getSchema().getInterfaces().contains(TraceObjectRegister.class) &&+ TraceObjectRegister.KEY_VALUE.equals(objectValue.getEntryKey());}public void onValueCreatedCheckTransfer(TraceObjectValue objectValue) {@@ -352,11 +345,11 @@ public enum DBTraceObjectRegisterSupport {public void onSymbolAddedCheckTransferToLabel(TraceLabelSymbol label, boolean isBigEndian) {TraceObjectManager objectManager = label.getTrace().getObjectManager();- TargetObjectSchema schema = objectManager.getRootSchema();+ TraceObjectSchema schema = objectManager.getRootSchema();if (schema == null) {return;}- PathMatcher matcher = schema.searchFor(TargetRegister.class, true);+ PathMatcher matcher = schema.searchFor(TraceObjectRegister.class, true);matcher = matcher.applyKeys(Align.RIGHT, List.of(label.getName()));for (TraceObjectValPath path : it(objectManager.getValuePaths(label.getLifespan(), matcher))) {@@ -399,10 +392,10 @@ public enum DBTraceObjectRegisterSupport {TraceMemorySpace mem = trace.getMemoryManager().getMemorySpace(space, true);TraceObject regContainer = trace.getObjectManager().getObjectByCanonicalPath(- TraceObjectKeyPath.parse(mem.getAddressSpace().getName()));- if (regContainer == null || !regContainer.getTargetSchema()+ KeyPath.parse(mem.getAddressSpace().getName()));+ if (regContainer == null || !regContainer.getSchema().getInterfaces()- .contains(TargetRegisterContainer.class)) {+ .contains(TraceObjectRegisterContainer.class)) {return;}TracePlatformManager platformManager = trace.getPlatformManager();@@ -430,7 +423,7 @@ public enum DBTraceObjectRegisterSupport {.getMemoryManager().getMemorySpace(hostAddr.getAddressSpace(), true);for (TraceObjectValue registerValue : it(registerObject.getOrderedValues(Lifespan.ALL,- TargetRegister.VALUE_ATTRIBUTE_NAME, true))) {+ TraceObjectRegister.KEY_VALUE, true))) {transferValueToPlatformRegister(registerValue, guest, mem, register);}}@@ -438,7 +431,7 @@ public enum DBTraceObjectRegisterSupport {public void onMappingAddedCheckTransferMemoryMapped(TraceObject root,TraceGuestPlatformMappedRange mapped) {for (TraceObjectValPath path : it(- root.querySuccessorsTargetInterface(Lifespan.ALL, TargetRegister.class, true))) {+ root.findSuccessorsInterface(Lifespan.ALL, TraceObjectRegister.class, true))) {TraceObject registerObject = path.getDestination(root);onMappingAddedCheckTransferRegisterObjectMemoryMapped(registerObject, mapped);}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/InternalTracePlatform.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/InternalTracePlatform.javaindex 682bc18530..199e2f01d1 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/InternalTracePlatform.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/InternalTracePlatform.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,20 +17,19 @@ package ghidra.trace.database.guest;import java.util.*;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetRegister;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathMatcher;-import ghidra.dbg.util.PathPredicates.Align;-import ghidra.dbg.util.PathUtils;import ghidra.program.model.address.*;import ghidra.program.model.lang.Language;import ghidra.program.model.lang.Register;import ghidra.program.model.symbol.SourceType;import ghidra.trace.database.guest.DBTraceGuestPlatform.DBTraceGuestLanguage;import ghidra.trace.model.guest.TracePlatform;+import ghidra.trace.model.memory.TraceObjectRegister;import ghidra.trace.model.symbol.*;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter.Align;+import ghidra.trace.model.target.path.PathMatcher;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.TraceRegisterUtils;import ghidra.util.LockHold;import ghidra.util.exception.DuplicateNameException;@@ -113,21 +112,21 @@ public interface InternalTracePlatform extends TracePlatform {}@Override- default PathMatcher getConventionalRegisterPath(TargetObjectSchema schema, List<String> path,+ default PathMatcher getConventionalRegisterPath(TraceObjectSchema schema, KeyPath path,Collection<String> names) {- PathMatcher matcher = schema.searchFor(TargetRegister.class, path, true);- if (matcher.isEmpty()) {+ PathMatcher matcher = schema.searchFor(TraceObjectRegister.class, path, true);+ if (matcher.isNone()) {return matcher;}PathMatcher result = new PathMatcher();- for (String name:names) {+ for (String name : names) {result.addAll(matcher.applyKeys(Align.RIGHT, List.of(name)));}return result;}@Override- default PathMatcher getConventionalRegisterPath(TargetObjectSchema schema, List<String> path,+ default PathMatcher getConventionalRegisterPath(TraceObjectSchema schema, KeyPath path,Register register) {return getConventionalRegisterPath(schema, path,getConventionalRegisterObjectNames(register));@@ -135,24 +134,18 @@ public interface InternalTracePlatform extends TracePlatform {@Overridedefault PathMatcher getConventionalRegisterPath(TraceObject container, Register register) {- return getConventionalRegisterPath(container.getTargetSchema(),- container.getCanonicalPath().getKeyList(), register);- }-- @Override- default PathMatcher getConventionalRegisterPath(TargetObject container, Register register) {- return getConventionalRegisterPath(container.getSchema(), container.getPath(), register);+ return getConventionalRegisterPath(container.getSchema(),+ container.getCanonicalPath(), register);}@Overridedefault PathMatcher getConventionalRegisterPath(AddressSpace space, Register register) {- List<String> path = PathUtils.parse(space.getName());- TargetObjectSchema rootSchema = getTrace().getObjectManager().getRootSchema();+ KeyPath path = KeyPath.parse(space.getName());+ TraceObjectSchema rootSchema = getTrace().getObjectManager().getRootSchema();if (rootSchema == null) {return null;}- TargetObjectSchema schema = rootSchema- .getSuccessorSchema(path);+ TraceObjectSchema schema = rootSchema.getSuccessorSchema(path);return getConventionalRegisterPath(schema, path, register);}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/AbstractBaseDBTraceCodeUnitsMemoryView.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/AbstractBaseDBTraceCodeUnitsMemoryView.javaindex 9c3d37a39f..51684102d6 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/AbstractBaseDBTraceCodeUnitsMemoryView.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/listing/AbstractBaseDBTraceCodeUnitsMemoryView.java@@ -25,7 +25,6 @@ import ghidra.trace.database.DBTraceUtils;import ghidra.trace.database.space.DBTraceDelegatingManager;import ghidra.trace.model.*;import ghidra.trace.model.listing.TraceBaseCodeUnitsView;-import ghidra.trace.model.thread.TraceThread;import ghidra.util.LockHold;/**@@ -54,25 +53,12 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getTrace()+ * @return the trace*/public Trace getTrace() {return manager.getTrace();}- /**- * @see TraceBaseCodeUnitsView#getThread()- */- public TraceThread getThread() {- return null;- }-- /**- * @see TraceBaseCodeUnitsView#getFrameLevel()- */- public int getFrameLevel() {- return 0;- }-/*** Get the individual view from the given space*@@ -135,7 +121,7 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo* @param snap the snap the client requested* @param range the range of iteration* @param forward true to iterate forward (min to max), false for backward (max to min)- * @return the iterator+ * @return an iterable of units*/public Iterable<? extends T> emptyOrFullIterableUndefined(long snap, AddressRange range,boolean forward) {@@ -144,6 +130,8 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see #emptyOrFullIterableUndefined(long, AddressRange, boolean)+ * @param tasr the range of space and time to cover+ * @return the iterable*/public Iterable<? extends T> emptyOrFullIterableUndefined(TraceAddressSnapRange tasr) {return Collections.emptyList();@@ -234,6 +222,7 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#size()+ * @return the number of defined units*/public int size() {int sum = 0;@@ -245,6 +234,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getBefore(long, Address)+ * @param snap the snap+ * @param address the address+ * @return the unit or null*/public T getBefore(long snap, Address address) {Address prev = prevAddress(address);@@ -256,6 +248,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getFloor(long, Address)+ * @param snap the snap+ * @param address the address+ * @return the unit or null*/public T getFloor(long snap, Address address) {try (LockHold hold = LockHold.lock(readLock())) {@@ -277,6 +272,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getContaining(long, Address)+ * @param snap the snap+ * @param address the address+ * @return the unit or null*/public T getContaining(long snap, Address address) {try (LockHold hold = LockHold.lock(readLock())) {@@ -290,6 +288,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getAt(long, Address)+ * @param snap the snap+ * @param address the address+ * @return the unit or null*/public T getAt(long snap, Address address) {try (LockHold hold = LockHold.lock(readLock())) {@@ -303,6 +304,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getCeiling(long, Address)+ * @param snap the snap+ * @param address the address+ * @return the unit or null*/public T getCeiling(long snap, Address address) {try (LockHold hold = LockHold.lock(readLock())) {@@ -321,6 +325,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getAfter(long, Address)+ * @param snap the snap+ * @param address the address+ * @return the unit or null*/public T getAfter(long snap, Address address) {Address next = nextAddress(address);@@ -332,6 +339,11 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#get(long, Address, Address, boolean)+ * @param snap the snap+ * @param min the min address+ * @param max the max address+ * @param forward true to iterate forward+ * @return an iterable of units*/public Iterable<? extends T> get(long snap, Address min, Address max, boolean forward) {if (min.hasSameAddressSpace(max)) {@@ -343,6 +355,10 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#get(long, AddressSetView, boolean)+ * @param snap the snap+ * @param set the address set+ * @param forward true to iterate forward+ * @return an iterable of units*/public Iterable<? extends T> get(long snap, AddressSetView set, boolean forward) {return () -> NestedIterator.start(set.iterator(forward),@@ -351,6 +367,10 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#get(long, AddressRange, boolean)+ * @param snap the snap+ * @param range the address range+ * @param forward true to iterate forward+ * @return an iterable of units*/public Iterable<? extends T> get(long snap, AddressRange range, boolean forward) {M m = getForSpace(range.getAddressSpace(), false);@@ -362,6 +382,10 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#get(long, Address, boolean)+ * @param snap the snap+ * @param start the start address+ * @param forward true to iterate forward+ * @return an iterable of units*/public Iterable<? extends T> get(long snap, Address start, boolean forward) {AddressFactory factory = manager.getTrace().getBaseAddressFactory();@@ -370,6 +394,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#get(long, boolean)+ * @param snap the snap+ * @param forward true to iterate forward+ * @return an iterable of units*/public Iterable<? extends T> get(long snap, boolean forward) {return get(snap, manager.getTrace().getBaseAddressFactory().getAddressSet(), forward);@@ -377,6 +404,8 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getIntersecting(TraceAddressSnapRange)+ * @param tasr the range in space and time to cover+ * @return an iterable of units*/public Iterable<? extends T> getIntersecting(TraceAddressSnapRange tasr) {M m = getForSpace(tasr.getX1().getAddressSpace(), false);@@ -388,6 +417,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getAddressSetView(long, AddressRange)+ * @param snap the snap+ * @param within the range to consider+ * @return the address set*/public AddressSetView getAddressSetView(long snap, AddressRange within) {M m = getForSpace(within.getAddressSpace(), false);@@ -399,6 +431,8 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#getAddressSetView(long)+ * @param snap the snap+ * @return the address set*/public AddressSetView getAddressSetView(long snap) {AddressSet result = new AddressSet();@@ -416,6 +450,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#containsAddress(long, Address)+ * @param snap the snap+ * @param address the address+ * @return true if contained*/public boolean containsAddress(long snap, Address address) {return delegateRead(address.getAddressSpace(), m -> m.containsAddress(snap, address),@@ -424,6 +461,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#coversRange(Lifespan, AddressRange)+ * @param span the span+ * @param range the range+ * @return true if covered*/public boolean coversRange(Lifespan span, AddressRange range) {return delegateRead(range.getAddressSpace(), m -> m.coversRange(span, range),@@ -432,6 +472,8 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#coversRange(TraceAddressSnapRange)+ * @param range the range in space and time+ * @return true if covered*/public boolean coversRange(TraceAddressSnapRange range) {return delegateRead(range.getRange().getAddressSpace(), m -> m.coversRange(range),@@ -440,6 +482,9 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#intersectsRange(Lifespan, AddressRange)+ * @param span the span+ * @param range the range+ * @return true if intersected*/public boolean intersectsRange(Lifespan span, AddressRange range) {return delegateRead(range.getAddressSpace(), m -> m.intersectsRange(span, range),@@ -448,6 +493,8 @@ public abstract class AbstractBaseDBTraceCodeUnitsMemoryView<T extends DBTraceCo/*** @see TraceBaseCodeUnitsView#intersectsRange(TraceAddressSnapRange)+ * @param range the range in space and time+ * @return true if intersected*/public boolean intersectsRange(TraceAddressSnapRange range) {return delegateRead(range.getRange().getAddressSpace(), m -> m.intersectsRange(range),diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceMemoryManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceMemoryManager.javaindex 0c1de3f0ea..c30b10af8a 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceMemoryManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceMemoryManager.java@@ -25,7 +25,6 @@ import java.util.concurrent.locks.ReadWriteLock;import java.util.function.Predicate;import db.DBHandle;-import ghidra.dbg.target.TargetMemoryRegion;import ghidra.framework.data.OpenMode;import ghidra.program.model.address.*;import ghidra.program.model.lang.Language;@@ -174,7 +173,7 @@ public class DBTraceMemoryManager extends AbstractDBTraceSpaceBasedManager<DBTrapublic TraceMemoryRegion getRegionContaining(long snap, Address address) {if (trace.getObjectManager().hasSchema()) {return trace.getObjectManager()- .getObjectContaining(snap, address, TargetMemoryRegion.RANGE_ATTRIBUTE_NAME,+ .getObjectContaining(snap, address, TraceObjectMemoryRegion.KEY_RANGE,TraceObjectMemoryRegion.class);}return delegateRead(address.getAddressSpace(), m -> m.getRegionContaining(snap, address));@@ -186,7 +185,7 @@ public class DBTraceMemoryManager extends AbstractDBTraceSpaceBasedManager<DBTraif (trace.getObjectManager().hasSchema()) {return trace.getObjectManager().getObjectsIntersecting(lifespan, range,- TargetMemoryRegion.RANGE_ATTRIBUTE_NAME, TraceObjectMemoryRegion.class);+ TraceObjectMemoryRegion.KEY_RANGE, TraceObjectMemoryRegion.class);}return delegateRead(range.getAddressSpace(), m -> m.getRegionsIntersecting(lifespan, range),Collections.emptyList());@@ -219,7 +218,7 @@ public class DBTraceMemoryManager extends AbstractDBTraceSpaceBasedManager<DBTrapublic AddressSetView getRegionsAddressSet(long snap) {if (trace.getObjectManager().hasSchema()) {return trace.getObjectManager()- .getObjectsAddressSet(snap, TargetMemoryRegion.RANGE_ATTRIBUTE_NAME,+ .getObjectsAddressSet(snap, TraceObjectMemoryRegion.KEY_RANGE,TraceObjectMemoryRegion.class, r -> true);}return new UnionAddressSetView(@@ -231,7 +230,7 @@ public class DBTraceMemoryManager extends AbstractDBTraceSpaceBasedManager<DBTraPredicate<TraceMemoryRegion> predicate) {if (trace.getObjectManager().hasSchema()) {return trace.getObjectManager()- .getObjectsAddressSet(snap, TargetMemoryRegion.RANGE_ATTRIBUTE_NAME,+ .getObjectsAddressSet(snap, TraceObjectMemoryRegion.KEY_RANGE,TraceObjectMemoryRegion.class, predicate);}return new UnionAddressSetView(getActiveMemorySpaces().stream()diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectMemory.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectMemory.javanew file mode 100644index 0000000000..49b50875e7--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectMemory.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.memory;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.memory.TraceObjectMemory;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectMemory implements TraceObjectMemory, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectMemory(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectMemoryRegion.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectMemoryRegion.javaindex 0042e16bd4..b258a9dbdd 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectMemoryRegion.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectMemoryRegion.java@@ -17,9 +17,6 @@ package ghidra.trace.database.memory;import java.util.*;-import ghidra.dbg.target.TargetMemoryRegion;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.program.model.address.*;import ghidra.trace.database.DBTrace;import ghidra.trace.database.DBTraceUtils;@@ -30,7 +27,9 @@ import ghidra.trace.model.Trace;import ghidra.trace.model.memory.*;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.*;import ghidra.util.LockHold;import ghidra.util.exception.DuplicateNameException;@@ -39,15 +38,15 @@ public class DBTraceObjectMemoryRegion implements TraceObjectMemoryRegion, DBTraprotected record Keys(Set<String> all, String range, String display,Set<String> flags) {- static Keys fromSchema(TargetObjectSchema schema) {- String keyRange = schema.checkAliasedAttribute(TargetMemoryRegion.RANGE_ATTRIBUTE_NAME);- String keyDisplay = schema.checkAliasedAttribute(TargetObject.DISPLAY_ATTRIBUTE_NAME);+ static Keys fromSchema(TraceObjectSchema schema) {+ String keyRange = schema.checkAliasedAttribute(TraceObjectMemoryRegion.KEY_RANGE);+ String keyDisplay = schema.checkAliasedAttribute(TraceObjectInterface.KEY_DISPLAY);String keyReadable =- schema.checkAliasedAttribute(TargetMemoryRegion.READABLE_ATTRIBUTE_NAME);+ schema.checkAliasedAttribute(TraceObjectMemoryRegion.KEY_READABLE);String keyWritable =- schema.checkAliasedAttribute(TargetMemoryRegion.WRITABLE_ATTRIBUTE_NAME);+ schema.checkAliasedAttribute(TraceObjectMemoryRegion.KEY_WRITABLE);String keyExecutable =- schema.checkAliasedAttribute(TargetMemoryRegion.EXECUTABLE_ATTRIBUTE_NAME);+ schema.checkAliasedAttribute(TraceObjectMemoryRegion.KEY_EXECUTABLE);return new Keys(Set.of(keyRange, keyDisplay, keyReadable, keyWritable, keyExecutable),keyRange, keyDisplay, Set.of(keyReadable, keyWritable, keyExecutable));}@@ -66,14 +65,14 @@ public class DBTraceObjectMemoryRegion implements TraceObjectMemoryRegion, DBTra}protected class RegionChangeTranslator extends Translator<TraceMemoryRegion> {- private static final Map<TargetObjectSchema, Keys> KEYS_BY_SCHEMA =+ private static final Map<TraceObjectSchema, Keys> KEYS_BY_SCHEMA =new WeakHashMap<>();private final Keys keys;protected RegionChangeTranslator(DBTraceObject object, TraceMemoryRegion iface) {- super(TargetMemoryRegion.RANGE_ATTRIBUTE_NAME, object, iface);- TargetObjectSchema schema = object.getTargetSchema();+ super(TraceObjectMemoryRegion.KEY_RANGE, object, iface);+ TraceObjectSchema schema = object.getSchema();synchronized (KEYS_BY_SCHEMA) {keys = KEYS_BY_SCHEMA.computeIfAbsent(schema, Keys::fromSchema);}@@ -151,7 +150,7 @@ public class DBTraceObjectMemoryRegion implements TraceObjectMemoryRegion, DBTra@Overridepublic void setName(Lifespan lifespan, String name) {- object.setValue(lifespan, TargetObject.DISPLAY_ATTRIBUTE_NAME, name);+ object.setValue(lifespan, TraceObjectInterface.KEY_DISPLAY, name);}@Override@@ -164,7 +163,7 @@ public class DBTraceObjectMemoryRegion implements TraceObjectMemoryRegion, DBTra@Overridepublic String getName() {TraceObjectValue value =- object.getValue(getCreationSnap(), TargetObject.DISPLAY_ATTRIBUTE_NAME);+ object.getValue(getCreationSnap(), TraceObjectInterface.KEY_DISPLAY);return value == null ? "" : (String) value.getValue();}@@ -215,7 +214,7 @@ public class DBTraceObjectMemoryRegion implements TraceObjectMemoryRegion, DBTra@Overridepublic void setRange(Lifespan lifespan, AddressRange newRange) {try (LockHold hold = object.getTrace().lockWrite()) {- object.setValue(lifespan, TargetMemoryRegion.RANGE_ATTRIBUTE_NAME, newRange);+ object.setValue(lifespan, TraceObjectMemoryRegion.KEY_RANGE, newRange);this.range = newRange;}}@@ -232,7 +231,7 @@ public class DBTraceObjectMemoryRegion implements TraceObjectMemoryRegion, DBTratry (LockHold hold = object.getTrace().lockRead()) {// TODO: Caching without regard to snap seems badreturn range = TraceObjectInterfaceUtils.getValue(object, snap,- TargetMemoryRegion.RANGE_ATTRIBUTE_NAME, AddressRange.class, range);+ TraceObjectMemoryRegion.KEY_RANGE, AddressRange.class, range);}}@@ -298,9 +297,9 @@ public class DBTraceObjectMemoryRegion implements TraceObjectMemoryRegion, DBTraprotected static String keyForFlag(TraceMemoryFlag flag) {return switch (flag) {- case READ -> TargetMemoryRegion.READABLE_ATTRIBUTE_NAME;- case WRITE -> TargetMemoryRegion.WRITABLE_ATTRIBUTE_NAME;- case EXECUTE -> TargetMemoryRegion.EXECUTABLE_ATTRIBUTE_NAME;+ case READ -> TraceObjectMemoryRegion.KEY_READABLE;+ case WRITE -> TraceObjectMemoryRegion.KEY_WRITABLE;+ case EXECUTE -> TraceObjectMemoryRegion.KEY_EXECUTABLE;case VOLATILE -> KEY_VOLATILE;default -> throw new AssertionError();};diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectRegister.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectRegister.javaindex ed1b1d1b9d..f16d05dcef 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectRegister.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectRegister.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,16 +17,16 @@ package ghidra.trace.database.memory;import java.math.BigInteger;-import ghidra.dbg.target.TargetRegister;-import ghidra.dbg.util.PathUtils;import ghidra.pcode.utils.Utils;import ghidra.trace.database.target.DBTraceObject;import ghidra.trace.database.target.DBTraceObjectInterface;import ghidra.trace.model.Lifespan;import ghidra.trace.model.memory.TraceMemoryState;import ghidra.trace.model.memory.TraceObjectRegister;-import ghidra.trace.model.target.*;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.util.TraceChangeRecord;@@ -51,17 +51,14 @@ public class DBTraceObjectRegister implements TraceObjectRegister, DBTraceObject@Overridepublic String getName() {- TraceObjectKeyPath path = object.getCanonicalPath();- if (PathUtils.isIndex(path.key())) {- return path.index();- }- return path.key();+ KeyPath path = object.getCanonicalPath();+ return KeyPath.parseIfIndex(path.key());}@Overridepublic int getBitLength() {return TraceObjectInterfaceUtils.getValue(object, computeMinSnap(),- TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, Integer.class, 0);+ TraceObjectRegister.KEY_BITLENGTH, Integer.class, 0);}@Override@@ -70,12 +67,12 @@ public class DBTraceObjectRegister implements TraceObjectRegister, DBTraceObjectif (length != 0 && value.length != length) {throw new IllegalArgumentException("Length must match the register");}- object.setValue(lifespan, TargetRegister.VALUE_ATTRIBUTE_NAME, value);+ object.setValue(lifespan, TraceObjectRegister.KEY_VALUE, value);}@Overridepublic byte[] getValue(long snap) {- TraceObjectValue ov = object.getValue(snap, TargetRegister.VALUE_ATTRIBUTE_NAME);+ TraceObjectValue ov = object.getValue(snap, TraceObjectRegister.KEY_VALUE);if (ov == null) {return null;}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectRegisterContainer.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectRegisterContainer.javanew file mode 100644index 0000000000..e1e3ded1ae--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/memory/DBTraceObjectRegisterContainer.java@@ -0,0 +1,41 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.memory;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.memory.TraceObjectRegisterContainer;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectRegisterContainer+ implements TraceObjectRegisterContainer, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectRegisterContainer(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceModuleManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceModuleManager.javaindex e382de9fcf..4e23e801f8 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceModuleManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceModuleManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -21,8 +21,6 @@ import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReadWriteLock;import db.DBHandle;-import ghidra.dbg.target.TargetModule;-import ghidra.dbg.target.TargetSection;import ghidra.framework.data.OpenMode;import ghidra.program.model.address.*;import ghidra.program.model.lang.Language;@@ -159,7 +157,7 @@ public class DBTraceModuleManager extends AbstractDBTraceSpaceBasedManager<DBTrapublic Collection<? extends TraceModule> getModulesAt(long snap, Address address) {if (trace.getObjectManager().hasSchema()) {return trace.getObjectManager()- .getObjectsContaining(snap, address, TargetModule.RANGE_ATTRIBUTE_NAME,+ .getObjectsContaining(snap, address, TraceObjectModule.KEY_RANGE,TraceObjectModule.class);}return delegateRead(address.getAddressSpace(), m -> m.getModulesAt(snap, address),@@ -171,7 +169,7 @@ public class DBTraceModuleManager extends AbstractDBTraceSpaceBasedManager<DBTraAddressRange range) {if (trace.getObjectManager().hasSchema()) {return trace.getObjectManager()- .getObjectsIntersecting(lifespan, range, TargetModule.RANGE_ATTRIBUTE_NAME,+ .getObjectsIntersecting(lifespan, range, TraceObjectModule.KEY_RANGE,TraceObjectModule.class);}return delegateRead(range.getAddressSpace(), m -> m.getModulesIntersecting(lifespan, range),@@ -187,7 +185,7 @@ public class DBTraceModuleManager extends AbstractDBTraceSpaceBasedManager<DBTrapublic Collection<? extends TraceSection> getSectionsAt(long snap, Address address) {if (trace.getObjectManager().hasSchema()) {return trace.getObjectManager()- .getObjectsContaining(snap, address, TargetSection.RANGE_ATTRIBUTE_NAME,+ .getObjectsContaining(snap, address, TraceObjectSection.KEY_RANGE,TraceObjectSection.class);}return delegateRead(address.getAddressSpace(), m -> m.getSectionsAt(snap, address),@@ -199,7 +197,7 @@ public class DBTraceModuleManager extends AbstractDBTraceSpaceBasedManager<DBTraAddressRange range) {if (trace.getObjectManager().hasSchema()) {return trace.getObjectManager()- .getObjectsIntersecting(lifespan, range, TargetSection.RANGE_ATTRIBUTE_NAME,+ .getObjectsIntersecting(lifespan, range, TraceObjectSection.KEY_RANGE,TraceObjectSection.class);}return delegateRead(range.getAddressSpace(),diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectModule.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectModule.javaindex 0491a57e93..017e018bdf 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectModule.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectModule.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,11 +18,6 @@ package ghidra.trace.database.module;import java.util.*;import java.util.stream.Collectors;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathMatcher;-import ghidra.dbg.util.PathPredicates.Align;-import ghidra.dbg.util.PathUtils;import ghidra.program.model.address.*;import ghidra.trace.database.DBTraceUtils;import ghidra.trace.database.target.*;@@ -30,7 +25,12 @@ import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.modules.*;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter.Align;+import ghidra.trace.model.target.path.PathMatcher;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.*;import ghidra.util.LockHold;import ghidra.util.exception.DuplicateNameException;@@ -38,18 +38,18 @@ import ghidra.util.exception.DuplicateNameException;public class DBTraceObjectModule implements TraceObjectModule, DBTraceObjectInterface {protected class ModuleChangeTranslator extends Translator<TraceModule> {- private static final Map<TargetObjectSchema, Set<String>> KEYS_BY_SCHEMA =+ private static final Map<TraceObjectSchema, Set<String>> KEYS_BY_SCHEMA =new WeakHashMap<>();private final Set<String> keys;protected ModuleChangeTranslator(DBTraceObject object, TraceModule iface) {- super(TargetModule.RANGE_ATTRIBUTE_NAME, object, iface);- TargetObjectSchema schema = object.getTargetSchema();+ super(TraceObjectModule.KEY_RANGE, object, iface);+ TraceObjectSchema schema = object.getSchema();synchronized (KEYS_BY_SCHEMA) {keys = KEYS_BY_SCHEMA.computeIfAbsent(schema, s -> Set.of(- s.checkAliasedAttribute(TargetModule.RANGE_ATTRIBUTE_NAME),- s.checkAliasedAttribute(TargetObject.DISPLAY_ATTRIBUTE_NAME)));+ s.checkAliasedAttribute(TraceObjectModule.KEY_RANGE),+ s.checkAliasedAttribute(TraceObjectInterface.KEY_DISPLAY)));}}@@ -102,8 +102,8 @@ public class DBTraceObjectModule implements TraceObjectModule, DBTraceObjectIntethrows DuplicateNameException {try (LockHold hold = object.getTrace().lockWrite()) {DBTraceObjectManager manager = object.getManager();- List<String> sectionKeyList = PathUtils.parse(sectionPath);- if (!PathUtils.isAncestor(object.getCanonicalPath().getKeyList(), sectionKeyList)) {+ KeyPath sectionKeyList = KeyPath.parse(sectionPath);+ if (!object.getCanonicalPath().isAncestor(sectionKeyList)) {throw new IllegalArgumentException("Section path must be a successor of this module's path");}@@ -118,7 +118,7 @@ public class DBTraceObjectModule implements TraceObjectModule, DBTraceObjectInte@Overridepublic void setName(Lifespan lifespan, String name) {- object.setValue(lifespan, TargetModule.MODULE_NAME_ATTRIBUTE_NAME, name);+ object.setValue(lifespan, TraceObjectModule.KEY_MODULE_NAME, name);}@Override@@ -131,13 +131,13 @@ public class DBTraceObjectModule implements TraceObjectModule, DBTraceObjectInte@Overridepublic String getName() {return TraceObjectInterfaceUtils.getValue(object, getLoadedSnap(),- TargetModule.MODULE_NAME_ATTRIBUTE_NAME, String.class, "");+ TraceObjectModule.KEY_MODULE_NAME, String.class, "");}@Overridepublic void setRange(Lifespan lifespan, AddressRange range) {try (LockHold hold = object.getTrace().lockWrite()) {- object.setValue(lifespan, TargetModule.RANGE_ATTRIBUTE_NAME, range);+ object.setValue(lifespan, TraceObjectModule.KEY_RANGE, range);this.range = range;}}@@ -156,7 +156,7 @@ public class DBTraceObjectModule implements TraceObjectModule, DBTraceObjectIntereturn range;}return range = TraceObjectInterfaceUtils.getValue(object, getLoadedSnap(),- TargetModule.RANGE_ATTRIBUTE_NAME, AddressRange.class, range);+ TraceObjectModule.KEY_RANGE, AddressRange.class, range);}}@@ -255,7 +255,7 @@ public class DBTraceObjectModule implements TraceObjectModule, DBTraceObjectInte@Overridepublic TraceObjectSection getSectionByName(String sectionName) {- PathMatcher matcher = object.getTargetSchema().searchFor(TargetSection.class, true);+ PathMatcher matcher = object.getSchema().searchFor(TraceObjectSection.class, true);PathMatcher applied = matcher.applyKeys(Align.LEFT, List.of(sectionName));return object.getSuccessors(getLifespan(), applied).map(p -> p.getDestination(object).queryInterface(TraceObjectSection.class))diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectSection.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectSection.javaindex f971025f55..45bf72a944 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectSection.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/DBTraceObjectSection.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,9 +17,6 @@ package ghidra.trace.database.module;import java.util.*;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathUtils;import ghidra.program.model.address.AddressRange;import ghidra.trace.database.target.DBTraceObject;import ghidra.trace.database.target.DBTraceObjectInterface;@@ -28,25 +25,28 @@ import ghidra.trace.model.Trace;import ghidra.trace.model.modules.TraceObjectModule;import ghidra.trace.model.modules.TraceSection;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.*;import ghidra.util.LockHold;public class DBTraceObjectSection implements TraceObjectSection, DBTraceObjectInterface {protected class SectionTranslator extends Translator<TraceSection> {- private static final Map<TargetObjectSchema, Set<String>> KEYS_BY_SCHEMA =+ private static final Map<TraceObjectSchema, Set<String>> KEYS_BY_SCHEMA =new WeakHashMap<>();private final Set<String> keys;protected SectionTranslator(DBTraceObject object, TraceSection iface) {- super(TargetSection.RANGE_ATTRIBUTE_NAME, object, iface);- TargetObjectSchema schema = object.getTargetSchema();+ super(TraceObjectSection.KEY_RANGE, object, iface);+ TraceObjectSchema schema = object.getSchema();synchronized (KEYS_BY_SCHEMA) {keys = KEYS_BY_SCHEMA.computeIfAbsent(schema, s -> Set.of(- s.checkAliasedAttribute(TargetSection.RANGE_ATTRIBUTE_NAME),- s.checkAliasedAttribute(TargetObject.DISPLAY_ATTRIBUTE_NAME)));+ s.checkAliasedAttribute(TraceObjectSection.KEY_RANGE),+ s.checkAliasedAttribute(TraceObjectInterface.KEY_DISPLAY)));}}@@ -109,7 +109,7 @@ public class DBTraceObjectSection implements TraceObjectSection, DBTraceObjectIn@Overridepublic void setName(Lifespan lifespan, String name) {- object.setValue(lifespan, TargetObject.DISPLAY_ATTRIBUTE_NAME, name);+ object.setValue(lifespan, TraceObjectInterface.KEY_DISPLAY, name);}@Override@@ -122,15 +122,15 @@ public class DBTraceObjectSection implements TraceObjectSection, DBTraceObjectIn@Overridepublic String getName() {String key = object.getCanonicalPath().key();- String index = PathUtils.isIndex(key) ? PathUtils.parseIndex(key) : key;+ String index = KeyPath.parseIfIndex(key);return TraceObjectInterfaceUtils.getValue(object, computeMinSnap(),- TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, index);+ TraceObjectInterface.KEY_DISPLAY, String.class, index);}@Overridepublic void setRange(Lifespan lifespan, AddressRange range) {try (LockHold hold = object.getTrace().lockWrite()) {- object.setValue(lifespan, TargetModule.RANGE_ATTRIBUTE_NAME, range);+ object.setValue(lifespan, TraceObjectModule.KEY_RANGE, range);this.range = range;}}@@ -142,7 +142,7 @@ public class DBTraceObjectSection implements TraceObjectSection, DBTraceObjectInreturn range;}return range = TraceObjectInterfaceUtils.getValue(object, computeMinSnap(),- TargetModule.RANGE_ATTRIBUTE_NAME, AddressRange.class, range);+ TraceObjectModule.KEY_RANGE, AddressRange.class, range);}}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/TraceObjectSection.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/TraceObjectSection.javaindex 93d594ba65..b9d77c9b30 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/TraceObjectSection.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/module/TraceObjectSection.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,22 +15,38 @@*/package ghidra.trace.database.module;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetSection;import ghidra.program.model.address.AddressRange;import ghidra.trace.model.Lifespan;import ghidra.trace.model.modules.TraceSection;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;+/**+ * An allocated section of a binary module+ *+ * <p>+ * Note that the model should only present those sections which are allocated in memory. Otherwise+ * strange things may happen, such as zero-length ranges (which AddressRange hates), or overlapping+ * ranges (which Trace hates).+ *+ * <p>+ * TODO: Present all sections, but include isAllocated?+ */@TraceObjectInfo(- targetIf = TargetSection.class,+ schemaName = "Section",shortName = "section",+ attributes = {+ TraceObjectSection.KEY_MODULE,+ TraceObjectSection.KEY_RANGE,+ },fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- TargetSection.RANGE_ATTRIBUTE_NAME+ TraceObjectInterface.KEY_DISPLAY,+ TraceObjectSection.KEY_RANGE})public interface TraceObjectSection extends TraceSection, TraceObjectInterface {+ String KEY_MODULE = "_module";+ String KEY_RANGE = "_range";+void setName(Lifespan lifespan, String name);void setRange(Lifespan lifespan, AddressRange range);diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewMemory.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewMemory.javaindex 240d88d8d8..a46a159ee6 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewMemory.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/program/DBTraceProgramViewMemory.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -20,7 +20,6 @@ import java.util.function.Consumer;import java.util.function.Function;import ghidra.program.model.address.*;-import ghidra.program.model.mem.MemoryAccessException;import ghidra.program.model.mem.MemoryBlock;import ghidra.trace.model.memory.TraceMemoryRegion;import ghidra.util.LockHold;diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/AbstractDBTraceSpaceBasedManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/AbstractDBTraceSpaceBasedManager.javaindex 4d3fdb556e..88e23ce5f9 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/AbstractDBTraceSpaceBasedManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/AbstractDBTraceSpaceBasedManager.java@@ -23,12 +23,12 @@ import java.util.concurrent.locks.ReadWriteLock;import db.DBHandle;import db.DBRecord;import generic.CatenatedCollection;-import ghidra.dbg.target.TargetRegisterContainer;import ghidra.framework.data.OpenMode;import ghidra.program.model.address.*;import ghidra.program.model.lang.Language;import ghidra.trace.database.*;import ghidra.trace.database.thread.DBTraceThreadManager;+import ghidra.trace.model.memory.TraceObjectRegisterContainer;import ghidra.trace.model.stack.TraceObjectStackFrame;import ghidra.trace.model.stack.TraceStackFrame;import ghidra.trace.model.target.TraceObject;@@ -310,12 +310,12 @@ public abstract class AbstractDBTraceSpaceBasedManager<M extends DBTraceSpaceBas}protected TraceObject doGetRegisterContainer(TraceObject threadObject, int frameLevel) {- if (threadObject.getTargetSchema()+ if (threadObject.getSchema().getInterfaces()- .contains(TargetRegisterContainer.class)) {+ .contains(TraceObjectRegisterContainer.class)) {return threadObject;}- return threadObject.queryRegisterContainer(frameLevel);+ return threadObject.findRegisterContainer(frameLevel);}protected M getForRegisterSpace(TraceObject threadObject, int frameLevel,diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/DBTraceDelegatingManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/DBTraceDelegatingManager.javaindex b4ab4a993b..d7a7a5f74c 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/DBTraceDelegatingManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/space/DBTraceDelegatingManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -241,6 +241,7 @@ public interface DBTraceDelegatingManager<M> {* @param spaces the delegates* @param func an address set getter for each delegate* @return the unioned results+ * @throws E if {@code func} throws and exception*/default <E extends Throwable> AddressSetView delegateAddressSet(Iterable<M> spaces, ExcFunction<M, AddressSetView, E> func) throws E {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStack.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStack.javaindex 40efb04ccf..ff81c49c3d 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStack.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStack.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -19,14 +19,13 @@ import java.util.*;import java.util.stream.Collectors;import java.util.stream.Stream;-import ghidra.dbg.target.TargetStackFrame;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.*;import ghidra.trace.database.target.DBTraceObject;import ghidra.trace.database.target.DBTraceObjectInterface;import ghidra.trace.model.Lifespan;import ghidra.trace.model.stack.*;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.util.*;@@ -101,15 +100,14 @@ public class DBTraceObjectStack implements TraceObjectStack, DBTraceObjectInterfprotected TraceObjectStackFrame doAddStackFrame(int level) {try (LockHold hold = object.getTrace().lockWrite()) {- PathMatcher matcher = object.getTargetSchema().searchFor(TargetStackFrame.class, true);- List<String> relKeyList =- matcher.applyKeys(PathUtils.makeIndex(level)).getSingletonPath();- if (relKeyList == null) {+ PathMatcher matcher =+ object.getSchema().searchFor(TraceObjectStackFrame.class, true);+ KeyPath relPath = matcher.applyKeys(KeyPath.makeIndex(level)).getSingletonPath();+ if (relPath == null) {throw new IllegalStateException("Could not determine where to create new frame");}- List<String> keyList =- PathUtils.extend(object.getCanonicalPath().getKeyList(), relKeyList);- return object.getManager().addStackFrame(keyList, getSnap());+ KeyPath path = object.getCanonicalPath().extend(relPath);+ return object.getManager().addStackFrame(path, getSnap());}}@@ -175,15 +173,15 @@ public class DBTraceObjectStack implements TraceObjectStack, DBTraceObjectInterf}protected TraceStackFrame doGetFrame(int level) {- TargetObjectSchema schema = object.getTargetSchema();- PathPredicates matcher = schema.searchFor(TargetStackFrame.class, true);- PathPredicates decMatcher = matcher.applyKeys(PathUtils.makeIndex(level));- PathPredicates hexMatcher = matcher.applyKeys("0x" + Integer.toHexString(level));+ TraceObjectSchema schema = object.getSchema();+ PathFilter filter = schema.searchFor(TraceObjectStackFrame.class, true);+ PathFilter decFilter = filter.applyKeys(KeyPath.makeIndex(level));+ PathFilter hexFilter = filter.applyKeys("0x" + Integer.toHexString(level));Lifespan span = computeSpan();- return object.getSuccessors(span, decMatcher)+ return object.getSuccessors(span, decFilter).findAny().map(p -> p.getDestination(object).queryInterface(TraceObjectStackFrame.class))- .or(() -> object.getSuccessors(span, hexMatcher)+ .or(() -> object.getSuccessors(span, hexFilter).findAny().map(p -> p.getDestination(object).queryInterface(TraceObjectStackFrame.class)))diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStackFrame.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStackFrame.javaindex ef1d765760..614ad8ecef 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStackFrame.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceObjectStackFrame.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,9 +17,6 @@ package ghidra.trace.database.stack;import java.util.*;-import ghidra.dbg.target.TargetStackFrame;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathUtils;import ghidra.framework.model.EventType;import ghidra.program.model.address.Address;import ghidra.program.model.listing.CodeUnit;@@ -32,13 +29,15 @@ import ghidra.trace.model.stack.TraceObjectStack;import ghidra.trace.model.stack.TraceObjectStackFrame;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.TraceChangeRecord;import ghidra.trace.util.TraceEvents;import ghidra.util.LockHold;public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceObjectInterface {- private static final Map<TargetObjectSchema, Set<String>> KEYS_BY_SCHEMA = new WeakHashMap<>();+ private static final Map<TraceObjectSchema, Set<String>> KEYS_BY_SCHEMA = new WeakHashMap<>();private final DBTraceObject object;private final Set<String> keys;@@ -50,10 +49,10 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceObpublic DBTraceObjectStackFrame(DBTraceObject object) {this.object = object;- TargetObjectSchema schema = object.getTargetSchema();+ TraceObjectSchema schema = object.getSchema();synchronized (KEYS_BY_SCHEMA) {keys = KEYS_BY_SCHEMA.computeIfAbsent(schema,- s -> Set.of(schema.checkAliasedAttribute(TargetStackFrame.PC_ATTRIBUTE_NAME)));+ s -> Set.of(schema.checkAliasedAttribute(TraceObjectStackFrame.KEY_PC)));}}@@ -68,13 +67,13 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceOb@Overridepublic int getLevel() {- List<String> keys = object.getCanonicalPath().getKeyList();- for (int i = keys.size() - 1; i >= 0; i--) {- String k = keys.get(i);- if (!PathUtils.isIndex(k)) {+ KeyPath path = object.getCanonicalPath();+ for (int i = path.size() - 1; i >= 0; i--) {+ String k = path.key(i);+ if (!KeyPath.isIndex(k)) {continue;}- String index = PathUtils.parseIndex(k);+ String index = KeyPath.parseIndex(k);try {return Integer.decode(index);// TODO: Perhaps just have an attribute that is its level?@@ -88,7 +87,7 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceOb@Overridepublic Address getProgramCounter(long snap) {- return TraceObjectInterfaceUtils.getValue(object, snap, TargetStackFrame.PC_ATTRIBUTE_NAME,+ return TraceObjectInterfaceUtils.getValue(object, snap, TraceObjectStackFrame.KEY_PC,Address.class, null);}@@ -98,7 +97,7 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceObif (pc == Address.NO_ADDRESS) {pc = null;}- object.setValue(span, TargetStackFrame.PC_ATTRIBUTE_NAME, pc);+ object.setValue(span, TraceObjectStackFrame.KEY_PC, pc);}}@@ -128,7 +127,7 @@ public class DBTraceObjectStackFrame implements TraceObjectStackFrame, DBTraceObpublic void setComment(long snap, String comment) {/* See rant in getComment */try (LockHold hold = object.getTrace().lockWrite()) {- TraceObjectValue pcAttr = object.getValue(snap, TargetStackFrame.PC_ATTRIBUTE_NAME);+ TraceObjectValue pcAttr = object.getValue(snap, TraceObjectStackFrame.KEY_PC);object.getTrace().getCommentAdapter().setComment(pcAttr.getLifespan(), (Address) pcAttr.getValue(),diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStackManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStackManager.javaindex 8f03fdb0b2..60c8d584cd 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStackManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/stack/DBTraceStackManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,13 +16,10 @@package ghidra.trace.database.stack;import java.io.IOException;-import java.util.List;import java.util.concurrent.locks.ReadWriteLock;import db.DBHandle;import generic.NestedIterator;-import ghidra.dbg.target.*;-import ghidra.dbg.util.*;import ghidra.framework.data.OpenMode;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressSetView;@@ -34,7 +31,8 @@ import ghidra.trace.database.thread.DBTraceThreadManager;import ghidra.trace.model.Lifespan;import ghidra.trace.model.stack.*;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.*;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.util.TraceChangeRecord;@@ -97,8 +95,9 @@ public class DBTraceStackManager implements TraceStackManager, DBTraceManager {return frameStore.getObjectAt(frameKey);}- public static PathPredicates single(TraceObject seed, Class<? extends TargetObject> targetIf) {- PathMatcher stackMatcher = seed.getTargetSchema().searchFor(targetIf, false);+ public static PathFilter single(TraceObject seed,+ Class<? extends TraceObjectInterface> targetIf) {+ PathMatcher stackMatcher = seed.getSchema().searchFor(targetIf, false);if (stackMatcher.getSingletonPath() == null) {throw new IllegalStateException("Schema doesn't provide a unique " +targetIf.getSimpleName() + " for " + seed.getCanonicalPath());@@ -110,32 +109,29 @@ public class DBTraceStackManager implements TraceStackManager, DBTraceManager {boolean createIfAbsent) {TraceObjectThread objThread = (TraceObjectThread) thread;TraceObject obj = objThread.getObject();- PathPredicates predicates = single(obj, TargetStack.class);+ PathFilter filter = single(obj, TraceObjectStack.class);if (createIfAbsent) {try (LockHold hold = trace.lockWrite()) {TraceObjectStack stack = trace.getObjectManager()- .getSuccessor(obj, predicates, snap, TraceObjectStack.class);+ .getSuccessor(obj, filter, snap, TraceObjectStack.class);if (stack != null) {return stack;}- List<String> keyList = PathUtils.extend(obj.getCanonicalPath().getKeyList(),- predicates.getSingletonPath());- return trace.getObjectManager().addStack(keyList, snap);+ KeyPath path = obj.getCanonicalPath().extend(filter.getSingletonPath());+ return trace.getObjectManager().addStack(path, snap);}}try (LockHold hold = trace.lockRead()) {return trace.getObjectManager()- .getSuccessor(obj, predicates, snap, TraceObjectStack.class);+ .getSuccessor(obj, filter, snap, TraceObjectStack.class);}}protected TraceObjectStack doGetLatestObjectStack(TraceThread thread, long snap) {TraceObjectThread objThread = (TraceObjectThread) thread;TraceObject obj = objThread.getObject();- List<String> keyList = single(obj, TargetStack.class).getSingletonPath();- return trace.getObjectManager()- .getLatestSuccessor(obj, TraceObjectKeyPath.of(keyList), snap,- TraceObjectStack.class);+ KeyPath path = single(obj, TraceObjectStack.class).getSingletonPath();+ return trace.getObjectManager().getLatestSuccessor(obj, path, snap, TraceObjectStack.class);}@Override@@ -189,7 +185,7 @@ public class DBTraceStackManager implements TraceStackManager, DBTraceManager {return () -> NestedIterator.start(set.iterator(),rng -> trace.getObjectManager().getObjectsIntersecting(Lifespan.ALL, rng,- TargetStackFrame.PC_ATTRIBUTE_NAME, TraceObjectStackFrame.class)+ TraceObjectStackFrame.KEY_PC, TraceObjectStackFrame.class).iterator());}return () -> NestedIterator.start(set.iterator(),diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/AbstractDBTraceSymbol.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/AbstractDBTraceSymbol.javaindex e8c506269b..11344cffa1 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/AbstractDBTraceSymbol.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/AbstractDBTraceSymbol.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -26,7 +26,8 @@ import db.DBRecord;import ghidra.program.model.address.*;import ghidra.program.model.listing.CircularDependencyException;import ghidra.program.model.listing.Program;-import ghidra.program.model.symbol.*;+import ghidra.program.model.symbol.Namespace;+import ghidra.program.model.symbol.SourceType;import ghidra.program.util.ProgramLocation;import ghidra.trace.database.DBTrace;import ghidra.trace.database.address.DBTraceOverlaySpaceAdapter;@@ -89,9 +90,10 @@ public abstract class AbstractDBTraceSymbol extends DBAnnotatedObject/*** {@inheritDoc}*+ * <p>* NOTE: If the IDs match, then the symbols are considered equal, regardless of their other- * attributes. This mechanic seems required to support the whole "placeholder" idea. See- * {@link SymbolTable#createSymbolPlaceholder(Address, long)}.+ * attributes. This mechanic seems required to support the whole "placeholder" idea. TODO: The+ * "placeholder" thing may no longer be applicable.*/@Overridepublic boolean equals(Object obj) {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceReferenceManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceReferenceManager.javaindex 94bbbed54c..de78ef2266 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceReferenceManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/symbol/DBTraceReferenceManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -71,12 +71,13 @@ public class DBTraceReferenceManager extends AbstractDBTraceSpaceBasedManager<DB}/**- * Ensures that a "from" addresses is in memory+ * Ensures that a "from" address is in memory*+ * <p>* NOTE: To manage references from registers, you must use* {@link #getReferenceRegisterSpace(TraceThread, boolean)}, which requires a thread.*- * @param address the address to check+ * @param space the space of the address to check*/@Overridepublic void checkIsInMemory(AddressSpace space) {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/CachePerDBTraceObject.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/CachePerDBTraceObject.javaindex a2d385e9e3..5c677ba876 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/CachePerDBTraceObject.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/CachePerDBTraceObject.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -62,8 +62,6 @@ public class CachePerDBTraceObject {}private static final int MAX_CACHE_KEYS = 200;- private static final int MAX_VALUES_PER_KEY = 20;- private static final int MAX_VALUES_ANY_KEY = 4000;private static final int EXPANSION = 10;private record CachedLifespanValues<K>(Lifespan span,diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObject.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObject.javaindex 82515aa92d..2b7d0563b9 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObject.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObject.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,42 +18,26 @@ package ghidra.trace.database.target;import java.io.IOException;import java.lang.reflect.Field;import java.util.*;-import java.util.function.Function;import java.util.stream.Collectors;import java.util.stream.Stream;import db.DBRecord;import db.StringField;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.*;import ghidra.trace.database.DBTrace;-import ghidra.trace.database.breakpoint.DBTraceObjectBreakpointLocation;-import ghidra.trace.database.breakpoint.DBTraceObjectBreakpointSpec;-import ghidra.trace.database.memory.DBTraceObjectMemoryRegion;-import ghidra.trace.database.memory.DBTraceObjectRegister;-import ghidra.trace.database.module.*;-import ghidra.trace.database.stack.DBTraceObjectStack;-import ghidra.trace.database.stack.DBTraceObjectStackFrame;import ghidra.trace.database.target.CachePerDBTraceObject.Cached;import ghidra.trace.database.target.DBTraceObjectValue.ValueLifespanSetter;import ghidra.trace.database.target.ValueSpace.EntryKeyDimension;import ghidra.trace.database.target.ValueSpace.SnapDimension;import ghidra.trace.database.target.visitors.*;import ghidra.trace.database.target.visitors.TreeTraversal.Visitor;-import ghidra.trace.database.thread.DBTraceObjectThread;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Lifespan.*;-import ghidra.trace.model.breakpoint.TraceObjectBreakpointLocation;-import ghidra.trace.model.breakpoint.TraceObjectBreakpointSpec;-import ghidra.trace.model.memory.TraceObjectMemoryRegion;-import ghidra.trace.model.memory.TraceObjectRegister;-import ghidra.trace.model.modules.TraceObjectModule;-import ghidra.trace.model.stack.TraceObjectStack;-import ghidra.trace.model.stack.TraceObjectStackFrame;import ghidra.trace.model.target.*;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;-import ghidra.trace.model.thread.TraceObjectThread;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInterfaceFactory.Constructor;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.TraceChangeRecord;import ghidra.trace.util.TraceEvents;import ghidra.util.*;@@ -65,43 +49,24 @@ import ghidra.util.database.annot.*;public class DBTraceObject extends DBAnnotatedObject implements TraceObject {protected static final String TABLE_NAME = "Objects";- protected static <T extends TraceObjectInterface> //- Map.Entry<Class<? extends T>, Function<DBTraceObject, ? extends T>> safeEntry(- Class<T> cls, Function<DBTraceObject, ? extends T> ctor) {- return Map.entry(cls, ctor);- }-- protected static final Map<Class<? extends TraceObjectInterface>, //- Function<DBTraceObject, ? extends TraceObjectInterface>> CTORS = Map.ofEntries(- safeEntry(TraceObjectThread.class, DBTraceObjectThread::new),- safeEntry(TraceObjectMemoryRegion.class, DBTraceObjectMemoryRegion::new),- safeEntry(TraceObjectModule.class, DBTraceObjectModule::new),- safeEntry(TraceObjectSection.class, DBTraceObjectSection::new),- safeEntry(TraceObjectBreakpointSpec.class, DBTraceObjectBreakpointSpec::new),- safeEntry(TraceObjectBreakpointLocation.class,- DBTraceObjectBreakpointLocation::new),- safeEntry(TraceObjectStack.class, DBTraceObjectStack::new),- safeEntry(TraceObjectStackFrame.class, DBTraceObjectStackFrame::new),- safeEntry(TraceObjectRegister.class, DBTraceObjectRegister::new));-protected static final class ObjectPathDBFieldCodec- extends AbstractDBFieldCodec<TraceObjectKeyPath, DBAnnotatedObject, StringField> {+ extends AbstractDBFieldCodec<KeyPath, DBAnnotatedObject, StringField> {public ObjectPathDBFieldCodec(Class<DBAnnotatedObject> objectType, Field field,int column) {- super(TraceObjectKeyPath.class, objectType, StringField.class, field, column);+ super(KeyPath.class, objectType, StringField.class, field, column);}- protected String encode(TraceObjectKeyPath value) {+ protected String encode(KeyPath value) {return value == null ? null : value.toString();}- protected TraceObjectKeyPath decode(String path) {- return TraceObjectKeyPath.parse(path);+ protected KeyPath decode(String path) {+ return KeyPath.parse(path);}@Override- public void store(TraceObjectKeyPath value, StringField f) {+ public void store(KeyPath value, StringField f) {f.setString(encode(value));}@@ -128,11 +93,11 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {column = PATH_COLUMN_NAME,codec = ObjectPathDBFieldCodec.class,indexed = true)- private TraceObjectKeyPath path;+ private KeyPath path;protected final DBTraceObjectManager manager;- private TargetObjectSchema targetSchema;+ private TraceObjectSchema schema;private Map<Class<? extends TraceObjectInterface>, TraceObjectInterface> ifaces;private final CachePerDBTraceObject cache = new CachePerDBTraceObject();@@ -163,16 +128,13 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {if (ifaces != null) {return;}- Set<Class<? extends TargetObject>> targetIfaces = getTargetSchema().getInterfaces();- ifaces = CTORS.entrySet()- .stream()- .filter(- e -> targetIfaces.contains(TraceObjectInterfaceUtils.toTargetIf(e.getKey())))- .collect(- Collectors.toUnmodifiableMap(e -> e.getKey(), e -> e.getValue().apply(this)));+ ifaces = TraceObjectInterfaceUtils.streamConstructors(getSchema())+ .collect(Collectors.toUnmodifiableMap(+ Constructor::iface,+ c -> c.ctor().apply(this)));}- protected void set(TraceObjectKeyPath path) {+ protected void set(KeyPath path) {this.path = path;update(PATH_COLUMN);@@ -194,7 +156,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {}@Override- public TraceObjectKeyPath getCanonicalPath() {+ public KeyPath getCanonicalPath() {try (LockHold hold = manager.trace.lockRead()) {return path;}@@ -334,11 +296,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic Collection<Class<? extends TraceObjectInterface>> getInterfaces() {- Set<Class<? extends TargetObject>> targetIfs = getTargetSchema().getInterfaces();- return CTORS.keySet()- .stream()- .filter(iface -> targetIfs.contains(TraceObjectInterfaceUtils.toTargetIf(iface)))- .collect(Collectors.toSet());+ return getSchema().getInterfaces();}@Override@@ -420,7 +378,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {public Collection<DBTraceObjectValue> getElements(Lifespan lifespan) {try (LockHold hold = manager.trace.lockRead()) {return streamValuesR(lifespan)- .filter(v -> PathUtils.isIndex(v.getEntryKey()))+ .filter(v -> KeyPath.isIndex(v.getEntryKey())).toList();}}@@ -429,7 +387,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {public Collection<DBTraceObjectValue> getAttributes(Lifespan lifespan) {try (LockHold hold = manager.trace.lockRead()) {return streamValuesR(lifespan)- .filter(v -> PathUtils.isName(v.getEntryKey()))+ .filter(v -> KeyPath.isName(v.getEntryKey())).toList();}}@@ -492,7 +450,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic Collection<? extends DBTraceObjectValue> getValues(Lifespan span, String key) {try (LockHold hold = manager.trace.lockRead()) {- String k = getTargetSchema().checkAliasedAttribute(key);+ String k = getSchema().checkAliasedAttribute(key);return streamValuesR(span, k, true).toList();}}@@ -524,7 +482,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic DBTraceObjectValue getValue(long snap, String key) {try (LockHold hold = manager.trace.lockRead()) {- String k = getTargetSchema().checkAliasedAttribute(key);+ String k = getSchema().checkAliasedAttribute(key);return getValueR(snap, k);}}@@ -533,7 +491,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {public Stream<DBTraceObjectValue> getOrderedValues(Lifespan span, String key,boolean forward) {try (LockHold hold = manager.trace.lockRead()) {- String k = getTargetSchema().checkAliasedAttribute(key);+ String k = getSchema().checkAliasedAttribute(key);// Locking issue if we stream lazily. Capture to list with lockreturn streamValuesR(span, k, forward).toList().stream();}@@ -541,17 +499,17 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic DBTraceObjectValue getElement(long snap, String index) {- return getValue(snap, PathUtils.makeKey(index));+ return getValue(snap, KeyPath.makeKey(index));}@Overridepublic DBTraceObjectValue getElement(long snap, long index) {- return getElement(snap, PathUtils.makeIndex(index));+ return getElement(snap, KeyPath.makeIndex(index));}@Overridepublic TraceObjectValue getAttribute(long snap, String name) {- if (!PathUtils.isName(name)) {+ if (!KeyPath.isName(name)) {throw new IllegalArgumentException("name cannot be an index");}return getValue(snap, name);@@ -566,11 +524,11 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic Stream<? extends TraceObjectValPath> getAncestors(Lifespan span,- PathPredicates relativePredicates) {+ PathFilter relativeFilter) {try (LockHold hold = manager.trace.lockRead()) {Stream<? extends TraceObjectValPath> ancestors =- doStreamVisitor(span, new AncestorsRelativeVisitor(relativePredicates));- if (relativePredicates.matches(List.of())) {+ doStreamVisitor(span, new AncestorsRelativeVisitor(relativeFilter));+ if (relativeFilter.matches(KeyPath.ROOT)) {return Stream.concat(Stream.of(DBTraceObjectValPath.of()), ancestors);}return ancestors;@@ -579,19 +537,19 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic Stream<? extends TraceObjectValPath> getAncestorsRoot(- Lifespan span, PathPredicates rootPredicates) {+ Lifespan span, PathFilter rootFilter) {try (LockHold hold = manager.trace.lockRead()) {- return doStreamVisitor(span, new AncestorsRootVisitor(rootPredicates));+ return doStreamVisitor(span, new AncestorsRootVisitor(rootFilter));}}@Overridepublic Stream<? extends TraceObjectValPath> getSuccessors(- Lifespan span, PathPredicates relativePredicates) {+ Lifespan span, PathFilter relativeFilter) {try (LockHold hold = manager.trace.lockRead()) {Stream<? extends TraceObjectValPath> succcessors =- doStreamVisitor(span, new SuccessorsRelativeVisitor(relativePredicates));- if (relativePredicates.matches(List.of())) {+ doStreamVisitor(span, new SuccessorsRelativeVisitor(relativeFilter));+ if (relativeFilter.matches(KeyPath.ROOT)) {// Pre-cat the empty path (not the empty stream)return Stream.concat(Stream.of(DBTraceObjectValPath.of()), succcessors);}@@ -601,7 +559,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic Stream<? extends TraceObjectValPath> getOrderedSuccessors(Lifespan span,- TraceObjectKeyPath relativePath, boolean forward) {+ KeyPath relativePath, boolean forward) {DBTraceObjectValPath empty = DBTraceObjectValPath.of();try (LockHold hold = manager.trace.lockRead()) {if (relativePath.isRoot()) {@@ -615,11 +573,11 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic Stream<? extends TraceObjectValPath> getCanonicalSuccessors(- PathPredicates relativePredicates) {+ PathFilter relativeFilter) {try (LockHold hold = manager.trace.lockRead()) {Stream<? extends TraceObjectValPath> successors = doStreamVisitor(Lifespan.ALL,- new CanonicalSuccessorsRelativeVisitor(relativePredicates));- if (relativePredicates.matches(List.of())) {+ new CanonicalSuccessorsRelativeVisitor(relativeFilter));+ if (relativeFilter.matches(KeyPath.ROOT)) {// Pre-cat the empty path (not the empty stream)return Stream.concat(Stream.of(DBTraceObjectValPath.of()), successors);}@@ -638,7 +596,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {if (isDeleted()) {throw new IllegalStateException("Cannot set value on deleted object.");}- String k = getTargetSchema().checkAliasedAttribute(key);+ String k = getSchema().checkAliasedAttribute(key);if (resolution == ConflictResolution.DENY) {doCheckConflicts(lifespan, k, value);}@@ -694,7 +652,7 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic TraceObjectValue setAttribute(Lifespan lifespan, String name, Object value) {- if (!PathUtils.isName(name)) {+ if (!KeyPath.isName(name)) {throw new IllegalArgumentException("Attribute name must not be an index");}return setValue(lifespan, name, value);@@ -702,41 +660,41 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic TraceObjectValue setElement(Lifespan lifespan, String index, Object value) {- return setValue(lifespan, PathUtils.makeKey(index), value);+ return setValue(lifespan, KeyPath.makeKey(index), value);}@Overridepublic TraceObjectValue setElement(Lifespan lifespan, long index, Object value) {- return setElement(lifespan, PathUtils.makeIndex(index), value);+ return setElement(lifespan, KeyPath.makeIndex(index), value);}@Override- public TargetObjectSchema getTargetSchema() {+ public TraceObjectSchema getSchema() {// NOTE: No need to synchronize. Schema is immutable.- if (targetSchema == null) {- targetSchema = manager.rootSchema.getSuccessorSchema(path.getKeyList());+ if (schema == null) {+ schema = manager.rootSchema.getSuccessorSchema(path);}- return targetSchema;+ return schema;}@Override- public Stream<? extends TraceObjectValPath> queryAncestorsTargetInterface(Lifespan span,- Class<? extends TargetObject> targetIf) {+ public Stream<? extends TraceObjectValPath> findAncestorsInterface(Lifespan span,+ Class<? extends TraceObjectInterface> iface) {// This is a sort of meet-in-the-middle. The type search must originate from the root- PathMatcher matcher = getManager().getRootSchema().searchFor(targetIf, false);+ PathMatcher matcher = getManager().getRootSchema().searchFor(iface, false);return getAncestorsRoot(span, matcher);}@Overridepublic <I extends TraceObjectInterface> Stream<I> queryAncestorsInterface(Lifespan span,- Class<I> ifClass) {- return queryAncestorsTargetInterface(span, TraceObjectInterfaceUtils.toTargetIf(ifClass))- .map(p -> p.getSource(this).queryInterface(ifClass));+ Class<I> iface) {+ return findAncestorsInterface(span, iface)+ .map(p -> p.getSource(this).queryInterface(iface));}- public TraceObject queryOrCreateCanonicalAncestorTargetInterface(- Class<? extends TargetObject> targetIf) {- PathMatcher matcher = getManager().getRootSchema().searchFor(targetIf, false);+ public TraceObject findOrCreateCanonicalAncestorInterface(+ Class<? extends TraceObjectInterface> iface) {+ PathMatcher matcher = getManager().getRootSchema().searchFor(iface, false);return path.streamMatchingAncestry(matcher).limit(1).map(kp -> manager.createObject(kp))@@ -745,16 +703,15 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {}public <I extends TraceObjectInterface> I queryOrCreateCanonicalAncestorInterface(- Class<I> ifClass) {- return queryOrCreateCanonicalAncestorTargetInterface(- TraceObjectInterfaceUtils.toTargetIf(ifClass)).queryInterface(ifClass);+ Class<I> iface) {+ return findOrCreateCanonicalAncestorInterface(iface).queryInterface(iface);}@Override- public Stream<? extends TraceObject> queryCanonicalAncestorsTargetInterface(- Class<? extends TargetObject> targetIf) {+ public Stream<? extends TraceObject> findCanonicalAncestorsInterface(+ Class<? extends TraceObjectInterface> iface) {// This is a sort of meet-in-the-middle. The type search must originate from the root- PathMatcher matcher = getManager().getRootSchema().searchFor(targetIf, false);+ PathMatcher matcher = getManager().getRootSchema().searchFor(iface, false);try (LockHold hold = manager.trace.lockRead()) {return path.streamMatchingAncestry(matcher).map(kp -> manager.getObjectByCanonicalPath(kp));@@ -763,37 +720,36 @@ public class DBTraceObject extends DBAnnotatedObject implements TraceObject {@Overridepublic <I extends TraceObjectInterface> Stream<I> queryCanonicalAncestorsInterface(- Class<I> ifClass) {- return queryCanonicalAncestorsTargetInterface(TraceObjectInterfaceUtils.toTargetIf(ifClass))- .map(o -> o.queryInterface(ifClass));+ Class<I> iface) {+ return findCanonicalAncestorsInterface(iface).map(o -> o.queryInterface(iface));}// TODO: Post filter until GP-1301private boolean isActuallyInterface(TraceObjectValPath path,- Class<? extends TargetObject> targetIf) {+ Class<? extends TraceObjectInterface> iface) {TraceObjectValue lastEntry = path.getLastEntry();if (lastEntry == null) {// TODO: This assumes the client will call getDestination(this)- return this.getTargetSchema().getInterfaces().contains(targetIf);+ return this.getSchema().getInterfaces().contains(iface);}if (!lastEntry.isObject()) {return false;}- return lastEntry.getChild().getTargetSchema().getInterfaces().contains(targetIf);+ return lastEntry.getChild().getSchema().getInterfaces().contains(iface);}@Override- public Stream<? extends TraceObjectValPath> querySuccessorsTargetInterface(Lifespan span,- Class<? extends TargetObject> targetIf, boolean requireCanonical) {- PathMatcher matcher = getTargetSchema().searchFor(targetIf, requireCanonical);- return getSuccessors(span, matcher).filter(p -> isActuallyInterface(p, targetIf));+ public Stream<? extends TraceObjectValPath> findSuccessorsInterface(Lifespan span,+ Class<? extends TraceObjectInterface> iface, boolean requireCanonical) {+ PathMatcher matcher = getSchema().searchFor(iface, requireCanonical);+ return getSuccessors(span, matcher).filter(p -> isActuallyInterface(p, iface));}@Overridepublic <I extends TraceObjectInterface> Stream<I> querySuccessorsInterface(Lifespan span,- Class<I> ifClass, boolean requireCanonical) {- return querySuccessorsTargetInterface(span, TraceObjectInterfaceUtils.toTargetIf(ifClass),- requireCanonical).map(p -> p.getDestination(this).queryInterface(ifClass));+ Class<I> iface, boolean requireCanonical) {+ return findSuccessorsInterface(span, iface, requireCanonical)+ .map(p -> p.getDestination(this).queryInterface(iface));}protected void doDelete() {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectInterface.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectInterface.javaindex 868f190382..302d29e042 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectInterface.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectInterface.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,7 +15,6 @@*/package ghidra.trace.database.target;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;import ghidra.trace.database.space.DBTraceSpaceKey.DefaultDBTraceSpaceKey;@@ -23,7 +22,10 @@ import ghidra.trace.model.Lifespan;import ghidra.trace.model.Lifespan.DefaultLifeSet;import ghidra.trace.model.Lifespan.LifeSet;import ghidra.trace.model.TraceUniqueObject;-import ghidra.trace.model.target.*;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.util.*;import ghidra.util.database.ObjectKey;@@ -42,7 +44,7 @@ public interface DBTraceObjectInterface extends TraceObjectInterface, TraceUniquthis.spaceValueKey = null;}else {- TargetObjectSchema schema = object.getTargetSchema();+ TraceObjectSchema schema = object.getSchema();this.spaceValueKey = schema.checkAliasedAttribute(spaceValueKey);}this.object = object;diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectManager.javaindex 055b124216..252010d9b5 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectManager.java@@ -26,11 +26,6 @@ import java.util.stream.Stream;import org.jdom.JDOMException;import db.*;-import ghidra.dbg.target.TargetBreakpointSpec;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.util.*;import ghidra.framework.data.OpenMode;import ghidra.program.model.address.*;import ghidra.program.model.lang.Language;@@ -52,7 +47,10 @@ import ghidra.trace.model.stack.TraceObjectStackFrame;import ghidra.trace.model.target.*;import ghidra.trace.model.target.DuplicateKeyException;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.util.TraceChangeRecord;@@ -126,7 +124,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager@DBAnnotatedField(column = SCHEMA_COLUMN_NAME)private String schemaName;- private TargetObjectSchema schema;+ private TraceObjectSchema schema;public DBTraceObjectSchemaEntry(DBCachedObjectStore<?> store, DBRecord record) {super(store, record);@@ -140,7 +138,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerschema = context.getSchema(new SchemaName(schemaName));}- protected void set(TargetObjectSchema schema) {+ protected void set(TraceObjectSchema schema) {context = schema.getContext();schemaName = schema.getName().toString();update(CONTEXT_COLUMN, SCHEMA_COLUMN);@@ -159,11 +157,11 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerprotected final DBTraceObjectValueMap valueMap;protected final DBTraceObjectValueWriteBehindCache valueWbCache;- protected final DBCachedObjectIndex<TraceObjectKeyPath, DBTraceObject> objectsByPath;+ protected final DBCachedObjectIndex<KeyPath, DBTraceObject> objectsByPath;protected final Collection<TraceObject> objectsView;- protected TargetObjectSchema rootSchema;+ protected TraceObjectSchema rootSchema;protected final Map<ObjectsContainingKey, Collection<?>> objectsContainingCache =new LinkedHashMap<>() {@@ -172,7 +170,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerreturn size() > OBJECTS_CONTAINING_CACHE_SIZE;}};- protected final Map<Class<? extends TraceObjectInterface>, Set<TargetObjectSchema>> //+ protected final Map<Class<? extends TraceObjectInterface>, Set<TraceObjectSchema>> //schemasByInterface = new HashMap<>();public DBTraceObjectManager(DBHandle dbh, OpenMode openMode, ReadWriteLock lock,@@ -193,7 +191,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerDBTraceObjectValueNode.class, false, 50);valueMap = valueTree.asSpatialMap();- objectsByPath = objectStore.getIndex(TraceObjectKeyPath.class, DBTraceObject.PATH_COLUMN);+ objectsByPath = objectStore.getIndex(KeyPath.class, DBTraceObject.PATH_COLUMN);valueWbCache = new DBTraceObjectValueWriteBehindCache(this);@@ -269,7 +267,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerreturn trace;}- protected void setSchema(TargetObjectSchema schema) {+ protected void setSchema(TraceObjectSchema schema) {if (rootSchema != null) {throw new IllegalStateException("There is already a root object");}@@ -314,7 +312,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerreturn entry;}- protected DBTraceObject doCreateObject(TraceObjectKeyPath path) {+ protected DBTraceObject doCreateObject(KeyPath path) {DBTraceObject obj = objectsByPath.getOne(path);if (obj != null) {return obj;@@ -325,12 +323,12 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerreturn obj;}- protected DBTraceObject doGetObject(TraceObjectKeyPath path) {+ protected DBTraceObject doGetObject(KeyPath path) {return objectsByPath.getOne(path);}@Override- public DBTraceObject createObject(TraceObjectKeyPath path) {+ public DBTraceObject createObject(KeyPath path) {if (path.isRoot()) {throw new IllegalArgumentException("Cannot create non-root object with root path");}@@ -343,10 +341,10 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager}@Override- public DBTraceObjectValue createRootObject(TargetObjectSchema schema) {+ public DBTraceObjectValue createRootObject(TraceObjectSchema schema) {try (LockHold hold = trace.lockWrite()) {setSchema(schema);- DBTraceObject root = doCreateObject(TraceObjectKeyPath.of());+ DBTraceObject root = doCreateObject(KeyPath.of());assert root.getKey() == 0;DBTraceObjectValue val = doCreateValue(Lifespan.ALL, null, "", root);assert val.getWrapped() instanceof DBTraceObjectValueData data && data.getKey() == 0;@@ -355,7 +353,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager}@Override- public TargetObjectSchema getRootSchema() {+ public TraceObjectSchema getRootSchema() {try (LockHold hold = trace.lockRead()) {return rootSchema;}@@ -381,15 +379,15 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager}@Override- public DBTraceObject getObjectByCanonicalPath(TraceObjectKeyPath path) {+ public DBTraceObject getObjectByCanonicalPath(KeyPath path) {return objectsByPath.getOne(path);}@Overridepublic Stream<? extends DBTraceObject> getObjectsByPath(Lifespan span,- TraceObjectKeyPath path) {+ KeyPath path) {DBTraceObject root = getRootObject();- return getValuePaths(span, new PathPattern(path.getKeyList()))+ return getValuePaths(span, new PathPattern(path)).map(p -> p.getDestinationValue(root)).filter(DBTraceObject.class::isInstance).map(DBTraceObject.class::cast);@@ -397,13 +395,13 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager@Overridepublic Stream<? extends TraceObjectValPath> getValuePaths(Lifespan span,- PathPredicates predicates) {+ PathFilter filter) {try (LockHold hold = trace.lockRead()) {DBTraceObjectValue rootVal = getRootValue();if (rootVal == null) {return Stream.of();}- return rootVal.doStreamVisitor(span, new SuccessorsRelativeVisitor(predicates));+ return rootVal.doStreamVisitor(span, new SuccessorsRelativeVisitor(filter));}}@@ -467,12 +465,11 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager@Overridepublic <I extends TraceObjectInterface> Stream<I> queryAllInterface(Lifespan span,- Class<I> ifClass) {+ Class<I> iface) {if (rootSchema == null) {throw new IllegalStateException("There is no schema. Create a root object.");}- Class<? extends TargetObject> targetIf = TraceObjectInterfaceUtils.toTargetIf(ifClass);- PathMatcher matcher = rootSchema.searchFor(targetIf, true);+ PathMatcher matcher = rootSchema.searchFor(iface, true);return getValuePaths(span, matcher).filter(p -> {TraceObject object = p.getDestination(getRootObject());if (object == null) {@@ -480,7 +477,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerreturn false;}return true;- }).map(p -> p.getDestination(getRootObject()).queryInterface(ifClass));+ }).map(p -> p.getDestination(getRootObject()).queryInterface(iface));}@Override@@ -534,21 +531,18 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerreturn rootSchema != null;}- protected <I extends TraceObjectInterface> I doAddWithInterface(List<String> keyList,- Class<I> iface) {- Class<? extends TargetObject> targetIf = TraceObjectInterfaceUtils.toTargetIf(iface);- TargetObjectSchema schema = rootSchema.getSuccessorSchema(keyList);- if (!schema.getInterfaces().contains(targetIf)) {- throw new BadSchemaException(- "Schema " + schema + " at '" + PathUtils.toString(keyList) +- "' does not provide interface " + iface.getSimpleName());- }- DBTraceObject obj = createObject(TraceObjectKeyPath.of(keyList));+ protected <I extends TraceObjectInterface> I doAddWithInterface(KeyPath path, Class<I> iface) {+ TraceObjectSchema schema = rootSchema.getSuccessorSchema(path);+ if (!schema.getInterfaces().contains(iface)) {+ throw new BadSchemaException("Schema " + schema + " at '" + path ++ "' does not provide interface " + iface.getSimpleName());+ }+ DBTraceObject obj = createObject(path);return obj.queryInterface(iface);}protected <I extends TraceObjectInterface> I doAddWithInterface(String path, Class<I> iface) {- return doAddWithInterface(PathUtils.parse(path), iface);+ return doAddWithInterface(KeyPath.parse(path), iface);}public <I extends TraceObjectInterface> Collection<I> getAllObjects(Class<I> iface) {@@ -560,7 +554,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerpublic <I extends TraceObjectInterface> Collection<I> getObjectsByPath(String path,Class<I> iface) {try (LockHold hold = trace.lockRead()) {- return getObjectsByPath(Lifespan.ALL, TraceObjectKeyPath.parse(path))+ return getObjectsByPath(Lifespan.ALL, KeyPath.parse(path)).map(o -> o.queryInterface(iface)).filter(i -> i != null).collect(Collectors.toSet());@@ -570,7 +564,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerpublic <I extends TraceObjectInterface> I getObjectByPath(long snap, String path,Class<I> iface) {try (LockHold hold = trace.lockRead()) {- TraceObjectKeyPath parsed = TraceObjectKeyPath.parse(path);+ KeyPath parsed = KeyPath.parse(path);DBTraceObject object = getObjectByCanonicalPath(parsed);if (object != null) {return object.queryInterface(iface);@@ -614,15 +608,14 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerreturn col.iterator().next();}- protected Set<TargetObjectSchema> collectSchemasForInterface(+ protected Set<TraceObjectSchema> collectSchemasForInterface(Class<? extends TraceObjectInterface> iface) {if (rootSchema == null) {return Set.of();}- Class<? extends TargetObject> targetIf = TraceObjectInterfaceUtils.toTargetIf(iface);- Set<TargetObjectSchema> result = new HashSet<>();- for (TargetObjectSchema schema : rootSchema.getContext().getAllSchemas()) {- if (schema.getInterfaces().contains(targetIf)) {+ Set<TraceObjectSchema> result = new HashSet<>();+ for (TraceObjectSchema schema : rootSchema.getContext().getAllSchemas()) {+ if (schema.getInterfaces().contains(iface)) {result.add(schema);}}@@ -632,17 +625,17 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerpublic <I extends TraceObjectInterface> Collection<I> getObjectsIntersecting(Lifespan lifespan,AddressRange range, String key, Class<I> iface) {try (LockHold hold = trace.lockRead()) {- Set<TargetObjectSchema> schemas;+ Set<TraceObjectSchema> schemas;synchronized (schemasByInterface) {schemas =schemasByInterface.computeIfAbsent(iface, this::collectSchemasForInterface);}- Map<String, List<TargetObjectSchema>> schemasByAliasTo =+ Map<String, List<TraceObjectSchema>> schemasByAliasTo =schemas.stream().collect(Collectors.groupingBy(s -> s.checkAliasedAttribute(key)));return schemasByAliasTo.entrySet().stream().flatMap(ent -> {return getValuesIntersecting(lifespan, range, ent.getKey()).stream().map(v -> v.getParent())- .filter(o -> ent.getValue().contains(o.getTargetSchema()));+ .filter(o -> ent.getValue().contains(o.getSchema()));}).map(o -> o.queryInterface(iface)).collect(Collectors.toSet());}}@@ -679,9 +672,9 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager}public <I extends TraceObjectInterface> I getSuccessor(TraceObject seed,- PathPredicates predicates, long snap, Class<I> iface) {+ PathFilter filter, long snap, Class<I> iface) {try (LockHold hold = trace.lockRead()) {- return seed.getSuccessors(Lifespan.at(snap), predicates)+ return seed.getSuccessors(Lifespan.at(snap), filter).map(p -> p.getDestination(seed).queryInterface(iface)).filter(i -> i != null).findAny()@@ -690,7 +683,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager}public <I extends TraceObjectInterface> I getLatestSuccessor(TraceObject seed,- TraceObjectKeyPath path, long snap, Class<I> iface) {+ KeyPath path, long snap, Class<I> iface) {try (LockHold hold = trace.lockRead()) {return seed.getOrderedSuccessors(Lifespan.toNow(snap), path, false).map(p -> p.getDestination(seed).queryInterface(iface))@@ -705,8 +698,8 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerCollection<TraceBreakpointKind> kinds, boolean enabled, String comment)throws DuplicateNameException {// First verify that the schema accommodates- List<String> specPath =- getRootSchema().searchForAncestor(TargetBreakpointSpec.class, PathUtils.parse(path));+ KeyPath specPath = getRootSchema().searchForAncestor(TraceObjectBreakpointSpec.class,+ KeyPath.parse(path));if (specPath == null) {throw new IllegalStateException("The schema does not provide an implicit " +"breakpoint specification on the given path.");@@ -773,17 +766,17 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManager}}- public TraceObjectStack addStack(List<String> keyList, long snap) {+ public TraceObjectStack addStack(KeyPath path, long snap) {try (LockHold hold = trace.lockWrite()) {- TraceObjectStack stack = doAddWithInterface(keyList, TraceObjectStack.class);+ TraceObjectStack stack = doAddWithInterface(path, TraceObjectStack.class);stack.getObject().insert(Lifespan.at(snap), ConflictResolution.DENY);return stack;}}- public TraceObjectStackFrame addStackFrame(List<String> keyList, long snap) {+ public TraceObjectStackFrame addStackFrame(KeyPath path, long snap) {try (LockHold hold = trace.lockWrite()) {- TraceObjectStackFrame frame = doAddWithInterface(keyList, TraceObjectStackFrame.class);+ TraceObjectStackFrame frame = doAddWithInterface(path, TraceObjectStackFrame.class);frame.getObject().insert(Lifespan.at(snap), ConflictResolution.DENY);return frame;}@@ -792,7 +785,7 @@ public class DBTraceObjectManager implements TraceObjectManager, DBTraceManagerprotected void checkDuplicateThread(String path, Lifespan lifespan)throws DuplicateNameException {// TODO: Change the semantics to just expand the life rather than complain of duplication- DBTraceObject exists = getObjectByCanonicalPath(TraceObjectKeyPath.parse(path));+ DBTraceObject exists = getObjectByCanonicalPath(KeyPath.parse(path));if (exists == null) {return;}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValPath.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValPath.javaindex 215b429a96..4dbc07968b 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValPath.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValPath.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,10 +16,10 @@package ghidra.trace.database.target;import java.util.*;-import java.util.stream.Collectors;-import ghidra.dbg.util.PathUtils.PathComparator;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.KeyPath.PathComparator;public class DBTraceObjectValPath implements TraceObjectValPath {public static final DBTraceObjectValPath EMPTY = new DBTraceObjectValPath(List.of());@@ -37,15 +37,15 @@ public class DBTraceObjectValPath implements TraceObjectValPath {}private final List<DBTraceObjectValue> entryList;- private List<String> keyList; // lazily computed+ private KeyPath path; // lazily computedprivate DBTraceObjectValPath(List<DBTraceObjectValue> entryList) {this.entryList = entryList;}@Override- public int compareTo(TraceObjectValPath o) {- return PathComparator.KEYED.compare(getKeyList(), o.getKeyList());+ public int compareTo(TraceObjectValPath that) {+ return PathComparator.KEYED.compare(this.getPath(), that.getPath());}@Override@@ -53,18 +53,16 @@ public class DBTraceObjectValPath implements TraceObjectValPath {return entryList;}- protected List<String> computeKeyList() {- return entryList.stream()- .map(e -> e.getEntryKey())- .collect(Collectors.toUnmodifiableList());+ protected KeyPath computePath() {+ return KeyPath.of(entryList.stream().map(e -> e.getEntryKey()));}@Override- public List<String> getKeyList() {- if (keyList == null) {- keyList = computeKeyList();+ public KeyPath getPath() {+ if (path == null) {+ path = computePath();}- return keyList;+ return path;}@Overridediff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValue.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValue.javaindex b0248e6a5b..3bf5a517e0 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValue.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValue.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -25,6 +25,7 @@ import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.KeyPath;import ghidra.trace.util.TraceChangeRecord;import ghidra.trace.util.TraceEvents;import ghidra.util.LockHold;@@ -178,16 +179,16 @@ public class DBTraceObjectValue implements TraceObjectValue {}}- protected TraceObjectKeyPath doGetCanonicalPath() {+ protected KeyPath doGetCanonicalPath() {DBTraceObject parent = wrapped.getParent();if (parent == null) {- return TraceObjectKeyPath.of();+ return KeyPath.of();}return parent.getCanonicalPath().extend(wrapped.getEntryKey());}@Override- public TraceObjectKeyPath getCanonicalPath() {+ public KeyPath getCanonicalPath() {try (LockHold hold = LockHold.lock(manager.lock.readLock())) {return doGetCanonicalPath();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValueWriteBehindCache.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValueWriteBehindCache.javaindex 421da8b434..13b0481e16 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValueWriteBehindCache.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/DBTraceObjectValueWriteBehindCache.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -25,8 +25,8 @@ import db.Transaction;import ghidra.async.AsyncReference;import ghidra.program.model.address.*;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.*;class DBTraceObjectValueWriteBehindCache {@@ -228,8 +228,8 @@ class DBTraceObjectValueWriteBehindCache {public Stream<DBTraceObjectValueBehind> streamCanonicalParents(DBTraceObject child,Lifespan lifespan) {- TraceObjectKeyPath path = child.getCanonicalPath();- TraceObjectKeyPath parentPath = path.parent();+ KeyPath path = child.getCanonicalPath();+ KeyPath parentPath = path.parent();if (parentPath == null) { // child is the rootreturn Stream.of();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/TraceObjectValueQuery.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/TraceObjectValueQuery.javaindex ad2c2218cc..283648292b 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/TraceObjectValueQuery.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/TraceObjectValueQuery.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -21,7 +21,7 @@ import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;import ghidra.trace.database.target.ValueSpace.*;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.database.DBCachedObjectStoreFactory.RecAddress;import ghidra.util.database.spatial.hyper.AbstractHyperBoxQuery;import ghidra.util.database.spatial.hyper.HyperDirection;@@ -58,7 +58,7 @@ public class TraceObjectValueQuerypublic static TraceObjectValueQuery canonicalParents(DBTraceObject child, Lifespan lifespan) {Objects.requireNonNull(child);- TraceObjectKeyPath path = child.getCanonicalPath();+ KeyPath path = child.getCanonicalPath();String entryKey = path.isRoot() ? "" : path.key();long childKey = child.getKey();return AbstractHyperBoxQuery.intersecting(diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectActivatable.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectActivatable.javanew file mode 100644index 0000000000..4034c82952--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectActivatable.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectActivatable;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectActivatable implements TraceObjectActivatable, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectActivatable(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectAggregate.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectAggregate.javanew file mode 100644index 0000000000..2aa5e9368d--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectAggregate.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectAggregate;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectAggregate implements TraceObjectAggregate, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectAggregate(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectEnvironment.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectEnvironment.javanew file mode 100644index 0000000000..2dcf403740--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectEnvironment.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectEnvironment;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectEnvironment implements TraceObjectEnvironment, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectEnvironment(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectEventScope.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectEventScope.javanew file mode 100644index 0000000000..83024bfc3d--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectEventScope.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectEventScope;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectEventScope implements TraceObjectEventScope, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectEventScope(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectExecutionStateful.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectExecutionStateful.javanew file mode 100644index 0000000000..806b22c818--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectExecutionStateful.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectExecutionStateful;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectExecutionStateful implements TraceObjectExecutionStateful, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectExecutionStateful(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectFocusScope.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectFocusScope.javanew file mode 100644index 0000000000..ab50ba3232--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectFocusScope.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectFocusScope;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectFocusScope implements TraceObjectFocusScope, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectFocusScope(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectMethod.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectMethod.javanew file mode 100644index 0000000000..aaec7e38c3--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectMethod.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectMethod;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectMethod implements TraceObjectMethod, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectMethod(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectTogglable.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectTogglable.javanew file mode 100644index 0000000000..783d2a4e13--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/iface/DBTraceObjectTogglable.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.target.iface;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectTogglable;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectTogglable implements TraceObjectTogglable, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectTogglable(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRelativeVisitor.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRelativeVisitor.javaindex 3866596980..c5cf5b50a9 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRelativeVisitor.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRelativeVisitor.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,22 +15,22 @@*/package ghidra.trace.database.target.visitors;-import java.util.List;import java.util.Set;import java.util.stream.Stream;-import ghidra.dbg.util.PathPredicates;import ghidra.trace.database.target.visitors.TreeTraversal.SpanIntersectingVisitor;import ghidra.trace.database.target.visitors.TreeTraversal.VisitResult;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;public class AncestorsRelativeVisitor implements SpanIntersectingVisitor {- protected final PathPredicates predicates;+ protected final PathFilter filter;- public AncestorsRelativeVisitor(PathPredicates predicates) {- this.predicates = predicates;+ public AncestorsRelativeVisitor(PathFilter filter) {+ this.filter = filter;}@Override@@ -40,10 +40,10 @@ public class AncestorsRelativeVisitor implements SpanIntersectingVisitor {}@Override- public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath path) {- List<String> keyList = path.getKeyList();- return VisitResult.result(predicates.matches(keyList),- predicates.ancestorCouldMatchRight(keyList, true) && value.isObject());+ public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath valPath) {+ KeyPath path = valPath.getPath();+ return VisitResult.result(filter.matches(path),+ filter.ancestorCouldMatchRight(path, true) && value.isObject());}@Override@@ -54,13 +54,13 @@ public class AncestorsRelativeVisitor implements SpanIntersectingVisitor {@Overridepublic Stream<? extends TraceObjectValue> continueValues(TraceObject object,Lifespan span, TraceObjectValPath pre) {- Set<String> prevKeys = predicates.getPrevKeys(pre.getKeyList());+ Set<String> prevKeys = filter.getPrevKeys(pre.getPath());if (prevKeys.isEmpty()) {return Stream.empty();}return object.getParents(span).stream()- .filter(v -> PathPredicates.anyMatches(prevKeys, v.getEntryKey()));+ .filter(v -> PathFilter.anyMatches(prevKeys, v.getEntryKey()));}}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRootVisitor.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRootVisitor.javaindex df281b4f9e..54d5121640 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRootVisitor.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/AncestorsRootVisitor.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,18 +17,18 @@ package ghidra.trace.database.target.visitors;import java.util.stream.Stream;-import ghidra.dbg.util.PathPredicates;import ghidra.trace.database.target.visitors.TreeTraversal.SpanIntersectingVisitor;import ghidra.trace.database.target.visitors.TreeTraversal.VisitResult;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.PathFilter;public class AncestorsRootVisitor implements SpanIntersectingVisitor {- protected final PathPredicates predicates;+ protected final PathFilter filter;- public AncestorsRootVisitor(PathPredicates predicates) {- this.predicates = predicates;+ public AncestorsRootVisitor(PathFilter filter) {+ this.filter = filter;}@Override@@ -39,8 +39,7 @@ public class AncestorsRootVisitor implements SpanIntersectingVisitor {@Overridepublic VisitResult visitValue(TraceObjectValue value, TraceObjectValPath path) {- return VisitResult.result(- predicates.matches(value.getParent().getCanonicalPath().getKeyList()), true);+ return VisitResult.result(filter.matches(value.getParent().getCanonicalPath()), true);}@Override@@ -55,8 +54,8 @@ public class AncestorsRootVisitor implements SpanIntersectingVisitor {return Stream.empty();}/**- * Can't really filter the parent values by predicates here, since the predicates are not- * matching relative paths, but canonical paths.+ * Can't really use filter for parent values here. The filter does not match relative paths,+ * but canonical paths.*/return object.getParents(span).stream().filter(v -> !path.contains(v));}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/CanonicalSuccessorsRelativeVisitor.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/CanonicalSuccessorsRelativeVisitor.javaindex 36bbb54f7b..a3e07cc217 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/CanonicalSuccessorsRelativeVisitor.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/CanonicalSuccessorsRelativeVisitor.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,22 +15,24 @@*/package ghidra.trace.database.target.visitors;-import java.util.*;+import java.util.HashSet;+import java.util.Set;import java.util.stream.Stream;-import ghidra.dbg.util.PathPredicates;import ghidra.trace.database.target.visitors.TreeTraversal.VisitResult;import ghidra.trace.database.target.visitors.TreeTraversal.Visitor;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;public class CanonicalSuccessorsRelativeVisitor implements Visitor {- protected final PathPredicates predicates;+ protected final PathFilter filter;protected final Set<TraceObject> seen = new HashSet<>();- public CanonicalSuccessorsRelativeVisitor(PathPredicates predicates) {- this.predicates = predicates;+ public CanonicalSuccessorsRelativeVisitor(PathFilter filter) {+ this.filter = filter;}@Override@@ -45,10 +47,10 @@ public class CanonicalSuccessorsRelativeVisitor implements Visitor {}@Override- public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath path) {- List<String> keyList = path.getKeyList();- return VisitResult.result(predicates.matches(keyList),- predicates.successorCouldMatch(keyList, true) && value.isObject());+ public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath valPath) {+ KeyPath path = valPath.getPath();+ return VisitResult.result(filter.matches(path),+ filter.successorCouldMatch(path, true) && value.isObject());}@Override@@ -66,7 +68,7 @@ public class CanonicalSuccessorsRelativeVisitor implements Visitor {@Overridepublic Stream<? extends TraceObjectValue> continueValues(TraceObject object,Lifespan span, TraceObjectValPath pre) {- Set<String> nextKeys = predicates.getNextKeys(pre.getKeyList());+ Set<String> nextKeys = filter.getNextKeys(pre.getPath());if (nextKeys.isEmpty()) {return Stream.empty();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/OrderedSuccessorsVisitor.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/OrderedSuccessorsVisitor.javaindex f7336abcdb..7df0ac82d8 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/OrderedSuccessorsVisitor.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/OrderedSuccessorsVisitor.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,24 +15,22 @@*/package ghidra.trace.database.target.visitors;-import java.util.List;import java.util.Set;import java.util.stream.Stream;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;import ghidra.trace.database.target.visitors.TreeTraversal.SpanIntersectingVisitor;import ghidra.trace.database.target.visitors.TreeTraversal.VisitResult;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.*;public class OrderedSuccessorsVisitor implements SpanIntersectingVisitor {- protected final PathPredicates predicates;+ protected final PathFilter filter;protected final boolean forward;- public OrderedSuccessorsVisitor(TraceObjectKeyPath path, boolean forward) {- this.predicates = new PathPattern(path.getKeyList());+ public OrderedSuccessorsVisitor(KeyPath path, boolean forward) {+ this.filter = new PathPattern(path);this.forward = forward;}@@ -43,13 +41,13 @@ public class OrderedSuccessorsVisitor implements SpanIntersectingVisitor {}@Override- public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath path) {- List<String> keyList = path.getKeyList();- if (predicates.matches(keyList)) {+ public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath valPath) {+ KeyPath path = valPath.getPath();+ if (filter.matches(path)) {// Singleton path, so if I match, no successor canreturn VisitResult.INCLUDE_PRUNE;}- if (!value.isObject() || !predicates.successorCouldMatch(keyList, true)) {+ if (!value.isObject() || !filter.successorCouldMatch(path, true)) {return VisitResult.EXCLUDE_PRUNE;}return VisitResult.EXCLUDE_DESCEND;@@ -62,8 +60,8 @@ public class OrderedSuccessorsVisitor implements SpanIntersectingVisitor {@Overridepublic Stream<? extends TraceObjectValue> continueValues(TraceObject object,- Lifespan span, TraceObjectValPath path) {- Set<String> nextKeys = predicates.getNextKeys(path.getKeyList());+ Lifespan span, TraceObjectValPath valPath) {+ Set<String> nextKeys = filter.getNextKeys(valPath.getPath());if (nextKeys.isEmpty()) {return Stream.empty();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/SuccessorsRelativeVisitor.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/SuccessorsRelativeVisitor.javaindex 425e226510..30f6dce646 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/SuccessorsRelativeVisitor.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/target/visitors/SuccessorsRelativeVisitor.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,22 +15,22 @@*/package ghidra.trace.database.target.visitors;-import java.util.List;import java.util.Set;import java.util.stream.Stream;-import ghidra.dbg.util.PathPredicates;import ghidra.trace.database.target.visitors.TreeTraversal.SpanIntersectingVisitor;import ghidra.trace.database.target.visitors.TreeTraversal.VisitResult;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;public class SuccessorsRelativeVisitor implements SpanIntersectingVisitor {- protected final PathPredicates predicates;+ protected final PathFilter filter;- public SuccessorsRelativeVisitor(PathPredicates predicates) {- this.predicates = predicates;+ public SuccessorsRelativeVisitor(PathFilter filter) {+ this.filter = filter;}@Override@@ -40,10 +40,10 @@ public class SuccessorsRelativeVisitor implements SpanIntersectingVisitor {}@Override- public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath path) {- List<String> keyList = path.getKeyList();- return VisitResult.result(predicates.matches(keyList),- predicates.successorCouldMatch(keyList, true) && value.isObject());+ public VisitResult visitValue(TraceObjectValue value, TraceObjectValPath valPath) {+ KeyPath path = valPath.getPath();+ return VisitResult.result(filter.matches(path),+ filter.successorCouldMatch(path, true) && value.isObject());}@Override@@ -54,7 +54,7 @@ public class SuccessorsRelativeVisitor implements SpanIntersectingVisitor {@Overridepublic Stream<? extends TraceObjectValue> continueValues(TraceObject object,Lifespan span, TraceObjectValPath pre) {- Set<String> nextKeys = predicates.getNextKeys(pre.getKeyList());+ Set<String> nextKeys = filter.getNextKeys(pre.getPath());if (nextKeys.isEmpty()) {return Stream.empty();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/thread/DBTraceObjectProcess.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/thread/DBTraceObjectProcess.javanew file mode 100644index 0000000000..adcc423a04--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/thread/DBTraceObjectProcess.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.database.thread;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.database.target.DBTraceObjectInterface;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.thread.TraceObjectProcess;+import ghidra.trace.util.TraceChangeRecord;++public class DBTraceObjectProcess implements TraceObjectProcess, DBTraceObjectInterface {+ private final DBTraceObject object;++ public DBTraceObjectProcess(DBTraceObject object) {+ this.object = object;+ }++ @Override+ public TraceObject getObject() {+ return object;+ }++ @Override+ public TraceChangeRecord<?, ?> translateEvent(TraceChangeRecord<?, ?> rec) {+ return null;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/thread/DBTraceObjectThread.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/thread/DBTraceObjectThread.javaindex b035b92939..6413d346ed 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/thread/DBTraceObjectThread.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/thread/DBTraceObjectThread.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,13 +17,12 @@ package ghidra.trace.database.thread;import java.util.*;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.trace.database.target.DBTraceObject;import ghidra.trace.database.target.DBTraceObjectInterface;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;-import ghidra.trace.model.target.annot.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.util.*;@@ -33,18 +32,18 @@ import ghidra.util.exception.DuplicateNameException;public class DBTraceObjectThread implements TraceObjectThread, DBTraceObjectInterface {protected class ThreadChangeTranslator extends Translator<TraceThread> {- private static final Map<TargetObjectSchema, Set<String>> KEYS_BY_SCHEMA =+ private static final Map<TraceObjectSchema, Set<String>> KEYS_BY_SCHEMA =new WeakHashMap<>();private final Set<String> keys;protected ThreadChangeTranslator(DBTraceObject object, TraceThread iface) {super(null, object, iface);- TargetObjectSchema schema = object.getTargetSchema();+ TraceObjectSchema schema = object.getSchema();synchronized (KEYS_BY_SCHEMA) {keys = KEYS_BY_SCHEMA.computeIfAbsent(schema, s -> Set.of(s.checkAliasedAttribute(KEY_COMMENT),- s.checkAliasedAttribute(TargetObject.DISPLAY_ATTRIBUTE_NAME)));+ s.checkAliasedAttribute(KEY_DISPLAY)));}}@@ -105,13 +104,13 @@ public class DBTraceObjectThread implements TraceObjectThread, DBTraceObjectInte@Overridepublic String getName() {- return TraceObjectInterfaceUtils.getValue(object, getCreationSnap(),- TargetObject.DISPLAY_ATTRIBUTE_NAME, String.class, "");+ return TraceObjectInterfaceUtils.getValue(object, getCreationSnap(), KEY_DISPLAY,+ String.class, "");}@Overridepublic void setName(Lifespan lifespan, String name) {- object.setValue(lifespan, TargetObject.DISPLAY_ATTRIBUTE_NAME, name);+ object.setValue(lifespan, KEY_DISPLAY, name);}@Overridediff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/time/DBTraceSnapshot.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/time/DBTraceSnapshot.javaindex d37e4f5df6..709e754ec4 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/time/DBTraceSnapshot.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/time/DBTraceSnapshot.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,11 +18,11 @@ package ghidra.trace.database.time;import java.io.IOException;import db.DBRecord;-import ghidra.dbg.target.TargetEventScope;import ghidra.trace.database.target.DBTraceObject;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.iface.TraceObjectEventScope;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.TraceSnapshot;@@ -156,11 +156,11 @@ public class DBTraceSnapshot extends DBAnnotatedObject implements TraceSnapshotif (root == null) {return null;}- if (!root.getTargetSchema().getInterfaces().contains(TargetEventScope.class)) {+ if (!root.getSchema().getInterfaces().contains(TraceObjectEventScope.class)) {return null;}TraceObjectValue eventAttr =- root.getAttribute(getKey(), TargetEventScope.EVENT_OBJECT_ATTRIBUTE_NAME);+ root.getAttribute(getKey(), TraceObjectEventScope.KEY_EVENT_THREAD);if (eventAttr == null) {return null;}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/Lifespan.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/Lifespan.javaindex 965ef07542..de1b3da002 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/Lifespan.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/Lifespan.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -84,7 +84,7 @@ public sealed interface Lifespan extends Span<Long, Lifespan>, Iterable<Long> {* last scratch snapshot. Otherwise, this is the same as {@link #nowOn(long)}.** @param snap- * @return+ * @return the lifespan*/static Lifespan nowOnMaybeScratch(long snap) {if (isScratch(snap)) {@@ -322,6 +322,9 @@ public sealed interface Lifespan extends Span<Long, Lifespan>, Iterable<Long> {/*** A non-empty lifespan of snapshot keys+ *+ * @param lmin the minimum snap+ * @param lmax the maximum snap*/public record Impl(long lmin, long lmax) implements Lifespan {@Overridediff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceExecutionState.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceExecutionState.javanew file mode 100644index 0000000000..641b045544--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceExecutionState.java@@ -0,0 +1,125 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model;++/**+ * The execution state of a debug target object+ */+public enum TraceExecutionState {+ /**+ * The object has been created, but it not yet alive+ *+ * <p>+ * This may apply, e.g., to a GDB "Inferior," which has no yet been used to launch or attach to+ * a process.+ */+ INACTIVE(false, false, false, false),++ /**+ * The object is alive, but its execution state is unspecified+ *+ * <p>+ * Implementations should use {@link #STOPPED} and {@link #RUNNING} whenever possible. For some+ * objects, e.g., a process, this is conventionally determined by its parts, e.g., threads: A+ * process is running when <em>any</em> of its threads are running. It is stopped when+ * <em>all</em> of its threads are stopped. For the clients' sakes, all models should implement+ * these conventions internally.+ */+ ALIVE(true, false, false, false),++ /**+ * The object is alive, but not executing+ */+ STOPPED(true, false, true, false),++ /**+ * The object is alive and executing+ *+ * <p>+ * "Running" is loosely defined. For example, with respect to a thread, it may indicate the+ * thread is currently executing, waiting on an event, or scheduled for execution. It does not+ * necessarily mean it is executing on a CPU at this exact moment.+ */+ RUNNING(true, true, false, false),++ /**+ * The object is no longer alive+ *+ * <p>+ * The object still exists but no longer represents something alive. This could be used for+ * stale handles to objects which may still be queried (e.g., for a process exit code), or e.g.,+ * a GDB "Inferior," which could be re-used to launch or attach to another process.+ */+ TERMINATED(false, false, false, true);++ private final boolean alive;+ private final boolean running;+ private final boolean stopped;+ private final boolean terminated;++ private TraceExecutionState(boolean alive, boolean running, boolean stopped,+ boolean terminated) {+ this.alive = alive;+ this.running = running;+ this.stopped = stopped;+ this.terminated = terminated;+ }++ /**+ * Check if this state implies the object is alive+ *+ * @return true if alive+ */+ public boolean isAlive() {+ return alive;+ }++ /**+ * Check if this state implies the object is running+ *+ * @return true if running+ */+ public boolean isRunning() {+ return running;+ }++ /**+ * Check if this state implies the object is stopped+ *+ * @return true if stopped+ */+ public boolean isStopped() {+ return stopped;+ }++ /**+ * Check if this state implies the object was terminated+ *+ * @return true if terminated+ */+ public boolean isTerminated() {+ return terminated;+ }++ /**+ * Check if this state is ambiguous+ *+ * @return true if terminated+ */+ public boolean isUnknown() {+ return !stopped && !running && !terminated;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointLocation.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointLocation.javaindex b9f20ee67d..b4656cf1e8 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointLocation.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointLocation.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,25 +17,25 @@ package ghidra.trace.model.breakpoint;import java.util.Collection;-import ghidra.dbg.target.TargetBreakpointLocation;-import ghidra.dbg.target.TargetObject;import ghidra.program.model.address.AddressRange;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;import ghidra.util.exception.DuplicateNameException;@TraceObjectInfo(- targetIf = TargetBreakpointLocation.class,+ schemaName = "BreakpointLocation",shortName = "breakpoint location",- fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- TargetBreakpointLocation.RANGE_ATTRIBUTE_NAME,- TraceObjectBreakpointLocation.KEY_COMMENT,+ attributes = {+ TraceObjectBreakpointLocation.KEY_RANGE,TraceObjectBreakpointLocation.KEY_EMU_ENABLED,+ TraceObjectBreakpointLocation.KEY_EMU_SLEIGH,+ },+ fixedKeys = {+ TraceObjectBreakpointLocation.KEY_RANGE,})public interface TraceObjectBreakpointLocation extends TraceBreakpoint, TraceObjectInterface {- String KEY_COMMENT = "_comment";+ String KEY_RANGE = "_range";String KEY_EMU_ENABLED = "_emu_enabled";String KEY_EMU_SLEIGH = "_emu_sleigh";diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointSpec.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointSpec.javaindex 294ff11ba0..c1da2b60b5 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointSpec.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/breakpoint/TraceObjectBreakpointSpec.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,28 +17,54 @@ package ghidra.trace.model.breakpoint;import java.util.Collection;-import ghidra.dbg.target.TargetBreakpointSpec;-import ghidra.dbg.target.TargetObject;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;import ghidra.util.exception.DuplicateNameException;/**- * TODO:+ * The specification of a breakpoint applied to a target object+ *+ * <p>+ * Note that a single specification could result in several locations, or no locations at all. For+ * example, a breakpoint placed on a function within a module which has not been loaded ("pending"+ * in GDB's nomenclature), will not have any location. On the other hand, a breakpoint expressed by+ * line number in a C++ template or a C macro could resolve to many addresses. The children of this+ * object include the resolved {@link TargetBreakpointLocation}s. If the debugger does not share+ * this same concept, then its breakpoints should implement both the specification and the location;+ * the specification need not have any children.+ *+ * <p>+ * This object extends {@link TargetTogglable} for a transitional period only. Implementations whose+ * breakpoint specifications can be toggled should declare this interface explicitly. When the+ * specification is user togglable, toggling it should effectively toggle all locations -- whether+ * or not the locations are user togglable.** <p>* NOTE: When enumerating trace breakpoints, use the locations, not the specifications.*/@TraceObjectInfo(- targetIf = TargetBreakpointSpec.class,+ schemaName = "BreakpointSpec",shortName = "breakpoint specification",+ attributes = {+ TraceObjectBreakpointSpec.KEY_EXPRESSION,+ TraceObjectBreakpointSpec.KEY_KINDS,+ TraceObjectBreakpointSpec.KEY_AS_BPT,+ },fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- TargetBreakpointSpec.EXPRESSION_ATTRIBUTE_NAME,- TargetBreakpointSpec.KINDS_ATTRIBUTE_NAME,+ TraceObjectInterface.KEY_DISPLAY,+ TraceObjectBreakpointSpec.KEY_EXPRESSION,+ TraceObjectBreakpointSpec.KEY_KINDS,})public interface TraceObjectBreakpointSpec extends TraceBreakpoint, TraceObjectInterface {+ String KEY_EXPRESSION = "_expression";+ String KEY_KINDS = "_kinds";+ String KEY_AS_BPT = "_bpt";++ // TODO: Make hit count part of the common interface?+ // TODO: Make command list part of the common interface?+ // TODO: Make condition part of the common interface?+void setLifespan(Lifespan lifespan) throws DuplicateNameException;Collection<? extends TraceObjectBreakpointLocation> getLocations();diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TraceGuestPlatform.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TraceGuestPlatform.javaindex d1030bcb0e..dd81d9f5e3 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TraceGuestPlatform.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TraceGuestPlatform.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -52,6 +52,9 @@ public interface TraceGuestPlatform extends TracePlatform {/*** Remove the mapped language, including all code units of the language+ *+ * @param monitor to monitor task progress+ * @throws CancelledException if the task is cancelled by the monitor*/void delete(TaskMonitor monitor) throws CancelledException;}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TracePlatform.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TracePlatform.javaindex db28758d77..2203f55323 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TracePlatform.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/guest/TracePlatform.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,18 +16,17 @@package ghidra.trace.model.guest;import java.util.Collection;-import java.util.List;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetRegister;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathMatcher;import ghidra.program.model.address.*;import ghidra.program.model.lang.*;import ghidra.program.model.mem.MemBuffer;import ghidra.trace.model.Trace;+import ghidra.trace.model.memory.TraceObjectRegister;import ghidra.trace.model.symbol.TraceLabelSymbol;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathMatcher;+import ghidra.trace.model.target.schema.TraceObjectSchema;/*** A platform within a trace@@ -193,7 +192,7 @@ public interface TracePlatform {* @param names the possible names of the register on the target* @return the path matcher, possibly empty*/- PathMatcher getConventionalRegisterPath(TargetObjectSchema schema, List<String> path,+ PathMatcher getConventionalRegisterPath(TraceObjectSchema schema, KeyPath path,Collection<String> names);/**@@ -208,33 +207,23 @@ public interface TracePlatform {* @param register the platform register* @return the path matcher, possibly empty*/- PathMatcher getConventionalRegisterPath(TargetObjectSchema schema, List<String> path,+ PathMatcher getConventionalRegisterPath(TraceObjectSchema schema, KeyPath path,Register register);/*** Get the expected path where an object defining the register value would be*- * @see #getConventionalRegisterPath(TargetObjectSchema, List, Register)+ * @see #getConventionalRegisterPath(TraceObjectSchema, KeyPath, Register)* @param container the register container* @param register the platform register* @return that path matcher, possibly empty, or null if the trace has no root schema*/PathMatcher getConventionalRegisterPath(TraceObject container, Register register);- /**- * Get the expected path where an object defining the register value would be- *- * @see #getConventionalRegisterPath(TargetObjectSchema, List, Register)- * @param container the target register container- * @param register the platform register- * @return the path matcher, possibly empty- */- PathMatcher getConventionalRegisterPath(TargetObject container, Register register);-/*** Get the expected path where an object defining the register value would be*- * @see #getConventionalRegisterPath(TargetObjectSchema, List, Register)+ * @see #getConventionalRegisterPath(TraceObjectSchema, KeyPath, Register)* @param overlay the overlay space allocated for a thread or frame* @param register the platform register* @return the path matcher, or null if there is no root schema@@ -242,11 +231,11 @@ public interface TracePlatform {PathMatcher getConventionalRegisterPath(AddressSpace overlay, Register register);/**- * Add a label the conventionally maps the value of a {@link TargetRegister} in the object+ * Add a label the conventionally maps the value of a {@link TraceObjectRegister} in the object* manager to a register from this platform** @param register the language register- * @param objectName the name of the {@link TargetRegister} in the object tree+ * @param objectName the name of the {@link TraceObjectRegister} in the object tree* @return the label*/TraceLabelSymbol addRegisterMapOverride(Register register, String objectName);diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceBaseCodeUnitsView.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceBaseCodeUnitsView.javaindex 970cd8e137..3fc43a8a59 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceBaseCodeUnitsView.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceBaseCodeUnitsView.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -250,6 +250,7 @@ public interface TraceBaseCodeUnitsView<T extends TraceCodeUnit> {* Get the unit (or component of a structure) which spans exactly the addresses of the given* register*+ * @param snap the snap* @param register the register* @return the unit or {@code null}*/@@ -262,6 +263,7 @@ public interface TraceBaseCodeUnitsView<T extends TraceCodeUnit> {* platform register** @param platform the platform whose language defines the register+ * @param snap the snap* @param register the register* @return the unit or {@code null}*/@@ -287,7 +289,7 @@ public interface TraceBaseCodeUnitsView<T extends TraceCodeUnit> {* <p>* This does not descend into structures.*- * @platform the platform whose language defines the register+ * @param platform the platform whose language defines the register* @param snap the snap during which the unit must be alive* @param register the register* @return the unit or {@code unit}@@ -297,6 +299,7 @@ public interface TraceBaseCodeUnitsView<T extends TraceCodeUnit> {/*** Get the live units whose start addresses are within the given register*+ * @param snap the snap* @param register the register* @param forward true to order the units by increasing address, false for descending* @return the iterable of unitsdiff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeManager.javaindex e5526249d0..761c0b2efe 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -40,7 +40,7 @@ import ghidra.trace.util.TraceAddressSpace;** <p>* To create an instruction, see- * {@link TraceInstructionsView#create(Lifespan, Address, TracePlatform, InstructionPrototype, ProcessorContextView)}.+ * {@link TraceInstructionsView#create(Lifespan, Address, TracePlatform, InstructionPrototype, ProcessorContextView, int)}.* Since clients do not ordinarily have an {@link InstructionPrototype} in hand, the more common* method is to invoke the {@link Disassembler} on {@link Trace#getProgramView()}.*diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeSpace.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeSpace.javaindex 3d12508708..8ec9440746 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeSpace.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/listing/TraceCodeSpace.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,6 +17,7 @@ package ghidra.trace.model.listing;import ghidra.program.database.code.CodeManager;import ghidra.program.model.address.AddressSpace;+import ghidra.trace.model.thread.TraceThread;/*** A space within a {@link CodeManager} bound to a specific address space or thread and frame@@ -27,8 +28,8 @@ import ghidra.program.model.address.AddressSpace;* efficient) to bind to the address space, anyway. Operating on register units requires binding to* the space.*- * @see TraceCodeManager#getCodeSpace(AddressSpace, boolean)}- * @see TraceCodeManager#getCodeRegisterSpace(TraceThread, int, boolean)}+ * @see TraceCodeManager#getCodeSpace(AddressSpace, boolean)+ * @see TraceCodeManager#getCodeRegisterSpace(TraceThread, int, boolean)*/public interface TraceCodeSpace extends TraceCodeOperations {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemoryManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemoryManager.javaindex d27016a2f5..74a4507b23 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemoryManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemoryManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -115,6 +115,9 @@ public interface TraceMemoryManager extends TraceMemoryOperations {* Obtain a "memory" space bound to the register address space for frame 0 of a given thread** @see #getMemoryRegisterSpace(TraceThread, int, boolean)+ * @param thread the given thread+ * @param createIfAbsent true to create the space if it's not already present+ * @return the space, or {@code null} if absent and not created*/TraceMemorySpace getMemoryRegisterSpace(TraceThread thread, boolean createIfAbsent);@@ -126,6 +129,9 @@ public interface TraceMemoryManager extends TraceMemoryOperations {* the given frame. Nor, if the frame is moved, will this space move with it.** @see #getMemoryRegisterSpace(TraceThread, int, boolean)+ * @param frame the stack frame+ * @param createIfAbsent true to create the space if it's not already present+ * @return the space, or {@code null} if absent and not created*/TraceMemorySpace getMemoryRegisterSpace(TraceStackFrame frame, boolean createIfAbsent);diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemorySpace.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemorySpace.javaindex 0aa4051e8e..915a43883d 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemorySpace.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceMemorySpace.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -41,10 +41,11 @@ public interface TraceMemorySpace extends TraceMemoryOperations {* Get the code space for this memory space** <p>- * This is a convenience for {@link TraceCodeManager#getCodeSpace(AddressSpace, boolean) on this- * same address space.+ * This is a convenience for {@link TraceCodeManager#getCodeSpace(AddressSpace, boolean)} on+ * this same address space.*+ * @param createIfAbsent true to create the space if it's not already present* @return the code space*/TraceCodeSpace getCodeSpace(boolean createIfAbsent);-}\ No newline at end of file+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectMemory.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectMemory.javanew file mode 100644index 0000000000..ca980005f6--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectMemory.java@@ -0,0 +1,36 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.memory;++import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;++/**+ * The memory model of a target object+ *+ * <p>+ * The convention for modeling valid addresses is to have children supporting+ * {@link TraceObjectMemoryRegion}. If no such children exist, then the client should assume no+ * address is valid. Thus, for the client to confidently access any memory, at least one child+ * region must exist. It may present the memory's entire address space in a single region.+ */+@TraceObjectInfo(+ schemaName = "Memory",+ shortName = "memory",+ attributes = {},+ fixedKeys = {})+public interface TraceObjectMemory extends TraceObjectInterface {+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectMemoryRegion.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectMemoryRegion.javaindex effd53dbe7..447df47de7 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectMemoryRegion.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectMemoryRegion.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,22 +18,31 @@ package ghidra.trace.model.memory;import java.util.Collection;import java.util.Set;-import ghidra.dbg.target.TargetMemoryRegion;-import ghidra.dbg.target.TargetObject;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;@TraceObjectInfo(- targetIf = TargetMemoryRegion.class,+ schemaName = "MemoryRegion",shortName = "region",+ attributes = {+ TraceObjectMemoryRegion.KEY_RANGE,+ TraceObjectMemoryRegion.KEY_READABLE,+ TraceObjectMemoryRegion.KEY_WRITABLE,+ TraceObjectMemoryRegion.KEY_EXECUTABLE,+ TraceObjectMemoryRegion.KEY_VOLATILE,+ },fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- TargetMemoryRegion.RANGE_ATTRIBUTE_NAME+ TraceObjectInterface.KEY_DISPLAY,+ TraceObjectMemoryRegion.KEY_RANGE,})public interface TraceObjectMemoryRegion extends TraceMemoryRegion, TraceObjectInterface {+ String KEY_RANGE = "_range";+ String KEY_READABLE = "_readable";+ String KEY_WRITABLE = "_writable";+ String KEY_EXECUTABLE = "_executable";String KEY_VOLATILE = "_volatile";void setName(Lifespan lifespan, String name);diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectRegister.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectRegister.javaindex 6f3ed899d5..dece014ed7 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectRegister.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectRegister.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,20 +15,58 @@*/package ghidra.trace.model.memory;-import ghidra.dbg.target.TargetRegister;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.TraceObjectManager;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;import ghidra.trace.model.thread.TraceObjectThread;+/**+ * A register+ *+ * <p>+ * There are two conventions for presenting registers and their values. Both are highly recommended:+ *+ * <ol>+ * <li><b>In the {@link TraceMemoryManager}</b>: If this convention is not implemented by the+ * connector, then the trace database itself will try to convert the object-model tree presentation+ * to it, because the only way to annotate data types and references in registers is to instantiate+ * the appropriate register space. See the manager's documentation for how to set these up.+ * <b>NOTE</b>: The {@link TraceObjectRegisterContainer} for the relevant thread or frame+ * <em>must</em> exist in this convention, even if the tree convention is not presented.</li>+ * <li><b>In the {@link TraceObjectManager}</b>: This convention is required when a register is not+ * known to Ghidra's slaspec, which is certainly the case if the connector falls back to the+ * {@code DATA} processor. It is easiest just to always present the tree. It provides some+ * redundancy in case the memory-manager presentation gets broken, and it allows the user to choose+ * a preferred presentation. In the tree convention, each register is presented with this interface.+ * The name is taken from the object key, the length in bits is given in the attribute+ * {@link #KEY_BITLENGTH}, and the value is given in the attribute+ * {@link TraceObjectInterface#KEY_VALUE}. Some connectors may present registers as primitive+ * children of the container, but that convention is discouraged.</li>+ * </ol>+ *+ * <p>+ * Some connectors may present registers in groups. To support this, there is an explicit+ * {@link TraceObjectRegisterContainer}. Ordinarily, the client would use the schema to detect a+ * "container" of {@link TraceObjectRegister}; however, that is not sufficient with groups. The root+ * container (per thread or per frame) is marked as the {@link TraceObjectRegisterContainer}. The+ * connector may then organize the registers into groups, each group being a plain+ * {@link TraceObject}, so long as each {@link TraceObjectRegister} is a successor to the register+ * container.+ */@TraceObjectInfo(- // NB. Originally meant to describe the register, it now also describes its value- targetIf = TargetRegister.class,+ schemaName = "Register",shortName = "register",+ attributes = {+ TraceObjectRegister.KEY_BITLENGTH,+ TraceObjectRegister.KEY_STATE,+ },fixedKeys = {- TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME+ TraceObjectRegister.KEY_BITLENGTH,})public interface TraceObjectRegister extends TraceObjectInterface {+ String KEY_BITLENGTH = "_length";String KEY_STATE = "_state";TraceObjectThread getThread();diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectRegisterContainer.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectRegisterContainer.javanew file mode 100644index 0000000000..057bc07669--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/memory/TraceObjectRegisterContainer.java@@ -0,0 +1,38 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.memory;++import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;+import ghidra.trace.model.target.schema.TraceObjectSchema;++/**+ * A container of registers.+ *+ * <p>+ * NOTE: This is a special case of "container", since it need not be the immediate parent of the+ * {@link TraceObjectRegister}s it contains. Thus, this cannot be supplanted by+ * {@link TraceObjectSchema#searchForCanonicalContainer(Class)}.+ *+ * @see TraceObjectRegister+ */+@TraceObjectInfo(+ schemaName = "RegisterContainer",+ shortName = "register container",+ attributes = {},+ fixedKeys = {})+public interface TraceObjectRegisterContainer extends TraceObjectInterface {+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModule.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModule.javaindex da6fa8fe9c..8451e42101 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModule.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModule.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -32,7 +32,7 @@ public interface TraceModule extends TraceUniqueObject {/*** Get the trace containing this module*- * @return+ * @return the trace*/Trace getTrace();@@ -60,6 +60,10 @@ public interface TraceModule extends TraceUniqueObject {* Add a section having the same full and short names** @see #addSection(String, String, AddressRange)+ * @param sectionPath the "full name" of the section+ * @param range the range of memory into which the section is loaded+ * @return the new section+ * @throws DuplicateNameException if a section with the given name already exists in this module*/default TraceSection addSection(String sectionPath, AddressRange range)throws DuplicateNameException {@@ -74,7 +78,7 @@ public interface TraceModule extends TraceUniqueObject {* display on the screen. This is not likely the file system path of the module's image. Rather,* it's typically the path of the module in the target debugger's object model.*- * @return+ * @return the path*/String getPath();@@ -183,7 +187,7 @@ public interface TraceModule extends TraceUniqueObject {/*** Get the lifespan of this module*- * @return+ * @return the lifespan*/Lifespan getLifespan();@@ -192,6 +196,8 @@ public interface TraceModule extends TraceUniqueObject {** @param loadedSnap the loaded snap, or {@link Long#MIN_VALUE} for "since the beginning of* time"+ * @throws DuplicateNameException if the lifespan adjustment would cause it to collide with+ * another module with the same name*/void setLoadedSnap(long loadedSnap) throws DuplicateNameException;@@ -206,6 +212,8 @@ public interface TraceModule extends TraceUniqueObject {* @see #setLifespan(Lifespan)** @param unloadedSnap the unloaded snap, or {@link Long#MAX_VALUE} for "to the end of time"+ * @throws DuplicateNameException if the lifespan adjustment would cause it to collide with+ * another module with the same name*/void setUnloadedSnap(long unloadedSnap) throws DuplicateNameException;diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModuleManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModuleManager.javaindex cc702d8c21..7873c0a727 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModuleManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceModuleManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -41,6 +41,8 @@ public interface TraceModuleManager extends TraceModuleOperations {* @param range the address range of the module -- min should be the base address* @param lifespan the span from load time to unload time* @return the new module+ * @throws DuplicateNameException if another module with the same name already exists for the+ * desired lifespan*/TraceModule addModule(String modulePath, String moduleName, AddressRange range,Lifespan lifespan) throws DuplicateNameException;@@ -49,9 +51,12 @@ public interface TraceModuleManager extends TraceModuleOperations {* Add a module which is still loaded** @param modulePath the "full name" of the module+ * @param moduleName the "short name" of the module* @param range the address range of the module -- min should be the base address* @param snap the snap at which the module was loaded* @return the new module+ * @throws DuplicateNameException if another module with the same name already exists for the+ * desired lifespan*/default TraceModule addLoadedModule(String modulePath, String moduleName, AddressRange range,long snap) throws DuplicateNameException {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceObjectModule.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceObjectModule.javaindex 22390a6c83..c291d4a358 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceObjectModule.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceObjectModule.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,22 +17,33 @@ package ghidra.trace.model.modules;import java.util.Collection;-import ghidra.dbg.target.TargetModule;-import ghidra.dbg.target.TargetObject;import ghidra.program.model.address.AddressRange;import ghidra.trace.database.module.TraceObjectSection;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;+/**+ * A binary module loaded by the target and/or debugger+ *+ * <p>+ * If the debugger cares to parse the modules for section information, those sections should be+ * presented as successors to the module.+ */@TraceObjectInfo(- targetIf = TargetModule.class,+ schemaName = "Module",shortName = "module",+ attributes = {+ TraceObjectModule.KEY_RANGE,+ TraceObjectModule.KEY_MODULE_NAME,+ },fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- TargetModule.RANGE_ATTRIBUTE_NAME+ TraceObjectModule.KEY_DISPLAY,+ TraceObjectModule.KEY_RANGE,})public interface TraceObjectModule extends TraceModule, TraceObjectInterface {+ String KEY_RANGE = "_range";+ String KEY_MODULE_NAME = "_module_name";void setName(Lifespan lifespan, String name);diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceSection.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceSection.javaindex 490f3d5b9d..7ca7b4d4ac 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceSection.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceSection.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -83,6 +83,7 @@ public interface TraceSection extends TraceUniqueObject {/*** @see #getRange()+ * @return the min address in the range*/default Address getStart() {AddressRange range = getRange();@@ -91,6 +92,7 @@ public interface TraceSection extends TraceUniqueObject {/*** @see #getRange()+ * @return the max address in the range*/default Address getEnd() {AddressRange range = getRange();diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceStaticMapping.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceStaticMapping.javaindex 8f83b370cf..b6c4ffca90 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceStaticMapping.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/modules/TraceStaticMapping.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -115,7 +115,7 @@ public interface TraceStaticMapping extends TraceUniqueObject {/*** Check if this mapping would conflict with the given prospective mapping*- * @see TraceStaticMappingManager#isAnyConflicting(AddressRange, Lifespan, URL, String)+ * @see TraceStaticMappingManager#findAnyConflicting(AddressRange, Lifespan, URL, String)* @param range the range in the trace ("from")* @param lifespan the span of time in the trace* @param toProgramURL the (Ghidra) URL of the static image ("to")diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/program/TickSpecificTraceView.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/program/TickSpecificTraceView.javaindex 512a2c7180..662ec9f9c9 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/program/TickSpecificTraceView.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/program/TickSpecificTraceView.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -28,7 +28,7 @@ interface SnapSpecificTraceView {/*** Get the snap this view presents*- * @return+ * @return the snap*/long getSnap();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapOperations.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapOperations.javaindex 49dd677cac..1cfa19a084 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapOperations.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapOperations.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -23,6 +23,8 @@ import ghidra.trace.model.*;/*** A map from address-snap pairs to user-defined values in a {@link Trace}+ *+ * @param <T> the type of values*/public interface TracePropertyMapOperations<T> {/**@@ -74,10 +76,6 @@ public interface TracePropertyMapOperations<T> {/*** Get the entry at the given address-snap pair*- * <p>- * Because there exists {@link Map.Entry#setValue(Object)}, this method cannot be in- * {@link TracePropertyGetter}.- ** @param snap the snap* @param address the address* @return the entry, which includes the ranges and the valuediff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapSpace.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapSpace.javaindex b2eae93549..b3a3a3125d 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapSpace.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/property/TracePropertyMapSpace.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -26,10 +26,6 @@ import ghidra.trace.util.TraceRegisterUtils;/*** A property map space for a memory space*- * <p>- * Note this interface is inherited by {@link TracePropertyMapRegisterSpace}, so "memory space" can- * also mean the {@code register} space.- ** @param <T> the type of values*/public interface TracePropertyMapSpace<T> extends TracePropertyMapOperations<T> {@@ -43,11 +39,6 @@ public interface TracePropertyMapSpace<T> extends TracePropertyMapOperations<T>/*** Get the address space for this space*- * <p>- * If this is the {@code register} space, then {@link TracePropertyMapRegisterSpace#getThread()}- * and {@link TracePropertyMapRegisterSpace#getFrameLevel()} are necessary to uniquely identify- * this space.- ** @return the address space*/AddressSpace getAddressSpace();diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStack.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStack.javaindex f380e52728..919ecd2522 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStack.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStack.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,17 +15,24 @@*/package ghidra.trace.model.stack;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetStack;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;+/**+ * Represents the execution stack, as unwound into frames by the debugger+ *+ * <p>+ * Conventionally, if the debugger can also unwind register values, then each frame should present a+ * register bank. Otherwise, the same object presenting this stack should present the register bank.+ *+ * <p>+ * TODO: Probably remove this. It serves only as a container of {@link TraceObjectStackFrame}, which+ * can be discovered using the schema.+ */@TraceObjectInfo(- targetIf = TargetStack.class,+ schemaName = "Stack",shortName = "stack",- fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- })+ attributes = {},+ fixedKeys = {})public interface TraceObjectStack extends TraceStack, TraceObjectInterface {-}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStackFrame.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStackFrame.javaindex 2c4063e8a3..97f3a73886 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStackFrame.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/stack/TraceObjectStackFrame.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,17 +15,16 @@*/package ghidra.trace.model.stack;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetStackFrame;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;@TraceObjectInfo(- targetIf = TargetStackFrame.class,+ schemaName = "StackFrame",shortName = "frame",- fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- })+ attributes = {+ TraceObjectStackFrame.KEY_PC,+ },+ fixedKeys = {})public interface TraceObjectStackFrame extends TraceStackFrame, TraceObjectInterface {-+ String KEY_PC = "_pc";}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObject.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObject.javaindex 2210c998c6..357fe663ec 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObject.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObject.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,26 +16,128 @@package ghidra.trace.model.target;import java.util.Collection;-import java.util.List;import java.util.stream.Stream;-import ghidra.dbg.target.*;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;+import ghidra.trace.database.module.TraceObjectSection;import ghidra.trace.model.*;import ghidra.trace.model.Lifespan.LifeSet;+import ghidra.trace.model.memory.*;+import ghidra.trace.model.modules.TraceObjectModule;+import ghidra.trace.model.target.iface.*;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.TraceObjectSchema;+import ghidra.trace.model.thread.TraceObjectProcess;+import ghidra.trace.model.thread.TraceObjectThread;/**- * The trace record of an observed {@link TargetObject}+ * A record of a target object in a debugger+ *+ * <p>+ * This object supports querying for and obtaining the interfaces which constitute what the object+ * is and define how the client may interact with it. The object may also have children, e.g., a+ * process should likely have threads.+ *+ * <p>+ * This interface is the focal point of the "debug target model." A debugger may present itself as+ * an arbitrary directory of "target objects." The root object is typically the debugger's session,+ * and one its attributes is a collection for its attached targets. These objects, including the+ * root object, may implement any number of interfaces extending {@link TraceObjectInterface}. These+ * interfaces comprise the type and behavior of the object. An object's children comprise its+ * elements (for collection-like objects) and attributes. Every object in the directory has a path.+ * Each element ("key") in the path identifies an index (if the child is an element) or a name (if+ * the child is an attribute). It is the implementation's responsibility to ensure each object's+ * path correctly identifies that same object in the model directory. The root has the empty path.+ * Every object must have a unique path; thus, every object must have a unique key among its+ * sibling.+ *+ * <p>+ * The objects are arranged in a directory with links permitted. Links come in the form of+ * object-valued attributes or elements where the path does not match the object value's path. Thus,+ * the overall structure remains a tree, but by resolving links, the model may be treated as a+ * directed graph, likely containing cycles.+ *+ * <p>+ * The implementation must guarantee that distinct {@link TraceObject}s from the same model do not+ * share the same path. That is, checking for object identity is sufficient to check that two+ * variables refer to the same object.+ *+ * <p>+ * Various conventions govern where the client/user should search to obtain a given interface in the+ * context of some target object. For example, if the user is interacting with a thread, and wishes+ * to access that thread's memory, it needs to follow a given search order to find the appropriate+ * target object(s), if they exist, implementing the desired interface. See+ * {@link TraceObjectSchema#searchForSuitable(TraceObjectSchema, KeyPath)} for details. In summary,+ * the order is:+ *+ * <ol>+ * <li><b>The object itself:</b> Test if the context target object supports the desired interface.+ * If it does, take it.</li>+ * <li><b>Aggregate objects:</b> If the object is marked with {@link TraceObjectAggregate}, collect+ * all attributes supporting the desired interface. If there are any, take them. This step is+ * applied recursively if any child attribute is also marked with {@link TraceObjectAggregate}.</li>+ * <li><b>Ancestry:</b> Apply these same steps to the object's (canonical) parent, recursively.</li>+ * </ol>+ *+ * <p>+ * For some situations, exactly one object is required. In that case, take the first obtained by+ * applying the above rules. In other situations, multiple objects may be acceptable. Again, apply+ * the rules until a sufficient collection of objects is obtained. If an object is in conflict with+ * another, take the first encountered. This situation may be appropriate if, e.g., multiple target+ * memories present disjoint regions. There should not be conflicts among sibling. If there are,+ * then either the model or the query is not sound. The order siblings considered should not matter.** <p>- * See {@link TargetObject} for information about how objects and the model schema are related in a- * debugger model. This trace object records a target object and a subset of its children into the- * database with additional timing information. For objects implementing specific- * {@link TargetObject} interfaces, a corresponding {@link TraceObjectInterface} can be retrieved.- * In many cases, such interfaces are just wrappers.+ * This relatively free structure and corresponding conventions allow for debuggers to present a+ * model which closely reflects the structure of its session. For example, the following structure+ * may be presented by a user-space debugger for a desktop operating system:+ *+ * <ul>+ * <li>"Session" : {@link TraceObject}</li>+ * <ul>+ * <li>"Process 789" : {@link TraceObjectProcess}, {@link TraceObjectAggregate}</li>+ * <ul>+ * <li>"Threads" : {@link TraceObject}</li>+ * <ul>+ * <li>"Thread 1" : {@link TraceObjectThread}, {@link TraceObjectExecutionStateful},+ * {@link TraceObjectAggregate}</li>+ * <ul>+ * <li>"Registers" : {@link TraceObjectRegisterContainer}</li>+ * <ul>+ * <li>"r1" : {@link TraceObjectRegister}</li>+ * <li>...</li>+ * </ul>+ * </ul>+ * <li>...more threads</li>+ * </ul>+ * <li>"Memory" : {@link TraceObjectMemory}</li>+ * <ul>+ * <li>"[0x00400000:0x00401234]" : {@link TraceObjectMemoryRegion}</li>+ * <li>...more regions</li>+ * </ul>+ * <li>"Modules" : {@link TraceObject}</li>+ * <ul>+ * <li>"/usr/bin/echo" : {@link TraceObjectModule}</li>+ * <ul>+ * <li>".text" : {@link TraceObjectSection}</li>+ * <li>...more sections</li>+ * </ul>+ * <li>...more modules</li>+ * </ul>+ * </ul>+ * <li>"Environment": {@link TraceObjectEnvironment}</li>+ * <ul>+ * <li>"Process 321" : {@link TraceObject}</li>+ * <li>...more processes</li>+ * </ul>+ * </ul>+ * </ul>+ *+ * <p>+ * Note that this interface does not provide target-related operations, but only a means of+ * modifying the database. The target connector, if this trace is still "live," should have a handle+ * to this same trace and so can update the records as events occur in the debugger session and keep+ * the target state up to date. Commands for manipulating the target and/or session itself are+ * provided by that connector.*/public interface TraceObject extends TraceUniqueObject {String EXTRA_INTERFACES_ATTRIBUTE_NAME = "_extra_ifs";@@ -66,7 +168,7 @@ public interface TraceObject extends TraceUniqueObject {** @return the path*/- TraceObjectKeyPath getCanonicalPath();+ KeyPath getCanonicalPath();/*** Get all ranges of this object's life@@ -199,10 +301,10 @@ public interface TraceObject extends TraceUniqueObject {* Request the specified interface provided by this object** @param <I> the type of the interface- * @param ifClass the class of the interface+ * @param iface the class of the interface* @return the interface, or null if not provided*/- <I extends TraceObjectInterface> I queryInterface(Class<I> ifClass);+ <I extends TraceObjectInterface> I queryInterface(Class<I> iface);/*** Get all values intersecting the given span and whose child is this object@@ -323,56 +425,56 @@ public interface TraceObject extends TraceUniqueObject {TraceObjectValue getAttribute(long snap, String name);/**- * Stream all ancestor values of this object matching the given predicates, intersecting the- * given span+ * Stream all ancestor values of this object matching the given filter, intersecting the given+ * span** <p>- * Aliased keys are excluded. The predicates should be formulated to use the aliases' target+ * Aliased keys are excluded. The filter should be formulated to use the aliases' target* attributes.** @param span a span which values along the path must intersect- * @param rootPredicates the predicates for matching path keys, relative to the root+ * @param rootFilter the filter for matching path keys, relative to the root* @return the stream of matching paths to values*/Stream<? extends TraceObjectValPath> getAncestorsRoot(Lifespan span,- PathPredicates rootPredicates);+ PathFilter rootFilter);/**- * Stream all ancestor values of this object matching the given predicates, intersecting the- * given span+ * Stream all ancestor values of this object matching the given filter, intersecting the given+ * span** <p>- * Aliased keys are excluded. The predicates should be formulated to use the aliases' target+ * Aliased keys are excluded. The filter should be formulated to use the aliases' target* attributes.** @param span a span which values along the path must intersect- * @param relativePredicates the predicates for matching path keys, relative to this object+ * @param relativeFilter the filter for matching path keys, relative to this object* @return the stream of matching paths to values*/Stream<? extends TraceObjectValPath> getAncestors(Lifespan span,- PathPredicates relativePredicates);+ PathFilter relativeFilter);/**- * Stream all successor values of this object matching the given predicates, intersecting the- * given span+ * Stream all successor values of this object matching the given filter, intersecting the given+ * span** <p>- * Aliased keys are excluded. The predicates should be formulated to use the aliases' target+ * Aliased keys are excluded. The filter should be formulated to use the aliases' target* attributes.** @param span a span which values along the path must intersect- * @param relativePredicates the predicates for matching path keys, relative to this object+ * @param relativeFilter the filter for matching path keys, relative to this object* @return the stream of matching paths to values*/Stream<? extends TraceObjectValPath> getSuccessors(Lifespan span,- PathPredicates relativePredicates);+ PathFilter relativeFilter);/*** Stream all successor values of this object at the given relative path, intersecting the given* span, ordered by time.** <p>- * Aliased keys are excluded. The predicates should be formulated to use the aliases' target+ * Aliased keys are excluded. The filter should be formulated to use the aliases' target* attributes.** @param span the span which values along the path must intersect@@ -381,21 +483,20 @@ public interface TraceObject extends TraceUniqueObject {* @return the stream of value paths*/Stream<? extends TraceObjectValPath> getOrderedSuccessors(Lifespan span,- TraceObjectKeyPath relativePath, boolean forward);+ KeyPath relativePath, boolean forward);/**- * Stream all canonical successor values of this object matching the given predicates+ * Stream all canonical successor values of this object matching the given filter** <p>* If an object has a disjoint life, i.e., multiple canonical parents, then only the* least-recent of those is traversed. Aliased keys are excluded; those can't be canonical* anyway.*- * @param relativePredicates predicates on the relative path from this object to desired- * successors+ * @param relativeFilter filter on the relative path from this object to desired successors* @return the stream of value paths*/- Stream<? extends TraceObjectValPath> getCanonicalSuccessors(PathPredicates relativePredicates);+ Stream<? extends TraceObjectValPath> getCanonicalSuccessors(PathFilter relativeFilter);/*** Set a value for the given lifespan@@ -468,79 +569,80 @@ public interface TraceObject extends TraceUniqueObject {TraceObjectValue setElement(Lifespan lifespan, long index, Object value);/**- * Get the (target) schema for this object+ * Get the schema for this object** @return the schema*/- TargetObjectSchema getTargetSchema();+ TraceObjectSchema getSchema();/**- * Search for ancestors having the given target interface+ * Search for ancestors having the given interface** @param span the span which the found objects must intersect- * @param targetIf the interface class+ * @param iface the interface class* @return the stream of found paths to values*/- Stream<? extends TraceObjectValPath> queryAncestorsTargetInterface(Lifespan span,- Class<? extends TargetObject> targetIf);+ Stream<? extends TraceObjectValPath> findAncestorsInterface(Lifespan span,+ Class<? extends TraceObjectInterface> iface);/**- * Search for ancestors providing the given interface and retrieve those interfaces+ * Search for ancestors having the given interface and retrieve those interfaces** @param <I> the interface type* @param span the span which the found objects must intersect- * @param ifClass the interface class+ * @param iface the interface class* @return the stream of interfaces*/<I extends TraceObjectInterface> Stream<I> queryAncestorsInterface(Lifespan span,- Class<I> ifClass);+ Class<I> iface);/**- * Search for ancestors on the canonical path having the given target interface+ * Search for ancestors on the canonical path having the given interface** <p>* The object may not yet be inserted at its canonical path.*- * @param targetIf the interface class+ * @param iface the interface class* @return the stream of objects*/- Stream<? extends TraceObject> queryCanonicalAncestorsTargetInterface(- Class<? extends TargetObject> targetIf);+ Stream<? extends TraceObject> findCanonicalAncestorsInterface(+ Class<? extends TraceObjectInterface> iface);/**- * Search for ancestors on the canonical path providing the given interface+ * Search for ancestors on the canonical path having the given interface and retrieve those+ * interfaces** <p>* The object may not yet be inserted at its canonical path.** @param <I> the interface type- * @param ifClass the interface class+ * @param iface the interface class* @return the stream of interfaces*/- <I extends TraceObjectInterface> Stream<I> queryCanonicalAncestorsInterface(Class<I> ifClass);+ <I extends TraceObjectInterface> Stream<I> queryCanonicalAncestorsInterface(Class<I> iface);/**- * Search for successors providing the given target interface+ * Search for successors having the given interface** @param span the span which the found paths must intersect- * @param targetIf the target interface class+ * @param iface the interface class* @param requireCanonical if the objects must be found within their canonical container* @return the stream of found paths to values*/- Stream<? extends TraceObjectValPath> querySuccessorsTargetInterface(Lifespan span,- Class<? extends TargetObject> targetIf, boolean requireCanonical);+ Stream<? extends TraceObjectValPath> findSuccessorsInterface(Lifespan span,+ Class<? extends TraceObjectInterface> iface, boolean requireCanonical);/**- * Search for successors providing the given interface and retrieve those interfaces+ * Search for successors having the given interface and retrieve those interfaces** @param <I> the interface type* @param span the span which the found objects must intersect- * @param ifClass the interface class+ * @param iface the interface class* @param requireCanonical if the objects must be found within their canonical container* @return the stream of interfaces*/<I extends TraceObjectInterface> Stream<I> querySuccessorsInterface(Lifespan span,- Class<I> ifClass, boolean requireCanonical);+ Class<I> iface, boolean requireCanonical);/*** Delete this object along with parent and child value entries referring to it@@ -569,7 +671,7 @@ public interface TraceObject extends TraceUniqueObject {* @return true if a method*/default boolean isMethod(long snap) {- if (getTargetSchema().getInterfaces().contains(TargetMethod.class)) {+ if (getSchema().getInterfaces().contains(TraceObjectMethod.class)) {return true;}TraceObjectValue extras = getAttribute(snap, TraceObject.EXTRA_INTERFACES_ATTRIBUTE_NAME);@@ -589,25 +691,39 @@ public interface TraceObject extends TraceUniqueObject {}/**- * Search for a suitable object having the given target interface+ * Search for a suitable object having the given interface** <p>* This operates by examining the schema for a unique suitable path, without regard to* lifespans. If needed, the caller should inspect the object's life.*- * @param targetIf the target interface+ * @param iface the interface* @return the suitable object, or null if not found*/- default TraceObject querySuitableTargetInterface(Class<? extends TargetObject> targetIf) {- if (targetIf == TargetObject.class) {+ default TraceObject findSuitableInterface(Class<? extends TraceObjectInterface> iface) {+ if (iface == TraceObjectInterface.class) {return this;}- List<String> path = getRoot().getTargetSchema()- .searchForSuitable(targetIf, getCanonicalPath().getKeyList());+ KeyPath path = getRoot().getSchema().searchForSuitable(iface, getCanonicalPath());+ if (path == null) {+ return null;+ }+ return getTrace().getObjectManager().getObjectByCanonicalPath(path);+ }++ /**+ * Search for a suitable canonical container of the given interface+ *+ * @param iface the interface+ * @return the container, or null if not found+ */+ default TraceObject findSuitableContainerInterface(+ Class<? extends TraceObjectInterface> iface) {+ KeyPath path = getRoot().getSchema().searchForSuitableContainer(iface, getCanonicalPath());if (path == null) {return null;}- return getTrace().getObjectManager().getObjectByCanonicalPath(TraceObjectKeyPath.of(path));+ return getTrace().getObjectManager().getObjectByCanonicalPath(path);}/**@@ -620,29 +736,27 @@ public interface TraceObject extends TraceUniqueObject {* @param schema the schema* @return the suitable object, or null if not found*/- default TraceObject querySuitableSchema(TargetObjectSchema schema) {- List<String> path = getRoot().getTargetSchema()- .searchForSuitable(schema, getCanonicalPath().getKeyList());+ default TraceObject findSuitableSchema(TraceObjectSchema schema) {+ KeyPath path = getRoot().getSchema().searchForSuitable(schema, getCanonicalPath());if (path == null) {return null;}- return getTrace().getObjectManager().getObjectByCanonicalPath(TraceObjectKeyPath.of(path));+ return getTrace().getObjectManager().getObjectByCanonicalPath(path);}/*** Search for a suitable register container*- * @see TargetObjectSchema#searchForRegisterContainer(int, List)+ * @see TraceObjectSchema#searchForRegisterContainer(int, KeyPath)* @param frameLevel the frame level. Must be 0 if not applicable* @return the register container, or null*/- default TraceObject queryRegisterContainer(int frameLevel) {- PathPredicates regsMatcher = getRoot().getTargetSchema()- .searchForRegisterContainer(frameLevel, getCanonicalPath().getKeyList());+ default TraceObject findRegisterContainer(int frameLevel) {+ PathFilter regsMatcher =+ getRoot().getSchema().searchForRegisterContainer(frameLevel, getCanonicalPath());for (PathPattern regsPattern : regsMatcher.getPatterns()) {TraceObject regsObj = getTrace().getObjectManager()- .getObjectByCanonicalPath(- TraceObjectKeyPath.of(regsPattern.getSingletonPath()));+ .getObjectByCanonicalPath(regsPattern.getSingletonPath());if (regsObj != null) {return regsObj;}@@ -657,21 +771,21 @@ public interface TraceObject extends TraceUniqueObject {* This searches for the conventional stateful object defining this object's execution state. If* such an object does not exist, null is returned. If one does exist, then its execution state* at the given snap is returned. If that state is null, it is assumed- * {@link TargetExecutionState#INACTIVE}.+ * {@link TraceExecutionState#INACTIVE}.** @param snap the snap* @return the state or null*/- default TargetExecutionState getExecutionState(long snap) {- TraceObject stateful = querySuitableTargetInterface(TargetExecutionStateful.class);+ default TraceExecutionState getExecutionState(long snap) {+ TraceObject stateful = findSuitableInterface(TraceObjectExecutionStateful.class);if (stateful == null) {return null;}TraceObjectValue stateVal =- stateful.getAttribute(snap, TargetExecutionStateful.STATE_ATTRIBUTE_NAME);+ stateful.getAttribute(snap, TraceObjectExecutionStateful.KEY_STATE);if (stateVal == null) {- return TargetExecutionState.INACTIVE;+ return TraceExecutionState.INACTIVE;}- return TargetExecutionState.valueOf((String) stateVal.getValue());+ return TraceExecutionState.valueOf((String) stateVal.getValue());}}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectKeyPath.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectKeyPath.javadeleted file mode 100644index 1de27134a0..0000000000--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectKeyPath.java+++ /dev/null@@ -1,267 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.trace.model.target;--import java.util.*;-import java.util.stream.Stream;--import ghidra.dbg.util.PathPredicates;-import ghidra.dbg.util.PathUtils;-import ghidra.dbg.util.PathUtils.PathComparator;--/**- * An immutable path of keys leading from one object object to another- *- * <p>- * Often, the source is the root. These are often taken as a parameter when searching for values. In- * essence, they simply wrap a list of string keys, but it provides convenience methods, sensible- * comparison, and better typing.- */-public final class TraceObjectKeyPath implements Comparable<TraceObjectKeyPath> {-- /**- * Create a path from the given list of keys- *- * @param keyList the list of keys from source to destination- * @return the path- */- public static TraceObjectKeyPath of(List<String> keyList) {- return new TraceObjectKeyPath(List.copyOf(keyList));- }-- /**- * Create a path from the given keys- *- * @param keys the keys from source to destination- * @return the path- */- public static TraceObjectKeyPath of(String... keys) {- return new TraceObjectKeyPath(List.of(keys));- }-- /**- * Parse a path from the given string- *- * @param path the dot-separated keys from source to destinattion- * @return the path- */- public static TraceObjectKeyPath parse(String path) {- return new TraceObjectKeyPath(PathUtils.parse(path));- }-- private final List<String> keyList;- private final int hash;-- private TraceObjectKeyPath(List<String> keyList) {- this.keyList = keyList;- this.hash = Objects.hash(keyList);- }-- @Override- public int hashCode() {- return hash;- }-- @Override- public int compareTo(TraceObjectKeyPath that) {- if (this == that) {- return 0;- }- return PathComparator.KEYED.compare(this.keyList, that.keyList);- }-- @Override- public boolean equals(Object obj) {- if (this == obj) {- return true;- }- if (!(obj instanceof TraceObjectKeyPath)) {- return false;- }- TraceObjectKeyPath that = (TraceObjectKeyPath) obj;- return this.keyList.equals(that.keyList);- }-- /**- * Get the (immutable) list of keys from source to destination- *- * @return the key list- */- public List<String> getKeyList() {- return keyList;- }-- /**- * Assuming the source is the root, check if this path refers to that root- *- * @return true if the path is empty, false otherwise- */- public boolean isRoot() {- return keyList.isEmpty();- }-- /**- * Create a new path by appending the given key- *- * <p>- * For example, if this path is "{@code Processes[2]}" and {@code name} takes the value- * "{@code Threads}", the result will be "{@code Processes[2].Threads}".- *- * @param name the new final key- * @return the resulting path- */- public TraceObjectKeyPath key(String name) {- return new TraceObjectKeyPath(PathUtils.extend(keyList, name));- }-- /**- * Get the final key of this path- *- * @return the final key- */- public String key() {- return PathUtils.getKey(keyList);- }-- /**- * Create a new path by appending the given element index- *- * <p>- * For example, if this path is "{@code Processes}" and {@code index} takes the value 2, the- * result will be "{@code Processes[2]}".- *- * @param index the new final index- * @return the resulting path- */- public TraceObjectKeyPath index(long index) {- return index(PathUtils.makeIndex(index));- }-- /**- * Create a new path by appending the given element index- *- * <p>- * This does the same as {@link #key(String)} but uses brackets instead. For example, if this- * path is "{@code Processes[2].Threads[0].Registers}" and {@code index} takes the value- * "{@code RAX}", the result will be "{@code Processes[2].Threads[0].Registers[RAX]"}.- *- * @param index the new final index- * @return the resulting path- */- public TraceObjectKeyPath index(String index) {- return new TraceObjectKeyPath(PathUtils.index(keyList, index));- }-- /**- * Get the final index of this path- *- * @return the final index- * @throws IllegalArgumentException if the final key is not an index, i.e., in brackets- */- public String index() {- return PathUtils.getIndex(keyList);- }-- /**- * {@inheritDoc}- *- * <p>- * Gives the dot-joined path- */- @Override- public String toString() {- return PathUtils.toString(keyList);- }-- /**- * Create a new path by removing the final key- *- * @return the resulting path, or null if this path is empty- */- public TraceObjectKeyPath parent() {- List<String> pkl = PathUtils.parent(keyList);- return pkl == null ? null : new TraceObjectKeyPath(pkl);- }-- /**- * Create a new path by appending the given list of keys- *- * <p>- * For example, if this path is "{@code Processes[2]}" and {@code subKeyList} takes the value- * {@code List.of("Threads", "[0]")}, the result will be "{@code Processes[2].Threads[0]}".- *- * @param subKeyList the list of keys to append- * @return the resulting path- */- public TraceObjectKeyPath extend(List<String> subKeyList) {- return new TraceObjectKeyPath(PathUtils.extend(keyList, subKeyList));- }-- /**- * Create a new path by appending the given keys- *- * @see #extend(List)- * @param subKeyList the keys to append- * @return the resulting path- */- public TraceObjectKeyPath extend(String... subKeyList) {- return extend(Arrays.asList(subKeyList));- }-- /**- * Stream, starting with the longer paths, paths that match the given predicates- *- * @param predicates the predicates to filter the ancestor paths- * @return the stream of matching paths, longest to shortest- */- public Stream<TraceObjectKeyPath> streamMatchingAncestry(PathPredicates predicates) {- if (!predicates.ancestorMatches(keyList, false)) {- return Stream.of();- }- Stream<TraceObjectKeyPath> ancestry =- isRoot() ? Stream.of() : parent().streamMatchingAncestry(predicates);- if (predicates.matches(keyList)) {- return Stream.concat(Stream.of(this), ancestry);- }- return ancestry;- }-- /**- * Check if this path is an ancestor of the given path- *- * <p>- * Equivalently, check if the given path is a successor of this path. A path is considered an- * ancestor of itself. To check for a strict ancestor, use- * {@code this.isAncestor(that) && !this.equals(that)}.- *- * @param that the supposed successor to this path- * @return true if the given path is in fact a successor- */- public boolean isAncestor(TraceObjectKeyPath that) {- return PathUtils.isAncestor(keyList, that.keyList);- }-- /**- * Assuming this is an ancestor of the given successor, compute the relative path from here to- * there- *- * @param successor the successor- * @return the relative path- */- public TraceObjectKeyPath relativize(TraceObjectKeyPath successor) {- return TraceObjectKeyPath.of(PathUtils.relativize(keyList, successor.keyList));- }-}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectManager.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectManager.javaindex c7bac4fd15..4cc0e49ed8 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectManager.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,13 +18,13 @@ package ghidra.trace.model.target;import java.util.Collection;import java.util.stream.Stream;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.TargetObjectSchema;-import ghidra.dbg.util.PathPredicates;import ghidra.program.model.address.AddressRange;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;+import ghidra.trace.model.target.schema.TraceObjectSchema;/*** A store of objects observed over time in a trace@@ -49,7 +49,7 @@ public interface TraceObjectManager {* @param schema the schema* @return the new object*/- TraceObjectValue createRootObject(TargetObjectSchema schema);+ TraceObjectValue createRootObject(TraceObjectSchema schema);/*** Create (or get) an object with the given canonical path@@ -57,18 +57,14 @@ public interface TraceObjectManager {* @param path the object's canonical path* @return the new object*/- TraceObject createObject(TraceObjectKeyPath path);+ TraceObject createObject(KeyPath path);/*** Get the schema of the root object*- * <p>- * NOTE: The interface classes specified by the schema are those for {@link TargetObject}. The- * interfaces in the database are different, and not all may have an analog.- ** @return the schema*/- TargetObjectSchema getRootSchema();+ TraceObjectSchema getRootSchema();/*** Get the root object, if it has been created@@ -91,7 +87,7 @@ public interface TraceObjectManager {* @param path the canonical path of the desired objects* @return the collection of objects*/- TraceObject getObjectByCanonicalPath(TraceObjectKeyPath path);+ TraceObject getObjectByCanonicalPath(KeyPath path);/*** Get objects in the database having the given path intersecting the given span@@ -101,7 +97,7 @@ public interface TraceObjectManager {* @return the iterable of objects*/Stream<? extends TraceObject> getObjectsByPath(Lifespan span,- TraceObjectKeyPath path);+ KeyPath path);/*** Get value entries in the database matching the given predicates intersecting the given span@@ -118,7 +114,7 @@ public interface TraceObjectManager {* @return an iterator over the matching objects*/Stream<? extends TraceObjectValPath> getValuePaths(Lifespan span,- PathPredicates predicates);+ PathFilter predicates);/*** Get all the objects in the database@@ -169,11 +165,11 @@ public interface TraceObjectManager {** @param <I> the type of the desired interface* @param span the span that desired objects must intersect- * @param ifClass the class of the desired interface+ * @param iface the class of the desired interface* @return the collection of all instances of the given interface*/<I extends TraceObjectInterface> Stream<I> queryAllInterface(Lifespan span,- Class<I> ifClass);+ Class<I> iface);/*** For maintenance, remove all disconnected objects@@ -189,9 +185,8 @@ public interface TraceObjectManager {** <p>* This is the only mechanism to modify the schema. This should almost never be necessary,- * because a {@link DebuggerObjectModel} should provide its immutable schema immediately.- * Nevertheless, the database permits schema modification, but requires that the entire model be- * replaced.+ * because a connector should provide its immutable schema immediately. Nevertheless, the+ * database permits schema modification, but requires that the entire model be replaced.*/void clear();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValPath.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValPath.javaindex 14f2e821cb..2cbae07226 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValPath.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValPath.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -17,8 +17,9 @@ package ghidra.trace.model.target;import java.util.List;-import ghidra.dbg.util.PathPredicates;import ghidra.trace.database.target.DBTraceObjectValPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;/*** A path of values leading from one object to another@@ -52,12 +53,12 @@ public interface TraceObjectValPath extends Comparable<TraceObjectValPath> {* Get the keys in the path, ordered from source to destination** <p>- * The returned list is suited for testing with {@link PathPredicates} or other- * path-manipulation methods.+ * The returned list is suited for testing with {@link PathFilter} or other path-manipulation+ * methods.** @return the list of keys*/- List<String> getKeyList();+ KeyPath getPath();/*** Check if a given value appears on this pathdiff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValue.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValue.javaindex eb4d6dfcf6..3933b7dfbf 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValue.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectValue.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,10 +15,11 @@*/package ghidra.trace.model.target;-import ghidra.dbg.target.schema.TargetObjectSchema;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.TraceObjectSchema;public interface TraceObjectValue {@@ -54,7 +55,7 @@ public interface TraceObjectValue {if (parent == null) {return getEntryKey().equals(keyOrAlias);}- return getEntryKey().equals(parent.getTargetSchema().checkAliasedAttribute(keyOrAlias));+ return getEntryKey().equals(parent.getSchema().checkAliasedAttribute(keyOrAlias));}/**@@ -66,7 +67,7 @@ public interface TraceObjectValue {** @return the canonical path*/- TraceObjectKeyPath getCanonicalPath();+ KeyPath getCanonicalPath();/*** Get the value@@ -117,8 +118,8 @@ public interface TraceObjectValue {** @return the schema*/- default TargetObjectSchema getTargetSchema() {- return getParent().getTargetSchema().getChildSchema(getEntryKey());+ default TraceObjectSchema getTargetSchema() {+ return getParent().getSchema().getChildSchema(getEntryKey());}/**@@ -220,6 +221,6 @@ public interface TraceObjectValue {if (parent == null) {return false;}- return parent.getTargetSchema().isHidden(getEntryKey());+ return parent.getSchema().isHidden(getEntryKey());}}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetActivatable.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectActivatable.javasimilarity index 81%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetActivatable.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectActivatable.javaindex 52919b0719..3ec8824faa 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetActivatable.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectActivatable.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,9 +13,9 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target;+package ghidra.trace.model.target.iface;-import ghidra.dbg.DebuggerTargetObjectIface;+import ghidra.trace.model.target.info.TraceObjectInfo;/*** An object which can be activated@@ -36,11 +36,11 @@ import ghidra.dbg.DebuggerTargetObjectIface;* <p>* We cannot just use the presence or absence of a suitable activation method as a proxy for this* interface, because the registry is only available when the back end is alive.- *- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.*/-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Activatable")-public interface TargetActivatable extends TargetObject {- // No methods+@TraceObjectInfo(+ schemaName = "Activatable",+ shortName = "activatable",+ attributes = {},+ fixedKeys = {})+public interface TraceObjectActivatable extends TraceObjectInterface {}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAggregate.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectAggregate.javasimilarity index 65%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAggregate.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectAggregate.javaindex 53f93ee546..a739a0bb0b 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetAggregate.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectAggregate.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,9 +13,9 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target;+package ghidra.trace.model.target.iface;-import ghidra.dbg.DebuggerTargetObjectIface;+import ghidra.trace.model.target.info.TraceObjectInfo;/*** A marker interface which indicates its attributes represent the object as a whole@@ -24,9 +24,13 @@ import ghidra.dbg.DebuggerTargetObjectIface;* Often applied to processes and sessions, this causes ancestry traversals to include this object's* children when visited.*- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.+ * <p>+ * TODO: This should be an attribute of the schema, not an interface.*/-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Aggregate")-public interface TargetAggregate extends TargetObject {+@TraceObjectInfo(+ schemaName = "Aggregate",+ shortName = "aggregate",+ attributes = {},+ fixedKeys = {})+public interface TraceObjectAggregate extends TraceObjectInterface {}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectEnvironment.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectEnvironment.javanew file mode 100644index 0000000000..b4cd03996e--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectEnvironment.java@@ -0,0 +1,48 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.target.iface;++import ghidra.trace.model.target.info.TraceObjectInfo;++/**+ * Provides information about a given target object+ *+ * <p>+ * This is mostly a marker interface so that the client knows where to look for information about a+ * target. This may be attached to the entire session, or it may be attached to individual targets+ * in a session. The information is generally encoded as string-valued attributes. The form of the+ * strings is not strictly specified. They should generally just take verbatim whatever string the+ * connected debugger would use to describe the platform. It is up to the client to interpret the+ * information.+ */+@TraceObjectInfo(+ schemaName = "Environment",+ shortName = "environment",+ attributes = {+ TraceObjectEnvironment.KEY_ARCH,+ TraceObjectEnvironment.KEY_DEBUGGER,+ TraceObjectEnvironment.KEY_ENDIAN,+ TraceObjectEnvironment.KEY_OS,+ },+ fixedKeys = {})+public interface TraceObjectEnvironment extends TraceObjectInterface {+ String KEY_ARCH = "_arch";+ String KEY_DEBUGGER = "_debugger";+ String KEY_ENDIAN = "_endian";+ String KEY_OS = "_os";++ // TODO: Devices? File System?+}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/DefaultTestTargetObject.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectEventScope.javasimilarity index 53%rename from Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/DefaultTestTargetObject.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectEventScope.javaindex 73634579c5..c3c9e34bef 100644--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/DefaultTestTargetObject.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectEventScope.java@@ -4,28 +4,32 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.model;+package ghidra.trace.model.target.iface;-import ghidra.dbg.agent.DefaultTargetObject;+import ghidra.trace.model.target.info.TraceObjectInfo;-public class DefaultTestTargetObject<E extends TestTargetObject, P extends TestTargetObject>- extends DefaultTargetObject<E, P> implements TestTargetObject {-- public DefaultTestTargetObject(P parent, String name, String typeHint) {- super(parent.getModel(), parent, name, typeHint);- }-- @Override- public TestDebuggerObjectModel getModel() {- return (TestDebuggerObjectModel) super.getModel();- }+/**+ * An object that can emit events affecting itself and its successors+ *+ * <p>+ * If this is present, it must be on the root object.+ */+@TraceObjectInfo(+ schemaName = "EventScope",+ shortName = "event scope",+ attributes = {+ TraceObjectEventScope.KEY_EVENT_THREAD,+ },+ fixedKeys = {})+public interface TraceObjectEventScope extends TraceObjectInterface {+ String KEY_EVENT_THREAD = "_event_thread";}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DebuggerModelTestUtils.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectExecutionStateful.javasimilarity index 61%rename from Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DebuggerModelTestUtils.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectExecutionStateful.javaindex af8e3144da..079aa31df9 100644--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DebuggerModelTestUtils.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectExecutionStateful.java@@ -13,9 +13,17 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.testutil;+package ghidra.trace.model.target.iface;-import ghidra.async.AsyncTestUtils;+import ghidra.trace.model.target.info.TraceObjectInfo;-public interface DebuggerModelTestUtils extends AsyncTestUtils {+@TraceObjectInfo(+ schemaName = "ExecutionStateful",+ shortName = "exec stateful",+ attributes = {+ TraceObjectExecutionStateful.KEY_STATE+ },+ fixedKeys = {})+public interface TraceObjectExecutionStateful extends TraceObjectInterface {+ String KEY_STATE = "_state";}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectFocusScope.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectFocusScope.javanew file mode 100644index 0000000000..2a14f52d14--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectFocusScope.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.target.iface;++import ghidra.trace.model.target.info.TraceObjectInfo;++/**+ * An object having a designated "focus"+ *+ * <p>+ * Focus is usually communicated via various UI hints, but also semantically implies that actions+ * taken within this scope apply to the focused object. The least confusing option is to implement+ * this at the root, but that need not always be the case.+ *+ * <p>+ * If this is present, it must be on the root object.+ */+@TraceObjectInfo(+ schemaName = "FocusScope",+ shortName = "focus scope",+ attributes = {+ TraceObjectFocusScope.KEY_FOCUS,+ },+ fixedKeys = {})+public interface TraceObjectFocusScope extends TraceObjectInterface {+ String KEY_FOCUS = "_focus";+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectInterface.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectInterface.javasimilarity index 70%rename from Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectInterface.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectInterface.javaindex 72cd4328fe..9aaf7c5d8e 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/TraceObjectInterface.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectInterface.java@@ -4,27 +4,48 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.trace.model.target;+package ghidra.trace.model.target.iface;import ghidra.lifecycle.Transitional;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Lifespan.LifeSet;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.info.TraceObjectInfo;import ghidra.trace.model.thread.TraceObjectThread;/*** A common interface for object-based implementations of other trace manager entries, e.g.,* {@link TraceObjectThread}.*/+@TraceObjectInfo(+ schemaName = "OBJECT",+ shortName = "object",+ attributes = {+ TraceObjectInterface.KEY_DISPLAY,+ TraceObjectInterface.KEY_COMMENT,+ },+ fixedKeys = {})public interface TraceObjectInterface {+ String KEY_DISPLAY = "_display";+ String KEY_SHORT_DISPLAY = "_short_display";+ String KEY_KIND = "_kind";+ String KEY_ORDER = "_order";++ // TODO: Should these belong to some Value interface?+ String KEY_MODIFIED = "_modified";+ String KEY_TYPE = "_type";+ String KEY_VALUE = "_value";+ String KEY_COMMENT = "_comment";+/*** Get the object backing this implementation*diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMethod.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectMethod.javasimilarity index 68%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMethod.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectMethod.javaindex 66acb362ec..1529f6e1e1 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/TargetMethod.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectMethod.java@@ -13,29 +13,17 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target;+package ghidra.trace.model.target.iface;import java.lang.annotation.*;-import java.lang.invoke.MethodHandle;-import java.lang.invoke.MethodHandles.Lookup;import java.lang.invoke.MethodType;-import java.lang.reflect.*;+import java.lang.reflect.Parameter;import java.util.*;-import java.util.concurrent.CompletableFuture;import java.util.function.Function;import java.util.stream.Collectors;import java.util.stream.Stream;-import org.apache.commons.lang3.reflect.TypeUtils;--import ghidra.dbg.DebuggerTargetObjectIface;-import ghidra.dbg.agent.AbstractDebuggerObjectModel;-import ghidra.dbg.agent.DefaultTargetObject;-import ghidra.dbg.error.DebuggerIllegalArgumentException;-import ghidra.dbg.target.schema.TargetAttributeType;-import ghidra.dbg.util.CollectionUtils.AbstractEmptyMap;-import ghidra.dbg.util.CollectionUtils.AbstractNMap;-import utilities.util.reflection.ReflectionUtilities;+import ghidra.trace.model.target.info.TraceObjectInfo;/*** An object which can be invoked as a method@@ -43,21 +31,20 @@ import utilities.util.reflection.ReflectionUtilities;* <p>* TODO: Should parameters and return type be something incorporated into Schemas?*- * @deprecated Will be removed in 11.3. Portions may be refactored into trace object database.+ * <p>+ * NOTE: We might keep this around a bit longer, since some connectors may like to reflect an object+ * model that presents methods in the tree. The connector will need to provide the means of+ * invocation, and that may become better integrated into the UI, but at least for now, being able+ * to show and hide them is important, so we at least need a named interface for them.*/-@Deprecated(forRemoval = true, since = "11.2")-@DebuggerTargetObjectIface("Method")-public interface TargetMethod extends TargetObject {- String PARAMETERS_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "parameters";- String RETURN_TYPE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "return_type";- public static String REDIRECT = "<=";-- @Target(ElementType.METHOD)- @Retention(RetentionPolicy.RUNTIME)- @Inherited- @interface Export {- String value();- }+@TraceObjectInfo(+ schemaName = "Method",+ shortName = "method",+ attributes = {+ // TODO: Parameter map, return type?+ },+ fixedKeys = {})+public interface TraceObjectMethod extends TraceObjectInterface {interface Value<T> {boolean specified();@@ -275,7 +262,8 @@ public interface TargetMethod extends TargetObject {* @return the new parameter description*/public static <T> ParameterDescription<T> create(Class<T> type, String name,- boolean required, T defaultValue, String display, String description, String schema) {+ boolean required, T defaultValue, String display, String description,+ String schema) {return new ParameterDescription<>(type, name, required, defaultValue, display,description, schema, List.of());}@@ -390,7 +378,8 @@ public interface TargetMethod extends TargetObject {return type.cast(dv);}- protected static <T> ParameterDescription<T> annotated(Class<T> type, Param annot, String name) {+ protected static <T> ParameterDescription<T> annotated(Class<T> type, Param annot,+ String name) {boolean required = isRequired(type, annot);T defaultValue = getDefault(type, annot);return ParameterDescription.create(type, name,@@ -410,9 +399,11 @@ public interface TargetMethod extends TargetObject {"Can only specify choices for String parameter");}return ParameterDescription.choices(String.class, name,- List.of(annot.choicesString().value()), annot.display(), annot.description(), annot.schema());+ List.of(annot.choicesString().value()), annot.display(), annot.description(),+ annot.schema());}- return annotated(MethodType.methodType(parameter.getType()).wrap().returnType(), annot, name);+ return annotated(MethodType.methodType(parameter.getType()).wrap().returnType(), annot,+ name);}public final Class<T> type;@@ -476,7 +467,7 @@ public interface TargetMethod extends TargetObject {** <p>* You must validate the arguments, using- * {@link TargetMethod#validateArguments(Map, Map, boolean)}, first.+ * {@link TraceObjectMethod#validateArguments(Map, Map, boolean)}, first.** @param arguments the validated arguments* @return the parameter@@ -487,7 +478,7 @@ public interface TargetMethod extends TargetObject {return (T) arguments.get(name);}if (required) {- throw new DebuggerIllegalArgumentException(+ throw new IllegalArgumentException("Missing required parameter '" + display + "' (" + name + ")");}return defaultValue;@@ -525,117 +516,17 @@ public interface TargetMethod extends TargetObject {}- public interface TargetParameterMap extends Map<String, ParameterDescription<?>> {- public static class EmptyTargetParameterMap extends- AbstractEmptyMap<String, ParameterDescription<?>> implements TargetParameterMap {- // Nothing- }-- public static class ImmutableTargetParameterMap extends- AbstractNMap<String, ParameterDescription<?>> implements TargetParameterMap {-- public ImmutableTargetParameterMap(Map<String, ParameterDescription<?>> map) {- super(map);- }- }-- TargetParameterMap EMPTY = new EmptyTargetParameterMap();-- public static TargetParameterMap of() {- return EMPTY;- }-- public static TargetParameterMap copyOf(Map<String, ParameterDescription<?>> map) {- return new ImmutableTargetParameterMap(map);- }-- @SafeVarargs- public static TargetParameterMap ofEntries(- Entry<String, ParameterDescription<?>>... entries) {- Map<String, ParameterDescription<?>> ordered = new LinkedHashMap<>();- for (Entry<String, ParameterDescription<?>> ent : entries) {- ordered.put(ent.getKey(), ent.getValue());- }- return new ImmutableTargetParameterMap(ordered);- }- }-- class AnnotatedTargetMethod extends DefaultTargetObject<TargetObject, TargetObject>- implements TargetMethod {-- public static Map<String, AnnotatedTargetMethod> collectExports(Lookup lookup,- AbstractDebuggerObjectModel model, TargetObject parent) {- Map<String, AnnotatedTargetMethod> result = new HashMap<>();- Set<Class<?>> allClasses = new LinkedHashSet<>();- allClasses.add(parent.getClass());- allClasses.addAll(ReflectionUtilities.getAllParents(parent.getClass()));- for (Class<?> declCls : allClasses) {- for (Method method : declCls.getDeclaredMethods()) {- Export annot = method.getAnnotation(Export.class);- if (annot == null || result.containsKey(annot.value())) {- continue;- }- result.put(annot.value(),- new AnnotatedTargetMethod(lookup, model, parent, method, annot));- }- }- return result;- }-- private final MethodHandle handle;- private final TargetParameterMap params;-- public AnnotatedTargetMethod(Lookup lookup, AbstractDebuggerObjectModel model,- TargetObject parent, Method method, Export annot) {- super(model, parent, annot.value(), "Method");- try {- this.handle = lookup.unreflect(method).bindTo(parent);- }- catch (IllegalAccessException e) {- throw new IllegalArgumentException("Method " + method + " is not accessible");- }- this.params = TargetMethod.makeParameters(- Stream.of(method.getParameters()).map(ParameterDescription::annotated));-- Map<TypeVariable<?>, Type> argsCf = TypeUtils- .getTypeArguments(method.getGenericReturnType(), CompletableFuture.class);- Type typeCfT = argsCf.get(CompletableFuture.class.getTypeParameters()[0]);- Class<?> returnType = TypeUtils.getRawType(typeCfT, typeCfT);-- changeAttributes(List.of(), Map.ofEntries(- Map.entry(RETURN_TYPE_ATTRIBUTE_NAME, returnType),- Map.entry(PARAMETERS_ATTRIBUTE_NAME, params)),- "Initialize");- }-- @SuppressWarnings("unchecked")- @Override- public CompletableFuture<Object> invoke(Map<String, ?> arguments) {- Map<String, ?> valid = TargetMethod.validateArguments(params, arguments, false);- List<Object> args = new ArrayList<>(params.size());- for (ParameterDescription<?> p : params.values()) {- args.add(p.get(valid));- }- try {- return (CompletableFuture<Object>) handle.invokeWithArguments(args);- }- catch (Throwable e) {- return CompletableFuture.failedFuture(e);- }- }- }-/*** Construct a map of parameter descriptions from a stream** @param params the descriptions* @return a map of descriptions by name*/- static TargetParameterMap makeParameters(Stream<ParameterDescription<?>> params) {- return TargetParameterMap- .copyOf(params.collect(Collectors.toMap(p -> p.name, p -> p, (a, b) -> {- throw new IllegalArgumentException("duplicate parameters: " + a + " and " + b);- }, LinkedHashMap::new)));+ static Map<String, ParameterDescription<?>> makeParameters(+ Stream<ParameterDescription<?>> params) {+ return params.collect(Collectors.toMap(p -> p.name, p -> p, (a, b) -> {+ throw new IllegalArgumentException("duplicate parameters: " + a + " and " + b);+ }, LinkedHashMap::new));}/**@@ -644,7 +535,8 @@ public interface TargetMethod extends TargetObject {* @param params the descriptions* @return a map of descriptions by name*/- static TargetParameterMap makeParameters(Collection<ParameterDescription<?>> params) {+ static Map<String, ParameterDescription<?>> makeParameters(+ Collection<ParameterDescription<?>> params) {return makeParameters(params.stream());}@@ -654,7 +546,7 @@ public interface TargetMethod extends TargetObject {* @param params the descriptions* @return a map of descriptions by name*/- static TargetParameterMap makeParameters(ParameterDescription<?>... params) {+ static Map<String, ParameterDescription<?>> makeParameters(ParameterDescription<?>... params) {return makeParameters(Stream.of(params));}@@ -672,7 +564,7 @@ public interface TargetMethod extends TargetObject {if (!parameters.keySet().containsAll(arguments.keySet())) {Set<String> extraneous = new TreeSet<>(arguments.keySet());extraneous.removeAll(parameters.keySet());- throw new DebuggerIllegalArgumentException("Extraneous parameters: " + extraneous);+ throw new IllegalArgumentException("Extraneous parameters: " + extraneous);}}Map<String, Object> valid = new LinkedHashMap<>();@@ -708,63 +600,8 @@ public interface TargetMethod extends TargetObject {sb.append("Extraneous parameters: ");sb.append(extraneous);}- throw new DebuggerIllegalArgumentException(sb.toString());+ throw new IllegalArgumentException(sb.toString());}return valid;}-- /**- * A convenience method used by {@link TargetLauncher} as a stopgap until "launch" becomes a- * {@link TargetMethod}.- *- * @param obj the object having a "parameters" attribute.- * @return the parameter map- */- static TargetParameterMap getParameters(TargetObject obj) {- return obj.getTypedAttributeNowByName(PARAMETERS_ATTRIBUTE_NAME, TargetParameterMap.class,- TargetParameterMap.of());- }-- /**- * Get the parameter descriptions of this method- *- * @return the name-description map of parameters- */- @TargetAttributeType(- name = PARAMETERS_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- default public TargetParameterMap getParameters() {- return getParameters(this);- }-- /**- * Get the return type of this method- *- * <p>- * If the return type is {@link TargetObject} then it is most likely a link, but that is not- * necessarily the case. If the arguments alone determine the returned object, then the returned- * object can in fact be a canonical object whose path includes the invocation syntax.- *- * @return the return type- */- @TargetAttributeType(- name = RETURN_TYPE_ATTRIBUTE_NAME,- required = true,- fixed = true,- hidden = true)- default public Class<?> getReturnType() {- return getTypedAttributeNowByName(RETURN_TYPE_ATTRIBUTE_NAME, Class.class, Object.class);- }-- // TODO: Allow extra parameters, i.e., varargs?-- /**- * Invoke the method with the given arguments- *- * @param arguments the map of named arguments- * @return a future which completes with the return value- */- CompletableFuture<Object> invoke(Map<String, ?> arguments);}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetObject.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectTogglable.javasimilarity index 59%rename from Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetObject.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectTogglable.javaindex 3aba4d187c..251fa84de2 100644--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/model/TestTargetObject.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/iface/TraceObjectTogglable.java@@ -4,20 +4,29 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.model;+package ghidra.trace.model.target.iface;-import ghidra.dbg.agent.SpiTargetObject;+import ghidra.trace.model.target.info.TraceObjectInfo;-public interface TestTargetObject extends SpiTargetObject {- @Override- TestDebuggerObjectModel getModel();+/**+ * An object which can be toggled+ */+@TraceObjectInfo(+ schemaName = "Togglable",+ shortName = "togglable",+ attributes = {+ TraceObjectTogglable.KEY_ENABLED,+ },+ fixedKeys = {})+public interface TraceObjectTogglable extends TraceObjectInterface {+ String KEY_ENABLED = "_enabled";}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/BuiltinTraceObjectInterfaceFactory.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/BuiltinTraceObjectInterfaceFactory.javanew file mode 100644index 0000000000..8114123e2d--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/BuiltinTraceObjectInterfaceFactory.java@@ -0,0 +1,69 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.target.info;++import static ghidra.trace.model.target.info.TraceObjectInterfaceFactory.ctor;++import java.util.List;++import ghidra.trace.database.breakpoint.DBTraceObjectBreakpointLocation;+import ghidra.trace.database.breakpoint.DBTraceObjectBreakpointSpec;+import ghidra.trace.database.memory.*;+import ghidra.trace.database.module.*;+import ghidra.trace.database.stack.DBTraceObjectStack;+import ghidra.trace.database.stack.DBTraceObjectStackFrame;+import ghidra.trace.database.target.iface.*;+import ghidra.trace.database.thread.DBTraceObjectProcess;+import ghidra.trace.database.thread.DBTraceObjectThread;+import ghidra.trace.model.breakpoint.TraceObjectBreakpointLocation;+import ghidra.trace.model.breakpoint.TraceObjectBreakpointSpec;+import ghidra.trace.model.memory.*;+import ghidra.trace.model.modules.TraceObjectModule;+import ghidra.trace.model.stack.TraceObjectStack;+import ghidra.trace.model.stack.TraceObjectStackFrame;+import ghidra.trace.model.target.iface.*;+import ghidra.trace.model.thread.TraceObjectProcess;+import ghidra.trace.model.thread.TraceObjectThread;++public class BuiltinTraceObjectInterfaceFactory implements TraceObjectInterfaceFactory {++ private static final List<Constructor<?>> BUILTINS = List.of(+ ctor(TraceObjectActivatable.class, DBTraceObjectActivatable::new),+ ctor(TraceObjectAggregate.class, DBTraceObjectAggregate::new),+ ctor(TraceObjectBreakpointLocation.class, DBTraceObjectBreakpointLocation::new),+ ctor(TraceObjectBreakpointSpec.class, DBTraceObjectBreakpointSpec::new),+ ctor(TraceObjectEnvironment.class, DBTraceObjectEnvironment::new),+ ctor(TraceObjectEventScope.class, DBTraceObjectEventScope::new),+ ctor(TraceObjectExecutionStateful.class, DBTraceObjectExecutionStateful::new),+ ctor(TraceObjectFocusScope.class, DBTraceObjectFocusScope::new),+ ctor(TraceObjectMemory.class, DBTraceObjectMemory::new),+ ctor(TraceObjectMemoryRegion.class, DBTraceObjectMemoryRegion::new),+ ctor(TraceObjectMethod.class, DBTraceObjectMethod::new),+ ctor(TraceObjectModule.class, DBTraceObjectModule::new),+ ctor(TraceObjectProcess.class, DBTraceObjectProcess::new),+ ctor(TraceObjectRegister.class, DBTraceObjectRegister::new),+ ctor(TraceObjectRegisterContainer.class, DBTraceObjectRegisterContainer::new),+ ctor(TraceObjectSection.class, DBTraceObjectSection::new),+ ctor(TraceObjectStack.class, DBTraceObjectStack::new),+ ctor(TraceObjectStackFrame.class, DBTraceObjectStackFrame::new),+ ctor(TraceObjectThread.class, DBTraceObjectThread::new),+ ctor(TraceObjectTogglable.class, DBTraceObjectTogglable::new));++ @Override+ public List<Constructor<?>> getInterfaceConstructors() {+ return BUILTINS;+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/annot/TraceObjectInfo.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInfo.javasimilarity index 61%rename from Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/annot/TraceObjectInfo.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInfo.javaindex 1b80ad43ad..9c325e33dc 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/annot/TraceObjectInfo.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInfo.java@@ -4,22 +4,19 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.trace.model.target.annot;+package ghidra.trace.model.target.info;import java.lang.annotation.*;-import ghidra.dbg.target.TargetObject;-import ghidra.trace.model.target.TraceObjectManager;-/*** Information about a trace target interface*/@@ -27,21 +24,20 @@ import ghidra.trace.model.target.TraceObjectManager;@Retention(RetentionPolicy.RUNTIME)public @interface TraceObjectInfo {/**- * The target interface corresponding to this trace interface- *- * <p>- * TODO: I really don't like this here. I would rather the schema interface names were mappable- * to a chosen domain, rather than being fixed on {@link TargetObject}.... In any case, this is- * used to ensure that {@link TraceObjectManager#queryAllInterface(Class)} and related have a- * means of translating from the trace domain into the target domain.+ * The name for this interface in the schema*/- Class<? extends TargetObject> targetIf();+ String schemaName();/*** A short name for this interface type*/String shortName();+ /**+ * The attributes expected or required by this interface+ */+ String[] attributes();+/*** Keys intrinsic to this interface, whose values are fixed during the object's lifespan*/diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInterfaceFactory.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInterfaceFactory.javanew file mode 100644index 0000000000..606ecf919b--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInterfaceFactory.java@@ -0,0 +1,36 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.target.info;++import java.util.List;+import java.util.function.Function;++import ghidra.trace.database.target.DBTraceObject;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.util.classfinder.ExtensionPoint;++public interface TraceObjectInterfaceFactory extends ExtensionPoint {++ record Constructor<I extends TraceObjectInterface>(Class<I> iface,+ Function<? super DBTraceObject, ? extends I> ctor) {}++ static <I extends TraceObjectInterface> Constructor<I> ctor(Class<I> iface,+ Function<? super DBTraceObject, ? extends I> ctor) {+ return new Constructor<>(iface, ctor);+ }++ List<Constructor<?>> getInterfaceConstructors();+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/annot/TraceObjectInterfaceUtils.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInterfaceUtils.javasimilarity index 50%rename from Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/annot/TraceObjectInterfaceUtils.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInterfaceUtils.javaindex 712a049fa9..1ce3ac2a93 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/annot/TraceObjectInterfaceUtils.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/info/TraceObjectInterfaceUtils.java@@ -4,30 +4,101 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.trace.model.target.annot;+package ghidra.trace.model.target.info;-import java.util.Collection;-import java.util.List;+import java.util.*;+import java.util.function.Function;+import java.util.stream.Collectors;+import java.util.stream.Stream;++import javax.swing.event.ChangeEvent;-import ghidra.dbg.target.TargetObject;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInterfaceFactory.Constructor;+import ghidra.trace.model.target.schema.TraceObjectSchema;import ghidra.util.LockHold;+import ghidra.util.Msg;+import ghidra.util.classfinder.ClassSearcher;import ghidra.util.exception.DuplicateNameException;public enum TraceObjectInterfaceUtils {;+ private static class Private {+ private Map<Class<?>, Constructor<?>> mapByClass = null;+ private Map<String, Constructor<?>> mapByName = null;++ public Private() {+ ClassSearcher.addChangeListener(this::classesChanged);+ }++ private synchronized void classesChanged(ChangeEvent evt) {+ mapByClass = null;+ }++ private void checkRefresh() {+ if (mapByClass == null) {+ List<TraceObjectInterfaceFactory> instances =+ ClassSearcher.getInstances(TraceObjectInterfaceFactory.class);+ if (instances.isEmpty()) {+ Msg.warn(this, "ClassSearcher not active, yet. Falling back to built-ins");+ instances = List.of(new BuiltinTraceObjectInterfaceFactory());+ }+ mapByClass = instances+ .stream()+ .flatMap(f -> f.getInterfaceConstructors().stream())+ .collect(Collectors.toUnmodifiableMap(+ Constructor::iface,+ Function.identity()));+ mapByName = mapByClass.values()+ .stream()+ .collect(Collectors.toUnmodifiableMap(+ c -> getSchemaName(c.iface()),+ Function.identity()));+ }+ }++ private synchronized Map<Class<?>, Constructor<?>> getMapByClass() {+ checkRefresh();+ return mapByClass;+ }++ private synchronized Map<String, Constructor<?>> getMapByName() {+ checkRefresh();+ return mapByName;+ }+ }++ private static final Private PRIVATE = new Private();++ public static Map<Class<?>, Constructor<?>> getAllConstructors() {+ return PRIVATE.getMapByClass();+ }++ public static Stream<Constructor<?>> streamConstructors(TraceObjectSchema schema) {+ return schema.getInterfaces().stream().map(PRIVATE.getMapByClass()::get);+ }++ public static boolean isTraceObject(Class<?> cls) {+ return cls == TraceObject.class || TraceObjectInterface.class.isAssignableFrom(cls);+ }++ public static Map<String, Constructor<?>> getConstructorsByName() {+ return PRIVATE.getMapByName();+ }+public static TraceObjectInfo requireAnnotation(Class<? extends TraceObjectInterface> traceIf) {TraceObjectInfo annot = traceIf.getAnnotation(TraceObjectInfo.class);if (annot == null) {@@ -37,9 +108,8 @@ public enum TraceObjectInterfaceUtils {return annot;}- public static Class<? extends TargetObject> toTargetIf(- Class<? extends TraceObjectInterface> traceIf) {- return requireAnnotation(traceIf).targetIf();+ public static String getSchemaName(Class<? extends TraceObjectInterface> traceIf) {+ return requireAnnotation(traceIf).schemaName();}public static String getShortName(Class<? extends TraceObjectInterface> traceIf) {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/KeyPath.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/KeyPath.javanew file mode 100644index 0000000000..58031a0ee9--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/KeyPath.java@@ -0,0 +1,660 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.target.path;++import java.nio.CharBuffer;+import java.util.*;+import java.util.regex.Matcher;+import java.util.regex.Pattern;+import java.util.stream.Stream;++/**+ * An immutable path of keys leading from one object (usually the root) object to another+ *+ * <p>+ * Often, the source is the root. These are often taken as a parameter when searching for values. In+ * essence, they simply wrap a list of string keys, but it provides convenience methods, sensible+ * comparison, and better typing.+ */+public final class KeyPath implements Comparable<KeyPath>, Iterable<String> {+ public static final KeyPath ROOT = new KeyPath();++ /**+ * Encode the given index in decimal, without brackets+ *+ * @param i the numeric index+ * @return the encoded index+ */+ public static String makeIndex(long i) {+ return Long.toString(i);+ }++ /**+ * Check if the given key is a bracketed index+ *+ * @param key the key to check+ * @return true if it is an index+ */+ public static boolean isIndex(String key) {+ return key == null ? false : key.startsWith("[") && key.endsWith("]");+ }++ /**+ * Check if the given key is an attribute name, i.e., not an index+ *+ * @param key the key to check+ * @return true if it is an attribute name+ */+ public static boolean isName(String key) {+ return key == null ? false : !isIndex(key);+ }++ /**+ * Parse an index value from a key+ *+ * <p>+ * Where key is the form {@code [index]}, this merely returns {@code index}.+ *+ * @param key the key+ * @return the index+ * @throws IllegalArgumentException if key is not of the required form+ */+ public static String parseIndex(String key) {+ if (isIndex(key)) {+ return key.substring(1, key.length() - 1);+ }+ throw new IllegalArgumentException("Index keys must be of the form '[index]'. Got " + key);+ }++ /**+ * If an index, parse it, otherwise just return the key+ *+ * @param key the key+ * @return the index or key+ */+ public static String parseIfIndex(String key) {+ if (isIndex(key)) {+ return key.substring(1, key.length() - 1);+ }+ return key;+ }++ /**+ * Encode the given index as a key+ *+ * <p>+ * When indexing elements, no brackets are needed. The brackets become necessary when used as a+ * key, e.g., when specifying an index within a path, or as keys in a map of all children.+ *+ * @param index the index+ * @return the key, specifying an element.+ */+ public static String makeKey(String index) {+ return "[" + index + "]";+ }++ /**+ * Comparators for keys, i.e., strings in a path+ */+ public enum KeyComparator implements Comparator<String> {+ /**+ * Sort keys by attribute name, lexicographically.+ */+ ATTRIBUTE {+ @Override+ public int compare(String o1, String o2) {+ return o1.compareTo(o2);+ }+ },+ /**+ * Sort keys by element index.+ *+ * <p>+ * Element indices may be multidimensional, in which case the dimensions are separated by+ * commas, and sorting prioritizes the left-most dimensions. Where indices (or dimensions+ * thereof) appear to be numeric, they are sorted as such. Otherwise, they are sorted+ * lexicographically. Numeric types can be encoded in hexadecimal. While decimal is typical+ * you may run into difficulties if those numbers are too large, as the implementation must+ * assume numeric types are hexadecimal.+ *+ * @implNote The only way I can think to resolve the numeric encoding issue is to examine+ * all keys before even selecting a comparator. As is, a comparator can only see+ * two keys at a time, and has no context to what it's actually sorting.+ */+ ELEMENT {+ @Override+ public int compare(String o1, String o2) {+ String[] p1 = o1.split(",");+ String[] p2 = o2.split(",");+ int min = Math.min(p1.length, p2.length);+ for (int i = 0; i < min; i++) {+ int c = ELEMENT_DIM.compare(p1[i], p2[i]);+ if (c != 0) {+ return c;+ }+ }+ return Integer.compare(p1.length, p2.length);+ }+ },+ /**+ * Sort keys by element index, allowing only one dimension.+ *+ * <p>+ * Please use {@link #ELEMENT}, unless you really know you need this instead.+ */+ ELEMENT_DIM {+ @Override+ public int compare(String o1, String o2) {+ Long l1 = null;+ Long l2 = null;+ try {+ l1 = Long.parseLong(o1, 16);+ }+ catch (NumberFormatException e) {+ }+ try {+ l2 = Long.parseLong(o2, 16);+ }+ catch (NumberFormatException e) {+ }+ if (l1 != null && l2 != null) {+ return l1.compareTo(l2);+ }+ if (l1 != null) { // Want numbers first, so l1 < l2+ return -1;+ }+ if (l2 != null) {+ return 1;+ }+ return o1.compareTo(o2);+ }+ },+ /**+ * Sort keys by element or index as appropriate, placing elements first.+ */+ CHILD {+ @Override+ public int compare(String o1, String o2) {+ boolean ii1 = o1.startsWith("[") && o1.endsWith("]");+ boolean ii2 = o2.startsWith("[") && o2.endsWith("]");+ if (ii1 && ii2) {+ return ELEMENT.compare(o1.substring(1, o1.length() - 1),+ o2.substring(1, o2.length() - 1));+ }+ if (ii1) {+ return -1;+ }+ if (ii2) {+ return 1;+ }+ return ATTRIBUTE.compare(o1, o2);+ }+ }+ }++ /**+ * Comparators for paths+ */+ public enum PathComparator implements Comparator<KeyPath> {+ /**+ * Sort paths by key, prioritizing the left-most, i.e., top-most, keys.+ *+ * <p>+ * If one path is a prefix to the other, the prefix is "less than" the other.+ */+ KEYED {+ @Override+ public int compare(KeyPath o1, KeyPath o2) {+ int min = Math.min(o1.size(), o2.size());+ for (int i = 0; i < min; i++) {+ String e1 = o1.key(i);+ String e2 = o2.key(i);+ int c = e1.compareTo(e2);+ if (c != 0) {+ return c;+ }+ }+ return Integer.compare(o1.size(), o2.size());+ }+ },+ /**+ * Sort paths by length, longest first, then as in {@link #KEYED}.+ */+ LONGEST_FIRST {+ @Override+ public int compare(KeyPath o1, KeyPath o2) {+ int c;+ c = Integer.compare(o2.size(), o1.size());+ if (c != 0) {+ return c;+ }+ return KEYED.compare(o1, o2);+ }+ }+ }++ public static class PathParser {+ protected final static Pattern LBRACKET = Pattern.compile("\\[");+ protected final static Pattern RBRACKET = Pattern.compile("\\]");+ protected final static Pattern BRACKETED = Pattern.compile("\\[.*?\\]");+ protected final static Pattern LPAREN = Pattern.compile("\\(");+ protected final static Pattern RPAREN = Pattern.compile("\\)");++ protected final CharBuffer buf;+ protected final Pattern sep;++ protected final List<String> result = new ArrayList<>();++ public PathParser(CharSequence path, String sepRE) {+ buf = CharBuffer.wrap(path);+ sep = Pattern.compile(sepRE);+ }++ protected String match(Pattern pat) {+ Matcher mat = pat.matcher(buf);+ if (!mat.lookingAt()) {+ throw new IllegalArgumentException("Expecting " + pat + ", but had " + buf);+ }+ String tok = mat.group();+ int length = mat.end() - mat.start();+ buf.position(buf.position() + length);+ return tok;+ }++ protected void advanceParenthesized() {+ while (buf.hasRemaining()) {+ if (RPAREN.matcher(buf).lookingAt()) {+ buf.get();+ break;+ }+ else if (LPAREN.matcher(buf).lookingAt()) {+ buf.get();+ advanceParenthesized();+ }+ else {+ buf.get();+ }+ }+ }++ protected String parseName() {+ int p = buf.position();+ while (buf.hasRemaining()) {+ if (sep.matcher(buf).lookingAt()) {+ break;+ }+ else if (LBRACKET.matcher(buf).lookingAt()) {+ break;+ }+ else if (LPAREN.matcher(buf).lookingAt()) {+ buf.get();+ advanceParenthesized();+ }+ else {+ buf.get();+ }+ }+ int e = buf.position();+ buf.position(p);+ String tok = buf.subSequence(0, e - p).toString();+ buf.position(e);+ return tok;+ }++ protected String parseNext() {+ if (sep.matcher(buf).lookingAt()) {+ match(sep);+ return parseName();+ }+ if (LBRACKET.matcher(buf).lookingAt()) {+ return match(BRACKETED);+ }+ throw new IllegalArgumentException(+ "Expected " + sep + " or " + LBRACKET + ", but had " + buf);+ }++ public KeyPath parse() {+ String first = parseName();+ if (first.length() != 0) {+ result.add(first);+ }+ while (buf.hasRemaining()) {+ result.add(parseNext());+ }+ return KeyPath.of(result);+ }+ }++ /**+ * Create a path from the given list of keys+ *+ * @param keyList the list of keys from source to destination+ * @return the path+ */+ public static KeyPath of(List<String> keyList) {+ return new KeyPath(keyList.toArray(String[]::new));+ }++ public static KeyPath of(Stream<String> keyStream) {+ return new KeyPath(keyStream.toArray(String[]::new));+ }++ /**+ * Create a path from the given keys+ *+ * @param keys the keys from source to destination+ * @return the path+ */+ public static KeyPath of(String... keys) {+ return new KeyPath(Arrays.copyOf(keys, keys.length));+ }++ /**+ * Parse a path from the given string+ *+ * @param path the dot-separated keys from source to destination+ * @return the path+ */+ public static KeyPath parse(String path) {+ return new PathParser(path, "\\.").parse();+ }++ final String[] keys;+ private final int hash;++ KeyPath(String... keys) {+ this.keys = keys;+ this.hash = Objects.hash((Object[]) keys);+ }++ @Override+ public int hashCode() {+ return hash;+ }++ @Override+ public int compareTo(KeyPath that) {+ if (this == that) {+ return 0;+ }+ return PathComparator.KEYED.compare(this, that);+ }++ @Override+ public boolean equals(Object obj) {+ if (this == obj) {+ return true;+ }+ if (!(obj instanceof KeyPath that)) {+ return false;+ }+ return Arrays.equals(this.keys, that.keys);+ }++ public int size() {+ return keys.length;+ }++ @Override+ public Iterator<String> iterator() {+ return new Iterator<>() {+ int i = 0;++ @Override+ public boolean hasNext() {+ return i < keys.length;+ }++ @Override+ public String next() {+ return keys[i++];+ }+ };+ }++ public String key(int i) {+ return keys[i];+ }++ /**+ * Get the (immutable) list of keys from source to destination+ *+ * @return the key list+ */+ public List<String> toList() {+ return List.of(keys);+ }++ public boolean containsWildcard() {+ for (String k : keys) {+ if (PathPattern.isWildcard(k)) {+ return true;+ }+ }+ return false;+ }++ public int countWildcards() {+ int count = 0;+ for (String k : keys) {+ if (PathPattern.isWildcard(k)) {+ count++;+ }+ }+ return count;+ }++ /**+ * Assuming the source is the root, check if this path refers to that root+ *+ * @return true if the path is empty, false otherwise+ */+ public boolean isRoot() {+ return keys.length == 0;+ }++ /**+ * Create a new path by appending the given key+ *+ * <p>+ * For example, if this path is "{@code Processes[2]}" and {@code name} takes the value+ * "{@code Threads}", the result will be "{@code Processes[2].Threads}".+ *+ * @param name the new final key+ * @return the resulting path+ */+ public KeyPath key(String name) {+ String[] keys = Arrays.copyOf(this.keys, this.keys.length + 1);+ keys[this.keys.length] = name;+ return new KeyPath(keys);+ }++ /**+ * Get the final key of this path+ *+ * @return the final key+ */+ public String key() {+ if (keys.length == 0) {+ return null;+ }+ return keys[keys.length - 1];+ }++ /**+ * Create a new path by appending the given element index+ *+ * <p>+ * For example, if this path is "{@code Processes}" and {@code index} takes the value 2, the+ * result will be "{@code Processes[2]}".+ *+ * @param index the new final index+ * @return the resulting path+ */+ public KeyPath index(long index) {+ return index(makeIndex(index));+ }++ /**+ * Create a new path by appending the given element index+ *+ * <p>+ * This does the same as {@link #key(String)} but uses brackets instead. For example, if this+ * path is "{@code Processes[2].Threads[0].Registers}" and {@code index} takes the value+ * "{@code RAX}", the result will be "{@code Processes[2].Threads[0].Registers[RAX]"}.+ *+ * @param index the new final index+ * @return the resulting path+ */+ public KeyPath index(String index) {+ return extend(makeKey(index));+ }++ /**+ * Get the final index of this path+ *+ * @return the final index+ * @throws IllegalArgumentException if the final key is not an index, i.e., in brackets+ */+ public String index() {+ String key = key();+ return key == null ? null : parseIndex(key);+ }++ /**+ * {@inheritDoc}+ *+ * <p>+ * Gives the dot-joined path+ */+ @Override+ public String toString() {+ StringBuilder sb = new StringBuilder();+ boolean first = true;+ for (String k : keys) {+ if (!isIndex(k) && !first) {+ sb.append(".");+ }+ first = false;+ sb.append(k);+ }+ return sb.toString();+ }++ /**+ * Create a new path by removing the final key+ *+ * @return the resulting path, or null if this path is empty+ */+ public KeyPath parent() {+ return parent(1);+ }++ /**+ * Create a new path by removing the final {@code n} keys+ *+ * @param n the number of keys to remove+ * @return the resulting path, or null if fewer than 0 keys would remain+ */+ public KeyPath parent(int n) {+ if (n < 0) {+ throw new IllegalArgumentException("n<0");+ }+ if (keys.length < n) {+ return null;+ }+ return new KeyPath(Arrays.copyOf(keys, keys.length - n));+ }++ /**+ * Create a new path by appending the given list of keys+ *+ * <p>+ * For example, if this path is "{@code Processes[2]}" and {@code sub} takes the value+ * "{@code Threads[0]}", the result will be "{@code Processes[2].Threads[0]}".+ *+ * @param sub the path to append+ * @return the resulting path+ */+ public KeyPath extend(KeyPath sub) {+ return extend(sub.keys);+ }++ /**+ * Create a new path by appending the given keys+ *+ * @see #extend(KeyPath)+ * @param subKeys the keys to append+ * @return the resulting path+ */+ public KeyPath extend(String... subKeys) {+ String[] keys = Arrays.copyOf(this.keys, this.keys.length + subKeys.length);+ System.arraycopy(subKeys, 0, keys, this.keys.length, subKeys.length);+ return new KeyPath(keys);+ }++ /**+ * Stream, starting with the longer paths, paths that match the given predicates+ *+ * @param filter the predicates to filter the ancestor paths+ * @return the stream of matching paths, longest to shortest+ */+ public Stream<KeyPath> streamMatchingAncestry(PathFilter filter) {+ if (!filter.ancestorMatches(this, false)) {+ return Stream.of();+ }+ Stream<KeyPath> ancestry =+ isRoot() ? Stream.of() : parent().streamMatchingAncestry(filter);+ if (filter.matches(this)) {+ return Stream.concat(Stream.of(this), ancestry);+ }+ return ancestry;+ }++ /**+ * Check if this path is an ancestor of the given path+ *+ * <p>+ * Equivalently, check if the given path is a successor of this path. A path is considered an+ * ancestor of itself. To check for a strict ancestor, use+ * {@code this.isAncestor(that) && !this.equals(that)}.+ *+ * @param successor the supposed successor to this path+ * @return true if the given path is in fact a successor+ */+ public boolean isAncestor(KeyPath successor) {+ if (this.keys.length > successor.keys.length) {+ return false;+ }+ int len = this.keys.length;+ return Arrays.equals(this.keys, 0, len, successor.keys, 0, len);+ }++ /**+ * Assuming this is an ancestor of the given successor, compute the relative path from here to+ * there+ *+ * @param successor the successor+ * @return the relative path+ */+ public KeyPath relativize(KeyPath successor) {+ if (!isAncestor(successor)) {+ throw new IllegalArgumentException("this is not an ancestor to successor");+ }+ return new KeyPath(+ Arrays.copyOfRange(successor.keys, this.keys.length, successor.keys.length));+ }+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathFilter.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathFilter.javanew file mode 100644index 0000000000..13f6fce253--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathFilter.java@@ -0,0 +1,330 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.target.path;++import java.util.*;+import java.util.stream.Collectors;+import java.util.stream.IntStream;++import ghidra.util.ReversedListIterator;++public interface PathFilter {+ PathFilter NONE = new PathFilter() {+ @Override+ public PathFilter or(PathFilter that) {+ return that;+ }++ @Override+ public boolean matches(KeyPath path) {+ return false;+ }++ @Override+ public boolean successorCouldMatch(KeyPath path, boolean strict) {+ return false;+ }++ @Override+ public boolean ancestorMatches(KeyPath path, boolean strict) {+ return false;+ }++ @Override+ public boolean ancestorCouldMatchRight(KeyPath path, boolean strict) {+ return false;+ }++ @Override+ public Set<String> getNextKeys(KeyPath path) {+ return Set.of();+ }++ @Override+ public Set<String> getNextNames(KeyPath path) {+ return Set.of();+ }++ @Override+ public Set<String> getNextIndices(KeyPath path) {+ return Set.of();+ }++ @Override+ public Set<String> getPrevKeys(KeyPath path) {+ return Set.of();+ }++ @Override+ public KeyPath getSingletonPath() {+ return null;+ }++ @Override+ public PathPattern getSingletonPattern() {+ return null;+ }++ @Override+ public Collection<PathPattern> getPatterns() {+ return List.of();+ }++ @Override+ public PathFilter removeRight(int count) {+ return this;+ }++ @Override+ public PathFilter applyKeys(Align align, List<String> keys) {+ return this;+ }++ @Override+ public boolean isNone() {+ return true;+ }+ };++ enum Align {+ LEFT {+ @Override+ <T> ListIterator<T> iterator(List<T> list) {+ return list.listIterator();+ }+ },+ RIGHT {+ @Override+ <T> ListIterator<T> iterator(List<T> list) {+ return new ReversedListIterator<>(list.listIterator(list.size()));+ }+ };++ abstract <T> ListIterator<T> iterator(List<T> list);++ <T> ListIterator<T> iterator(T[] arr) {+ return iterator(Arrays.asList(arr));+ };+ }++ static boolean keyMatches(String pat, String key) {+ if (key.equals(pat)) {+ return true;+ }+ if ("[]".equals(pat)) {+ return KeyPath.isIndex(key);+ }+ if ("".equals(pat)) {+ return KeyPath.isName(key);+ }+ return false;+ }++ static boolean anyMatches(Set<String> pats, String key) {+ return pats.stream().anyMatch(p -> keyMatches(p, key));+ }++ static PathFilter pattern(String... keyPatterns) {+ return new PathPattern(KeyPath.of(keyPatterns));+ }++ static PathFilter pattern(KeyPath keyPatterns) {+ return new PathPattern(keyPatterns);+ }++ static PathPattern parse(String pattern) {+ return new PathPattern(KeyPath.parse(pattern));+ }++ PathFilter or(PathFilter that);++ /**+ * Check if the entire path passes+ *+ * @param path the path to check+ * @return true if it matches, false otherwise+ */+ boolean matches(KeyPath path);++ /**+ * Check if the given path <em>could</em> have a matching successor+ *+ * <p>+ * This essentially checks if the given path is a viable prefix to the matcher.+ *+ * @implNote this method could become impractical for culling queries if we allow too+ * sophisticated of patterns. Notably, to allow an "any number of keys" pattern, e.g.,+ * akin to {@code /src/**{@literal /}*.c} in file system path matchers. Anything+ * starting with "src" could have a successor that matches.+ *+ *+ * @param path the path (prefix) to check+ * @param strict true to exclude the case where {@link #matches(KeyPath)} would return true+ * @return true if a successor could match, false otherwise+ */+ boolean successorCouldMatch(KeyPath path, boolean strict);++ /**+ * Check if the given path has an ancestor that matches+ *+ * @param path the path to check+ * @param strict true to exclude the case where {@link #matches(KeyPath)} would return true+ * @return true if an ancestor matches, false otherwise+ */+ boolean ancestorMatches(KeyPath path, boolean strict);++ /**+ * Check if the given path <em>could</em> have a matching ancestor, right to left+ *+ * <p>+ * This essentially checks if the given path is a viable postfix to the matcher.+ *+ * @param path the path (postfix) to check+ * @param strict true to exclude the case where {@link #matches(KeyPath)} would return true+ * @return true if an ancestor could match, false otherwise+ */+ boolean ancestorCouldMatchRight(KeyPath path, boolean strict);++ /**+ * Get the patterns for the next possible key+ *+ * <p>+ * If a successor of the given path cannot match this pattern, the empty set is returned.+ *+ * @param path the ancestor path+ * @return a set of patterns where indices are enclosed in brackets {@code []}+ */+ Set<String> getNextKeys(KeyPath path);++ /**+ * Get the patterns for the next possible name+ *+ * <p>+ * If a successor of the given path cannot match this pattern, the empty set is returned. If the+ * pattern could accept a name next, get all patterns describing those names+ *+ * @param path the ancestor path+ * @return a set of patterns+ */+ Set<String> getNextNames(KeyPath path);++ /**+ * Assuming a successor of path could match, get the patterns for the next possible index+ *+ * <p>+ * If a successor of the given path cannot match this pattern, the empty set is returned. If the+ * pattern could accept an index next, get all patterns describing those indices+ *+ * @param path the ancestor path+ * @return a set of patterns, without brackets {@code []}+ */+ Set<String> getNextIndices(KeyPath path);++ /**+ * Get the patterns for the previous possible key (right-to-left matching)+ *+ * <p>+ * If an ancestor of the given path cannot match this pattern, the empty set is returned.+ *+ * @param path the successor path+ * @return a set of patterns where indices are enclosed in brackets {@code []}+ */+ Set<String> getPrevKeys(KeyPath path);++ /**+ * If this predicate is known to match only one path, i.e., no wildcards, get that path+ *+ * @return the singleton path, or {@code null}+ */+ KeyPath getSingletonPath();++ /**+ * If this predicate consists of a single pattern, get that pattern+ *+ * @return the singleton pattern, or {@code null}+ */+ PathPattern getSingletonPattern();++ /**+ * Get the patterns of this predicate+ *+ * @return the patterns+ */+ Collection<PathPattern> getPatterns();++ /**+ * Remove count elements from the right+ *+ * @param count the number of elements to remove+ * @return the resulting filter+ */+ PathFilter removeRight(int count);++ /**+ * Substitute wildcards from left to right for the given list of keys+ *+ * <p>+ * Takes each pattern and substitutes its wildcards for the given indices, according to the+ * given alignment. This object is unmodified, and the result is returned.+ *+ * <p>+ * If there are fewer wildcards in a pattern than given, only the first keys are taken. If there+ * are fewer keys than wildcards in a pattern, then the remaining wildcards are left in the+ * resulting pattern. In this manner, the left-most wildcards are substituted for the left-most+ * indices, or the right-most wildcards are substituted for the right-most indices, depending on+ * the alignment.+ *+ * @param align the end to align+ * @param keys the keys to substitute+ * @return the pattern or matcher with the applied substitutions+ */+ PathFilter applyKeys(Align align, List<String> keys);++ default PathFilter applyKeys(Align align, String... keys) {+ return applyKeys(align, List.of(keys));+ }++ default PathFilter applyKeys(String... keys) {+ return applyKeys(Align.LEFT, keys);+ }++ default PathFilter applyIntKeys(int radix, Align align, List<Integer> keys) {+ return applyKeys(align,+ keys.stream().map(k -> Integer.toString(k, radix)).collect(Collectors.toList()));+ }++ default PathFilter applyIntKeys(int radix, Align align, int... keys) {+ return applyKeys(align,+ IntStream.of(keys)+ .mapToObj(k -> Integer.toString(k, radix))+ .collect(Collectors.toList()));+ }++ default PathFilter applyIntKeys(int... keys) {+ return applyIntKeys(10, Align.LEFT, keys);+ }++ /**+ * Test if any patterns are contained here+ *+ * <p>+ * Note that the presence of a pattern does not guarantee the presence of a matching object.+ * However, the absence of any pattern does guarantee no object can match.+ *+ * @return true if equivalent to {@link #NONE}+ */+ boolean isNone();+}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathMatcher.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathMatcher.javasimilarity index 79%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathMatcher.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathMatcher.javaindex ba6c8b19cc..3008fc0d22 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathMatcher.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathMatcher.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,24 +13,19 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.util;+package ghidra.trace.model.target.path;import java.util.*;import java.util.function.Predicate;import org.apache.commons.lang3.StringUtils;-/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.- */-@Deprecated(since = "11.2")-public class PathMatcher implements PathPredicates {+public class PathMatcher implements PathFilter {protected static final Set<String> WILD_SINGLETON = Set.of("");protected final Set<PathPattern> patterns = new HashSet<>();- public void addPattern(List<String> pattern) {+ public void addPattern(KeyPath pattern) {patterns.add(new PathPattern(pattern));}@@ -63,7 +58,7 @@ public class PathMatcher implements PathPredicates {}@Override- public PathPredicates or(PathPredicates that) {+ public PathFilter or(PathFilter that) {PathMatcher result = new PathMatcher();result.patterns.addAll(this.patterns);if (that instanceof PathMatcher) {@@ -92,27 +87,27 @@ public class PathMatcher implements PathPredicates {}@Override- public boolean matches(List<String> path) {+ public boolean matches(KeyPath path) {return anyPattern(p -> p.matches(path));}@Override- public boolean successorCouldMatch(List<String> path, boolean strict) {+ public boolean successorCouldMatch(KeyPath path, boolean strict) {return anyPattern(p -> p.successorCouldMatch(path, strict));}@Override- public boolean ancestorMatches(List<String> path, boolean strict) {+ public boolean ancestorMatches(KeyPath path, boolean strict) {return anyPattern(p -> p.ancestorMatches(path, strict));}@Override- public boolean ancestorCouldMatchRight(List<String> path, boolean strict) {+ public boolean ancestorCouldMatchRight(KeyPath path, boolean strict) {return anyPattern(p -> p.ancestorCouldMatchRight(path, strict));}@Override- public List<String> getSingletonPath() {+ public KeyPath getSingletonPath() {if (patterns.size() != 1) {return null;}@@ -134,17 +129,17 @@ public class PathMatcher implements PathPredicates {protected void coalesceWilds(Set<String> result) {if (result.contains("")) {- result.removeIf(PathUtils::isName);+ result.removeIf(KeyPath::isName);result.add("");}if (result.contains("[]")) {- result.removeIf(PathUtils::isIndex);+ result.removeIf(KeyPath::isIndex);result.add("[]");}}@Override- public Set<String> getNextKeys(List<String> path) {+ public Set<String> getNextKeys(KeyPath path) {Set<String> result = new HashSet<>();for (PathPattern pattern : patterns) {result.addAll(pattern.getNextKeys(path));@@ -154,7 +149,7 @@ public class PathMatcher implements PathPredicates {}@Override- public Set<String> getNextNames(List<String> path) {+ public Set<String> getNextNames(KeyPath path) {Set<String> result = new HashSet<>();for (PathPattern pattern : patterns) {result.addAll(pattern.getNextNames(path));@@ -166,7 +161,7 @@ public class PathMatcher implements PathPredicates {}@Override- public Set<String> getNextIndices(List<String> path) {+ public Set<String> getNextIndices(KeyPath path) {Set<String> result = new HashSet<>();for (PathPattern pattern : patterns) {result.addAll(pattern.getNextIndices(path));@@ -178,7 +173,7 @@ public class PathMatcher implements PathPredicates {}@Override- public Set<String> getPrevKeys(List<String> path) {+ public Set<String> getPrevKeys(KeyPath path) {Set<String> result = new HashSet<>();for (PathPattern pattern : patterns) {result.addAll(pattern.getPrevKeys(path));@@ -188,7 +183,7 @@ public class PathMatcher implements PathPredicates {}@Override- public boolean isEmpty() {+ public boolean isNone() {return patterns.isEmpty();}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathPattern.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathPattern.javasimilarity index 54%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathPattern.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathPattern.javaindex b0a7c312c8..e81eb06498 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/PathPattern.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathPattern.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,53 +13,47 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.util;+package ghidra.trace.model.target.path;import java.util.*;-/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.- */-@Deprecated(since = "11.2")-public class PathPattern implements PathPredicates {- private final List<String> pattern;+public class PathPattern implements PathFilter {+ private final KeyPath pattern;/*** TODO: This can get more sophisticated if needed, but for now, I don't think we even need* regular expressions. Either we care about a path element, or we don't.** <p>- * This takes a list of path keys as a means of matching paths. The empty key serves as a- * wildcard accepting all keys in that position, e.g., the following matches all elements within+ * This takes a keypath as a means of matching paths. The blank key serves as a wildcard+ * accepting all keys in that position, e.g., the following matches all elements within* {@code Processes}:*- * <p>- * {@code List.of("Processes", "[]")}- *- * <p>- * This should still be compatible with {@link PathUtils#parse(String)} and- * {@link PathUtils#toString(List)} allowing the last example to be expressed as- * {@code PathUtils.parse("Processes[]")}.+ * <pre>+ * {@link PathFilter#parse(String) PathFilter.parse}("Processes[]");+ * </pre>** @param pattern a list of path elements*/- public PathPattern(List<String> pattern) {- this.pattern = List.copyOf(pattern);+ public PathPattern(KeyPath pattern) {+ this.pattern = pattern;}@Overridepublic String toString() {- return String.format("<PathPattern %s>", PathUtils.toString(pattern));+ return String.format("<PathPattern %s>", pattern);}/**- * Convert this pattern to a string as in {@link PathPredicates#parse(String)}.+ * Convert this pattern to a string.,+ *+ * <p>+ * This is the inverse of {@link PathFilter#parse(String)}.** @return the string*/public String toPatternString() {- return PathUtils.toString(pattern);+ return pattern.toString();}@Override@@ -80,7 +74,7 @@ public class PathPattern implements PathPredicates {}@Override- public PathPredicates or(PathPredicates that) {+ public PathFilter or(PathFilter that) {if (this.equals(that)) {return this;}@@ -103,20 +97,20 @@ public class PathPattern implements PathPredicates {return "[]".equals(pat) || "".equals(pat);}- protected boolean matchesUpTo(List<String> path, int length) {+ protected boolean matchesUpTo(KeyPath path, int length) {for (int i = 0; i < length; i++) {- if (!PathPredicates.keyMatches(pattern.get(i), path.get(i))) {+ if (!PathFilter.keyMatches(pattern.key(i), path.key(i))) {return false;}}return true;}- protected boolean matchesBackTo(List<String> path, int length) {+ protected boolean matchesBackTo(KeyPath path, int length) {int patternMax = pattern.size() - 1;int pathMax = path.size() - 1;for (int i = 0; i < length; i++) {- if (!PathPredicates.keyMatches(pattern.get(patternMax - i), path.get(pathMax - i))) {+ if (!PathFilter.keyMatches(pattern.key(patternMax - i), path.key(pathMax - i))) {return false;}}@@ -124,7 +118,7 @@ public class PathPattern implements PathPredicates {}@Override- public boolean matches(List<String> path) {+ public boolean matches(KeyPath path) {if (path.size() != pattern.size()) {return false;}@@ -132,7 +126,7 @@ public class PathPattern implements PathPredicates {}@Override- public boolean successorCouldMatch(List<String> path, boolean strict) {+ public boolean successorCouldMatch(KeyPath path, boolean strict) {if (path.size() > pattern.size()) {return false;}@@ -143,7 +137,7 @@ public class PathPattern implements PathPredicates {}@Override- public boolean ancestorMatches(List<String> path, boolean strict) {+ public boolean ancestorMatches(KeyPath path, boolean strict) {if (path.size() < pattern.size()) {return false;}@@ -154,7 +148,7 @@ public class PathPattern implements PathPredicates {}@Override- public boolean ancestorCouldMatchRight(List<String> path, boolean strict) {+ public boolean ancestorCouldMatchRight(KeyPath path, boolean strict) {if (path.size() > pattern.size()) {return false;}@@ -164,29 +158,20 @@ public class PathPattern implements PathPredicates {return matchesBackTo(path, path.size());}- protected static boolean containsWildcards(List<String> pattern) {- for (String pat : pattern) {- if (isWildcard(pat)) {- return true;- }- }- return false;- }-@Override- public List<String> getSingletonPath() {- if (containsWildcards(pattern)) {+ public KeyPath getSingletonPath() {+ if (pattern.containsWildcard()) {return null;}return pattern;}/**- * Return the pattern as a list of key patterns+ * Return the pattern as a key path of patterns** @return the list of key patterns*/- public List<String> asPath() {+ public KeyPath asPath() {return pattern;}@@ -196,7 +181,7 @@ public class PathPattern implements PathPredicates {* @return the count*/public int countWildcards() {- return (int) pattern.stream().filter(k -> isWildcard(k)).count();+ return pattern.countWildcards();}@Override@@ -210,115 +195,117 @@ public class PathPattern implements PathPredicates {}@Override- public Set<String> getNextKeys(List<String> path) {+ public Set<String> getNextKeys(KeyPath path) {if (path.size() >= pattern.size()) {return Set.of();}if (!matchesUpTo(path, path.size())) {return Set.of();}- return Set.of(pattern.get(path.size()));+ return Set.of(pattern.key(path.size()));}@Override- public Set<String> getNextNames(List<String> path) {+ public Set<String> getNextNames(KeyPath path) {if (path.size() >= pattern.size()) {return Set.of();}if (!matchesUpTo(path, path.size())) {return Set.of();}- String pat = pattern.get(path.size());- if (PathUtils.isName(pat)) {+ String pat = pattern.key(path.size());+ if (KeyPath.isName(pat)) {return Set.of(pat);}return Set.of();}@Override- public Set<String> getNextIndices(List<String> path) {+ public Set<String> getNextIndices(KeyPath path) {if (path.size() >= pattern.size()) {return Set.of();}if (!matchesUpTo(path, path.size())) {return Set.of();}- String pat = pattern.get(path.size());- if (PathUtils.isIndex(pat)) {- return Set.of(PathUtils.parseIndex(pat));+ String pat = pattern.key(path.size());+ if (KeyPath.isIndex(pat)) {+ return Set.of(KeyPath.parseIndex(pat));}return Set.of();}@Override- public Set<String> getPrevKeys(List<String> path) {+ public Set<String> getPrevKeys(KeyPath path) {if (path.size() >= pattern.size()) {return Set.of();}if (!matchesBackTo(path, path.size())) {return Set.of();}- return Set.of(pattern.get(pattern.size() - 1 - path.size()));+ return Set.of(pattern.key(pattern.size() - 1 - path.size()));}@Override- public boolean isEmpty() {+ public boolean isNone() {return false;}@Override- public PathPattern applyKeys(Align align, List<String> indices) {- List<String> result = Arrays.asList(new String[pattern.size()]);- ListIterator<String> iit = align.iterator(indices);- ListIterator<String> pit = align.iterator(pattern);+ public PathPattern applyKeys(Align align, List<String> keys) {+ String[] result = new String[pattern.size()];+ ListIterator<String> kit = align.iterator(keys);+ ListIterator<String> pit = align.iterator(pattern.keys);while (pit.hasNext()) {int i = pit.nextIndex();String pat = pit.next();- if (iit.hasNext() && isWildcard(pat)) {- String index = iit.next();- if (PathUtils.isIndex(pat)) {- result.set(i, PathUtils.makeKey(index));+ if (kit.hasNext() && isWildcard(pat)) {+ String index = kit.next();+ if (KeyPath.isIndex(pat)) {+ result[i] = KeyPath.makeKey(index);}else {// NB. Rare for attribute wildcards, but just in case- result.set(i, index);+ result[i] = index;}}else {- result.set(i, pat);+ result[i] = pat;}}- return new PathPattern(result);+ return new PathPattern(new KeyPath(result));}/*** If the given path matches, extract keys where matched by wildcards** <p>- * This is essentially the inverse of {@link #applyKeys(List)}, but can only be asked of one- * pattern. The keys are returned from left to right, in the order matched by the pattern. Only- * those keys matched by a wildcard are included in the result. Indices are extracted with the- * brackets {@code []} removed.+ * This is essentially the inverse of {@link #applyKeys(String...)}, but can only be asked of+ * one pattern. The keys are returned from left to right, in the order matched by the pattern.+ * Only those keys matched by a wildcard are included in the result. Indices are extracted with+ * the brackets {@code []} removed.** @param path the path to match+ * @param matchLength true if the path must have the same number of keys as this pattern, or+ * false if the path is allowed to have more keys than this pattern* @return the list of matched keys or {@code null} if not matched*/- public List<String> matchKeys(List<String> path) {+ public List<String> matchKeys(KeyPath path, boolean matchLength) {int length = pattern.size();- if (length != path.size()) {+ if (matchLength ? length != path.size() : length > path.size()) {return null;}List<String> result = new ArrayList<>();for (int i = 0; i < length; i++) {- String pat = pattern.get(i);- String key = path.get(i);- if (!PathPredicates.keyMatches(pat, key)) {+ String pat = pattern.key(i);+ String key = path.key(i);+ if (!PathFilter.keyMatches(pat, key)) {return null;}if (isWildcard(pat)) {- if (PathUtils.isIndex(pat)) {- result.add(PathUtils.parseIndex(key));+ if (KeyPath.isIndex(pat)) {+ result.add(KeyPath.parseIndex(key));}else {result.add(key);@@ -328,11 +315,12 @@ public class PathPattern implements PathPredicates {return result;}- public void doRemoveRight(int count, PathMatcher result) {- if (count > pattern.size()) {+ void doRemoveRight(int count, PathMatcher result) {+ KeyPath parent = pattern.parent(count);+ if (parent == null) {return;}- result.addPattern(pattern.subList(0, pattern.size() - count));+ result.addPattern(parent);}@Overridediff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/BadSchemaException.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/BadSchemaException.javasimilarity index 95%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/BadSchemaException.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/BadSchemaException.javaindex c39e32dbbf..57b1208456 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/BadSchemaException.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/BadSchemaException.java@@ -13,7 +13,7 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;/*** An exception that indicates a path or object does not provide a required interface.diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/DefaultSchemaContext.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/DefaultSchemaContext.javasimilarity index 58%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/DefaultSchemaContext.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/DefaultSchemaContext.javaindex e4b324b911..ca3ac325b6 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/DefaultSchemaContext.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/DefaultSchemaContext.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,22 +13,21 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;import java.util.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.util.Msg;/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.+ * The default implementation of a schema context*/-@Deprecated(since = "11.2")public class DefaultSchemaContext implements SchemaContext {- private final Map<SchemaName, TargetObjectSchema> schemas = new LinkedHashMap<>();+ private final Map<SchemaName, TraceObjectSchema> schemas = new LinkedHashMap<>();public DefaultSchemaContext() {- for (EnumerableTargetObjectSchema schema : EnumerableTargetObjectSchema.values()) {+ for (PrimitiveTraceObjectSchema schema : PrimitiveTraceObjectSchema.values()) {schemas.put(schema.getName(), schema);}}@@ -37,37 +36,41 @@ public class DefaultSchemaContext implements SchemaContext {return new SchemaBuilder(this, name);}- public synchronized void putSchema(TargetObjectSchema schema) {+ public synchronized void putSchema(TraceObjectSchema schema) {if (schemas.containsKey(schema.getName())) {throw new IllegalArgumentException("Name already in context: " + schema.getName());}schemas.put(schema.getName(), schema);}- public synchronized void replaceSchema(TargetObjectSchema schema) {+ public synchronized void replaceSchema(TraceObjectSchema schema) {schemas.put(schema.getName(), schema);}@Override- public synchronized TargetObjectSchema getSchemaOrNull(SchemaName name) {+ public synchronized TraceObjectSchema getSchemaOrNull(SchemaName name) {return schemas.get(name);}@Override- public synchronized TargetObjectSchema getSchema(SchemaName name) {- return Objects.requireNonNull(schemas.get(name), "No such schema name: " + name);+ public synchronized TraceObjectSchema getSchema(SchemaName name) {+ TraceObjectSchema schema = schemas.get(name);+ if (schema == null) {+ Msg.error(this, "No such schema name: " + name);+ return PrimitiveTraceObjectSchema.ANY;+ }+ return schema;}@Override- public synchronized Set<TargetObjectSchema> getAllSchemas() {- // Set.copyOf does not preserve iteration order- return Collections.unmodifiableSet(new LinkedHashSet<>(schemas.values()));+ public synchronized SequencedSet<TraceObjectSchema> getAllSchemas() {+ return Collections.unmodifiableSequencedSet(new LinkedHashSet<>(schemas.values()));}@Overridepublic String toString() {StringBuilder sb = new StringBuilder();- for (TargetObjectSchema s : schemas.values()) {+ for (TraceObjectSchema s : schemas.values()) {sb.append(s + "\n");}return sb.toString();diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/DefaultTargetObjectSchema.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/DefaultTraceObjectSchema.javasimilarity index 81%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/DefaultTargetObjectSchema.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/DefaultTraceObjectSchema.javaindex d1f9522690..13c0e2ab84 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/DefaultTargetObjectSchema.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/DefaultTraceObjectSchema.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,20 +13,28 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;import java.util.*;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetObject;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.+ * The "type descriptor" of a {@link TraceObject}.+ *+ * <p>+ * These are typically loaded from XML anymore. See {@link XmlSchemaContext}. It typically consists+ * of a list of expected attributes and their respective schemas, some of which may be+ * {@link PrimitiveTraceObjectSchema primitive}; and the schema of elements, if this is a container.+ * It is a bit more flexible than that, but that is the usual case. A schema may also specify one or+ * more interfaces it supports. An interface typically requires certain attributes, but also implies+ * some debugger-related behavior should be available via the target's command set. See+ * {@link TraceObjectInterface} and its derivatives for information about each interface.*/-@Deprecated(since = "11.2")-public class DefaultTargetObjectSchema- implements TargetObjectSchema, Comparable<DefaultTargetObjectSchema> {+public class DefaultTraceObjectSchema+ implements TraceObjectSchema, Comparable<DefaultTraceObjectSchema> {private static final String INDENT = " ";public static class DefaultAttributeSchema@@ -35,10 +43,10 @@ public class DefaultTargetObjectSchemaprivate final SchemaName schema;private final boolean isRequired;private final boolean isFixed;- private final boolean isHidden;+ private final Hidden hidden;public DefaultAttributeSchema(String name, SchemaName schema, boolean isRequired,- boolean isFixed, boolean isHidden) {+ boolean isFixed, Hidden hidden) {if (name.equals("") && isRequired) {throw new IllegalArgumentException("The default attribute schema cannot be required");@@ -47,13 +55,13 @@ public class DefaultTargetObjectSchemathis.schema = schema;this.isRequired = isRequired;this.isFixed = isFixed;- this.isHidden = isHidden;+ this.hidden = hidden.adjust(name);}@Overridepublic String toString() {return String.format("<attr name=%s schema=%s required=%s fixed=%s hidden=%s>",- name, schema, isRequired, isFixed, isHidden);+ name, schema, isRequired, isFixed, hidden.toString().toLowerCase());}/**@@ -81,7 +89,7 @@ public class DefaultTargetObjectSchemaif (this.isFixed != that.isFixed) {return false;}- if (this.isHidden != that.isHidden) {+ if (this.hidden != that.hidden) {return false;}return true;@@ -118,8 +126,8 @@ public class DefaultTargetObjectSchema}@Override- public boolean isHidden() {- return isHidden;+ public Hidden getHidden() {+ return hidden;}}@@ -184,25 +192,21 @@ public class DefaultTargetObjectSchemaprivate final SchemaContext context;private final SchemaName name;private final Class<?> type;- private final Set<Class<? extends TargetObject>> interfaces;+ private final Set<Class<? extends TraceObjectInterface>> interfaces;private final boolean isCanonicalContainer;private final Map<String, SchemaName> elementSchemas;private final SchemaName defaultElementSchema;- private final ResyncMode elementResync;private final Map<String, AttributeSchema> attributeSchemas;private final Map<String, String> attributeAliases;private final AttributeSchema defaultAttributeSchema;- private final ResyncMode attributeResync;- DefaultTargetObjectSchema(SchemaContext context, SchemaName name, Class<?> type,- Set<Class<? extends TargetObject>> interfaces, boolean isCanonicalContainer,+ DefaultTraceObjectSchema(SchemaContext context, SchemaName name, Class<?> type,+ Set<Class<? extends TraceObjectInterface>> interfaces, boolean isCanonicalContainer,Map<String, SchemaName> elementSchemas, SchemaName defaultElementSchema,- ResyncMode elementResync,Map<String, AttributeSchema> attributeSchemas, Map<String, String> attributeAliases,- AttributeSchema defaultAttributeSchema,- ResyncMode attributeResync) {+ AttributeSchema defaultAttributeSchema) {this.context = context;this.name = name;this.type = type;@@ -211,14 +215,12 @@ public class DefaultTargetObjectSchemathis.elementSchemas = Collections.unmodifiableMap(new LinkedHashMap<>(elementSchemas));this.defaultElementSchema = defaultElementSchema;- this.elementResync = elementResync;AliasResolver resolver =new AliasResolver(attributeSchemas, attributeAliases, defaultAttributeSchema);this.attributeAliases = Collections.unmodifiableMap(resolver.resolveAliases());this.attributeSchemas = Collections.unmodifiableMap(resolver.resolveSchemas());this.defaultAttributeSchema = defaultAttributeSchema;- this.attributeResync = attributeResync;}@Override@@ -237,7 +239,7 @@ public class DefaultTargetObjectSchema}@Override- public Set<Class<? extends TargetObject>> getInterfaces() {+ public Set<Class<? extends TraceObjectInterface>> getInterfaces() {return interfaces;}@@ -256,11 +258,6 @@ public class DefaultTargetObjectSchemareturn defaultElementSchema;}- @Override- public ResyncMode getElementResyncMode() {- return elementResync;- }-@Overridepublic Map<String, AttributeSchema> getAttributeSchemas() {return attributeSchemas;@@ -276,11 +273,6 @@ public class DefaultTargetObjectSchemareturn defaultAttributeSchema;}- @Override- public ResyncMode getAttributeResyncMode() {- return attributeResync;- }-@Overridepublic String toString() {StringBuilder sb = new StringBuilder();@@ -296,16 +288,16 @@ public class DefaultTargetObjectSchema}sb.append(" {\n" + INDENT);sb.append("ifaces = [");- for (Class<? extends TargetObject> iface : interfaces) {- sb.append(DebuggerObjectModel.requireIfaceName(iface));+ for (Class<? extends TraceObjectInterface> iface : interfaces) {+ sb.append(TraceObjectInterfaceUtils.getSchemaName(iface));sb.append(" ");}sb.append("]\n" + INDENT);- sb.append("elements(resync " + elementResync + ") = ");+ sb.append("elements = ");sb.append(elementSchemas);sb.append(" default " + defaultElementSchema);sb.append("\n" + INDENT);- sb.append("attributes(resync " + attributeResync + ") = ");+ sb.append("attributes = ");sb.append(attributeSchemas);sb.append(" default " + defaultAttributeSchema);sb.append(" aliases " + attributeAliases);@@ -328,7 +320,7 @@ public class DefaultTargetObjectSchema*/@Overridepublic boolean equals(Object obj) {- if (!(obj instanceof DefaultTargetObjectSchema that)) {+ if (!(obj instanceof DefaultTraceObjectSchema that)) {return false;}if (!Objects.equals(this.name, that.name)) {@@ -349,9 +341,6 @@ public class DefaultTargetObjectSchemaif (!Objects.equals(this.defaultElementSchema, that.defaultElementSchema)) {return false;}- if (!Objects.equals(this.elementResync, that.elementResync)) {- return false;- }if (!Objects.equals(this.attributeSchemas, that.attributeSchemas)) {return false;}@@ -361,9 +350,6 @@ public class DefaultTargetObjectSchemaif (!Objects.equals(this.defaultAttributeSchema, that.defaultAttributeSchema)) {return false;}- if (!Objects.equals(this.attributeResync, that.attributeResync)) {- return false;- }return true;}@@ -373,7 +359,7 @@ public class DefaultTargetObjectSchema}@Override- public int compareTo(DefaultTargetObjectSchema o) {+ public int compareTo(DefaultTraceObjectSchema o) {return name.compareTo(o.name);}}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/EnumerableTargetObjectSchema.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/PrimitiveTraceObjectSchema.javasimilarity index 65%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/EnumerableTargetObjectSchema.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/PrimitiveTraceObjectSchema.javaindex 81b0fd4049..b29a918080 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/EnumerableTargetObjectSchema.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/PrimitiveTraceObjectSchema.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,33 +13,28 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;import java.util.*;-import ghidra.dbg.attributes.TargetDataType;-import ghidra.dbg.attributes.TargetObjectList;-import ghidra.dbg.target.TargetAttacher.TargetAttachKindSet;-import ghidra.dbg.target.TargetBreakpointSpecContainer.TargetBreakpointKindSet;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.TargetMethod.TargetParameterMap;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetSteppable.TargetStepKindSet;-import ghidra.dbg.util.PathMatcher;+import ghidra.lifecycle.Unfinished;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRange;+import ghidra.trace.model.TraceExecutionState;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathMatcher;/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.+ * The schemas common to all contexts, as they describe the primitive and built-in types.*/-@Deprecated(since = "11.2")-public enum EnumerableTargetObjectSchema implements TargetObjectSchema {+public enum PrimitiveTraceObjectSchema implements TraceObjectSchema {/*** The top-most type descriptor** <p>- * The described value can be any primitive or a {@link TargetObject}.+ * The described value can be any primitive or a {@link TraceObject}.*/ANY(Object.class) {@Override@@ -53,7 +48,7 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {}@Override- public boolean isAssignableFrom(TargetObjectSchema that) {+ public boolean isAssignableFrom(TraceObjectSchema that) {return true;}},@@ -61,9 +56,9 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {* The least restrictive, but least informative object schema.** <p>- * This requires nothing more than the described value to be a {@link TargetObject}.+ * This requires nothing more than the described value to be a {@link TraceObject}.*/- OBJECT(TargetObject.class) {+ OBJECT(TraceObject.class) {@Overridepublic SchemaName getDefaultElementSchema() {return OBJECT.getName();@@ -75,7 +70,7 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {}@Override- public boolean isAssignableFrom(TargetObjectSchema that) {+ public boolean isAssignableFrom(TraceObjectSchema that) {// That is has as schema implies it's a TargetObjectreturn true;}@@ -98,14 +93,8 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {STRING(String.class),ADDRESS(Address.class),RANGE(AddressRange.class),- DATA_TYPE(TargetDataType.class),- // TODO: Limited built-in generics?- LIST_OBJECT(TargetObjectList.class),- MAP_PARAMETERS(TargetParameterMap.class),- SET_ATTACH_KIND(TargetAttachKindSet.class),- SET_BREAKPOINT_KIND(TargetBreakpointKindSet.class),- SET_STEP_KIND(TargetStepKindSet.class),- EXECUTION_STATE(TargetExecutionState.class),+ EXECUTION_STATE(TraceExecutionState.class),+ MAP_PARAMETERS(Unfinished.class), // TODO: How to describe Method objects?// Additional types supported by the Trace databaseCHAR(Character.class, char.class),BOOL_ARR(boolean[].class),@@ -129,8 +118,8 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {* @param cls the class, which may or may not be the boxed form* @return the schema or null if no schema is suitable*/- public static EnumerableTargetObjectSchema schemaForPrimitive(Class<?> cls) {- for (EnumerableTargetObjectSchema schema : EnumerableTargetObjectSchema.values()) {+ public static PrimitiveTraceObjectSchema schemaForPrimitive(Class<?> cls) {+ for (PrimitiveTraceObjectSchema schema : PrimitiveTraceObjectSchema.values()) {if (schema.getTypes().contains(cls)) {return schema;}@@ -146,14 +135,14 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {* @return the name or null if no schema is suitable*/public static SchemaName nameForPrimitive(Class<?> cls) {- EnumerableTargetObjectSchema schema = schemaForPrimitive(cls);+ PrimitiveTraceObjectSchema schema = schemaForPrimitive(cls);return schema == null ? null : schema.getName();}private final SchemaName name;private final List<Class<?>> types;- private EnumerableTargetObjectSchema(Class<?>... types) {+ private PrimitiveTraceObjectSchema(Class<?>... types) {this.name = new SchemaName(this.name());this.types = List.of(types);}@@ -178,7 +167,7 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {}@Override- public Set<Class<? extends TargetObject>> getInterfaces() {+ public Set<Class<? extends TraceObjectInterface>> getInterfaces() {return Set.of();}@@ -197,11 +186,6 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {return VOID.getName();}- @Override- public ResyncMode getElementResyncMode() {- return TargetObjectSchema.DEFAULT_ELEMENT_RESYNC;- }-@Overridepublic Map<String, AttributeSchema> getAttributeSchemas() {return Map.of();@@ -218,22 +202,18 @@ public enum EnumerableTargetObjectSchema implements TargetObjectSchema {}@Override- public ResyncMode getAttributeResyncMode() {- return TargetObjectSchema.DEFAULT_ATTRIBUTE_RESYNC;- }-- @Override- public PathMatcher searchFor(Class<? extends TargetObject> type, boolean requireCanonical) {+ public PathMatcher searchFor(Class<? extends TraceObjectInterface> type,+ boolean requireCanonical) {return new PathMatcher();}@Override- public List<String> searchForCanonicalContainer(Class<? extends TargetObject> type) {+ public KeyPath searchForCanonicalContainer(Class<? extends TraceObjectInterface> type) {return null;}@Override- public List<String> searchForSuitable(Class<? extends TargetObject> type, List<String> path) {+ public KeyPath searchForSuitable(Class<? extends TraceObjectInterface> type, KeyPath path) {return null;}}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/SchemaBuilder.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/SchemaBuilder.javasimilarity index 74%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/SchemaBuilder.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/SchemaBuilder.javaindex 91171c81bc..234c4f3b02 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/SchemaBuilder.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/SchemaBuilder.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,34 +13,36 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;import java.util.*;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.TargetObjectSchema.*;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.schema.TraceObjectSchema.AttributeSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.+ * A builder for a {@link TraceObjectSchema}.*/-@Deprecated(since = "11.2")public class SchemaBuilder {+ public static final SchemaName DEFAULT_ELEMENT_SCHEMA =+ PrimitiveTraceObjectSchema.OBJECT.getName();+ public static final AttributeSchema DEFAULT_ATTRIBUTE_SCHEMA = AttributeSchema.DEFAULT_ANY;+private final DefaultSchemaContext context;private final SchemaName name;- private Class<?> type = TargetObject.class;- private Set<Class<? extends TargetObject>> interfaces = new LinkedHashSet<>();+ private Class<?> type = TraceObject.class;+ private Set<Class<? extends TraceObjectInterface>> interfaces = new LinkedHashSet<>();private boolean isCanonicalContainer = false;private Map<String, SchemaName> elementSchemas = new LinkedHashMap<>();- private SchemaName defaultElementSchema = EnumerableTargetObjectSchema.OBJECT.getName();- private ResyncMode elementResync = TargetObjectSchema.DEFAULT_ELEMENT_RESYNC;+ private SchemaName defaultElementSchema = DEFAULT_ELEMENT_SCHEMA;private Map<String, AttributeSchema> attributeSchemas = new LinkedHashMap<>();private Map<String, String> attributeAliases = new LinkedHashMap<>();- private AttributeSchema defaultAttributeSchema = AttributeSchema.DEFAULT_ANY;- private ResyncMode attributeResync = TargetObjectSchema.DEFAULT_ATTRIBUTE_RESYNC;+ private AttributeSchema defaultAttributeSchema = DEFAULT_ATTRIBUTE_SCHEMA;private Map<String, Object> elementOrigins = new LinkedHashMap<>();private Map<String, Object> attributeOrigins = new LinkedHashMap<>();@@ -50,7 +52,7 @@ public class SchemaBuilder {this.name = name;}- public SchemaBuilder(DefaultSchemaContext context, TargetObjectSchema schema) {+ public SchemaBuilder(DefaultSchemaContext context, TraceObjectSchema schema) {this(context, schema.getName());setType(schema.getType());setInterfaces(schema.getInterfaces());@@ -58,11 +60,9 @@ public class SchemaBuilder {elementSchemas.putAll(schema.getElementSchemas());setDefaultElementSchema(schema.getDefaultElementSchema());- setElementResyncMode(schema.getElementResyncMode());attributeSchemas.putAll(schema.getAttributeSchemas());setDefaultAttributeSchema(schema.getDefaultAttributeSchema());- setAttributeResyncMode(schema.getAttributeResyncMode());}public SchemaBuilder setType(Class<?> type) {@@ -74,22 +74,22 @@ public class SchemaBuilder {return type;}- public SchemaBuilder setInterfaces(Set<Class<? extends TargetObject>> interfaces) {+ public SchemaBuilder setInterfaces(Set<Class<? extends TraceObjectInterface>> interfaces) {this.interfaces.clear();this.interfaces.addAll(interfaces);return this;}- public Set<Class<? extends TargetObject>> getInterfaces() {+ public Set<Class<? extends TraceObjectInterface>> getInterfaces() {return Set.copyOf(interfaces);}- public SchemaBuilder addInterface(Class<? extends TargetObject> iface) {+ public SchemaBuilder addInterface(Class<? extends TraceObjectInterface> iface) {this.interfaces.add(iface);return this;}- public SchemaBuilder removeInterface(Class<? extends TargetObject> iface) {+ public SchemaBuilder removeInterface(Class<? extends TraceObjectInterface> iface) {this.interfaces.remove(iface);return this;}@@ -108,6 +108,7 @@ public class SchemaBuilder {** @param index the index whose schema to define, or "" for the default* @param schema the schema defining the element+ * @param origin optional, for diagnostics, an object describing the element schema's origin* @return this builder*/public SchemaBuilder addElementSchema(String index, SchemaName schema, Object origin) {@@ -126,7 +127,7 @@ public class SchemaBuilder {public SchemaBuilder removeElementSchema(String index) {if (index.equals("")) {- return setDefaultElementSchema(EnumerableTargetObjectSchema.OBJECT.getName());+ return setDefaultElementSchema(PrimitiveTraceObjectSchema.OBJECT.getName());}elementSchemas.remove(index);elementOrigins.remove(index);@@ -146,15 +147,6 @@ public class SchemaBuilder {return defaultElementSchema;}- public SchemaBuilder setElementResyncMode(ResyncMode elementResync) {- this.elementResync = elementResync;- return this;- }-- public ResyncMode getElementResyncMode() {- return elementResync;- }-/*** Define the schema for a child attribute.*@@ -163,6 +155,7 @@ public class SchemaBuilder {* schema.** @param schema the attribute schema to add to the definition+ * @param origin optional, for diagnostics, an object describing the attribute schema's origin* @return this builder*/public SchemaBuilder addAttributeSchema(AttributeSchema schema, Object origin) {@@ -245,25 +238,16 @@ public class SchemaBuilder {return defaultAttributeSchema;}- public SchemaBuilder setAttributeResyncMode(ResyncMode attributeResync) {- this.attributeResync = attributeResync;- return this;- }-- public ResyncMode getAttributeResyncMode() {- return attributeResync;- }-- public TargetObjectSchema buildAndAdd() {- TargetObjectSchema schema = build();+ public TraceObjectSchema buildAndAdd() {+ TraceObjectSchema schema = build();context.putSchema(schema);return schema;}- public TargetObjectSchema build() {- return new DefaultTargetObjectSchema(+ public TraceObjectSchema build() {+ return new DefaultTraceObjectSchema(context, name, type, interfaces, isCanonicalContainer,- elementSchemas, defaultElementSchema, elementResync,- attributeSchemas, attributeAliases, defaultAttributeSchema, attributeResync);+ elementSchemas, defaultElementSchema,+ attributeSchemas, attributeAliases, defaultAttributeSchema);}}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/SchemaContext.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/SchemaContext.javasimilarity index 54%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/SchemaContext.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/SchemaContext.javaindex f87f537006..2f2d5a72ac 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/SchemaContext.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/SchemaContext.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,33 +13,27 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;-import java.util.Set;+import java.util.SequencedSet;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;/**- * A collection of related schemas- *- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.+ * A collection of related schemas all for the same trace or target*/-@Deprecated(since = "11.2")public interface SchemaContext {/*** Resolve a schema in this context by name** <p>- * Note that resolving a name generated outside of this context may have undefined results. In- * most cases, it will resolve to the schema whose name has the same string representation, but- * it might instead throw a {@link NullPointerException}.+ * Note that resolving a name generated outside of this context may have undefined results.** @param name the schema's name- * @return the schema- * @throws NullPointerException if no schema by the given name exists+ * @return the schema or {@link PrimitiveTraceObjectSchema#ANY} if no schema by the given name+ * exists*/- TargetObjectSchema getSchema(SchemaName name);+ TraceObjectSchema getSchema(SchemaName name);/*** Resolve a schema in this context by name@@ -47,12 +41,12 @@ public interface SchemaContext {* @param name the schema's name* @return the schema, or null if no schema by the given name exists*/- TargetObjectSchema getSchemaOrNull(SchemaName name);+ TraceObjectSchema getSchemaOrNull(SchemaName name);/*** Collect all schemas in this context** @return the set of all schemas*/- Set<TargetObjectSchema> getAllSchemas();+ SequencedSet<TraceObjectSchema> getAllSchemas();}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetObjectSchema.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/TraceObjectSchema.javasimilarity index 55%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetObjectSchema.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/TraceObjectSchema.javaindex e44f62afbc..32ff9c5388 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/TargetObjectSchema.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/TraceObjectSchema.java@@ -13,24 +13,26 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;import java.util.*;import java.util.Map.Entry;-import java.util.concurrent.CompletableFuture;import java.util.function.Predicate;import java.util.stream.Collectors;-import ghidra.dbg.DebuggerObjectModel.RefreshBehavior;-import ghidra.dbg.agent.DefaultTargetObject;-import ghidra.dbg.target.*;-import ghidra.dbg.target.schema.DefaultTargetObjectSchema.DefaultAttributeSchema;-import ghidra.dbg.util.*;-import ghidra.dbg.util.CollectionUtils.Delta;+import ghidra.trace.model.Lifespan;+import ghidra.trace.model.memory.TraceObjectRegisterContainer;+import ghidra.trace.model.stack.TraceObjectStack;+import ghidra.trace.model.stack.TraceObjectStackFrame;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectAggregate;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.path.*;+import ghidra.trace.model.target.schema.DefaultTraceObjectSchema.DefaultAttributeSchema;import ghidra.util.Msg;/**- * Type information for a particular value or {@link TargetObject}+ * Type information for a particular value or {@link TraceObject}** <p>* This allows a client to inspect predictable aspects of a model before fetching any actual@@ -38,143 +40,74 @@ import ghidra.util.Msg;* comprehend the model's structure in general.** <p>- * For a primitive type, the type is given by {@link #getType()}. For {@link TargetObject}s,+ * For a primitive type, the type is given by {@link #getType()}. For {@link TraceObject}s,* supported interfaces are given by {@link #getInterfaces()}. The types of children are determined* by matching on the keys (indices and names), the result being a subordinate- * {@link TargetObjectSchema}. Keys must match exactly, unless the "pattern" is the empty string,+ * {@link TraceObjectSchema}. Keys must match exactly, unless the "pattern" is the empty string,* which matches any key. Similarly, the wild-card index is {@code []}.** <p>* The schema can specify attribute aliases, which implies that a particular key ("from") will* always have the same value as another ("to"). As a result, the schemas of aliased keys will also* implicitly match.- *- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.*/-@Deprecated(since = "11.2")-public interface TargetObjectSchema {- public static final ResyncMode DEFAULT_ELEMENT_RESYNC = ResyncMode.NEVER;- public static final ResyncMode DEFAULT_ATTRIBUTE_RESYNC = ResyncMode.NEVER;+public interface TraceObjectSchema {/*** An identifier for schemas within a context.- *+ *+ * <p>* This is essentially a wrapper on {@link String}, but typed so that strings and names cannot* be accidentally interchanged.+ *+ * <p>+ * TODO: In retrospect, I'm not sure having this has improved anything. Might just replace this+ * with a plain {@link String}.+ *+ * @param name the name*/- class SchemaName implements Comparable<SchemaName> {- private final String name;-- /**- * Create an identifier with the given name- *- * <p>- * In most cases, this constructor should always be wrapped in a cache, e.g.,- * {@link Map#computeIfAbsent(Object, java.util.function.Function)}.- *- * @param name the name- */- public SchemaName(String name) {- this.name = Objects.requireNonNull(name);- }-- /**- * {@inheritDoc}- *- * @return the name- */+ record SchemaName(String name) implements Comparable<SchemaName> {@Override- public String toString() {+ public final String toString() {return name;}- @Override- public boolean equals(Object obj) {- if (!(obj instanceof SchemaName)) {- return false;- }- SchemaName that = (SchemaName) obj;- if (!this.name.equals(that.name)) {- return false;- }- return true;- }-- @Override- public int hashCode() {- return name.hashCode();- }-@Overridepublic int compareTo(SchemaName o) {return this.name.compareTo(o.name);}}- /**- * A mode describing what "promise" a model makes when keeping elements or attributes up to date- *- * <p>- * Each object specifies a element sync mode, and an attribute sync mode. These describe when- * the client must call {@link TargetObject#resync(RefreshBehavior, RefreshBehavior)} to- * refresh/resync to ensure it has a fresh cache of elements and/or attributes. Note that any- * client requesting a resync will cause all clients to receive the updates.- */- enum ResyncMode {- /**- * The object's elements are kept up to date via unsolicited push notifications / callbacks- *- * <p>- * The client should never have to call {@link TargetObject#resync()}. This is the default,- * and it is preferred for attributes. It is most appropriate for small-ish collections that- * change often and that the client is likely to need, e.g., the process, thread, and module- * lists. In general, if the native debugger or API offers callbacks for updating the- * collection, then this is the mode to use.- */- NEVER {+ enum Hidden {+ DEFAULT {@Override- public boolean shouldResync(CompletableFuture<Void> curRequest) {- return false;+ public boolean isHidden(String name) {+ return name.startsWith("_");}- },- /**- * The object must be explicitly synchronized once- *- * <p>- * This mode is appropriate for large collections, e.g., the symbols of a module. To push- * these without solicitation could be expensive, both for the model to retrieve them from- * the debugger, and for the client to process the collection. They should only be retrieved- * when asked, via {@link TargetObject#resync()}. Such collections are typically fixed, and- * so do not require later updates. Nevertheless, if the collection <em>does</em> change,- * then those updates must be pushed without further solicitation.- */- ONCE {+@Override- public boolean shouldResync(CompletableFuture<Void> curRequest) {- return curRequest == null || curRequest.isCompletedExceptionally();+ public Hidden adjust(String name) {+ return name.isEmpty() ? this : FALSE;}},- /**- * The object's elements are only updated when requested- *- * <p>- * This is the default for elements. It is appropriate for collections where the client- * doesn't necessarily need an up-to-date copy. Please note the higher likelihood that the- * client may make requests involving an object that has since become invalid. The model- * must be prepared to reject those requests gracefully. The most common example is the list- * of attachable processes: It should only be retrieved when requested, and there's no need- * to keep it up to date. If a process terminates, and the client later requests to attach- * to it, the request may be rejected.- */- ALWAYS {+ TRUE {@Override- public boolean shouldResync(CompletableFuture<Void> curRequest) {+ public boolean isHidden(String name) {return true;}+ },+ FALSE {+ @Override+ public boolean isHidden(String name) {+ return false;+ }};- public abstract boolean shouldResync(CompletableFuture<Void> curRequest);+ public abstract boolean isHidden(String name);++ public Hidden adjust(String name) {+ return this;+ }}/**@@ -185,17 +118,17 @@ public interface TargetObjectSchema {* A descriptor suitable as a default that imposes no restrictions.*/AttributeSchema DEFAULT_ANY = new DefaultAttributeSchema("",- EnumerableTargetObjectSchema.ANY.getName(), false, false, true);+ PrimitiveTraceObjectSchema.ANY.getName(), false, false, Hidden.DEFAULT);/*** A descriptor suitable as a default that requires an object*/AttributeSchema DEFAULT_OBJECT = new DefaultAttributeSchema("",- EnumerableTargetObjectSchema.OBJECT.getName(), false, false, true);+ PrimitiveTraceObjectSchema.OBJECT.getName(), false, false, Hidden.DEFAULT);/*** A descriptor suitable as a default that forbids an attribute name*/AttributeSchema DEFAULT_VOID = new DefaultAttributeSchema("",- EnumerableTargetObjectSchema.VOID.getName(), false, true, true);+ PrimitiveTraceObjectSchema.VOID.getName(), false, true, Hidden.TRUE);/*** Get the name of the attribute@@ -231,9 +164,14 @@ public interface TargetObjectSchema {* <p>* This is purely a UI hint. It has no other semantic consequence.*+ * @param name the actual name of the attribute, in case this is the default attribute* @return true if hidden, false if visible*/- boolean isHidden();+ default boolean isHidden(String name) {+ return getHidden().isHidden(name);+ }++ Hidden getHidden();}/**@@ -257,9 +195,9 @@ public interface TargetObjectSchema {* Get the Java class that best represents this type.** <p>- * Note that this is either a primitive, or {@link TargetObject}. Even though an object- * implementation is necessarily a sub-type of {@link TargetObject}, for any object schema, this- * return {@link TargetObject}. Information about a "sub-type" of object is communicated via+ * Note that this is either a primitive, or {@link TraceObject}. Even though an object+ * implementation is necessarily a sub-type of {@link TraceObject}, for any object schema, this+ * return {@link TraceObject}. Information about a "sub-type" of object is communicated via* interfaces, element schemas, and attribute schemas.** @return the Java class for this type@@ -271,7 +209,7 @@ public interface TargetObjectSchema {** @return the set of required interfaces*/- Set<Class<? extends TargetObject>> getInterfaces();+ Set<Class<? extends TraceObjectInterface>> getInterfaces();/*** Check if this object is the canonical container for its elements@@ -314,7 +252,7 @@ public interface TargetObjectSchema {* @return the default named schema*/default SchemaName getDefaultElementSchema() {- return EnumerableTargetObjectSchema.OBJECT.getName();+ return PrimitiveTraceObjectSchema.OBJECT.getName();}/**@@ -332,13 +270,6 @@ public interface TargetObjectSchema {return schemaName == null ? getDefaultElementSchema() : schemaName;}- /**- * Get the re-synchronization mode for the object's elements- *- * @return the element re-synchronization mode- */- ResyncMode getElementResyncMode();-/*** Get the map of attribute names to named schemas*@@ -408,13 +339,6 @@ public interface TargetObjectSchema {return attributeSchema == null ? getDefaultAttributeSchema() : attributeSchema;}- /**- * Get the re-synchronization mode for attributes- *- * @return the attribute re-synchronization mode- */- ResyncMode getAttributeResyncMode();-/*** Get the named schema for a child having the given key*@@ -422,8 +346,8 @@ public interface TargetObjectSchema {* @return the named schema*/default SchemaName getChildSchemaName(String key) {- if (PathUtils.isIndex(key)) {- return getElementSchema(PathUtils.parseIndex(key));+ if (KeyPath.isIndex(key)) {+ return getElementSchema(KeyPath.parseIndex(key));}return getAttributeSchema(key).getSchema();}@@ -438,7 +362,7 @@ public interface TargetObjectSchema {* @param key the key* @return the schema*/- default TargetObjectSchema getChildSchema(String key) {+ default TraceObjectSchema getChildSchema(String key) {SchemaName name = getChildSchemaName(key);return getContext().getSchema(name);}@@ -449,17 +373,13 @@ public interface TargetObjectSchema {* <p>* If this is the schema of the root object, then this gives the schema of the object at the* given path in the model. This will always give a non-null result, though that result might be- * {@link EnumerableTargetObjectSchema#VOID}.+ * {@link PrimitiveTraceObjectSchema#VOID}.** @param path the relative path from an object having this schema to the desired successor* @return the schema for the successor*/- default TargetObjectSchema getSuccessorSchema(List<String> path) {- if (path.isEmpty()) {- return this;- }- TargetObjectSchema childSchema = getChildSchema(path.get(0));- return childSchema.getSuccessorSchema(path.subList(1, path.size()));+ default TraceObjectSchema getSuccessorSchema(KeyPath path) {+ return Private.getSuccessorSchema(this, path, 0);}/**@@ -479,14 +399,14 @@ public interface TargetObjectSchema {* </pre>** <p>- * All entries are non-null, though they may be {@link EnumerableTargetObjectSchema#VOID}.+ * All entries are non-null, though they may be {@link PrimitiveTraceObjectSchema#VOID}.** @param path the relative path from an object having this schema to the desired successor* @return the list of schemas traversed, ending with the successor's schema*/- default List<TargetObjectSchema> getSuccessorSchemas(List<String> path) {- List<TargetObjectSchema> result = new ArrayList<>();- TargetObjectSchema schema = this;+ default List<TraceObjectSchema> getSuccessorSchemas(KeyPath path) {+ List<TraceObjectSchema> result = new ArrayList<>();+ TraceObjectSchema schema = this;result.add(schema);for (String key : path) {schema = schema.getChildSchema(key);@@ -496,10 +416,15 @@ public interface TargetObjectSchema {}/**- * Do the same as {@link #searchFor(Class, List, boolean)} with an empty prefix+ * Do the same as {@link #searchFor(Class, KeyPath, boolean)} with an empty prefix+ *+ * @param type the sub-type of {@link TraceObjectInterface} to search for+ * @param requireCanonical only return patterns matching a canonical location for the type+ * @return a set of patterns where such objects could be found*/- default PathMatcher searchFor(Class<? extends TargetObject> type, boolean requireCanonical) {- return searchFor(type, List.of(), requireCanonical);+ default PathMatcher searchFor(Class<? extends TraceObjectInterface> type,+ boolean requireCanonical) {+ return searchFor(type, KeyPath.ROOT, requireCanonical);}/**@@ -509,14 +434,14 @@ public interface TargetObjectSchema {* Each returned path pattern accepts relative paths from an object having this schema to a* successor implementing the interface.*- * @param type the sub-type of {@link TargetObject} to search for+ * @param type the sub-type of {@link TraceObjectInterface} to search for* @param prefix the prefix for each relative path pattern* @param requireCanonical only return patterns matching a canonical location for the type* @return a set of patterns where such objects could be found*/- default PathMatcher searchFor(Class<? extends TargetObject> type, List<String> prefix,+ default PathMatcher searchFor(Class<? extends TraceObjectInterface> type, KeyPath prefix,boolean requireCanonical) {- if (type == TargetObject.class) {+ if (type == TraceObjectInterface.class) {throw new IllegalArgumentException("Must provide a specific interface");}PathMatcher result = new PathMatcher();@@ -538,9 +463,8 @@ public interface TargetObjectSchema {for (AttributeSchema as : ent.schema.getAttributeSchemas().values()) {try {SchemaName schema = as.getSchema();- TargetObjectSchema child = ctx.getSchema(schema);- expandAttribute(nextLevel, ent, child,- PathUtils.extend(ent.path, as.getName()));+ TraceObjectSchema child = ctx.getSchema(schema);+ expandAttribute(nextLevel, ent, child, ent.path.key(as.getName()));}catch (NullPointerException npe) {Msg.error(this, "Null schema for " + as);@@ -551,24 +475,23 @@ public interface TargetObjectSchema {public void expandDefaultAttribute(Set<T> nextLevel, T ent) {SchemaContext ctx = ent.schema.getContext();AttributeSchema das = ent.schema.getDefaultAttributeSchema();- TargetObjectSchema child = ctx.getSchema(das.getSchema());- expandAttribute(nextLevel, ent, child, PathUtils.extend(ent.path, das.getName()));+ TraceObjectSchema child = ctx.getSchema(das.getSchema());+ expandAttribute(nextLevel, ent, child, ent.path.key(das.getName()));}public void expandElements(Set<T> nextLevel, T ent) {SchemaContext ctx = ent.schema.getContext();for (Map.Entry<String, SchemaName> elemEnt : ent.schema.getElementSchemas().entrySet()) {- TargetObjectSchema child = ctx.getSchema(elemEnt.getValue());- expandElement(nextLevel, ent, child,- PathUtils.index(ent.path, elemEnt.getKey()));+ TraceObjectSchema child = ctx.getSchema(elemEnt.getValue());+ expandElement(nextLevel, ent, child, ent.path.index(elemEnt.getKey()));}}public void expandDefaultElement(Set<T> nextLevel, T ent) {SchemaContext ctx = ent.schema.getContext();- TargetObjectSchema child = ctx.getSchema(ent.schema.getDefaultElementSchema());- expandElement(nextLevel, ent, child, PathUtils.index(ent.path, ""));+ TraceObjectSchema child = ctx.getSchema(ent.schema.getDefaultElementSchema());+ expandElement(nextLevel, ent, child, ent.path.index(""));}public void nextLevel() {@@ -589,20 +512,20 @@ public interface TargetObjectSchema {return true;}- public void expandAttribute(Set<T> nextLevel, T ent, TargetObjectSchema schema,- List<String> path) {+ public void expandAttribute(Set<T> nextLevel, T ent, TraceObjectSchema schema,+ KeyPath path) {}- public void expandElement(Set<T> nextLevel, T ent, TargetObjectSchema schema,- List<String> path) {+ public void expandElement(Set<T> nextLevel, T ent, TraceObjectSchema schema,+ KeyPath path) {}}private static class SearchEntry {- final List<String> path;- final TargetObjectSchema schema;+ final KeyPath path;+ final TraceObjectSchema schema;- public SearchEntry(List<String> path, TargetObjectSchema schema) {+ public SearchEntry(KeyPath path, TraceObjectSchema schema) {this.path = path;this.schema = schema;}@@ -611,28 +534,28 @@ public interface TargetObjectSchema {private static class CanonicalSearchEntry extends SearchEntry {final boolean parentIsCanonical;- public CanonicalSearchEntry(List<String> path, boolean parentIsCanonical,- TargetObjectSchema schema) {+ public CanonicalSearchEntry(KeyPath path, boolean parentIsCanonical,+ TraceObjectSchema schema) {super(path, schema);this.parentIsCanonical = parentIsCanonical;}}private static class InAggregateSearch extends BreadthFirst<SearchEntry> {- final Set<TargetObjectSchema> visited = new HashSet<>();+ final Set<TraceObjectSchema> visited = new HashSet<>();- public InAggregateSearch(TargetObjectSchema seed) {- super(Set.of(new SearchEntry(List.of(), seed)));+ public InAggregateSearch(TraceObjectSchema seed) {+ super(Set.of(new SearchEntry(KeyPath.ROOT, seed)));}@Overridepublic boolean descend(SearchEntry ent) {- return ent.schema.getInterfaces().contains(TargetAggregate.class);+ return ent.schema.getInterfaces().contains(TraceObjectAggregate.class);}@Overridepublic void expandAttribute(Set<SearchEntry> nextLevel, SearchEntry ent,- TargetObjectSchema schema, List<String> path) {+ TraceObjectSchema schema, KeyPath path) {if (visited.add(schema)) {nextLevel.add(new SearchEntry(path, schema));}@@ -651,11 +574,12 @@ public interface TargetObjectSchema {}}- private static void searchFor(TargetObjectSchema sch, PathMatcher result,- List<String> prefix, boolean parentIsCanonical, Class<? extends TargetObject> type,+ private static void searchFor(TraceObjectSchema sch, PathMatcher result,+ KeyPath prefix, boolean parentIsCanonical,+ Class<? extends TraceObjectInterface> type,boolean requireAggregate, boolean requireCanonical,- Set<TargetObjectSchema> visited) {- if (sch instanceof EnumerableTargetObjectSchema) {+ Set<TraceObjectSchema> visited) {+ if (sch instanceof PrimitiveTraceObjectSchema) {return;}if (sch.getInterfaces().contains(type) && (parentIsCanonical || !requireCanonical)) {@@ -665,30 +589,30 @@ public interface TargetObjectSchema {if (!visited.add(sch)) {return;}- if (requireAggregate && !sch.getInterfaces().contains(TargetAggregate.class)) {+ if (requireAggregate && !sch.getInterfaces().contains(TraceObjectAggregate.class)) {return;}SchemaContext ctx = sch.getContext();boolean isCanonical = sch.isCanonicalContainer();for (Entry<String, SchemaName> ent : sch.getElementSchemas().entrySet()) {- List<String> extended = PathUtils.index(prefix, ent.getKey());- TargetObjectSchema elemSchema = ctx.getSchema(ent.getValue());+ KeyPath extended = prefix.index(ent.getKey());+ TraceObjectSchema elemSchema = ctx.getSchema(ent.getValue());searchFor(elemSchema, result, extended, isCanonical, type, requireAggregate,requireCanonical, visited);}- List<String> deExtended = PathUtils.extend(prefix, "[]");- TargetObjectSchema deSchema = ctx.getSchema(sch.getDefaultElementSchema());+ KeyPath deExtended = prefix.key("[]");+ TraceObjectSchema deSchema = ctx.getSchema(sch.getDefaultElementSchema());searchFor(deSchema, result, deExtended, isCanonical, type, requireAggregate,requireCanonical, visited);for (Entry<String, AttributeSchema> ent : sch.getAttributeSchemas().entrySet()) {- List<String> extended = PathUtils.extend(prefix, ent.getKey());- TargetObjectSchema attrSchema = ctx.getSchema(ent.getValue().getSchema());+ KeyPath extended = prefix.key(ent.getKey());+ TraceObjectSchema attrSchema = ctx.getSchema(ent.getValue().getSchema());searchFor(attrSchema, result, extended, isCanonical, type, requireAggregate,requireCanonical, visited);}- List<String> daExtended = PathUtils.extend(prefix, "");- TargetObjectSchema daSchema =+ KeyPath daExtended = prefix.key("");+ TraceObjectSchema daSchema =ctx.getSchema(sch.getDefaultAttributeSchema().getSchema());searchFor(daSchema, result, daExtended, isCanonical, type, requireAggregate,requireCanonical, visited);@@ -696,7 +620,7 @@ public interface TargetObjectSchema {visited.remove(sch);}- static List<String> searchForInAggregate(TargetObjectSchema seed,+ static KeyPath searchForInAggregate(TraceObjectSchema seed,Predicate<SearchEntry> predicate) {InAggregateSearch inAgg = new InAggregateSearch(seed);while (!inAgg.allOnLevel.isEmpty()) {@@ -714,27 +638,36 @@ public interface TargetObjectSchema {return null;}- static List<String> searchForSuitableInAggregate(TargetObjectSchema seed,- Class<? extends TargetObject> type) {+ static KeyPath searchForSuitableInAggregate(TraceObjectSchema seed,+ Class<? extends TraceObjectInterface> type) {return searchForInAggregate(seed, ent -> ent.schema.getInterfaces().contains(type));}- static List<String> searchForSuitableInAggregate(TargetObjectSchema seed,- TargetObjectSchema schema) {+ static KeyPath searchForSuitableInAggregate(TraceObjectSchema seed,+ TraceObjectSchema schema) {return searchForInAggregate(seed, ent -> ent.schema == schema);}- static List<String> searchForSuitableContainerInAggregate(TargetObjectSchema seed,- Class<? extends TargetObject> type) {+ static KeyPath searchForSuitableContainerInAggregate(TraceObjectSchema seed,+ Class<? extends TraceObjectInterface> type) {return searchForInAggregate(seed, ent -> {if (!ent.schema.isCanonicalContainer()) {return false;}- TargetObjectSchema deSchema =+ TraceObjectSchema deSchema =ent.schema.getContext().getSchema(ent.schema.getDefaultElementSchema());return deSchema.getInterfaces().contains(type);});}++ static TraceObjectSchema getSuccessorSchema(TraceObjectSchema schema, KeyPath path,+ int i) {+ if (i >= path.size()) {+ return schema;+ }+ TraceObjectSchema childSchema = schema.getChildSchema(path.key(i));+ return getSuccessorSchema(childSchema, path, i + 1);+ }}/**@@ -743,62 +676,63 @@ public interface TargetObjectSchema {* <p>* If more than one container is found having the shortest path, then {@code null} is returned.*- * @param type the sub-type of {@link TargetObject} to search for+ * @param type the sub-type of {@link TraceObjectInterface} to search for* @return the single path to that container*/- default List<String> searchForCanonicalContainer(Class<? extends TargetObject> type) {- if (type == TargetObject.class) {+ default KeyPath searchForCanonicalContainer(Class<? extends TraceObjectInterface> type) {+ if (type == TraceObjectInterface.class) {throw new IllegalArgumentException("Must provide a specific interface");}SchemaContext ctx = getContext();- Set<TargetObjectSchema> visited = new HashSet<>();- Set<TargetObjectSchema> visitedAsElement = new HashSet<>();+ Set<TraceObjectSchema> visited = new HashSet<>();+ Set<TraceObjectSchema> visitedAsElement = new HashSet<>();Set<Private.CanonicalSearchEntry> allOnLevel = new HashSet<>();- allOnLevel.add(new Private.CanonicalSearchEntry(List.of(), false, this));+ allOnLevel.add(new Private.CanonicalSearchEntry(KeyPath.ROOT, false, this));while (!allOnLevel.isEmpty()) {- List<String> found = null;+ KeyPath found = null;for (Private.CanonicalSearchEntry ent : allOnLevel) {if (ent.schema.getInterfaces().contains(type) && ent.parentIsCanonical) {// Check for final being index is in parentIsCanonical.if (found != null) {return null; // Non-unique answer}- found = PathUtils.parent(ent.path);+ found = ent.path.parent();}}if (found != null) {- return List.copyOf(found); // Unique shortest answer+ return found; // Unique shortest answer}Set<Private.CanonicalSearchEntry> nextLevel = new HashSet<>();for (Private.CanonicalSearchEntry ent : allOnLevel) {- if (PathPattern.isWildcard(PathUtils.getKey(ent.path))) {+ if (PathPattern.isWildcard(ent.path.key())) {continue;}for (Map.Entry<String, AttributeSchema> attrEnt : ent.schema.getAttributeSchemas().entrySet()) {- TargetObjectSchema attrSchema = ctx.getSchema(attrEnt.getValue().getSchema());- if (TargetObject.class.isAssignableFrom(attrSchema.getType()) &&+ TraceObjectSchema attrSchema = ctx.getSchema(attrEnt.getValue().getSchema());+ if (TraceObjectInterface.class.isAssignableFrom(attrSchema.getType()) &&visited.add(attrSchema)) {nextLevel.add(new Private.CanonicalSearchEntry(- PathUtils.extend(ent.path, attrEnt.getKey()), false, // If child is not element, this is not is canonical container- attrSchema));+ ent.path.key(attrEnt.getKey()),+ // If child is not element, this is not its canonical container+ false, attrSchema));}}for (Map.Entry<String, SchemaName> elemEnt : ent.schema.getElementSchemas().entrySet()) {- TargetObjectSchema elemSchema = ctx.getSchema(elemEnt.getValue());+ TraceObjectSchema elemSchema = ctx.getSchema(elemEnt.getValue());visited.add(elemSchema); // Add but do not conditionif (visitedAsElement.add(elemSchema)) {nextLevel.add(new Private.CanonicalSearchEntry(- PathUtils.index(ent.path, elemEnt.getKey()),+ ent.path.index(elemEnt.getKey()),ent.schema.isCanonicalContainer(), elemSchema));}}- TargetObjectSchema deSchema = ctx.getSchema(ent.schema.getDefaultElementSchema());+ TraceObjectSchema deSchema = ctx.getSchema(ent.schema.getDefaultElementSchema());visited.add(deSchema);if (visitedAsElement.add(deSchema)) {- nextLevel.add(new Private.CanonicalSearchEntry(PathUtils.index(ent.path, ""),+ nextLevel.add(new Private.CanonicalSearchEntry(ent.path.index(""),ent.schema.isCanonicalContainer(), deSchema));}}@@ -815,16 +749,16 @@ public interface TargetObjectSchema {* @param path the path of a seed object* @return the expected path of the suitable object, or null*/- default List<String> searchForSuitable(Class<? extends TargetObject> type, List<String> path) {- List<TargetObjectSchema> schemas = getSuccessorSchemas(path);- for (; path != null; path = PathUtils.parent(path)) {- TargetObjectSchema schema = schemas.get(path.size());+ default KeyPath searchForSuitable(Class<? extends TraceObjectInterface> type, KeyPath path) {+ List<TraceObjectSchema> schemas = getSuccessorSchemas(path);+ for (; path != null; path = path.parent()) {+ TraceObjectSchema schema = schemas.get(path.size());if (schema.getInterfaces().contains(type)) {return path;}- List<String> inAgg = Private.searchForSuitableInAggregate(schema, type);+ KeyPath inAgg = Private.searchForSuitableInAggregate(schema, type);if (inAgg != null) {- return PathUtils.extend(path, inAgg);+ return path.extend(inAgg);}}return null;@@ -837,16 +771,16 @@ public interface TargetObjectSchema {* @param path the path of a seed object* @return the expected path of the suitable object, or null*/- default List<String> searchForSuitable(TargetObjectSchema schema, List<String> path) {- List<TargetObjectSchema> schemas = getSuccessorSchemas(path);- for (; path != null; path = PathUtils.parent(path)) {- TargetObjectSchema check = schemas.get(path.size());+ default KeyPath searchForSuitable(TraceObjectSchema schema, KeyPath path) {+ List<TraceObjectSchema> schemas = getSuccessorSchemas(path);+ for (; path != null; path = path.parent()) {+ TraceObjectSchema check = schemas.get(path.size());if (check == schema) {return path;}- List<String> inAgg = Private.searchForSuitableInAggregate(check, schema);+ KeyPath inAgg = Private.searchForSuitableInAggregate(check, schema);if (inAgg != null) {- return PathUtils.extend(path, inAgg);+ return path.extend(inAgg);}}return null;@@ -856,51 +790,50 @@ public interface TargetObjectSchema {* Search for all suitable objects with this schema at the given path** <p>- * This behaves like {@link #searchForSuitable(Class, List)}, except that it returns a matcher- * for all possibilities. Conventionally, when the client uses the matcher to find suitable- * objects and must choose from among the results, those having the longer paths should be- * preferred. More specifically, it should prefer those sharing the longer path prefixes with+ * This behaves like {@link #searchForSuitable(Class, KeyPath)}, except that it returns a+ * matcher for all possibilities. Conventionally, when the client uses the matcher to find+ * suitable objects and must choose from among the results, those having the longer paths should+ * be preferred. More specifically, it should prefer those sharing the longer path prefixes with* the given path. The client should <em>not</em> just take the first objects, since these will* likely have the shortest paths. If exactly one object is required, consider using- * {@link #searchForSuitable(Class, List)} instead.+ * {@link #searchForSuitable(Class, KeyPath)} instead.** @param type* @param path- * @return the predicates for finding objects+ * @return the filter for finding objects*/- default PathPredicates matcherForSuitable(Class<? extends TargetObject> type,- List<String> path) {+ default PathFilter filterForSuitable(Class<? extends TraceObjectInterface> type, KeyPath path) {PathMatcher result = new PathMatcher();- Set<TargetObjectSchema> visited = new HashSet<>();- List<TargetObjectSchema> schemas = getSuccessorSchemas(path);- for (; path != null; path = PathUtils.parent(path)) {- TargetObjectSchema schema = schemas.get(path.size());+ Set<TraceObjectSchema> visited = new HashSet<>();+ List<TraceObjectSchema> schemas = getSuccessorSchemas(path);+ for (; path != null; path = path.parent()) {+ TraceObjectSchema schema = schemas.get(path.size());Private.searchFor(schema, result, path, false, type, true, false, visited);}return result;}/**- * Like {@link #searchForSuitable(Class, List)}, but searches for the canonical container whose- * elements have the given type+ * Like {@link #searchForSuitable(Class, KeyPath)}, but searches for the canonical container+ * whose elements have the given type** @param type the type of object sought* @param path the path of a seed object* @return the expected path of the suitable container of those objects, or null*/- default List<String> searchForSuitableContainer(Class<? extends TargetObject> type,- List<String> path) {- List<TargetObjectSchema> schemas = getSuccessorSchemas(path);- for (; path != null; path = PathUtils.parent(path)) {- TargetObjectSchema schema = schemas.get(path.size());- TargetObjectSchema deSchema =+ default KeyPath searchForSuitableContainer(Class<? extends TraceObjectInterface> type,+ KeyPath path) {+ List<TraceObjectSchema> schemas = getSuccessorSchemas(path);+ for (; path != null; path = path.parent()) {+ TraceObjectSchema schema = schemas.get(path.size());+ TraceObjectSchema deSchema =schema.getContext().getSchema(schema.getDefaultElementSchema());if (deSchema.getInterfaces().contains(type) && schema.isCanonicalContainer()) {return path;}- List<String> inAgg = Private.searchForSuitableContainerInAggregate(schema, type);+ KeyPath inAgg = Private.searchForSuitableContainerInAggregate(schema, type);if (inAgg != null) {- return PathUtils.extend(path, inAgg);+ return path.extend(inAgg);}}return null;@@ -917,9 +850,9 @@ public interface TargetObjectSchema {* @param path the seed path* @return the found path, or {@code null} if no ancestor implements the interface*/- default List<String> searchForAncestor(Class<? extends TargetObject> type, List<String> path) {- for (; path != null; path = PathUtils.parent(path)) {- TargetObjectSchema schema = getSuccessorSchema(path);+ default KeyPath searchForAncestor(Class<? extends TraceObjectInterface> type, KeyPath path) {+ for (; path != null; path = path.parent()) {+ TraceObjectSchema schema = getSuccessorSchema(path);if (schema.getInterfaces().contains(type)) {return path;}@@ -937,14 +870,14 @@ public interface TargetObjectSchema {* @param path the seed path* @return the found path, or {@code null} if no such ancestor was found*/- default List<String> searchForAncestorContainer(Class<? extends TargetObject> type,- List<String> path) {- for (; path != null; path = PathUtils.parent(path)) {- TargetObjectSchema schema = getSuccessorSchema(path);+ default KeyPath searchForAncestorContainer(Class<? extends TraceObjectInterface> type,+ KeyPath path) {+ for (; path != null; path = path.parent()) {+ TraceObjectSchema schema = getSuccessorSchema(path);if (!schema.isCanonicalContainer()) {continue;}- TargetObjectSchema deSchema =+ TraceObjectSchema deSchema =schema.getContext().getSchema(schema.getDefaultElementSchema());if (deSchema.getInterfaces().contains(type)) {return path;@@ -957,29 +890,17 @@ public interface TargetObjectSchema {* Check if the given key should be hidden for an object having this schema** <p>- * Elements ought never to be hidden. Otherwise, this defers to the attribute schema. As a- * special case, if the attribute schema is {@link AttributeSchema#DEFAULT_ANY} or- * {@link AttributeSchema#DEFAULT_OBJECT}, then it checks if the attribute starts with- * {@link TargetObject#PREFIX_INVISIBLE}. That convention is deprecated, and no new code should- * rely on that prefix. The special case provides a transition point for client-side code that- * would like to use the schema's definition for controlling visibility, but still support- * models which have not implemented schemas.+ * Elements ought never to be hidden. Otherwise, this defers to the attribute schema.** @param key the child key to check* @return true if hidden*/default boolean isHidden(String key) {- if (PathUtils.isIndex(key)) {+ if (KeyPath.isIndex(key)) {return false;}AttributeSchema schema = getAttributeSchema(key);- if (schema == AttributeSchema.DEFAULT_ANY ||- schema == AttributeSchema.DEFAULT_OBJECT ||- schema == AttributeSchema.DEFAULT_VOID) {- // FIXME: Remove this hack once we stop depending on this prefix- return key.startsWith(TargetObject.PREFIX_INVISIBLE);- }- return schema.isHidden();+ return schema.isHidden(key);}/**@@ -991,12 +912,11 @@ public interface TargetObjectSchema {* @param key the key that is being assigned* @param strict true to throw an exception upon violation; false to just log and continue*/- default void validateTypeAndInterfaces(Object value, List<String> parentPath, String key,+ default void validateTypeAndInterfaces(Object value, KeyPath parentPath, String key,boolean strict) {Class<?> cls = value.getClass();if (!getType().isAssignableFrom(cls)) {- String path =- key == null ? null : PathUtils.toString(PathUtils.extend(parentPath, key));+ String path = key == null ? null : parentPath.key(key).toString();String msg = path == null? "Value " + value + " does not conform to required type " + getType() +" of schema " + this@@ -1007,7 +927,7 @@ public interface TargetObjectSchema {throw new AssertionError(msg);}}- for (Class<? extends TargetObject> iface : getInterfaces()) {+ for (Class<? extends TraceObjectInterface> iface : getInterfaces()) {if (!iface.isAssignableFrom(cls)) {// TODO: Should this throw an exception, eventually?String msg = "Value " + value + " does not implement required interface " + iface +@@ -1024,20 +944,25 @@ public interface TargetObjectSchema {* Verify that all required attributes are present** <p>- * Note: this should be called not at construction, but when the object is actually added to the- * model, e.g., when it appears in the "added" set of- * {@link DefaultTargetObject#setAttributes(Map, String)} called on its parent.+ * NOTE: This may become part of a schema and/or connector tester/validator later.+ *+ * @param object the object whose schema is this one+ * @param strict to throw exceptions upon violations+ * @param snap the relevant snapshot*/- default void validateRequiredAttributes(TargetObject object, boolean strict) {- Set<String> present = object.getCachedAttributes().keySet();- Set<String> missing = getAttributeSchemas().values()+ default void validateRequiredAttributes(TraceObject object, boolean strict, long snap) {+ Set<String> present = object.getAttributes(Lifespan.at(snap))+ .stream()+ .map(a -> a.getEntryKey())+ .collect(Collectors.toUnmodifiableSet());+ Set<String> absent = getAttributeSchemas().values().stream().filter(AttributeSchema::isRequired).map(AttributeSchema::getName).filter(a -> !present.contains(a)).collect(Collectors.toSet());- if (!missing.isEmpty()) {- String msg = "Object " + object + " is missing required attributes " + missing ++ if (!absent.isEmpty()) {+ String msg = "Object " + object + " is missing required attributes " + absent +" of schema " + this;Msg.error(this, msg);if (strict) {@@ -1046,85 +971,6 @@ public interface TargetObjectSchema {}}- /**- * Verify that the given change does not cause a violation of the attribute schema- *- * <p>- * For attributes, there are multiple possibilities of violation:- * </p>- *- * <ul>- * <li>The type of an added attribute does not conform</li>- * <li>A required attribute is removed</li>- * <li>A fixed attribute is changed</li>- * </ul>- *- * @param delta the delta, before or after the fact- */- default void validateAttributeDelta(List<String> parentPath, Delta<?, ?> delta,- boolean strict) {- for (Map.Entry<String, ?> ent : delta.added.entrySet()) {- String key = ent.getKey();- Object value = ent.getValue();- AttributeSchema as = getAttributeSchema(key);- TargetObjectSchema schema = getContext().getSchema(as.getSchema());- schema.validateTypeAndInterfaces(value, parentPath, key, strict);- }-- // TODO: Creating these sets *every* change could be costly- // NB. "keysRemoved" does not include changed things, just removed- Set<String> violatesRequired = getAttributeSchemas().values()- .stream()- .filter(AttributeSchema::isRequired)- .map(AttributeSchema::getName)- .filter(delta.getKeysRemoved()::contains)- .collect(Collectors.toSet());- if (!violatesRequired.isEmpty()) {- String msg = "Object " + parentPath + " removed required attributes " +- violatesRequired + " of schema " + this;- Msg.error(this, msg);- if (strict) {- throw new AssertionError(msg);- }- }- // TODO: Another set....- // NB. "removed" includes changed things- // NB. I don't care about "new" attributes, since those don't violate "fixed"- // TODO: Should "new, fixed" attributes be allowed after the object enters the model- Set<String> violatesFixed = getAttributeSchemas().values()- .stream()- .filter(AttributeSchema::isFixed)- .map(AttributeSchema::getName)- .filter(delta.removed::containsKey)- .collect(Collectors.toSet());- if (!violatesFixed.isEmpty()) {- String msg = "Object " + parentPath + " modified or removed fixed attributes " +- violatesFixed + " of schema " + this;- Msg.error(this, msg);- if (strict) {- throw new AssertionError(msg);- }- }- }-- /**- * Verify that the given change does not cause a violation of the element schema- *- * <p>- * For elements, we can only check whether the type conforms. Important within that, however, is- * that we verify the elements all have their required attributes.- *- * @param delta the delta, before or after the fact- */- default void validateElementDelta(List<String> parentPath,- Delta<?, ? extends TargetObject> delta, boolean strict) {- for (Map.Entry<String, ? extends TargetObject> ent : delta.added.entrySet()) {- TargetObject element = ent.getValue();- TargetObjectSchema schema = getContext().getSchema(getElementSchema(ent.getKey()));- schema.validateTypeAndInterfaces(element, parentPath, ent.getKey(), strict);- }- }-/*** Search for a suitable register container*@@ -1152,36 +998,38 @@ public interface TargetObjectSchema {** <p>* This places some conventional restrictions / expectations on models where registers are given- * on a frame-by-frame basis. The schema should present the {@link TargetRegisterContainer} as- * the same object or a successor to {@link TargetStackFrame}, which must in turn be a successor- * to {@link TargetStack}. The frame level (an index) must be in the path from stack to frame.- * There can be no wild cards between the frame and the register container. For example, the- * container for {@code Threads[1]} may be {@code Threads[1].Stack[n].Registers}, where- * {@code n} is the frame level. {@code Threads[1].Stack} would have the {@link TargetStack}- * interface, {@code Threads[1].Stack[0]} would have the {@link TargetStackFrame} interface, and- * {@code Threads[1].Stack[0].Registers} would have the {@link TargetRegisterContainer}- * interface. Note it is not sufficient for {@link TargetRegisterContainer} to be a successor of- * {@link TargetStack} with a single index between. There <em>must</em> be an intervening- * {@link TargetStackFrame}, and the frame level (index) must precede it.+ * on a frame-by-frame basis. The schema should present the {@link TraceObjectRegisterContainer}+ * as the same object or a successor to {@link TraceObjectStackFrame}, which must in turn be a+ * successor to {@link TraceObjectStack}. The frame level (an index) must be in the path from+ * stack to frame. There can be no wildcards between the frame and the register container. For+ * example, the container for {@code Threads[1]} may be {@code Threads[1].Stack[n].Registers},+ * where {@code n} is the frame level. {@code Threads[1].Stack} would have the+ * {@link TraceObjectStack} interface, {@code Threads[1].Stack[0]} would have the+ * {@link TraceObjectStackFrame} interface, and {@code Threads[1].Stack[0].Registers} would have+ * the {@link TraceObjectRegisterContainer} interface. Note it is not sufficient for+ * {@link TraceObjectRegisterContainer} to be a successor of {@link TraceObjectStack} with a+ * single index between. There <em>must</em> be an intervening {@link TraceObjectStackFrame},+ * and the frame level (index) must precede it.** @param frameLevel the frame level. May be ignored if not applicable* @param path the path of the seed object relative to the root- * @return the predicates where the register container should be found, possibly empty+ * @return the filter where the register container should be found, possibly+ * {@link PathFilter#NONE}*/- default PathPredicates searchForRegisterContainer(int frameLevel, List<String> path) {- List<String> simple = searchForSuitable(TargetRegisterContainer.class, path);+ default PathFilter searchForRegisterContainer(int frameLevel, KeyPath path) {+ KeyPath simple = searchForSuitable(TraceObjectRegisterContainer.class, path);if (simple != null) {- return PathPredicates.pattern(simple);+ return PathFilter.pattern(simple);}- List<String> stackPath = searchForSuitable(TargetStack.class, path);+ KeyPath stackPath = searchForSuitable(TraceObjectStack.class, path);if (stackPath == null) {- return PathPredicates.EMPTY;+ return PathFilter.NONE;}PathPattern framePatternRelStack =- getSuccessorSchema(stackPath).searchFor(TargetStackFrame.class, false)+ getSuccessorSchema(stackPath).searchFor(TraceObjectStackFrame.class, false).getSingletonPattern();if (framePatternRelStack == null) {- return PathPredicates.EMPTY;+ return PathFilter.NONE;}if (framePatternRelStack.countWildcards() != 1) {@@ -1191,11 +1039,10 @@ public interface TargetObjectSchema {PathMatcher result = new PathMatcher();for (String index : List.of(Integer.toString(frameLevel),"0x" + Integer.toHexString(frameLevel))) {- List<String> framePathRelStack =+ KeyPath framePathRelStack =framePatternRelStack.applyKeys(index).getSingletonPath();- List<String> framePath = PathUtils.extend(stackPath, framePathRelStack);- List<String> regsPath =- searchForSuitable(TargetRegisterContainer.class, framePath);+ KeyPath framePath = stackPath.extend(framePathRelStack);+ KeyPath regsPath = searchForSuitable(TraceObjectRegisterContainer.class, framePath);if (regsPath != null) {result.addPattern(regsPath);}@@ -1207,11 +1054,11 @@ public interface TargetObjectSchema {* Compute the frame level of the object at the given path relative to this schema** <p>- * If there is no {@link TargetStackFrame} in the path, this will return 0 since it is not+ * If there is no {@link TraceObjectStackFrame} in the path, this will return 0 since it is not* applicable to the object. If there is a stack frame in the path, this will examine its- * ancestry, up to and excluding the {@link TargetStack} for an index. If there isn't a stack in- * the path, it is assumed to be an ancestor of this schema, meaning the examination will- * exhaust the ancestry provided in the path. If no index is found, an exception is thrown,+ * ancestry, up to and excluding the {@link TraceObjectStack} for an index. If there isn't a+ * stack in the path, it is assumed to be an ancestor of this schema, meaning the examination+ * will exhaust the ancestry provided in the path. If no index is found, an exception is thrown,* because the frame level is applicable, but couldn't be computed from the path given. In that* case, the client should include more ancestry in the path. Ideally, this is invoked relative* to the root schema.@@ -1220,16 +1067,16 @@ public interface TargetObjectSchema {* @return the frame level, or 0 if not applicable* @throws IllegalArgumentException if frame level is applicable but not given in the path*/- default int computeFrameLevel(List<String> path) {- List<String> framePath = searchForAncestor(TargetStackFrame.class, path);+ default int computeFrameLevel(KeyPath path) {+ KeyPath framePath = searchForAncestor(TraceObjectStackFrame.class, path);if (framePath == null) {return 0;}- List<String> stackPath = searchForAncestor(TargetStack.class, framePath);+ KeyPath stackPath = searchForAncestor(TraceObjectStack.class, framePath);for (int i = stackPath == null ? 0 : stackPath.size(); i < framePath.size(); i++) {- String key = framePath.get(i);- if (PathUtils.isIndex(key)) {- return Integer.decode(PathUtils.parseIndex(key));+ String key = framePath.key(i);+ if (KeyPath.isIndex(key)) {+ return Integer.decode(KeyPath.parseIndex(key));}}throw new IllegalArgumentException("No index between stack and frame");@@ -1240,14 +1087,13 @@ public interface TargetObjectSchema {** <p>* This works analogously to {@link Class#isAssignableFrom(Class)}, except that schemas are- * quite a bit less flexible. Only {@link EnumerableTargetObjectSchema#ANY} and- * {@link EnumerableTargetObjectSchema#OBJECT} can accept anything other than exactly- * themselves.+ * quite a bit less flexible. Only {@link PrimitiveTraceObjectSchema#ANY} and+ * {@link PrimitiveTraceObjectSchema#OBJECT} can accept anything other than exactly themselves.** @param that* @return true if an object of that schema can be assigned to this schema.*/- default boolean isAssignableFrom(TargetObjectSchema that) {+ default boolean isAssignableFrom(TraceObjectSchema that) {return this.equals(that);}}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/XmlSchemaContext.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/XmlSchemaContext.javasimilarity index 74%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/XmlSchemaContext.javarename to Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/XmlSchemaContext.javaindex cdd40b4fb9..8dce5fa5c9 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/XmlSchemaContext.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/schema/XmlSchemaContext.java@@ -5,7 +5,7 @@* you may not use this file except in compliance with the License.* You may obtain a copy of the License at*- * http://www.apache.org/licenses/LICENSE-2.0+ * http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,@@ -13,7 +13,7 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.target.schema;+package ghidra.trace.model.target.schema;import java.io.*;import java.util.*;@@ -21,24 +21,22 @@ import java.util.*;import org.jdom.*;import org.jdom.input.SAXBuilder;-import ghidra.dbg.DebuggerObjectModel;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.schema.DefaultTargetObjectSchema.DefaultAttributeSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.*;+import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInterfaceFactory.Constructor;+import ghidra.trace.model.target.info.TraceObjectInterfaceUtils;+import ghidra.trace.model.target.schema.DefaultTraceObjectSchema.DefaultAttributeSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.*;import ghidra.util.Msg;import ghidra.util.xml.XmlUtilities;/**- * @deprecated This will be moved/refactored into trace database. In general, it will still exist,- * but things depending on it are now back on shifting sand.+ * A {@link SchemaContext} decoded from XML.*/-@Deprecated(since = "11.2")public class XmlSchemaContext extends DefaultSchemaContext {protected static final String ELEM_CONTEXT = "context";protected static final String ATTR_CANONICAL = "canonical";protected static final String ELEM_SCHEMA = "schema";- protected static final String ATTR_ELEMENT_RESYNC = "elementResync";- protected static final String ATTR_ATTRIBUTE_RESYNC = "attributeResync";protected static final String ELEM_INTERFACE = "interface";protected static final String ELEM_ELEMENT = "element";protected static final String ATTR_INDEX = "index";@@ -52,10 +50,24 @@ public class XmlSchemaContext extends DefaultSchemaContext {protected static final String ATTR_FROM = "from";protected static final String ATTR_TO = "to";protected static final String YES = "yes";+ protected static final String NO = "no";+ protected static final String DEFAULT = "default";protected static final Set<String> TRUES = Set.of("true", YES, "y", "1");+ protected static final Set<String> FALSES = Set.of("false", NO, "n", "0");protected static boolean parseBoolean(Element ele, String attrName) {- return TRUES.contains(ele.getAttributeValue(attrName, "no").toLowerCase());+ return TRUES.contains(ele.getAttributeValue(attrName, NO).toLowerCase());+ }++ protected static Hidden parseHidden(Element ele, String attrName) {+ String value = ele.getAttributeValue(attrName, DEFAULT).toLowerCase();+ if (TRUES.contains(value)) {+ return Hidden.TRUE;+ }+ if (FALSES.contains(value)) {+ return Hidden.FALSE;+ }+ return Hidden.DEFAULT;}public static String serialize(SchemaContext ctx) {@@ -64,7 +76,7 @@ public class XmlSchemaContext extends DefaultSchemaContext {public static Element contextToXml(SchemaContext ctx) {Element result = new Element(ELEM_CONTEXT);- for (TargetObjectSchema schema : ctx.getAllSchemas()) {+ for (TraceObjectSchema schema : ctx.getAllSchemas()) {Element schemaElem = schemaToXml(schema);if (schemaElem != null) {result.addContent(schemaElem);@@ -75,7 +87,7 @@ public class XmlSchemaContext extends DefaultSchemaContext {public static Element attributeSchemaToXml(AttributeSchema as) {Element attrElem = new Element(ELEM_ATTRIBUTE);- if (!as.getName().equals("")) {+ if (!as.getName().isEmpty()) {XmlUtilities.setStringAttr(attrElem, ATTR_NAME, as.getName());}XmlUtilities.setStringAttr(attrElem, ATTR_SCHEMA, as.getSchema().toString());@@ -85,8 +97,15 @@ public class XmlSchemaContext extends DefaultSchemaContext {if (as.isFixed()) {XmlUtilities.setStringAttr(attrElem, ATTR_FIXED, YES);}- if (as.isHidden()) {- XmlUtilities.setStringAttr(attrElem, ATTR_HIDDEN, YES);+ switch (as.getHidden()) {+ case TRUE -> XmlUtilities.setStringAttr(attrElem, ATTR_HIDDEN, YES);+ case FALSE -> {+ if (as.getName().isEmpty()) {+ XmlUtilities.setStringAttr(attrElem, ATTR_HIDDEN, NO);+ }+ }+ case DEFAULT -> {+ }}return attrElem;}@@ -98,30 +117,26 @@ public class XmlSchemaContext extends DefaultSchemaContext {return aliasElem;}- public static Element schemaToXml(TargetObjectSchema schema) {- if (!TargetObject.class.isAssignableFrom(schema.getType())) {+ public static Element schemaToXml(TraceObjectSchema schema) {+ if (!TraceObject.class.isAssignableFrom(schema.getType())) {return null;}- if (schema == EnumerableTargetObjectSchema.OBJECT) {+ if (schema == PrimitiveTraceObjectSchema.OBJECT) {return null;}Element result = new Element(ELEM_SCHEMA);XmlUtilities.setStringAttr(result, ATTR_NAME, schema.getName().toString());- for (Class<? extends TargetObject> iface : schema.getInterfaces()) {+ for (Class<? extends TraceObjectInterface> iface : schema.getInterfaces()) {Element ifElem = new Element(ELEM_INTERFACE);XmlUtilities.setStringAttr(ifElem, ATTR_NAME,- DebuggerObjectModel.requireIfaceName(iface));+ TraceObjectInterfaceUtils.getSchemaName(iface));result.addContent(ifElem);}if (schema.isCanonicalContainer()) {XmlUtilities.setStringAttr(result, ATTR_CANONICAL, YES);}- XmlUtilities.setStringAttr(result, ATTR_ELEMENT_RESYNC,- schema.getElementResyncMode().name());- XmlUtilities.setStringAttr(result, ATTR_ATTRIBUTE_RESYNC,- schema.getAttributeResyncMode().name());for (Map.Entry<String, SchemaName> ent : schema.getElementSchemas().entrySet()) {Element elemElem = new Element(ELEM_ELEMENT);@@ -129,10 +144,12 @@ public class XmlSchemaContext extends DefaultSchemaContext {XmlUtilities.setStringAttr(elemElem, ATTR_SCHEMA, ent.getValue().toString());result.addContent(elemElem);}- Element deElem = new Element(ELEM_ELEMENT);- XmlUtilities.setStringAttr(deElem, ATTR_SCHEMA,- schema.getDefaultElementSchema().toString());- result.addContent(deElem);+ SchemaName des = schema.getDefaultElementSchema();+ if (!Objects.equals(des, SchemaBuilder.DEFAULT_ELEMENT_SCHEMA)) {+ Element deElem = new Element(ELEM_ELEMENT);+ XmlUtilities.setStringAttr(deElem, ATTR_SCHEMA, des.toString());+ result.addContent(deElem);+ }for (Map.Entry<String, AttributeSchema> ent : schema.getAttributeSchemas().entrySet()) {AttributeSchema as = ent.getValue();@@ -144,8 +161,10 @@ public class XmlSchemaContext extends DefaultSchemaContext {result.addContent(attrElem);}AttributeSchema das = schema.getDefaultAttributeSchema();- Element daElem = attributeSchemaToXml(das);- result.addContent(daElem);+ if (!Objects.equals(das, SchemaBuilder.DEFAULT_ATTRIBUTE_SCHEMA)) {+ Element daElem = attributeSchemaToXml(das);+ result.addContent(daElem);+ }// Yes, these will be the "resolved" aliases, but I think that's okay.for (Map.Entry<String, String> alias : schema.getAttributeAliases().entrySet()) {@@ -202,25 +221,22 @@ public class XmlSchemaContext extends DefaultSchemaContext {return value;}- public TargetObjectSchema schemaFromXml(Element schemaElem) {+ public TraceObjectSchema schemaFromXml(Element schemaElem) {SchemaBuilder builder = builder(name(schemaElem.getAttributeValue(ATTR_NAME, "")));+ Map<String, Constructor<?>> ctors = TraceObjectInterfaceUtils.getConstructorsByName();for (Element ifaceElem : XmlUtilities.getChildren(schemaElem, ELEM_INTERFACE)) {String ifaceName = requireAttributeValue(ifaceElem, ATTR_NAME);- Class<? extends TargetObject> iface = TargetObject.INTERFACES_BY_NAME.get(ifaceName);- if (iface == null) {+ Constructor<?> c = ctors.get(ifaceName);+ if (c == null) {Msg.warn(this, "Unknown interface name: '" + ifaceName + "'");}else {- builder.addInterface(iface);+ builder.addInterface(c.iface());}}builder.setCanonicalContainer(parseBoolean(schemaElem, ATTR_CANONICAL));- builder.setElementResyncMode(ResyncMode.valueOf(- schemaElem.getAttributeValue(ATTR_ELEMENT_RESYNC, ResyncMode.NEVER.name())));- builder.setAttributeResyncMode(ResyncMode.valueOf(- schemaElem.getAttributeValue(ATTR_ATTRIBUTE_RESYNC, ResyncMode.NEVER.name())));for (Element elemElem : XmlUtilities.getChildren(schemaElem, ELEM_ELEMENT)) {SchemaName schema = name(requireAttributeValue(elemElem, ATTR_SCHEMA));@@ -232,7 +248,7 @@ public class XmlSchemaContext extends DefaultSchemaContext {SchemaName schema = name(requireAttributeValue(attrElem, ATTR_SCHEMA));boolean required = parseBoolean(attrElem, ATTR_REQUIRED);boolean fixed = parseBoolean(attrElem, ATTR_FIXED);- boolean hidden = parseBoolean(attrElem, ATTR_HIDDEN);+ Hidden hidden = parseHidden(attrElem, ATTR_HIDDEN);String name = attrElem.getAttributeValue(ATTR_NAME, "");builder.addAttributeSchema(diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/thread/TraceObjectProcess.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/thread/TraceObjectProcess.javanew file mode 100644index 0000000000..a929f412ca--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/thread/TraceObjectProcess.java@@ -0,0 +1,41 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.thread;++import ghidra.trace.model.TraceExecutionState;+import ghidra.trace.model.target.iface.TraceObjectExecutionStateful;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;++/**+ * A marker interface which indicates a process, usually on a host operating system+ *+ * <p>+ * If this object does not support {@link TraceObjectExecutionStateful}, then its mere existence in+ * the model implies that it is {@link TraceExecutionState#ALIVE}. TODO: Should allow association+ * via convention to a different {@link TraceObjectExecutionStateful}, but that may have to wait+ * until schemas are introduced.+ */+@TraceObjectInfo(+ schemaName = "Process",+ shortName = "process",+ attributes = {+ TraceObjectProcess.KEY_PID,+ },+ fixedKeys = {})+public interface TraceObjectProcess extends TraceObjectInterface {+ String KEY_PID = "_pid";+}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/thread/TraceObjectThread.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/thread/TraceObjectThread.javaindex 70e986549c..625ff91bdd 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/thread/TraceObjectThread.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/thread/TraceObjectThread.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,21 +15,30 @@*/package ghidra.trace.model.thread;-import ghidra.dbg.target.TargetObject;-import ghidra.dbg.target.TargetThread;import ghidra.trace.model.Lifespan;-import ghidra.trace.model.target.TraceObjectInterface;-import ghidra.trace.model.target.annot.TraceObjectInfo;+import ghidra.trace.model.target.iface.TraceObjectExecutionStateful;+import ghidra.trace.model.target.iface.TraceObjectInterface;+import ghidra.trace.model.target.info.TraceObjectInfo;+/**+ * A marker interface which indicates a thread, usually within a process+ *+ * <p>+ * This object must be associated with a suitable {@link TraceObjectExecutionStateful}. In most+ * cases, the object should just implement it.+ */@TraceObjectInfo(- targetIf = TargetThread.class,+ schemaName = "Thread",shortName = "thread",+ attributes = {+ TraceObjectThread.KEY_TID,+ },fixedKeys = {- TargetObject.DISPLAY_ATTRIBUTE_NAME,- TraceObjectThread.KEY_COMMENT+ TraceObjectInterface.KEY_DISPLAY,+ TraceObjectInterface.KEY_COMMENT,})public interface TraceObjectThread extends TraceThread, TraceObjectInterface {- String KEY_COMMENT = "_comment";+ String KEY_TID = "_tid";void setName(Lifespan lifespan, String name);}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/XmlTargetObjectSchemaTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/dbg/target/schema/XmlTargetObjectSchemaTest.javasimilarity index 66%rename from Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/XmlTargetObjectSchemaTest.javarename to Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/dbg/target/schema/XmlTargetObjectSchemaTest.javaindex 21ff1a2f9b..89f0fe0edc 100644--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/target/schema/XmlTargetObjectSchemaTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/dbg/target/schema/XmlTargetObjectSchemaTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -22,28 +22,25 @@ import java.io.IOException;import org.jdom.JDOMException;import org.junit.Test;-import ghidra.dbg.target.TargetInterpreter;-import ghidra.dbg.target.TargetProcess;-import ghidra.dbg.target.schema.DefaultTargetObjectSchema.DefaultAttributeSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.*;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.DefaultTraceObjectSchema.DefaultAttributeSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.*;+import ghidra.trace.model.thread.TraceObjectProcess;public class XmlTargetObjectSchemaTest {protected static final String SCHEMA_XML =// Do not line-wrap or serialize test will fail"""<context>- <schema name="root" canonical="yes" elementResync="NEVER" attributeResync="ONCE">+ <schema name="root" canonical="yes"><interface name="Process" />- <interface name="Interpreter" /><element index="reserved" schema="VOID" /><element schema="down1" /><attribute name="some_int" schema="INT" /><attribute name="some_object" schema="OBJECT" required="yes" fixed="yes" hidden="yes" />- <attribute schema="ANY" hidden="yes" /><attribute-alias from="_int" to="some_int" /></schema>- <schema name="down1" elementResync="ALWAYS" attributeResync="ALWAYS">- <element schema="OBJECT" />+ <schema name="down1"><attribute schema="VOID" fixed="yes" hidden="yes" /></schema></context>"""; // Cannot have final final new-line or serialize test will fail@@ -51,24 +48,19 @@ public class XmlTargetObjectSchemaTest {protected static final DefaultSchemaContext CTX = new DefaultSchemaContext();protected static final SchemaName NAME_ROOT = new SchemaName("root");protected static final SchemaName NAME_DOWN1 = new SchemaName("down1");- protected static final TargetObjectSchema SCHEMA_ROOT = CTX.builder(NAME_ROOT)- .addInterface(TargetProcess.class)- .addInterface(TargetInterpreter.class)+ protected static final TraceObjectSchema SCHEMA_ROOT = CTX.builder(NAME_ROOT)+ .addInterface(TraceObjectProcess.class).setCanonicalContainer(true)- .addElementSchema("reserved", EnumerableTargetObjectSchema.VOID.getName(), null)+ .addElementSchema("reserved", PrimitiveTraceObjectSchema.VOID.getName(), null).addElementSchema("", NAME_DOWN1, null)- .setElementResyncMode(ResyncMode.NEVER).addAttributeSchema(new DefaultAttributeSchema("some_int",- EnumerableTargetObjectSchema.INT.getName(), false, false, false), null)+ PrimitiveTraceObjectSchema.INT.getName(), false, false, Hidden.FALSE), null).addAttributeSchema(new DefaultAttributeSchema("some_object",- EnumerableTargetObjectSchema.OBJECT.getName(), true, true, true), null)+ PrimitiveTraceObjectSchema.OBJECT.getName(), true, true, Hidden.TRUE), null).addAttributeAlias("_int", "some_int", null)- .setAttributeResyncMode(ResyncMode.ONCE).buildAndAdd();- protected static final TargetObjectSchema SCHEMA_DOWN1 = CTX.builder(NAME_DOWN1)- .setElementResyncMode(ResyncMode.ALWAYS)+ protected static final TraceObjectSchema SCHEMA_DOWN1 = CTX.builder(NAME_DOWN1).setDefaultAttributeSchema(AttributeSchema.DEFAULT_VOID)- .setAttributeResyncMode(ResyncMode.ALWAYS).buildAndAdd();@Testdiff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.javaindex 5b1cccdf30..994ccf6963 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -28,9 +28,6 @@ import org.junit.Test;import db.Transaction;import ghidra.app.plugin.assembler.*;import ghidra.app.plugin.assembler.sleigh.sem.AssemblyPatternBlock;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.pcode.emu.PcodeThread;import ghidra.pcode.exec.*;import ghidra.pcode.exec.PcodeExecutorStatePiece.Reason;@@ -45,7 +42,10 @@ import ghidra.trace.model.Lifespan;import ghidra.trace.model.guest.TraceGuestPlatform;import ghidra.trace.model.memory.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceThread;import ghidra.util.NumericUtilities;@@ -908,7 +908,7 @@ public class BytesTracePcodeEmulatorTest extends AbstractTracePcodeEmulatorTestx64.addMappedRegisterRange();x64.addMappedRange(tb.addr(0x00000000), tb.addr(x64, 0x00400000), 0x10000);x64.addMappedRange(tb.addr(0x20000000), tb.addr(x64, 0x00100000), 0x10000);- objects.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers"))+ objects.createObject(KeyPath.parse("Targets[0].Threads[0].Registers")).insert(Lifespan.nowOn(0), ConflictResolution.DENY);tb.exec(x64, 0, thread, 0, """diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.javaindex dd19a119fb..ce51174981 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/ToyDBTraceBuilder.java@@ -33,8 +33,6 @@ import db.Transaction;import generic.test.AbstractGenericTest;import generic.theme.GThemeDefaults.Colors.Messages;import ghidra.app.plugin.processors.sleigh.SleighLanguage;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.util.PathPredicates;import ghidra.framework.data.OpenMode;import ghidra.pcode.exec.*;import ghidra.pcode.exec.trace.TraceSleighUtils;@@ -60,6 +58,8 @@ import ghidra.trace.model.guest.TracePlatform;import ghidra.trace.model.symbol.TraceReferenceManager;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.util.Msg;@@ -762,7 +762,7 @@ public class ToyDBTraceBuilder implements AutoCloseable {public TraceObjectThread createObjectsProcessAndThreads() {DBTraceObjectManager objs = trace.getObjectManager();- TraceObjectKeyPath pathProc1 = TraceObjectKeyPath.parse("Processes[1]");+ KeyPath pathProc1 = KeyPath.parse("Processes[1]");TraceObject proc1 = objs.createObject(pathProc1);Lifespan zeroOn = Lifespan.nowOn(0);proc1.insert(zeroOn, ConflictResolution.DENY);@@ -771,7 +771,7 @@ public class ToyDBTraceBuilder implements AutoCloseable {TraceObject t2 = objs.createObject(pathProc1.key("Threads").index(2));t2.insert(zeroOn, ConflictResolution.DENY);- proc1.setAttribute(zeroOn, "_state", TargetExecutionState.STOPPED.name());+ proc1.setAttribute(zeroOn, "_state", TraceExecutionState.STOPPED.name());return t1.queryInterface(TraceObjectThread.class);}@@ -779,9 +779,9 @@ public class ToyDBTraceBuilder implements AutoCloseable {public void createObjectsFramesAndRegs(TraceObjectThread thread, Lifespan lifespan,TracePlatform platform, int n) {DBTraceObjectManager objs = trace.getObjectManager();- TraceObjectKeyPath pathThread = thread.getObject().getCanonicalPath();+ KeyPath pathThread = thread.getObject().getCanonicalPath();for (int i = 0; i < n; i++) {- TraceObjectKeyPath pathContainer = pathThread.key("Stack").index(i).key("Registers");+ KeyPath pathContainer = pathThread.key("Stack").index(i).key("Registers");for (Register reg : platform.getLanguage().getRegisters()) {TraceObject regObj = objs.createObject(pathContainer.index(reg.getName()));regObj.insert(lifespan, ConflictResolution.DENY);@@ -797,7 +797,7 @@ public class ToyDBTraceBuilder implements AutoCloseable {*/public TraceObject obj(String canonicalPath) {return trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse(canonicalPath));+ .getObjectByCanonicalPath(KeyPath.parse(canonicalPath));}/**@@ -818,7 +818,7 @@ public class ToyDBTraceBuilder implements AutoCloseable {*/public TraceObject objAny(String path, Lifespan span) {return trace.getObjectManager()- .getObjectsByPath(span, TraceObjectKeyPath.parse(path))+ .getObjectsByPath(span, KeyPath.parse(path)).findFirst().orElse(null);}@@ -845,7 +845,7 @@ public class ToyDBTraceBuilder implements AutoCloseable {*/public List<Object> objValues(long snap, String pattern) {return trace.getObjectManager()- .getValuePaths(Lifespan.at(snap), PathPredicates.parse(pattern))+ .getValuePaths(Lifespan.at(snap), PathFilter.parse(pattern)).map(p -> p.getDestinationValue(trace.getObjectManager().getRootObject())).toList();}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManagerObjectTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManagerObjectTest.javaindex 711056fddc..215751cae2 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManagerObjectTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/breakpoint/DBTraceBreakpointManagerObjectTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,9 +18,9 @@ package ghidra.trace.database.breakpoint;import org.junit.Before;import db.Transaction;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class DBTraceBreakpointManagerObjectTest extends DBTraceBreakpointManagerTest {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupportTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupportTest.javaindex 44cc7d94bc..12ef3e4561 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupportTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/guest/DBTraceObjectRegisterSupportTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -24,12 +24,6 @@ import org.junit.Before;import org.junit.Test;import db.Transaction;-import ghidra.dbg.target.TargetRegister;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.dbg.util.PathMatcher;-import ghidra.dbg.util.PathUtils;import ghidra.program.model.address.AddressSpace;import ghidra.program.model.lang.*;import ghidra.test.AbstractGhidraHeadlessIntegrationTest;@@ -39,9 +33,14 @@ import ghidra.trace.database.target.DBTraceObjectManagerTest;import ghidra.trace.model.Lifespan;import ghidra.trace.model.guest.TraceGuestPlatform;import ghidra.trace.model.memory.TraceMemorySpace;+import ghidra.trace.model.memory.TraceObjectRegister;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathMatcher;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.util.exception.DuplicateNameException;public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessIntegrationTest {@@ -65,18 +64,18 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regR0 = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[r0]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[r0]"));regR0.insert(Lifespan.nowOn(0), ConflictResolution.DENY);b.trace.getMemoryManager().createOverlayAddressSpace("Targets[0].Threads[0].Registers",b.trace.getBaseAddressFactory().getRegisterSpace());- regR0.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 64);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x1234);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 64);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x1234);}AddressSpace overlaySpace =@@ -93,11 +92,11 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regRAX = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[RAX]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[RAX]"));regRAX.insert(Lifespan.nowOn(0), ConflictResolution.DENY);b.trace.getMemoryManager().createOverlayAddressSpace("Targets[0].Threads[0].Registers",@@ -108,8 +107,8 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessIntegetSLEIGH_X86_64_LANGUAGE().getCompilerSpecByID(new CompilerSpecID("gcc")));amd64.addMappedRegisterRange();- regRAX.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 64);- regRAX.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x1234);+ regRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 64);+ regRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x1234);}AddressSpace overlaySpace =@@ -127,11 +126,11 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regOrigRAX = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[orig_rax]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[orig_rax]"));regOrigRAX.insert(Lifespan.nowOn(0), ConflictResolution.DENY);b.trace.getMemoryManager().createOverlayAddressSpace("Targets[0].Threads[0].Registers",@@ -144,8 +143,10 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteRAX = amd64.getLanguage().getRegister("RAX");amd64.addRegisterMapOverride(RAX, "orig_rax");- regOrigRAX.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 64);- regOrigRAX.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x1234);+ regOrigRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH,+ 64);+ regOrigRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE,+ 0x1234);}AddressSpace overlaySpace =@@ -162,11 +163,11 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regR0 = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[R0]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[R0]"));regR0.insert(Lifespan.nowOn(0), ConflictResolution.DENY);avr8 = b.trace.getPlatformManager()@@ -176,8 +177,8 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteavr8.addMappedRange(b.addr(0),avr8.getLanguage().getDefaultDataSpace().getAddress(0), 0x1000);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 8);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x12);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 8);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x12);}assertEquals(BigInteger.valueOf(0x12), b.trace.getMemoryManager()@@ -196,11 +197,11 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regR0 = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[R0]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[R0]"));regR0.insert(Lifespan.nowOn(0), ConflictResolution.DENY);overlay = b.trace.getMemoryManager()@@ -214,8 +215,8 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteavr8.addMappedRange(b.addr(overlay, 0),avr8.getLanguage().getDefaultDataSpace().getAddress(0), 0x1000);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 8);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x12);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 8);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x12);}assertEquals(BigInteger.valueOf(0x12), b.trace.getMemoryManager()@@ -234,11 +235,11 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regR0 = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[orig_r0]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[orig_r0]"));regR0.insert(Lifespan.nowOn(0), ConflictResolution.DENY);avr8 = b.trace.getPlatformManager()@@ -250,8 +251,8 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteR0 = avr8.getLanguage().getRegister("R0");avr8.addRegisterMapOverride(R0, "orig_r0");- regR0.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 8);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x12);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 8);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x12);}assertEquals(BigInteger.valueOf(0x12),@@ -269,11 +270,11 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regOrigRAX = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[orig_rax]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[orig_rax]"));regOrigRAX.insert(Lifespan.nowOn(0), ConflictResolution.DENY);b.trace.getMemoryManager().createOverlayAddressSpace("Targets[0].Threads[0].Registers",@@ -284,8 +285,10 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessIntegetSLEIGH_X86_64_LANGUAGE().getCompilerSpecByID(new CompilerSpecID("gcc")));amd64.addMappedRegisterRange();- regOrigRAX.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 64);- regOrigRAX.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x1234);+ regOrigRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH,+ 64);+ regOrigRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE,+ 0x1234);RAX = amd64.getLanguage().getRegister("RAX");amd64.addRegisterMapOverride(RAX, "orig_rax");@@ -306,11 +309,11 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regR0 = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[orig_r0]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[orig_r0]"));regR0.insert(Lifespan.nowOn(0), ConflictResolution.DENY);avr8 = b.trace.getPlatformManager()@@ -320,8 +323,8 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteavr8.addMappedRange(b.addr(0),avr8.getLanguage().getDefaultDataSpace().getAddress(0), 0x1000);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 8);- regR0.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x12);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 8);+ regR0.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x12);R0 = avr8.getLanguage().getRegister("R0");avr8.addRegisterMapOverride(R0, "orig_r0");@@ -341,18 +344,18 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regRAX = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[RAX]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[RAX]"));regRAX.insert(Lifespan.nowOn(0), ConflictResolution.DENY);b.trace.getMemoryManager().createOverlayAddressSpace("Targets[0].Threads[0].Registers",b.trace.getBaseAddressFactory().getRegisterSpace());- regRAX.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 64);- regRAX.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x1234);+ regRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 64);+ regRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x1234);amd64 = b.trace.getPlatformManager().addGuestPlatform(@@ -374,15 +377,15 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteroot = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();TraceObject thread =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);TraceObject regRAX = manager.createObject(- TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers.User[RAX]"));+ KeyPath.parse("Targets[0].Threads[0].Registers.User[RAX]"));regRAX.insert(Lifespan.nowOn(0), ConflictResolution.DENY);- regRAX.setValue(Lifespan.nowOn(0), TargetRegister.BIT_LENGTH_ATTRIBUTE_NAME, 64);- regRAX.setValue(Lifespan.nowOn(0), TargetRegister.VALUE_ATTRIBUTE_NAME, 0x1234);+ regRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_BITLENGTH, 64);+ regRAX.setValue(Lifespan.nowOn(0), TraceObjectRegister.KEY_VALUE, 0x1234);amd64 = b.trace.getPlatformManager().addGuestPlatform(@@ -427,7 +430,7 @@ public class DBTraceObjectRegisterSupportTest extends AbstractGhidraHeadlessInteprotected static void assertMatches(String path, PathMatcher matcher) {String message = matcher + " does not match " + path;- assertTrue(message, matcher.matches(PathUtils.parse(path)));+ assertTrue(message, matcher.matches(KeyPath.parse(path)));}@Testdiff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegionsTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegionsTest.javaindex f1882852ec..5fcb6e2fd5 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegionsTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegionsTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,9 +18,9 @@ package ghidra.trace.database.memory;import org.junit.Before;import db.Transaction;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class DBTraceMemoryManagerObjectRegionsTest extends DBTraceMemoryManagerRegionsTest {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerFrameBETest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerFrameBETest.javaindex 5a20a15362..804ad8611b 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerFrameBETest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerFrameBETest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -19,14 +19,14 @@ import org.junit.Before;import org.junit.Test;import db.Transaction;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.dbg.util.PathUtils;import ghidra.program.model.lang.LanguageID;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.util.LanguageTestWatcher.TestLanguage;@@ -87,7 +87,7 @@ public class DBTraceMemoryManagerObjectRegistersPerFrameBETestTraceThread thread = super.getOrAddThread(name, creationSnap);TraceObject obj = ((TraceObjectThread) thread).getObject();TraceObject objRegs = b.trace.getObjectManager()- .createObject(obj.getCanonicalPath().extend(PathUtils.parse("Stack[0]")));+ .createObject(obj.getCanonicalPath().extend(KeyPath.parse("Stack[0]")));objRegs.insert(Lifespan.ALL, ConflictResolution.DENY);return thread;}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerThreadLETest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerThreadLETest.javaindex 0b6ad673ac..eee48d6086 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerThreadLETest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/memory/DBTraceMemoryManagerObjectRegistersPerThreadLETest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -19,13 +19,13 @@ import org.junit.Before;import org.junit.Test;import db.Transaction;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.program.model.lang.LanguageID;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.util.LanguageTestWatcher.TestLanguage;diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/module/DBTraceModuleManagerObjectTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/module/DBTraceModuleManagerObjectTest.javaindex dc7181298d..4d1d717301 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/module/DBTraceModuleManagerObjectTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/module/DBTraceModuleManagerObjectTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,9 +18,9 @@ package ghidra.trace.database.module;import org.junit.*;import db.Transaction;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class DBTraceModuleManagerObjectTest extends DBTraceModuleManagerTest {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/stack/DBTraceStackManagerObjectTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/stack/DBTraceStackManagerObjectTest.javaindex 0754a92d75..973cc1c9fa 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/stack/DBTraceStackManagerObjectTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/stack/DBTraceStackManagerObjectTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,9 +18,9 @@ package ghidra.trace.database.stack;import org.junit.Before;import db.Transaction;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class DBTraceStackManagerObjectTest extends DBTraceStackManagerTest {diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.javaindex 1af4b18767..4c1d27b1a2 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/target/DBTraceObjectManagerTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -28,17 +28,18 @@ import org.junit.Test;import db.Transaction;import generic.Unique;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;-import ghidra.dbg.util.PathPredicates;-import ghidra.dbg.util.PathUtils;import ghidra.program.model.address.*;import ghidra.test.AbstractGhidraHeadlessIntegrationTest;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.iface.TraceObjectAggregate;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.util.database.DBAnnotatedObject;import ghidra.util.database.DBCachedObjectStore;@@ -49,7 +50,6 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationT<schema name='Session' elementResync='NEVER' attributeResync='ONCE'><attribute name='curTarget' schema='Target' /><attribute name='Targets' schema='TargetContainer' />- <attribute schema='VOID' /></schema><schema name='TargetContainer' canonical='yes' elementResync='NEVER'attributeResync='ONCE'>@@ -112,7 +112,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTprotected void populateModel(int targetCount) {try (Transaction tx = b.startTransaction()) {root = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();- TraceObjectKeyPath pathTargets = TraceObjectKeyPath.of("Targets");+ KeyPath pathTargets = KeyPath.of("Targets");targetContainer = manager.createObject(pathTargets);root.setAttribute(Lifespan.nowOn(0), "Targets", targetContainer);dumpStore(manager.valueTree.getDataStore());@@ -146,7 +146,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationT@Test(expected = IllegalStateException.class)public void testCreateObjectWithoutRootErr() {try (Transaction tx = b.startTransaction()) {- manager.createObject(TraceObjectKeyPath.of("Test"));+ manager.createObject(KeyPath.of("Test"));}}@@ -157,7 +157,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationT@Test(expected = IllegalArgumentException.class)public void testCreateObjectAsRootErrNoSchema() {try (Transaction tx = b.startTransaction()) {- manager.createObject(TraceObjectKeyPath.of());+ manager.createObject(KeyPath.of());}}@@ -169,7 +169,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpublic void testCreateObjectAsRootErrRootExists() {try (Transaction tx = b.startTransaction()) {manager.createRootObject(ctx.getSchema(new SchemaName("Session")));- manager.createObject(TraceObjectKeyPath.of());+ manager.createObject(KeyPath.of());}}@@ -208,32 +208,32 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTTraceObject obj;try (Transaction tx = b.startTransaction()) {manager.createRootObject(ctx.getSchema(new SchemaName("Session")));- obj = manager.createObject(TraceObjectKeyPath.of("Targets"));+ obj = manager.createObject(KeyPath.of("Targets"));}- assertEquals(TraceObjectKeyPath.of("Targets"), obj.getCanonicalPath());+ assertEquals(KeyPath.of("Targets"), obj.getCanonicalPath());}@Testpublic void testGetObjectsByCanonicalPath() {try (Transaction tx = b.startTransaction()) {root = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();- targetContainer = manager.createObject(TraceObjectKeyPath.of("Targets"));+ targetContainer = manager.createObject(KeyPath.of("Targets"));}- assertNull(manager.getObjectByCanonicalPath(TraceObjectKeyPath.of("Nothing")));- assertEquals(root, manager.getObjectByCanonicalPath(TraceObjectKeyPath.of()));+ assertNull(manager.getObjectByCanonicalPath(KeyPath.of("Nothing")));+ assertEquals(root, manager.getObjectByCanonicalPath(KeyPath.of()));assertEquals(targetContainer,- manager.getObjectByCanonicalPath(TraceObjectKeyPath.of("Targets")));+ manager.getObjectByCanonicalPath(KeyPath.of("Targets")));}@Testpublic void testGetValuesByPathRootOnly() {- assertEquals(0, manager.getValuePaths(Lifespan.ALL, PathPredicates.pattern()).count());+ assertEquals(0, manager.getValuePaths(Lifespan.ALL, PathFilter.pattern()).count());try (Transaction tx = b.startTransaction()) {manager.createRootObject(ctx.getSchema(new SchemaName("Session")));}- assertEquals(1, manager.getValuePaths(Lifespan.ALL, PathPredicates.pattern()).count());+ assertEquals(1, manager.getValuePaths(Lifespan.ALL, PathFilter.pattern()).count());}@Test@@ -241,23 +241,23 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpopulateModel(2);assertEquals(1,- manager.getObjectsByPath(Lifespan.at(0), TraceObjectKeyPath.parse("Targets[0]"))+ manager.getObjectsByPath(Lifespan.at(0), KeyPath.parse("Targets[0]")).count());assertEquals(0,- manager.getObjectsByPath(Lifespan.at(0), TraceObjectKeyPath.parse("Targets[1]"))+ manager.getObjectsByPath(Lifespan.at(0), KeyPath.parse("Targets[1]")).count());assertEquals(1,- manager.getObjectsByPath(Lifespan.at(1), TraceObjectKeyPath.parse("Targets[1]"))+ manager.getObjectsByPath(Lifespan.at(1), KeyPath.parse("Targets[1]")).count());assertEquals(2,- manager.getObjectsByPath(Lifespan.ALL, TraceObjectKeyPath.parse("curTarget")).count());+ manager.getObjectsByPath(Lifespan.ALL, KeyPath.parse("curTarget")).count());TraceObject target1 =- manager.getObjectsByPath(Lifespan.ALL, TraceObjectKeyPath.parse("Targets[1]"))+ manager.getObjectsByPath(Lifespan.ALL, KeyPath.parse("Targets[1]")).findAny().get();assertEquals(target1,- manager.getObjectsByPath(Lifespan.at(1), TraceObjectKeyPath.parse("curTarget"))+ manager.getObjectsByPath(Lifespan.at(1), KeyPath.parse("curTarget")).findAny().get());}@@ -266,7 +266,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpublic void testGetRangeValues() {try (Transaction tx = b.startTransaction()) {root = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();- targetContainer = manager.createObject(TraceObjectKeyPath.parse("Targets"));+ targetContainer = manager.createObject(KeyPath.parse("Targets"));root.setAttribute(Lifespan.ALL, "Targets", targetContainer);TraceObjectValue rangeVal =@@ -278,19 +278,19 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTassertNull(root.getValue(0, "b"));assertEquals(Set.of(rangeVal),- root.getSuccessors(Lifespan.ALL, PathPredicates.parse("a"))+ root.getSuccessors(Lifespan.ALL, PathFilter.parse("a")).map(p -> p.getLastEntry()).collect(Collectors.toSet()));assertEquals(Set.of(),- root.getSuccessors(Lifespan.toNow(-1), PathPredicates.parse("a"))+ root.getSuccessors(Lifespan.toNow(-1), PathFilter.parse("a")).map(p -> p.getLastEntry()).collect(Collectors.toSet()));assertEquals(Set.of(),- root.getSuccessors(Lifespan.ALL, PathPredicates.parse("b"))+ root.getSuccessors(Lifespan.ALL, PathFilter.parse("b")).map(p -> p.getLastEntry()).collect(Collectors.toSet()));assertEquals(Set.of(),- targetContainer.getSuccessors(Lifespan.ALL, PathPredicates.parse("a"))+ targetContainer.getSuccessors(Lifespan.ALL, PathFilter.parse("a")).map(p -> p.getLastEntry()).collect(Collectors.toSet()));@@ -312,7 +312,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpopulateModel(3);TraceObject thread;try (Transaction tx = b.startTransaction()) {- thread = manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ thread = manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);}@@ -377,7 +377,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpublic void testIsRoot() {try (Transaction tx = b.startTransaction()) {root = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();- targetContainer = manager.createObject(TraceObjectKeyPath.of("Targets"));+ targetContainer = manager.createObject(KeyPath.of("Targets"));}assertTrue(root.isRoot());@@ -389,7 +389,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpopulateModel(3);TraceObject object = Unique.assertOne(- manager.getObjectsByPath(Lifespan.at(0), TraceObjectKeyPath.parse("curTarget")));+ manager.getObjectsByPath(Lifespan.at(0), KeyPath.parse("curTarget")));List<TraceObjectValPath> paths =object.getAllPaths(Lifespan.at(0)).collect(Collectors.toList());@@ -400,19 +400,19 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpath = paths.get(0);assertEquals(object, path.getDestination(root));- assertEquals(PathUtils.parse("Targets[0]"), path.getKeyList());+ assertEquals(KeyPath.parse("Targets[0]"), path.getPath());path = paths.get(1);assertEquals(object, path.getDestination(root));- assertEquals(PathUtils.parse("Targets[0].self"), path.getKeyList());+ assertEquals(KeyPath.parse("Targets[0].self"), path.getPath());path = paths.get(2);assertEquals(object, path.getDestination(root));- assertEquals(List.of("curTarget"), path.getKeyList());+ assertEquals(KeyPath.of("curTarget"), path.getPath());path = paths.get(3);assertEquals(object, path.getDestination(root));- assertEquals(PathUtils.parse("curTarget.self"), path.getKeyList());+ assertEquals(KeyPath.parse("curTarget.self"), path.getPath());paths = root.getAllPaths(Lifespan.ALL).collect(Collectors.toList());assertEquals(1, paths.size());@@ -426,11 +426,14 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTtry (Transaction tx = b.startTransaction()) {root = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();- thread = manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ thread = manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);}assertEquals(Set.of(), root.getInterfaces());- assertEquals(Set.of(TraceObjectThread.class), thread.getInterfaces());+ assertEquals(Set.of(+ TraceObjectAggregate.class,+ TraceObjectThread.class),+ thread.getInterfaces());}@Test@@ -439,7 +442,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTtry (Transaction tx = b.startTransaction()) {root = manager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();- thread = manager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ thread = manager.createObject(KeyPath.parse("Targets[0].Threads[0]"));thread.insert(Lifespan.nowOn(0), ConflictResolution.DENY);}assertNull(root.queryInterface(TraceObjectThread.class));@@ -517,30 +520,30 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpublic void testGetSuccessors() {populateModel(3);- assertEquals(1, root.getSuccessors(Lifespan.ALL, PathPredicates.parse("")).count());+ assertEquals(1, root.getSuccessors(Lifespan.ALL, PathFilter.parse("")).count());- assertEquals(1, root.getSuccessors(Lifespan.ALL, PathPredicates.parse("Targets")).count());+ assertEquals(1, root.getSuccessors(Lifespan.ALL, PathFilter.parse("Targets")).count());assertEquals(1,- root.getSuccessors(Lifespan.at(0), PathPredicates.parse("Targets[]")).count());+ root.getSuccessors(Lifespan.at(0), PathFilter.parse("Targets[]")).count());assertEquals(1,- targetContainer.getSuccessors(Lifespan.at(0), PathPredicates.parse("[]")).count());+ targetContainer.getSuccessors(Lifespan.at(0), PathFilter.parse("[]")).count());assertEquals(3,- targetContainer.getSuccessors(Lifespan.ALL, PathPredicates.parse("[]")).count());+ targetContainer.getSuccessors(Lifespan.ALL, PathFilter.parse("[]")).count());assertEquals(3,- root.getSuccessors(Lifespan.ALL, PathPredicates.parse("curTarget")).count());+ root.getSuccessors(Lifespan.ALL, PathFilter.parse("curTarget")).count());assertEquals(2,- root.getSuccessors(Lifespan.span(0, 1), PathPredicates.parse("curTarget")).count());+ root.getSuccessors(Lifespan.span(0, 1), PathFilter.parse("curTarget")).count());assertEquals(1,- root.getSuccessors(Lifespan.at(1), PathPredicates.parse("curTarget")).count());+ root.getSuccessors(Lifespan.at(1), PathFilter.parse("curTarget")).count());assertEquals(0,- root.getSuccessors(Lifespan.toNow(-1), PathPredicates.parse("curTarget")).count());+ root.getSuccessors(Lifespan.toNow(-1), PathFilter.parse("curTarget")).count());assertEquals(1,- root.getSuccessors(Lifespan.ALL, PathPredicates.parse("anAttribute")).count());+ root.getSuccessors(Lifespan.ALL, PathFilter.parse("anAttribute")).count());assertEquals(0,- root.getSuccessors(Lifespan.ALL, PathPredicates.parse("anAttribute.nope")).count());+ root.getSuccessors(Lifespan.ALL, PathFilter.parse("anAttribute.nope")).count());}@Test@@ -548,20 +551,20 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTpopulateModel(3);assertEquals(List.of(root),- root.getOrderedSuccessors(Lifespan.ALL, TraceObjectKeyPath.parse(""), true)+ root.getOrderedSuccessors(Lifespan.ALL, KeyPath.parse(""), true).map(p -> p.getDestination(root)).collect(Collectors.toList()));assertEquals(List.of(root),- root.getOrderedSuccessors(Lifespan.ALL, TraceObjectKeyPath.parse(""), false)+ root.getOrderedSuccessors(Lifespan.ALL, KeyPath.parse(""), false).map(p -> p.getDestination(root)).collect(Collectors.toList()));assertEquals(List.of(targets.get(0), targets.get(1), targets.get(2)),- root.getOrderedSuccessors(Lifespan.ALL, TraceObjectKeyPath.parse("curTarget"), true)+ root.getOrderedSuccessors(Lifespan.ALL, KeyPath.parse("curTarget"), true).map(p -> p.getDestination(root)).collect(Collectors.toList()));assertEquals(List.of(targets.get(2), targets.get(1), targets.get(0)),- root.getOrderedSuccessors(Lifespan.ALL, TraceObjectKeyPath.parse("curTarget"), false)+ root.getOrderedSuccessors(Lifespan.ALL, KeyPath.parse("curTarget"), false).map(p -> p.getDestination(root)).collect(Collectors.toList()));}@@ -890,7 +893,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTassertFalse(t1.isDeleted());assertEquals(3, targetContainer.getValues(Lifespan.ALL).size());assertEquals(t1, Unique.assertOne(- manager.getObjectsByPath(Lifespan.ALL, TraceObjectKeyPath.parse("Targets[1]"))));+ manager.getObjectsByPath(Lifespan.ALL, KeyPath.parse("Targets[1]"))));assertEquals(t1, t1.getAttribute(1, "self").getValue());assertEquals(t1, root.getValue(1, "curTarget").getValue());@@ -902,14 +905,14 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTassertTrue(t1.getParents(Lifespan.ALL).isEmpty());assertEquals(2, targetContainer.getValues(Lifespan.ALL).size());assertEquals(0,- manager.getObjectsByPath(Lifespan.ALL, TraceObjectKeyPath.parse("Targets[1]")).count());+ manager.getObjectsByPath(Lifespan.ALL, KeyPath.parse("Targets[1]")).count());assertNull(t1.getAttribute(2, "self"));assertNull(root.getValue(1, "curTarget"));// Delete a branch (leaves stay, but detached)TraceObject t0 = targets.get(0);assertEquals(2,- manager.getObjectsByPath(Lifespan.ALL, TraceObjectKeyPath.parse("Targets[]")).count());+ manager.getObjectsByPath(Lifespan.ALL, KeyPath.parse("Targets[]")).count());assertTrue(t0.getParents(Lifespan.ALL).stream().anyMatch(v -> v.getParent() == targetContainer));assertEquals(2, targetContainer.getValues(Lifespan.ALL).size());@@ -924,7 +927,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationT}assertEquals(0,- manager.getObjectsByPath(Lifespan.ALL, TraceObjectKeyPath.parse("Targets[]")).count());+ manager.getObjectsByPath(Lifespan.ALL, KeyPath.parse("Targets[]")).count());assertFalse(t0.isDeleted());assertFalse(t0.getParents(Lifespan.ALL).stream().anyMatch(v -> v.getParent() == targetContainer));@@ -1009,7 +1012,7 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTTraceObjectValue primVal = root.setValue(Lifespan.ALL, "primitive", "A string");assertFalse(primVal.isCanonical());- TraceObject child = manager.createObject(TraceObjectKeyPath.parse("child"));+ TraceObject child = manager.createObject(KeyPath.parse("child"));TraceObjectValue objVal = root.setValue(Lifespan.ALL, "child", child);assertTrue(objVal.isCanonical());@@ -1083,23 +1086,23 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTmanager.createRootObject(ctx.getSchema(new SchemaName("Session")));root = rootVal.getChild();- TraceObject object = manager.createObject(TraceObjectKeyPath.parse("OutsideSchema"));+ TraceObject object = manager.createObject(KeyPath.parse("OutsideSchema"));object.insert(Lifespan.ALL, ConflictResolution.DENY);assertFalse(object.getCanonicalParent(0).isHidden());TraceObject elemOutside =- manager.createObject(TraceObjectKeyPath.parse("OutsideSchema[0]"));+ manager.createObject(KeyPath.parse("OutsideSchema[0]"));elemOutside.insert(Lifespan.ALL, ConflictResolution.DENY);assertFalse(elemOutside.getCanonicalParent(0).isHidden());TraceObject attrOutside =- manager.createObject(TraceObjectKeyPath.parse("OutsideSchema.Attr"));+ manager.createObject(KeyPath.parse("OutsideSchema.Attr"));attrOutside.insert(Lifespan.ALL, ConflictResolution.DENY);assertFalse(attrOutside.getCanonicalParent(0).isHidden());// TODO: This underscore convention is deprecated, but still in useTraceObject hiddenOutside =- manager.createObject(TraceObjectKeyPath.parse("OutsideSchema._Attr"));+ manager.createObject(KeyPath.parse("OutsideSchema._Attr"));hiddenOutside.insert(Lifespan.ALL, ConflictResolution.DENY);assertTrue(hiddenOutside.getCanonicalParent(0).isHidden());}@@ -1186,13 +1189,13 @@ public class DBTraceObjectManagerTest extends AbstractGhidraHeadlessIntegrationTroot = rootVal.getChild();regionText =- manager.createObject(TraceObjectKeyPath.parse("Targets[0].Memory[bin:.text]"));+ manager.createObject(KeyPath.parse("Targets[0].Memory[bin:.text]"));regionText.insert(Lifespan.nowOn(0), ConflictResolution.DENY);regionText.setAttribute(Lifespan.nowOn(0), "_range", b.range(0x00400000, 0x00401000));regionText.setAttribute(Lifespan.nowOn(0), "Range", b.range(0x00400000, 0x00402000));}- assertEquals(ctx.getSchema(new SchemaName("Region")), regionText.getTargetSchema());+ assertEquals(ctx.getSchema(new SchemaName("Region")), regionText.getSchema());assertEquals(Set.of(regionText.getAttribute(0, "Range")),Set.copyOf(regionText.getAttributes(Lifespan.ALL)));diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/thread/DBTraceThreadManagerObjectTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/thread/DBTraceThreadManagerObjectTest.javaindex f07f10fb5a..543a5c2aec 100644--- a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/thread/DBTraceThreadManagerObjectTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/thread/DBTraceThreadManagerObjectTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -18,9 +18,9 @@ package ghidra.trace.database.thread;import org.junit.Before;import db.Transaction;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class DBTraceThreadManagerObjectTest extends DBTraceThreadManagerTest {diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/PathUtilsTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/model/target/path/KeyPathTest.javasimilarity index 61%rename from Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/PathUtilsTest.javarename to Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/model/target/path/KeyPathTest.javaindex e0a1a2a141..b0e2aa0e54 100644--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/util/PathUtilsTest.java+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/model/target/path/KeyPathTest.java@@ -4,76 +4,74 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.util;+package ghidra.trace.model.target.path;import static org.junit.Assert.assertEquals;-import java.util.List;-import org.junit.Test;-public class PathUtilsTest {+public class KeyPathTest {@Testpublic void testParseEmpty() {- assertEquals(List.of(), PathUtils.parse(""));+ assertEquals(KeyPath.ROOT, KeyPath.parse(""));}@Testpublic void testParseName() {- assertEquals(List.of("name"), PathUtils.parse("name"));+ assertEquals(KeyPath.of("name"), KeyPath.parse("name"));}@Testpublic void testParseDottedName() {- assertEquals(List.of("name"), PathUtils.parse(".name"));+ assertEquals(KeyPath.of("name"), KeyPath.parse(".name"));}@Testpublic void testParseIndex() {- assertEquals(List.of("[index]"), PathUtils.parse("[index]"));+ assertEquals(KeyPath.of("[index]"), KeyPath.parse("[index]"));}@Testpublic void testParseNameThenIndex() {- assertEquals(List.of("name", "[index]"), PathUtils.parse("name[index]"));+ assertEquals(KeyPath.of("name", "[index]"), KeyPath.parse("name[index]"));}@Testpublic void testParseIndexThenName() {- assertEquals(List.of("[index]", "name"), PathUtils.parse("[index].name"));+ assertEquals(KeyPath.of("[index]", "name"), KeyPath.parse("[index].name"));}@Test(expected = IllegalArgumentException.class)public void testParseErrIndexNoDotName() {- PathUtils.parse("[index]name");+ KeyPath.parse("[index]name");}@Testpublic void testParseNameThenName() {- assertEquals(List.of("n1", "n2"), PathUtils.parse("n1.n2"));+ assertEquals(KeyPath.of("n1", "n2"), KeyPath.parse("n1.n2"));}@Testpublic void testParseIndexThenIndex() {- assertEquals(List.of("[i1]", "[i2]"), PathUtils.parse("[i1][i2]"));+ assertEquals(KeyPath.of("[i1]", "[i2]"), KeyPath.parse("[i1][i2]"));}@Testpublic void testParseIndexWithDot() {- assertEquals(List.of("[index.more]"), PathUtils.parse("[index.more]"));+ assertEquals(KeyPath.of("[index.more]"), KeyPath.parse("[index.more]"));}@Testpublic void testParseParenthesizedNameWithDot() {- assertEquals(List.of("query(e.x==6)"), PathUtils.parse(".query(e.x==6)"));+ assertEquals(KeyPath.of("query(e.x==6)"), KeyPath.parse(".query(e.x==6)"));}}diff --git a/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/model/target/path/PathFilterTest.java b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/model/target/path/PathFilterTest.javanew file mode 100644index 0000000000..4072783010--- /dev/null+++ b/Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/model/target/path/PathFilterTest.java@@ -0,0 +1,40 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.trace.model.target.path;++import static org.junit.Assert.assertEquals;++import java.util.Set;++import org.junit.Test;++public class PathFilterTest {+ @Test+ public void testGetPrevKeys() {+ PathFilter pred = PathFilter.parse("Processes[0].Threads[].Stack");++ assertEquals(Set.of("Stack"), pred.getPrevKeys(KeyPath.ROOT));+ assertEquals(Set.of("[]"), pred.getPrevKeys(KeyPath.parse("Stack")));+ assertEquals(Set.of("Threads"), pred.getPrevKeys(KeyPath.parse("[].Stack")));+ assertEquals(Set.of("[0]"), pred.getPrevKeys(KeyPath.parse("Threads[].Stack")));+ assertEquals(Set.of("Processes"), pred.getPrevKeys(KeyPath.parse("[0].Threads[].Stack")));+ assertEquals(Set.of(), pred.getPrevKeys(KeyPath.parse("Processes[0].Threads[].Stack")));++ assertEquals(Set.of(), pred.getPrevKeys(KeyPath.parse("Foo.Processes[0].Threads[].Stack")));+ assertEquals(Set.of(), pred.getPrevKeys(KeyPath.parse("Foo")));+ assertEquals(Set.of(), pred.getPrevKeys(KeyPath.parse("[]")));+ }+}diff --git a/Ghidra/Debug/TaintAnalysis/build.gradle b/Ghidra/Debug/TaintAnalysis/build.gradleindex e15c5c069d..f254947c57 100644--- a/Ghidra/Debug/TaintAnalysis/build.gradle+++ b/Ghidra/Debug/TaintAnalysis/build.gradle@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -29,7 +29,6 @@ dependencies {testImplementation project(path: ':Generic', configuration: 'testArtifacts')testImplementation project(path: ':ProposedUtils', configuration: 'testArtifacts')testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')- testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts')testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')testImplementation project(path: ':Debugger', configuration: 'testArtifacts')testImplementation project(path: ':SystemEmulation', configuration: 'testArtifacts')diff --git a/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/trace/TaintTracePcodeEmulatorTest.java b/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/trace/TaintTracePcodeEmulatorTest.javaindex 2c6ab9547f..b8fef6dd3e 100644--- a/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/trace/TaintTracePcodeEmulatorTest.java+++ b/Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/trace/TaintTracePcodeEmulatorTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -27,9 +27,6 @@ import org.junit.Test;import db.Transaction;import ghidra.app.plugin.assembler.*;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.pcode.emu.PcodeThread;import ghidra.pcode.exec.PcodeExecutorStatePiece.Reason;import ghidra.pcode.exec.trace.AbstractTracePcodeEmulatorTest;@@ -47,7 +44,10 @@ import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.property.TracePropertyMap;import ghidra.trace.model.property.TracePropertyMapSpace;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceThread;public class TaintTracePcodeEmulatorTest extends AbstractTracePcodeEmulatorTest {@@ -309,7 +309,7 @@ public class TaintTracePcodeEmulatorTest extends AbstractTracePcodeEmulatorTestx64.addMappedRegisterRange();x64.addMappedRange(tb.addr(0x00000000), tb.addr(x64, 0x00400000), 0x10000);x64.addMappedRange(tb.addr(0x20000000), tb.addr(x64, 0x00600000), 0x10000);- objects.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0].Registers"))+ objects.createObject(KeyPath.parse("Targets[0].Threads[0].Registers")).insert(Lifespan.nowOn(0), ConflictResolution.DENY);// TODO: Make Sleigh work in the guest platformTraceMemorySpace regs = mm.getMemoryRegisterSpace(thread, 0, true);diff --git a/Ghidra/Framework/Pty/build.gradle b/Ghidra/Framework/Pty/build.gradleindex 5127baa5b0..d751ad129b 100644--- a/Ghidra/Framework/Pty/build.gradle+++ b/Ghidra/Framework/Pty/build.gradle@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -25,8 +25,9 @@ apply plugin: 'eclipse'eclipse.project.name = 'Framework Pty'dependencies {- api project(':Framework-Debugging')- api "com.jcraft:jsch:0.1.55"+ api "net.java.dev.jna:jna:5.14.0"+ api "net.java.dev.jna:jna-platform:5.14.0"+ api project(":Docking")- testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts')+ testImplementation project(":Generic")}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/PtyChild.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/PtyChild.javaindex 3cfe46edd3..09122351d8 100644--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/PtyChild.java+++ b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/PtyChild.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -62,6 +62,12 @@ public interface PtyChild extends PtyEndpoint {/*** @see #session(String[], Map, File, Collection)+ * @param args the image path and arguments+ * @param env the environment+ * @param workingDirectory the working directory+ * @param mode the terminal mode. If a mode is not implemented, it may be silently ignored.+ * @return a handle to the subprocess+ * @throws IOException if the session could not be started*/default PtySession session(String[] args, Map<String, String> env, File workingDirectory,TermMode... mode) throws IOException {@@ -70,6 +76,11 @@ public interface PtyChild extends PtyEndpoint {/*** @see #session(String[], Map, File, Collection)+ * @param args the image path and arguments+ * @param env the environment+ * @param mode the terminal mode. If a mode is not implemented, it may be silently ignored.+ * @return a handle to the subprocess+ * @throws IOException if the session could not be started*/default PtySession session(String[] args, Map<String, String> env, TermMode... mode)throws IOException {@@ -97,6 +108,10 @@ public interface PtyChild extends PtyEndpoint {/*** @see #nullSession(Collection)+ * @param mode the terminal mode. If a mode is not implemented, it may be silently ignored.+ * @return the file name+ * @throws IOException if the session could not be started or the pty name could not be+ * determined*/default String nullSession(TermMode... mode) throws IOException {return nullSession(List.of(mode));diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ShellUtils.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ShellUtils.javasimilarity index 93%rename from Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ShellUtils.javarename to Ghidra/Framework/Pty/src/main/java/ghidra/pty/ShellUtils.javaindex bad064ff55..9d853cc528 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/util/ShellUtils.java+++ b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ShellUtils.java@@ -13,17 +13,12 @@* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.util;+package ghidra.pty;import java.nio.file.Paths;import java.util.*;import java.util.stream.Collectors;-/**- * @deprecated This will be moved/refactored. In general, it will still exist, but things depending- * on it are now back on shifting sand.- */-@Deprecated(since = "11.2")public class ShellUtils {enum State {NORMAL, NORMAL_ESCAPE, DQUOTE, DQUOTE_ESCAPE, SQUOTE, SQUOTE_ESCAPE;@@ -144,7 +139,7 @@ public class ShellUtils {if (a.contains(" ")) {if (a.contains("\"")) {if (a.contains("'")) {- return "\"" + a.replace("\"", "\\\"") + "\"";+ return "\"" + a.replace("\"", "\\\"") + "\"";}return "'" + a + "'";}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/GhidraSshPtyFactory.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/GhidraSshPtyFactory.javadeleted file mode 100644index 1bf3bb12a7..0000000000--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/GhidraSshPtyFactory.java+++ /dev/null@@ -1,250 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.pty.ssh;--import java.io.IOException;-import java.util.Objects;-import java.util.concurrent.CancellationException;--import javax.swing.JOptionPane;--import org.apache.commons.text.StringEscapeUtils;--import com.jcraft.jsch.*;-import com.jcraft.jsch.ConfigRepository.Config;--import docking.DockingWindowManager;-import docking.widgets.PasswordDialog;-import ghidra.pty.PtyFactory;-import ghidra.util.Msg;-import ghidra.util.StringUtilities;--public class GhidraSshPtyFactory implements PtyFactory {- private static final String TITLE = "GDB via SSH";- private static final int WRAP_LEN = 80;-- public static final String DEFAULT_HOSTNAME = "localhost";- public static final int DEFAULT_PORT = 22;- public static final String DEFAULT_USERNAME = "user";- public static final String DEFAULT_CONFIG_FILE = "~/.ssh/config";-- private class RequireTTYAlwaysConfig implements Config {- private final Config delegate;-- public RequireTTYAlwaysConfig(Config delegate) {- this.delegate = delegate;-- }-- @Override- public String getHostname() {- return delegate.getHostname();- }-- @Override- public String getUser() {- return delegate.getUser();- }-- @Override- public int getPort() {- return delegate.getPort();- }-- @Override- public String getValue(String key) {- if ("RequestTTY".equals(key)) {- return "yes";- }- return delegate.getValue(key);- }-- @Override- public String[] getValues(String key) {- if ("RequestTTY".equals(key)) {- return new String[] { "yes" };- }- return delegate.getValues(key);- }- }-- private class RequireTTYAlwaysConfigRepo implements ConfigRepository {- private final ConfigRepository delegate;-- public RequireTTYAlwaysConfigRepo(ConfigRepository delegate) {- this.delegate = delegate;- }-- @Override- public Config getConfig(String host) {- if (delegate == null) {- return new RequireTTYAlwaysConfig(ConfigRepository.defaultConfig);- }- return new RequireTTYAlwaysConfig(delegate.getConfig(host));- }- }-- private class GhidraUserInfo implements UserInfo {- private String password;- private String passphrase;-- public String doPromptSecret(String prompt) {- PasswordDialog dialog =- new PasswordDialog(TITLE, "SSH", hostname, prompt, null, null);- DockingWindowManager.showDialog(dialog);- if (dialog.okWasPressed()) {- return new String(dialog.getPassword());- }- return null;- }-- public String html(String message) {- // TODO: I shouldn't have to do this. Why won't swing wrap?- String wrapped = StringUtilities.wrapToWidth(message, WRAP_LEN);- return "<html><pre>" + StringEscapeUtils.escapeHtml4(wrapped).replace("\n", "<br>");- }-- @Override- public String getPassphrase() {- return passphrase;- }-- @Override- public String getPassword() {- return password;- }-- @Override- public boolean promptPassword(String message) {- password = doPromptSecret(message);- return password != null;- }-- @Override- public boolean promptPassphrase(String message) {- passphrase = doPromptSecret(message);- return passphrase != null;- }-- @Override- public boolean promptYesNo(String message) {- return JOptionPane.showConfirmDialog(null, html(message), TITLE,- JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION;- }-- @Override- public void showMessage(String message) {- JOptionPane.showMessageDialog(null, html(message), TITLE,- JOptionPane.INFORMATION_MESSAGE);- }- }-- private String hostname = DEFAULT_HOSTNAME;- private int port = DEFAULT_PORT;- private String username = DEFAULT_USERNAME;- private String configFile = DEFAULT_CONFIG_FILE;-- private Session session;-- public String getHostname() {- return hostname;- }-- public void setHostname(String hostname) {- this.hostname = Objects.requireNonNull(hostname);- }-- public int getPort() {- return port;- }-- public void setPort(int port) {- this.port = port;- }-- public String getUsername() {- return username;- }-- public void setUsername(String username) {- this.username = Objects.requireNonNull(username);- }-- public String getConfigFile() {- return configFile;- }-- public void setConfigFile(String configFile) {- this.configFile = configFile;- }-- protected Session connectAndAuthenticate() throws IOException {- JSch jsch = new JSch();- ConfigRepository configRepo = null;- try {- configRepo = OpenSSHConfig.parseFile(configFile);- }- catch (IOException e) {- Msg.warn(this, "ssh config file " + configFile + " could not be parsed.");- // I guess the config file doesn't exist. Just go on- }- jsch.setConfigRepository(new RequireTTYAlwaysConfigRepo(configRepo));-- try {- Session session =- jsch.getSession(username.length() == 0 ? null : username, hostname, port);- session.setUserInfo(new GhidraUserInfo());- session.connect();- return session;- }- catch (JSchException e) {- String message = e.getMessage();- if (message.equals("Auth cancel")) {- Msg.error(this, "SSH connection canceled");- throw new CancellationException("SSH connection canceled");- }- else if (message.startsWith("reject HostKey")) {- String cancelMessage = "SSH " + message;- Msg.error(this, cancelMessage);- throw new CancellationException(cancelMessage);- }- Msg.error(this, "SSH connection error");- throw new IOException("SSH connection error", e);- }- }-- @Override- public SshPty openpty(short cols, short rows) throws IOException {- if (session == null) {- session = connectAndAuthenticate();- }- try {- SshPty pty = new SshPty((ChannelExec) session.openChannel("exec"));- if (cols != 0 && rows != 0) {- pty.getChild().setWindowSize(cols, rows);- }- return pty;- }- catch (JSchException e) {- throw new IOException("SSH connection error", e);- }- }-- @Override- public String getDescription() {- return "ssh:" + hostname + "(user=" + username + ",port=" + port + ")";- }-}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPty.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPty.javadeleted file mode 100644index d221b2f2ea..0000000000--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPty.java+++ /dev/null@@ -1,57 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.pty.ssh;--import java.io.*;--import com.jcraft.jsch.ChannelExec;-import com.jcraft.jsch.JSchException;--import ghidra.pty.*;--public class SshPty implements Pty {- private final ChannelExec channel;- private final OutputStream out;- private final InputStream in;-- private final SshPtyParent parent;- private final SshPtyChild child;-- public SshPty(ChannelExec channel) throws JSchException, IOException {- this.channel = channel;-- out = channel.getOutputStream();- in = channel.getInputStream();-- parent = new SshPtyParent(channel, out, in);- child = new SshPtyChild(channel, out, in);- }-- @Override- public PtyParent getParent() {- return parent;- }-- @Override- public PtyChild getChild() {- return child;- }-- @Override- public void close() throws IOException {- channel.disconnect();- }-}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyChild.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyChild.javadeleted file mode 100644index 488ec1bca4..0000000000--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyChild.java+++ /dev/null@@ -1,125 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.pty.ssh;--import java.io.*;-import java.util.*;-import java.util.stream.Collectors;--import com.jcraft.jsch.ChannelExec;-import com.jcraft.jsch.JSchException;--import ghidra.dbg.util.ShellUtils;-import ghidra.pty.PtyChild;-import ghidra.util.Msg;--public class SshPtyChild extends SshPtyEndpoint implements PtyChild {- private String name;-- public SshPtyChild(ChannelExec channel, OutputStream outputStream, InputStream inputStream) {- super(channel, outputStream, inputStream);- }-- private String sttyString(Collection<TermMode> mode) {- StringBuilder sb = new StringBuilder();- if (mode.contains(Echo.OFF)) {- sb.append("-echo ");- }- else if (mode.contains(Echo.ON)) {- sb.append("echo ");- }- if (sb.isEmpty()) {- return "";- }- return "stty " + sb + "&& ";- }-- @Override- public SshPtySession session(String[] args, Map<String, String> env, File workingDirectory,- Collection<TermMode> mode) throws IOException {- if (workingDirectory != null) {- throw new UnsupportedOperationException();- }- /**- * TODO: This syntax assumes a UNIX-style shell, and even among them, this may not be- * universal. This certainly works for my version of bash :)- */- String envStr = env == null- ? ""- : env.entrySet()- .stream()- .map(e -> e.getKey() + "=" + e.getValue())- .collect(Collectors.joining(" ")) +- " ";- String cmdStr = ShellUtils.generateLine(Arrays.asList(args));- channel.setCommand(sttyString(mode) + envStr + cmdStr);- try {- channel.connect();- }- catch (JSchException e) {- throw new IOException("SSH error", e);- }- return new SshPtySession(channel);- }-- private String getTtyNameAndStartNullSession(Collection<TermMode> mode) throws IOException {- // NB. UNIX sleep is only required to support integer durations- channel.setCommand(sttyString(mode) +- "sh -c 'tty && ctrlc() { echo; } && trap ctrlc INT && while true; do sleep " +- Integer.MAX_VALUE + "; done'");- try {- channel.connect();- }- catch (JSchException e) {- throw new IOException("SSH error", e);- }- byte[] buf = new byte[1024]; // Should be plenty- for (int i = 0; i < 1024; i++) {- int chr = inputStream.read();- if (chr == '\n' || chr == -1) {- return new String(buf, 0, i + 1, "UTF-8").trim();- }- buf[i] = (byte) chr;- }- throw new IOException("Expected pty name. Got " + new String(buf, 0, 1024, "UTF-8"));- }-- @Override- public String nullSession(Collection<TermMode> mode) throws IOException {- if (name == null) {- this.name = getTtyNameAndStartNullSession(mode);- if ("".equals(name)) {- throw new IOException("Could not determine child remote tty name");- }- }- Msg.debug(this, "Remote SSH pty: " + name);- return name;- }-- @Override- public InputStream getInputStream() {- throw new UnsupportedOperationException("The child is not local");- }-- @Override- public OutputStream getOutputStream() {- throw new UnsupportedOperationException("The child is not local");- }- @Override- public void setWindowSize(short cols, short rows) {- channel.setPtySize(Short.toUnsignedInt(cols), Short.toUnsignedInt(rows), 0, 0);- }-}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyEndpoint.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyEndpoint.javadeleted file mode 100644index d5521b1991..0000000000--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyEndpoint.java+++ /dev/null@@ -1,45 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.pty.ssh;--import java.io.InputStream;-import java.io.OutputStream;--import com.jcraft.jsch.ChannelExec;--import ghidra.pty.PtyEndpoint;--public class SshPtyEndpoint implements PtyEndpoint {- protected final ChannelExec channel;- protected final OutputStream outputStream;- protected final InputStream inputStream;-- public SshPtyEndpoint(ChannelExec channel, OutputStream outputStream, InputStream inputStream) {- this.channel = channel;- this.outputStream = outputStream;- this.inputStream = inputStream;- }-- @Override- public OutputStream getOutputStream() {- return outputStream;- }-- @Override- public InputStream getInputStream() {- return inputStream;- }-}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyParent.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyParent.javadeleted file mode 100644index 19a281aa5b..0000000000--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtyParent.java+++ /dev/null@@ -1,29 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.pty.ssh;--import java.io.InputStream;-import java.io.OutputStream;--import com.jcraft.jsch.ChannelExec;--import ghidra.pty.PtyParent;--public class SshPtyParent extends SshPtyEndpoint implements PtyParent {- public SshPtyParent(ChannelExec channel, OutputStream outputStream, InputStream inputStream) {- super(channel, outputStream, inputStream);- }-}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtySession.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtySession.javadeleted file mode 100644index 078ad4ef69..0000000000--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/ssh/SshPtySession.java+++ /dev/null@@ -1,80 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.pty.ssh;--import java.util.concurrent.TimeUnit;-import java.util.concurrent.TimeoutException;--import com.jcraft.jsch.*;--import ghidra.pty.PtySession;--public class SshPtySession implements PtySession {-- private final Channel channel;-- public SshPtySession(Channel channel) {- this.channel = channel;- }-- protected int doWaitExited(Long millis) throws InterruptedException, TimeoutException {- long startMs = System.currentTimeMillis();- // Doesn't look like there's a clever way to wait. So do the spin sleep :(- while (!channel.isEOF()) {- Thread.sleep(100);- long elapsed = System.currentTimeMillis() - startMs;- if (millis != null && elapsed > millis) {- throw new TimeoutException();- }- }- // NB. May not be available- return channel.getExitStatus();- }-- @Override- public int waitExited() throws InterruptedException {- try {- return doWaitExited(null);- }- catch (TimeoutException e) {- throw new AssertionError(e);- }- }-- @Override- public int waitExited(long timeout, TimeUnit unit)- throws InterruptedException, TimeoutException {- long millis = TimeUnit.MILLISECONDS.convert(timeout, unit);- return doWaitExited(millis);- }-- @Override- public void destroyForcibly() {- channel.disconnect();- }-- @Override- public String description() {- Session session;- try {- session = channel.getSession();- }- catch (JSchException e) {- return "ssh";- }- return "ssh " + session.getUserName() + "@" + session.getHost() + ":" + session.getPort();- }-}diff --git a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.java b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.javaindex 7c7cd83404..144b28af0e 100644--- a/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.java+++ b/Ghidra/Framework/Pty/src/main/java/ghidra/pty/windows/ConPtyChild.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -26,8 +26,8 @@ import com.sun.jna.platform.win32.WinBase.PROCESS_INFORMATION;import com.sun.jna.platform.win32.WinDef.*;import com.sun.jna.platform.win32.WinNT.HANDLE;-import ghidra.dbg.util.ShellUtils;import ghidra.pty.PtyChild;+import ghidra.pty.ShellUtils;import ghidra.pty.local.LocalWindowsNativeProcessPtySession;import ghidra.pty.windows.jna.ConsoleApiNative;import ghidra.pty.windows.jna.ConsoleApiNative.STARTUPINFOEX;diff --git a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/ssh/SshPtyTest.java b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/ssh/SshPtyTest.javadeleted file mode 100644index c62094ea0e..0000000000--- a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/ssh/SshPtyTest.java+++ /dev/null@@ -1,75 +0,0 @@-/* ###- * IP: GHIDRA- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package ghidra.pty.ssh;--import static org.junit.Assert.assertEquals;-import static org.junit.Assume.assumeFalse;--import java.io.*;--import org.junit.Before;-import org.junit.Test;--import ghidra.app.script.AskDialog;-import ghidra.pty.*;-import ghidra.pty.PtyChild.Echo;-import ghidra.test.AbstractGhidraHeadedIntegrationTest;-import ghidra.util.SystemUtilities;-import ghidra.util.exception.CancelledException;--public class SshPtyTest extends AbstractGhidraHeadedIntegrationTest {- protected GhidraSshPtyFactory factory;-- @Before- public void setupSshPtyTest() throws CancelledException {- assumeFalse(SystemUtilities.isInTestingBatchMode());- factory = new GhidraSshPtyFactory();- factory.setUsername(promptUser());- }-- public static String promptUser() throws CancelledException {- AskDialog<String> dialog = new AskDialog<>("SSH", "Username:", AskDialog.STRING, "");- if (dialog.isCanceled()) {- throw new CancelledException();- }- return dialog.getValueAsString();- }-- @Test- public void testSessionBash() throws IOException, InterruptedException {- try (Pty pty = factory.openpty()) {- PtySession bash = pty.getChild().session(new String[] { "bash" }, null);- OutputStream out = pty.getParent().getOutputStream();- out.write("exit\n".getBytes("UTF-8"));- out.flush();- new StreamPumper(pty.getParent().getInputStream(), System.out).start();- assertEquals(0, bash.waitExited());- }- }-- @Test- public void testDisableEcho() throws IOException, InterruptedException {- try (Pty pty = factory.openpty()) {- PtySession bash =- pty.getChild().session(new String[] { "bash" }, null, Echo.OFF);- OutputStream out = pty.getParent().getOutputStream();- out.write("exit\n".getBytes("UTF-8"));- out.flush();- new StreamPumper(pty.getParent().getInputStream(), System.out).start();- assertEquals(0, bash.waitExited());- }- }-}diff --git a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DummyProc.java b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/testutil/DummyProc.javasimilarity index 98%rename from Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DummyProc.javarename to Ghidra/Framework/Pty/src/test/java/ghidra/pty/testutil/DummyProc.javaindex 376014d77e..8db0ec9f54 100644--- a/Ghidra/Debug/Framework-Debugging/src/test/java/ghidra/dbg/testutil/DummyProc.java+++ b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/testutil/DummyProc.java@@ -4,16 +4,16 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/-package ghidra.dbg.testutil;+package ghidra.pty.testutil;import java.io.*;import java.util.List;diff --git a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/unix/AbstractUnixPtyTest.java b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/unix/AbstractUnixPtyTest.javaindex 6a5795aaec..ca64500e35 100644--- a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/unix/AbstractUnixPtyTest.java+++ b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/unix/AbstractUnixPtyTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -25,10 +25,10 @@ import java.util.concurrent.TimeoutException;import org.junit.Test;-import ghidra.dbg.testutil.DummyProc;import ghidra.pty.AbstractPtyTest;import ghidra.pty.PtyChild.Echo;import ghidra.pty.PtySession;+import ghidra.pty.testutil.DummyProc;public abstract class AbstractUnixPtyTest extends AbstractPtyTest {diff --git a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.java b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.javaindex 8aa509c61f..9fb6130572 100644--- a/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.java+++ b/Ghidra/Framework/Pty/src/test/java/ghidra/pty/windows/ConPtyTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -27,9 +27,9 @@ import org.junit.Test;import com.sun.jna.LastErrorException;-import ghidra.dbg.testutil.DummyProc;import ghidra.framework.OperatingSystem;import ghidra.pty.*;+import ghidra.pty.testutil.DummyProc;public class ConPtyTest extends AbstractPtyTest {diff --git a/Ghidra/Test/DebuggerIntegrationTest/build.gradle b/Ghidra/Test/DebuggerIntegrationTest/build.gradleindex ff13fb27f8..8b25efc3a0 100644--- a/Ghidra/Test/DebuggerIntegrationTest/build.gradle+++ b/Ghidra/Test/DebuggerIntegrationTest/build.gradle@@ -15,6 +15,7 @@*/apply from: "$rootProject.projectDir/gradle/javaProject.gradle"apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"+apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"apply plugin: 'eclipse'eclipse.project.name = '_Debugger Integration Test'@@ -26,11 +27,11 @@ eclipse.project.name = '_Debugger Integration Test'// There are tests in this module that require resources in Base:test. This// is a on-off type of situation so just add to the resources source set here.sourceSets {- integrationTest {- resources {- srcDirs += [project(':Base').sourceSets.test.resources]- }- }+ integrationTest {+ resources {+ srcDirs += [project(':Base').sourceSets.test.resources]+ }+ }}processIntegrationTestResources {@@ -67,7 +68,6 @@ dependencies {testImplementation project(path: ':ProposedUtils', configuration: 'testArtifacts')testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')- testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts')testImplementation project(path: ':Debugger', configuration: 'testArtifacts')testImplementation project(path: ':Debugger-rmi-trace', configuration: 'testArtifacts')}@@ -81,6 +81,36 @@ ext.addExports(['java.desktop/sun.java2d=ALL-UNNAMED'])+task testSpecimenWin_x86_64 {+ dependsOn 'expCreateProcessWin_x86_64Executable'+ dependsOn 'expCreateThreadExitWin_x86_64Executable'+ //dependsOn 'expCreateThreadSpinWin_x86_64Executable'+ dependsOn 'expPrintWin_x86_64Executable'+ //dependsOn 'expSpinWin_x86_64Executable'+ dependsOn 'expRegistersWin_x86_64Executable'+ dependsOn 'expStackWin_x86_64Executable'+}++task testSpecimenLinux_x86_64 {+ dependsOn 'expCloneExecExecutable'//Linux_x86_64Executable'+ dependsOn 'expCloneExitLinux_x86_64Executable'+ //dependsOn 'expCloneSpinExecutable'//Linux_x86_64Executable'+ dependsOn 'expForkExecutable'//Linux_x86_64Executable'+ dependsOn 'expPrintLinux_x86_64Executable'+ dependsOn 'expReadLinux_x86_64Executable'+ dependsOn 'expSpinLinux_x86_64Executable'+ dependsOn 'expRegistersLinux_x86_64Executable'+ dependsOn 'expStackLinux_x86_64Executable'+ dependsOn 'expTraceableSleepExecutable'//Linux_x86_64Executable'++ doLast {+ exec {+ workingDir "build/os/linux_x86_64"+ commandLine "strip", "-o", "expSpin.stripped", "expSpin"+ }+ }+}+integrationTest {dependsOn { project(':Debugger-rmi-trace').assemblePyPackage }dependsOn { project(':Debugger-agent-gdb').assemblePyPackage }@@ -88,12 +118,12 @@ integrationTest {dependsOn { project(':Debugger-agent-dbgeng').assemblePyPackage }if ("linux_x86_64".equals(getCurrentPlatformName())) {- dependsOn(":Framework-Debugging:testSpecimenLinux_x86_64")+ dependsOn("testSpecimenLinux_x86_64")}if ("mac_x86_64".equals(getCurrentPlatformName())) {- dependsOn(":Framework-Debugging:testSpecimenMac_x86_64")+ dependsOn("testSpecimenMac_x86_64")}if ("win_x86_64".equals(getCurrentPlatformName())) {- dependsOn(":Framework-Debugging:testSpecimenWin_x86_64")+ dependsOn("testSpecimenWin_x86_64")}}diff --git a/Ghidra/Debug/Framework-Debugging/src/expCloneExec/c/expCloneExec.c b/Ghidra/Test/DebuggerIntegrationTest/src/expCloneExec/c/expCloneExec.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expCloneExec/c/expCloneExec.crename to Ghidra/Test/DebuggerIntegrationTest/src/expCloneExec/c/expCloneExec.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expCloneExit/c/expCloneExit.c b/Ghidra/Test/DebuggerIntegrationTest/src/expCloneExit/c/expCloneExit.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expCloneExit/c/expCloneExit.crename to Ghidra/Test/DebuggerIntegrationTest/src/expCloneExit/c/expCloneExit.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expCloneSpin/c/expCloneSpin.c b/Ghidra/Test/DebuggerIntegrationTest/src/expCloneSpin/c/expCloneSpin.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expCloneSpin/c/expCloneSpin.crename to Ghidra/Test/DebuggerIntegrationTest/src/expCloneSpin/c/expCloneSpin.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expCreateProcess/c/expCreateProcess.c b/Ghidra/Test/DebuggerIntegrationTest/src/expCreateProcess/c/expCreateProcess.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expCreateProcess/c/expCreateProcess.crename to Ghidra/Test/DebuggerIntegrationTest/src/expCreateProcess/c/expCreateProcess.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expCreateThreadExit/c/expCreateThreadExit.c b/Ghidra/Test/DebuggerIntegrationTest/src/expCreateThreadExit/c/expCreateThreadExit.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expCreateThreadExit/c/expCreateThreadExit.crename to Ghidra/Test/DebuggerIntegrationTest/src/expCreateThreadExit/c/expCreateThreadExit.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expCreateThreadSpin/c/expCreateThreadSpin.c b/Ghidra/Test/DebuggerIntegrationTest/src/expCreateThreadSpin/c/expCreateThreadSpin.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expCreateThreadSpin/c/expCreateThreadSpin.crename to Ghidra/Test/DebuggerIntegrationTest/src/expCreateThreadSpin/c/expCreateThreadSpin.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expFork/c/expFork.c b/Ghidra/Test/DebuggerIntegrationTest/src/expFork/c/expFork.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expFork/c/expFork.crename to Ghidra/Test/DebuggerIntegrationTest/src/expFork/c/expFork.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expPrint/c/expPrint.c b/Ghidra/Test/DebuggerIntegrationTest/src/expPrint/c/expPrint.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expPrint/c/expPrint.crename to Ghidra/Test/DebuggerIntegrationTest/src/expPrint/c/expPrint.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expRead/c/expRead.c b/Ghidra/Test/DebuggerIntegrationTest/src/expRead/c/expRead.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expRead/c/expRead.crename to Ghidra/Test/DebuggerIntegrationTest/src/expRead/c/expRead.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expRegisters/c/expRegisters.c b/Ghidra/Test/DebuggerIntegrationTest/src/expRegisters/c/expRegisters.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expRegisters/c/expRegisters.crename to Ghidra/Test/DebuggerIntegrationTest/src/expRegisters/c/expRegisters.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expSpin/c/expSpin.c b/Ghidra/Test/DebuggerIntegrationTest/src/expSpin/c/expSpin.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expSpin/c/expSpin.crename to Ghidra/Test/DebuggerIntegrationTest/src/expSpin/c/expSpin.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expStack/c/expStack.c b/Ghidra/Test/DebuggerIntegrationTest/src/expStack/c/expStack.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expStack/c/expStack.crename to Ghidra/Test/DebuggerIntegrationTest/src/expStack/c/expStack.cdiff --git a/Ghidra/Debug/Framework-Debugging/src/expTraceableSleep/c/expTraceableSleep.c b/Ghidra/Test/DebuggerIntegrationTest/src/expTraceableSleep/c/expTraceableSleep.csimilarity index 100%rename from Ghidra/Debug/Framework-Debugging/src/expTraceableSleep/c/expTraceableSleep.crename to Ghidra/Test/DebuggerIntegrationTest/src/expTraceableSleep/c/expTraceableSleep.cdiff --git a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointMarkerPluginScreenShots.java b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointMarkerPluginScreenShots.javaindex 501f8f4a73..2dae502c33 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointMarkerPluginScreenShots.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/screen/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointMarkerPluginScreenShots.java@@ -61,7 +61,7 @@ import ghidra.trace.model.DefaultTraceLocation;import ghidra.trace.model.Lifespan;import ghidra.trace.model.breakpoint.TraceBreakpointKind;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.Msg;import ghidra.util.Swing;import ghidra.util.task.RunManager;@@ -109,8 +109,8 @@ public class DebuggerBreakpointMarkerPluginScreenShots extends GhidraScreenShotGprotected void placeBreakpoint(long index, Address dynAddr, boolean enabled) {try (Transaction tx = tb.startTransaction()) {- TraceObjectKeyPath pathSpec =- TraceObjectKeyPath.parse("Processes[1].Breakpoints").index(index);+ KeyPath pathSpec =+ KeyPath.parse("Processes[1].Breakpoints").index(index);DBTraceObject objBptSpec = tb.trace.getObjectManager().createObject(pathSpec);DBTraceObject objBptLoc = tb.trace.getObjectManager().createObject(pathSpec.index(1));objBptLoc.setAttribute(Lifespan.nowOn(0), "Range",diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.javaindex d6241d4359..105df7fc74 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/AbstractDbgEngTraceRmiTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -33,7 +33,6 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiPlugin;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;import ghidra.app.services.TraceRmiService;-import ghidra.dbg.testutil.DummyProc;import ghidra.debug.api.tracermi.*;import ghidra.framework.*;import ghidra.framework.main.ApplicationLevelOnlyPlugin;@@ -43,6 +42,7 @@ import ghidra.framework.plugintool.PluginsConfiguration;import ghidra.framework.plugintool.util.*;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRangeImpl;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.model.Lifespan;import ghidra.trace.model.breakpoint.TraceBreakpointKind;import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngCommandsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngCommandsTest.javaindex 61fe5c66b3..b3cfbf380c 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngCommandsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngCommandsTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -31,7 +31,6 @@ import org.junit.Test;import db.Transaction;import generic.Unique;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.TraceRmiAcceptor;import ghidra.debug.api.tracermi.TraceRmiConnection;import ghidra.framework.Application;@@ -48,6 +47,8 @@ import ghidra.trace.model.listing.TraceData;import ghidra.trace.model.memory.*;import ghidra.trace.model.modules.TraceModule;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.TraceSnapshot;import ghidra.util.Msg;@@ -427,7 +428,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {long snap = Unique.assertOne(tb.trace.getTimeManager().getAllSnapshots()).getKey();List<TraceObjectValue> regVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Registers"))+ PathFilter.parse("Processes[].Threads[].Registers")).map(p -> p.getLastEntry()).toList();TraceObjectValue tobj = regVals.get(0);@@ -474,7 +475,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {long snap = Unique.assertOne(tb.trace.getTimeManager().getAllSnapshots()).getKey();List<TraceObjectValue> regVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Registers"))+ PathFilter.parse("Processes[].Threads[].Registers")).map(p -> p.getLastEntry()).toList();TraceObjectValue tobj = regVals.get(0);@@ -503,7 +504,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/pydbg/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);String created = extractOutSection(out, "---Id---");long id = Long.parseLong(created.split("id=")[1].split(",")[0]);@@ -528,7 +529,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/pydbg/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.nowOn(0), life);@@ -555,7 +556,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/pydbg/notepad.exe")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.at(0), life);@@ -581,7 +582,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/pydbg/notepad.exe")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);TraceObjectValue value = object.getValue(0, "test");return value == null ? null : (T) value.getValue();@@ -735,7 +736,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/pydbg/notepad.exe")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);assertEquals(Map.ofEntries(Map.entry("[1]", Lifespan.nowOn(0)),@@ -766,7 +767,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/pydbg/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);assertEquals("1\tTest.Objects[1]", extractOutSection(out, "---GetObject---"));}@@ -926,7 +927,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());// Would be nice to control / validate the specificsCollection<TraceObject> processes = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Processes[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Processes[]")).map(p -> p.getDestination(null)).toList();assertEquals(0, processes.size());@@ -948,7 +949,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());// Would be nice to control / validate the specificsCollection<TraceObject> available = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Available[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Available[]")).map(p -> p.getDestination(null)).toList();assertThat(available.size(), greaterThan(2));@@ -974,7 +975,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Breakpoints[]"))+ PathFilter.parse("Processes[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -1012,7 +1013,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());List<TraceObjectValue> procBreakVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Breakpoints[]"))+ PathFilter.parse("Processes[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -1140,7 +1141,7 @@ public class DbgEngCommandsTest extends AbstractDbgEngTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> stack = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[0].Threads[0].Stack[]"))+ PathFilter.parse("Processes[0].Threads[0].Stack[]")).map(p -> p.getDestination(null)).toList();assertThat(stack.size(), greaterThan(2));diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngHooksTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngHooksTest.javaindex f143df3169..0e245b3f0e 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngHooksTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngHooksTest.java@@ -25,8 +25,6 @@ import org.junit.Ignore;import org.junit.Test;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.RemoteMethod;import ghidra.program.model.address.AddressSpace;import ghidra.trace.database.ToyDBTraceBuilder;@@ -35,6 +33,7 @@ import ghidra.trace.model.Trace;import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.memory.TraceMemoryState;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.*;import ghidra.trace.model.time.TraceSnapshot;public class DbgEngHooksTest extends AbstractDbgEngTraceRmiTest {@@ -164,15 +163,15 @@ public class DbgEngHooksTest extends AbstractDbgEngTraceRmiTest {if (object == null) {return null;}- PathPattern pat = PathPredicates.parse(pattern).getSingletonPattern();+ PathPattern pat = PathFilter.parse(pattern).getSingletonPattern();// if (pat.countWildcards() != 1) {// throw new IllegalArgumentException("Exactly one wildcard required");// }- List<String> path = object.getCanonicalPath().getKeyList();+ KeyPath path = object.getCanonicalPath();if (path.size() < pat.asPath().size()) {return null;}- List<String> matched = pat.matchKeys(path.subList(0, pat.asPath().size()));+ List<String> matched = pat.matchKeys(path, false);if (matched == null) {return null;}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngMethodsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngMethodsTest.javaindex f6decb6c61..f338c63664 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngMethodsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngMethodsTest.java@@ -25,12 +25,10 @@ import org.junit.Test;import generic.Unique;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.testutil.DummyProc;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.RemoteMethod;import ghidra.program.model.address.*;import ghidra.program.model.lang.RegisterValue;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;@@ -40,6 +38,8 @@ import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.modules.TraceModule;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.path.PathFilter;+import ghidra.trace.model.target.path.PathPattern;public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {@@ -88,7 +88,7 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Available[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Available[]")).map(p -> p.getDestination(null)).toList();assertThat(list.size(), greaterThan(2));@@ -116,7 +116,7 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Breakpoints[]"))+ PathFilter.parse("Processes[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -155,7 +155,7 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {List<TraceObjectValue> procBreakVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Breakpoints[]"))+ PathFilter.parse("Processes[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -199,7 +199,7 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Processes[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Processes[]")).map(p -> p.getDestination(null)).toList();assertEquals(1, list.size());@@ -269,7 +269,7 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Stack[]"))+ PathFilter.parse("Processes[].Threads[].Stack[]")).map(p -> p.getDestination(null)).toList();assertTrue(list.size() > 1);@@ -363,7 +363,7 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {txPut(conn, "threads");PathPattern pattern =- PathPredicates.parse("Processes[].Threads[]").getSingletonPattern();+ PathFilter.parse("Processes[].Threads[]").getSingletonPattern();List<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0), pattern).map(p -> p.getDestination(null))@@ -373,7 +373,7 @@ public class DbgEngMethodsTest extends AbstractDbgEngTraceRmiTest {for (TraceObject t : list) {activateThread.invoke(Map.of("thread", t));String out = conn.executeCapture("print(util.dbg.get_thread())").strip();- List<String> indices = pattern.matchKeys(t.getCanonicalPath().getKeyList());+ List<String> indices = pattern.matchKeys(t.getCanonicalPath(), true);assertEquals("%s".formatted(indices.get(1)), out);}}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/AbstractGdbTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/AbstractGdbTraceRmiTest.javaindex b6c5905d58..3e62dc151c 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/AbstractGdbTraceRmiTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/AbstractGdbTraceRmiTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -36,8 +36,6 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiPlugin;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;import ghidra.app.services.TraceRmiService;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.testutil.DummyProc;import ghidra.debug.api.tracermi.*;import ghidra.framework.*;import ghidra.framework.main.ApplicationLevelOnlyPlugin;@@ -47,9 +45,12 @@ import ghidra.framework.plugintool.PluginsConfiguration;import ghidra.framework.plugintool.util.*;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRangeImpl;+import ghidra.pty.testutil.DummyProc;+import ghidra.trace.model.TraceExecutionState;import ghidra.trace.model.breakpoint.TraceBreakpointKind;import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;import ghidra.util.Msg;import ghidra.util.NumericUtilities;@@ -330,8 +331,8 @@ public abstract class AbstractGdbTraceRmiTest extends AbstractGhidraHeadedDebuggreturn stdout;}- protected void waitState(int infnum, Supplier<Long> snapSupplier, TargetExecutionState state) {- TraceObjectKeyPath infPath = TraceObjectKeyPath.parse("Inferiors").index(infnum);+ protected void waitState(int infnum, Supplier<Long> snapSupplier, TraceExecutionState state) {+ KeyPath infPath = KeyPath.parse("Inferiors").index(infnum);TraceObject inf =Objects.requireNonNull(tb.trace.getObjectManager().getObjectByCanonicalPath(infPath));waitForPass(@@ -340,11 +341,11 @@ public abstract class AbstractGdbTraceRmiTest extends AbstractGhidraHeadedDebugg}protected void waitStopped() {- waitState(1, () -> 0L, TargetExecutionState.STOPPED);+ waitState(1, () -> 0L, TraceExecutionState.STOPPED);}protected void waitRunning() {- waitState(1, () -> 0L, TargetExecutionState.RUNNING);+ waitState(1, () -> 0L, TraceExecutionState.RUNNING);}protected String extractOutSection(String out, String head) {diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbCommandsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbCommandsTest.javaindex ddfff9e220..ad845f9731 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbCommandsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbCommandsTest.java@@ -32,8 +32,6 @@ import db.Transaction;import generic.Unique;import generic.test.category.NightlyCategory;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.testutil.DummyProc;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.TraceRmiAcceptor;import ghidra.debug.api.tracermi.TraceRmiConnection;import ghidra.framework.Application;@@ -42,6 +40,7 @@ import ghidra.program.model.address.*;import ghidra.program.model.data.Float10DataType;import ghidra.program.model.lang.RegisterValue;import ghidra.program.model.listing.CodeUnit;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.*;import ghidra.trace.model.breakpoint.TraceBreakpointKind;@@ -50,6 +49,8 @@ import ghidra.trace.model.listing.TraceData;import ghidra.trace.model.memory.*;import ghidra.trace.model.modules.TraceModule;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;import ghidra.trace.model.time.TraceSnapshot;import ghidra.util.Msg;@@ -546,7 +547,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);String created = extractOutSection(out, "---Id---");long id = Long.parseLong(created.split("id=")[1].split(",")[0]);@@ -571,7 +572,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.nowOn(0), life);@@ -597,7 +598,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.at(0), life);@@ -626,7 +627,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/expPrint")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);TraceObjectValue value = object.getValue(0, "test");return value == null ? null : (T) value.getValue();@@ -786,7 +787,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/bash")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);assertEquals(Map.ofEntries(Map.entry("[1]", Lifespan.nowOn(0)),@@ -817,7 +818,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/gdb/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);String getObject = extractOutSection(out, "---GetObject---");assertEquals("%d\tTest.Objects[1]".formatted(object.getKey()), getObject);@@ -982,7 +983,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());// Would be nice to control / validate the specificsCollection<TraceObject> inferiors = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Inferiors[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Inferiors[]")).map(p -> p.getDestination(null)).toList();assertEquals(2, inferiors.size());@@ -1005,7 +1006,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());// Would be nice to control / validate the specificsCollection<TraceObject> available = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Available[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Available[]")).map(p -> p.getDestination(null)).toList();assertThat(available.size(), greaterThan(2));@@ -1035,7 +1036,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());List<TraceObjectValue> infBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Inferiors[1].Breakpoints[]"))+ PathFilter.parse("Inferiors[1].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -1177,7 +1178,7 @@ public class GdbCommandsTest extends AbstractGdbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> stack = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Inferiors[1].Threads[1].Stack[]"))+ PathFilter.parse("Inferiors[1].Threads[1].Stack[]")).map(p -> p.getDestination(null)).toList();assertThat(stack.size(), greaterThan(2));diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbHooksTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbHooksTest.javaindex 05f334a169..26677a8c5c 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbHooksTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbHooksTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -28,15 +28,14 @@ import org.junit.experimental.categories.Category;import generic.test.category.NightlyCategory;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.testutil.DummyProc;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;import ghidra.program.model.address.AddressSpace;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.Trace;+import ghidra.trace.model.TraceExecutionState;import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.*;import ghidra.trace.model.time.TraceSnapshot;@Category(NightlyCategory.class) // this may actually be an @PortSensitive test@@ -91,15 +90,15 @@ public class GdbHooksTest extends AbstractGdbTraceRmiTest {if (object == null) {return null;}- PathPattern pat = PathPredicates.parse(pattern).getSingletonPattern();+ PathPattern pat = PathFilter.parse(pattern).getSingletonPattern();if (pat.countWildcards() != 1) {throw new IllegalArgumentException("Exactly one wildcard required");}- List<String> path = object.getCanonicalPath().getKeyList();+ KeyPath path = object.getCanonicalPath();if (path.size() < pat.asPath().size()) {return null;}- List<String> matched = pat.matchKeys(path.subList(0, pat.asPath().size()));+ List<String> matched = pat.matchKeys(path, false);if (matched == null) {return null;}@@ -353,7 +352,7 @@ public class GdbHooksTest extends AbstractGdbTraceRmiTest {RUN_TIMEOUT_MS, RETRY_MS);conn.execute("continue");- waitState(1, () -> lastSnap(conn), TargetExecutionState.TERMINATED);+ waitState(1, () -> lastSnap(conn), TraceExecutionState.TERMINATED);/*** Termination does not clear objfiles. Not until we run a new target.*/diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.javaindex aff703f2d2..2f1e851ecf 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbMethodsTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -30,15 +30,13 @@ import db.Transaction;import generic.Unique;import generic.test.category.NightlyCategory;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.testutil.DummyProc;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.RemoteMethod;import ghidra.pcode.utils.Utils;import ghidra.program.model.address.*;import ghidra.program.model.data.Float10DataType;import ghidra.program.model.lang.Register;import ghidra.program.model.lang.RegisterValue;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;@@ -50,6 +48,8 @@ import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.modules.TraceModule;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.path.PathFilter;+import ghidra.trace.model.target.path.PathPattern;@Category(NightlyCategory.class) // this may actually be an @PortSensitive testpublic class GdbMethodsTest extends AbstractGdbTraceRmiTest {@@ -93,7 +93,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Available[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Available[]")).map(p -> p.getDestination(null)).toList();assertThat(list.size(), greaterThan(2));@@ -126,7 +126,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {List<TraceObjectValue> infBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Inferiors[1].Breakpoints[]"))+ PathFilter.parse("Inferiors[1].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -181,7 +181,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {List<TraceObjectValue> infBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Inferiors[1].Breakpoints[]"))+ PathFilter.parse("Inferiors[1].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -226,7 +226,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Inferiors[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Inferiors[]")).map(p -> p.getDestination(null)).toList();assertEquals(2, list.size());@@ -304,7 +304,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Inferiors[1].Threads[1].Stack[]"))+ PathFilter.parse("Inferiors[1].Threads[1].Stack[]")).map(p -> p.getDestination(null)).toList();assertThat(list.size(), greaterThan(2));@@ -423,7 +423,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());List<TraceObject> list = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Inferiors[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Inferiors[]")).map(p -> p.getDestination(null)).toList();assertEquals(2, list.size());@@ -457,7 +457,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());PathPattern pattern =- PathPredicates.parse("Inferiors[].Threads[]").getSingletonPattern();+ PathFilter.parse("Inferiors[].Threads[]").getSingletonPattern();List<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0), pattern).map(p -> p.getDestination(null))@@ -467,7 +467,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {for (TraceObject t : list) {activateThread.invoke(Map.of("thread", t));String out = conn.executeCapture("thread");- List<String> indices = pattern.matchKeys(t.getCanonicalPath().getKeyList());+ List<String> indices = pattern.matchKeys(t.getCanonicalPath(), true);assertThat(out, containsString("Current thread is %s.%s".formatted(indices.get(0), indices.get(1))));}@@ -494,7 +494,7 @@ public class GdbMethodsTest extends AbstractGdbTraceRmiTest {List<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Inferiors[1].Threads[1].Stack[]"))+ PathFilter.parse("Inferiors[1].Threads[1].Stack[]")).map(p -> p.getDestination(null)).toList();assertThat(list.size(), greaterThan(2));diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/AbstractJavaTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/AbstractJavaTraceRmiTest.javaindex 9eb9ff8ff8..b40e33c755 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/AbstractJavaTraceRmiTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/AbstractJavaTraceRmiTest.java@@ -35,7 +35,6 @@ import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiPlugin;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;import ghidra.app.plugin.core.misc.RecoverySnapshotMgrPlugin;import ghidra.app.services.TraceRmiService;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.*;import ghidra.framework.Application;import ghidra.framework.main.ApplicationLevelOnlyPlugin;@@ -48,6 +47,7 @@ import ghidra.program.model.address.Address;import ghidra.trace.model.Lifespan;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.path.PathFilter;import ghidra.util.Msg;import junit.framework.AssertionFailedError;@@ -515,7 +515,7 @@ public abstract class AbstractJavaTraceRmiTest extends AbstractGhidraHeadedDebugprotected List<TraceObjectValue> getValues(String path) {return tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(getMaxSnap()), PathPredicates.parse(path))+ .getValuePaths(Lifespan.at(getMaxSnap()), PathFilter.parse(path)).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -550,7 +550,7 @@ public abstract class AbstractJavaTraceRmiTest extends AbstractGhidraHeadedDebugpublic static void assertMatches(String expectedPattern, TraceObject object) {assertTrue("Expected matches " + expectedPattern + " but was " +object.getCanonicalPath().toString(),- PathPredicates.parse(expectedPattern).matches(object.getCanonicalPath().getKeyList()));+ PathFilter.parse(expectedPattern).matches(object.getCanonicalPath()));}protected void waitForLocation(String clsName, String methodName, long codeIndex) {diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/JavaCommandsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/JavaCommandsTest.javaindex d51502b078..f3b04cee17 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/JavaCommandsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/java/rmi/JavaCommandsTest.java@@ -30,7 +30,6 @@ import org.junit.Test;import generic.Unique;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.TraceRmiAcceptor;import ghidra.debug.api.tracermi.TraceRmiConnection;import ghidra.framework.model.DomainFile;@@ -43,6 +42,8 @@ import ghidra.trace.model.*;import ghidra.trace.model.memory.*;import ghidra.trace.model.modules.TraceModule;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;import ghidra.trace.model.thread.TraceThread;import ghidra.trace.model.time.TraceSnapshot;import ghidra.util.Msg;@@ -393,7 +394,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {long snap = getLastSnapshot().getKey();List<TraceObjectValue> regVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(snap),- PathPredicates.parse("VMs[].Threads[main].Stack[0].Registers"))+ PathFilter.parse("VMs[].Threads[main].Stack[0].Registers")).map(p -> p.getLastEntry()).toList();TraceObjectValue tobj = regVals.get(0);@@ -426,7 +427,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {long snap = getLastSnapshot().getKey();List<TraceObjectValue> regVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(snap),- PathPredicates.parse("VMs[].Threads[main].Stack[0].Registers"))+ PathFilter.parse("VMs[].Threads[main].Stack[0].Registers")).map(p -> p.getLastEntry()).toList();TraceObjectValue tobj = regVals.get(0);@@ -453,7 +454,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/Test")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1].Bob"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1].Bob"));assertNotNull(object);assertEquals(4L, object.getKey());}@@ -476,7 +477,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/Test")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1].Bob"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1].Bob"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.nowOn(0), life);@@ -502,7 +503,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/Test")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.span(0, 1), life);@@ -528,7 +529,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());long snap = getLastSnapshot().getKey();TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);TraceObjectValue test = object.getValue(snap, "test");return test == null ? null : (T) test.getValue();@@ -628,7 +629,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());long snap = getLastSnapshot().getKey();TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("VMs"));+ .getObjectByCanonicalPath(KeyPath.parse("VMs"));assertNotNull(object);TraceObjectValue value = object.getValue(snap, "test");Address address = (Address) value.getValue();@@ -656,13 +657,13 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());long snap = getLastSnapshot().getKey();TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("VMs"));+ .getObjectByCanonicalPath(KeyPath.parse("VMs"));assertNotNull(object);TraceObjectValue value = object.getValue(snap, "test");TraceObject ret = (TraceObject) value.getValue();TraceObject orig = tb.trace.getObjectManager().getObjectByCanonicalPath(- TraceObjectKeyPath.parse("VMs[OpenJDK 64-Bit Server VM].Threads[main]"));+ KeyPath.parse("VMs[OpenJDK 64-Bit Server VM].Threads[main]"));assertNotNull(ret);assertEquals(orig, ret);}@@ -688,7 +689,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/Test")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);assertEquals(Map.ofEntries(Map.entry("[1]", Lifespan.nowOn(0)),@@ -722,7 +723,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/jdi/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);assertEquals("Test.Objects[1]", extractOutSection(out, "---GetObject---"));}@@ -850,7 +851,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());long snap = getLastSnapshot().getKey();Collection<TraceObject> vms = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(snap), PathPredicates.parse("VMs[]"))+ .getValuePaths(Lifespan.at(snap), PathFilter.parse("VMs[]")).map(p -> p.getDestination(null)).toList();assertEquals(1, vms.size());@@ -872,7 +873,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());long snap = getLastSnapshot().getKey();Collection<TraceObject> processes = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(snap), PathPredicates.parse("VMs[].Processes"))+ .getValuePaths(Lifespan.at(snap), PathFilter.parse("VMs[].Processes")).map(p -> p.getDestination(null)).toList();assertEquals(1, processes.size());@@ -944,7 +945,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {long snap = getLastSnapshot().getKey();List<TraceObject> stack = tb.trace.getObjectManager().getValuePaths(Lifespan.at(snap),- PathPredicates.parse("VMs[].Threads[main].Stack[]"))+ PathFilter.parse("VMs[].Threads[main].Stack[]")).map(p -> p.getDestination(null)).toList();assertEquals(1, stack.size());@@ -987,7 +988,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {long snap = getLastSnapshot().getKey();List<TraceObjectValue> events = tb.trace.getObjectManager().getValuePaths(Lifespan.at(snap),- PathPredicates.parse("VMs[].Events[]"))+ PathFilter.parse("VMs[].Events[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -1013,7 +1014,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {long snap = getLastSnapshot().getKey();List<TraceObjectValue> breaks = tb.trace.getObjectManager().getValuePaths(Lifespan.at(snap),- PathPredicates.parse("VMs[].Breakpoints[]"))+ PathFilter.parse("VMs[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -1047,7 +1048,7 @@ public class JavaCommandsTest extends AbstractJavaTraceRmiTest {long snap = getLastSnapshot().getKey();List<TraceObjectValue> breaks = tb.trace.getObjectManager().getValuePaths(Lifespan.at(snap),- PathPredicates.parse("VMs[].Breakpoints[]"))+ PathFilter.parse("VMs[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/AbstractLldbTraceRmiTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/AbstractLldbTraceRmiTest.javaindex 35b5f8287d..a6544e6ed1 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/AbstractLldbTraceRmiTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/AbstractLldbTraceRmiTest.java@@ -38,7 +38,6 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerTest;import ghidra.app.plugin.core.debug.service.tracermi.TraceRmiPlugin;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;import ghidra.app.services.TraceRmiService;-import ghidra.dbg.testutil.DummyProc;import ghidra.debug.api.tracermi.*;import ghidra.framework.*;import ghidra.framework.main.ApplicationLevelOnlyPlugin;@@ -49,6 +48,7 @@ import ghidra.framework.plugintool.util.*;import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressRangeImpl;import ghidra.pty.*;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.model.Lifespan;import ghidra.trace.model.breakpoint.TraceBreakpointKind;import ghidra.trace.model.breakpoint.TraceBreakpointKind.TraceBreakpointKindSet;diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbCommandsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbCommandsTest.javaindex 647549b825..fa8aad4626 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbCommandsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbCommandsTest.java@@ -34,7 +34,6 @@ import db.Transaction;import generic.Unique;import generic.test.category.NightlyCategory;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.TraceRmiAcceptor;import ghidra.debug.api.tracermi.TraceRmiConnection;import ghidra.framework.model.DomainFile;@@ -51,6 +50,8 @@ import ghidra.trace.model.listing.TraceData;import ghidra.trace.model.memory.*;import ghidra.trace.model.modules.TraceModule;import ghidra.trace.model.target.*;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.path.PathFilter;import ghidra.trace.model.time.TraceSnapshot;import ghidra.util.Msg;@@ -434,7 +435,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {long snap = Unique.assertOne(tb.trace.getTimeManager().getAllSnapshots()).getKey();List<TraceObjectValue> regVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Stack[].Registers"))+ PathFilter.parse("Processes[].Threads[].Stack[].Registers")).map(p -> p.getLastEntry()).toList();TraceObjectValue tobj = regVals.get(0);@@ -494,7 +495,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {long snap = Unique.assertOne(tb.trace.getTimeManager().getAllSnapshots()).getKey();List<TraceObjectValue> regVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Stack[].Registers"))+ PathFilter.parse("Processes[].Threads[].Stack[].Registers")).map(p -> p.getLastEntry()).toList();TraceObjectValue tobj = regVals.get(0);@@ -540,7 +541,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/lldb/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);String created = extractOutSection(out, "---Id---");long id = Long.parseLong(created.split("id=")[1].split(",")[0]);@@ -565,7 +566,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/lldb/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.nowOn(0), life);@@ -594,7 +595,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/lldb/expPrint")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);Lifespan life = Unique.assertOne(object.getLife().spans());assertEquals(Lifespan.at(0), life);@@ -622,7 +623,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/lldb/expPrint")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);TraceObjectValue value = object.getValue(0, "test");return value == null ? null : (T) value.getValue();@@ -812,7 +813,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/lldb/expPrint")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);assertEquals(Map.ofEntries(Map.entry("[1]", Lifespan.nowOn(0)),@@ -843,7 +844,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {try (ManagedDomainObject mdo = openDomainObject("/New Traces/lldb/noname")) {tb = new ToyDBTraceBuilder((Trace) mdo.get());TraceObject object = tb.trace.getObjectManager()- .getObjectByCanonicalPath(TraceObjectKeyPath.parse("Test.Objects[1]"));+ .getObjectByCanonicalPath(KeyPath.parse("Test.Objects[1]"));assertNotNull(object);String getObject = extractOutSection(out, "---GetObject---");assertEquals("%d\tTest.Objects[1]".formatted(object.getKey()), getObject);@@ -990,7 +991,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());// Would be nice to control / validate the specificsCollection<TraceObject> processes = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Processes[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Processes[]")).map(p -> p.getDestination(null)).toList();assertEquals(1, processes.size());@@ -1012,7 +1013,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());// Would be nice to control / validate the specificsCollection<TraceObject> available = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Available[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Available[]")).map(p -> p.getDestination(null)).toList();assertThat(available.size(), greaterThan(2));@@ -1039,7 +1040,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Breakpoints[]"))+ PathFilter.parse("Processes[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -1078,7 +1079,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {tb = new ToyDBTraceBuilder((Trace) mdo.get());List<TraceObjectValue> procWatchLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Watchpoints[]"))+ PathFilter.parse("Processes[].Watchpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -1221,7 +1222,7 @@ public class LldbCommandsTest extends AbstractLldbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> stack = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Stack[]"))+ PathFilter.parse("Processes[].Threads[].Stack[]")).map(p -> p.getDestination(null)).toList();assertThat(stack.size(), greaterThan(2));diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbHooksTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbHooksTest.javaindex c9d40f86ef..20a89a6098 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbHooksTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbHooksTest.java@@ -29,15 +29,14 @@ import org.junit.experimental.categories.Category;import generic.test.category.NightlyCategory;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.testutil.DummyProc;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;import ghidra.program.model.address.AddressSpace;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.target.TraceObject;+import ghidra.trace.model.target.path.*;import ghidra.trace.model.time.TraceSnapshot;@Category(NightlyCategory.class) // this may actually be an @PortSensitive test@@ -174,15 +173,15 @@ public class LldbHooksTest extends AbstractLldbTraceRmiTest {if (object == null) {return null;}- PathPattern pat = PathPredicates.parse(pattern).getSingletonPattern();+ PathPattern pat = PathFilter.parse(pattern).getSingletonPattern();// if (pat.countWildcards() != 1) {// throw new IllegalArgumentException("Exactly one wildcard required");// }- List<String> path = object.getCanonicalPath().getKeyList();+ KeyPath path = object.getCanonicalPath();if (path.size() < pat.asPath().size()) {return null;}- List<String> matched = pat.matchKeys(path.subList(0, pat.asPath().size()));+ List<String> matched = pat.matchKeys(path, false);if (matched == null) {return null;}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.javaindex c232d4b135..8eefcc7a4e 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbMethodsTest.java@@ -29,13 +29,11 @@ import org.junit.experimental.categories.Category;import generic.Unique;import generic.test.category.NightlyCategory;import ghidra.app.plugin.core.debug.utils.ManagedDomainObject;-import ghidra.dbg.testutil.DummyProc;-import ghidra.dbg.util.PathPattern;-import ghidra.dbg.util.PathPredicates;import ghidra.debug.api.tracermi.RemoteMethod;import ghidra.framework.OperatingSystem;import ghidra.program.model.address.*;import ghidra.program.model.lang.RegisterValue;+import ghidra.pty.testutil.DummyProc;import ghidra.trace.database.ToyDBTraceBuilder;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;@@ -45,6 +43,8 @@ import ghidra.trace.model.memory.TraceMemorySpace;import ghidra.trace.model.modules.TraceModule;import ghidra.trace.model.target.TraceObject;import ghidra.trace.model.target.TraceObjectValue;+import ghidra.trace.model.target.path.PathFilter;+import ghidra.trace.model.target.path.PathPattern;@Category(NightlyCategory.class) // this may actually be an @PortSensitive testpublic class LldbMethodsTest extends AbstractLldbTraceRmiTest {@@ -85,7 +85,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Available[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Available[]")).map(p -> p.getDestination(null)).toList();assertThat(list.size(), greaterThan(2));@@ -112,7 +112,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Breakpoints[]"))+ PathFilter.parse("Processes[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -152,7 +152,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {List<TraceObjectValue> procBreakLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Breakpoints[]"))+ PathFilter.parse("Processes[].Breakpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -192,7 +192,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {List<TraceObjectValue> procWatchLocVals = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Watchpoints[]"))+ PathFilter.parse("Processes[].Watchpoints[]")).map(p -> p.getLastEntry()).sorted(Comparator.comparing(TraceObjectValue::getEntryKey)).toList();@@ -236,7 +236,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager()- .getValuePaths(Lifespan.at(0), PathPredicates.parse("Processes[]"))+ .getValuePaths(Lifespan.at(0), PathFilter.parse("Processes[]")).map(p -> p.getDestination(null)).toList();assertEquals(1, list.size());@@ -308,7 +308,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {// Would be nice to control / validate the specificsList<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Stack[]"))+ PathFilter.parse("Processes[].Threads[].Stack[]")).map(p -> p.getDestination(null)).toList();assertTrue(list.size() > 1);@@ -411,7 +411,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {txPut(conn, "threads");PathPattern pattern =- PathPredicates.parse("Processes[].Threads[]").getSingletonPattern();+ PathFilter.parse("Processes[].Threads[]").getSingletonPattern();List<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0), pattern).map(p -> p.getDestination(null))@@ -421,7 +421,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {for (TraceObject t : list) {activateThread.invoke(Map.of("thread", t));String out = conn.executeCapture("thread info");- List<String> indices = pattern.matchKeys(t.getCanonicalPath().getKeyList());+ List<String> indices = pattern.matchKeys(t.getCanonicalPath(), true);long index = Long.decode(indices.get(1));assertThat(out, Matchers.either(containsString("tid = %s".formatted(index)))@@ -449,7 +449,7 @@ public class LldbMethodsTest extends AbstractLldbTraceRmiTest {List<TraceObject> list = tb.trace.getObjectManager().getValuePaths(Lifespan.at(0),- PathPredicates.parse("Processes[].Threads[].Stack[]"))+ PathFilter.parse("Processes[].Threads[].Stack[]")).map(p -> p.getDestination(null)).toList();//assertThat(list.size(), greaterThan(2));diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerIntegrationTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerIntegrationTest.javaindex cc72a91923..a78da09128 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerIntegrationTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerIntegrationTest.java@@ -33,8 +33,6 @@ import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiConnection;import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiConnection.*;import ghidra.app.services.DebuggerControlService;import ghidra.app.services.DebuggerTraceManagerService;-import ghidra.dbg.target.schema.*;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.debug.api.target.ActionName;import ghidra.pcode.utils.Utils;import ghidra.program.model.address.Address;@@ -46,6 +44,9 @@ import ghidra.trace.model.memory.TraceMemoryState;import ghidra.trace.model.stack.TraceObjectStackFrame;import ghidra.trace.model.target.*;import ghidra.trace.model.target.TraceObject.ConflictResolution;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.*;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.util.NumericUtilities;public class AbstractGhidraHeadedDebuggerIntegrationTest@@ -91,7 +92,6 @@ public class AbstractGhidraHeadedDebuggerIntegrationTest</schema><schema name='RegisterContainer' canonical='yes' elementResync='NEVER'attributeResync='ONCE'>- <interface name='RegisterBank' /><interface name='RegisterContainer' /><element schema='Register' /></schema>@@ -116,16 +116,14 @@ public class AbstractGhidraHeadedDebuggerIntegrationTest</schema><schema name='BreakpointContainer' canonical='yes' elementResync='NEVER'attributeResync='ONCE'>- <interface name='BreakpointSpecContainer' /><element schema='BreakpointSpec' /></schema><schema name='BreakpointSpec' canonical='yes' elementResync='NEVER'attributeResync='ONCE'><interface name='BreakpointSpec' />- <interface name='BreakpointLocationContainer' /><interface name='Togglable' /><element schema='BreakpointLoc' />- <attribute name='Kinds' schema='SET_BREAKPOINT_KIND' />+ <attribute name='Kinds' schema='STRING' /><attribute-alias from='_kinds' to='Kinds' /><attribute name='Expression' schema='STRING' /><attribute-alias from='_expr' to='Expression' />@@ -140,7 +138,7 @@ public class AbstractGhidraHeadedDebuggerIntegrationTest</schema></context>""");- public static final TargetObjectSchema SCHEMA_SESSION =+ public static final TraceObjectSchema SCHEMA_SESSION =SCHEMA_CTX.getSchema(new SchemaName("Session"));protected TestTraceRmiConnection rmiCx;@@ -188,10 +186,10 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestprotected void addExecuteMethod() {rmiMethodExecute = new TestRemoteMethod("execute", ActionName.EXECUTE, "Execute",- "Execut a CLI command", EnumerableTargetObjectSchema.STRING,- new TestRemoteParameter("cmd", EnumerableTargetObjectSchema.STRING, true, null,+ "Execut a CLI command", PrimitiveTraceObjectSchema.STRING,+ new TestRemoteParameter("cmd", PrimitiveTraceObjectSchema.STRING, true, null,"Command", "The command to execute"),- new TestRemoteParameter("to_string", EnumerableTargetObjectSchema.BOOL, true, false,+ new TestRemoteParameter("to_string", PrimitiveTraceObjectSchema.BOOL, true, false,"To String", "Capture output to string"));rmiCx.getMethods().add(rmiMethodExecute);@@ -200,19 +198,19 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestprotected void addActivateMethods() {rmiMethodActivateProcess =new TestRemoteMethod("activate_process", ActionName.ACTIVATE, "Activate Process",- "Activate a process", EnumerableTargetObjectSchema.VOID,+ "Activate a process", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process to activate"));rmiMethodActivateThread =new TestRemoteMethod("activate_thread", ActionName.ACTIVATE, "Activate Thread",- "Activate a thread", EnumerableTargetObjectSchema.VOID,+ "Activate a thread", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to activate"));rmiMethodActivateFrame =new TestRemoteMethod("activate_frame", ActionName.ACTIVATE, "Activate Frame",- "Activate a frame", EnumerableTargetObjectSchema.VOID,+ "Activate a frame", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("frame", new SchemaName("Frame"), true, null, "Frame","The frame to activate"));@@ -229,33 +227,33 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestprotected void addControlMethods() {rmiMethodResume = new TestRemoteMethod("resume", ActionName.RESUME, "Resume",- "Resume the target", EnumerableTargetObjectSchema.VOID,+ "Resume the target", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process to resume"));rmiMethodInterrupt = new TestRemoteMethod("interrupt", ActionName.INTERRUPT, "Interrupt",- "Interrupt the target", EnumerableTargetObjectSchema.VOID,+ "Interrupt the target", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process to interrupt"));rmiMethodKill = new TestRemoteMethod("kill", ActionName.KILL, "Kill",- "Kill the target", EnumerableTargetObjectSchema.VOID,+ "Kill the target", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process to kill"));rmiMethodStepInto = new TestRemoteMethod("step_into", ActionName.STEP_INTO, "Step Into",- "Step the thread, descending into subroutines", EnumerableTargetObjectSchema.VOID,+ "Step the thread, descending into subroutines", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to step"));rmiMethodStepOver = new TestRemoteMethod("step_over", ActionName.STEP_OVER, "Step Over","Step the thread, without descending into subroutines",- EnumerableTargetObjectSchema.VOID,+ PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to step"));rmiMethodStepOut = new TestRemoteMethod("step_out", ActionName.STEP_OUT, "Step Out",- "Allow the thread to finish the current subroutine", EnumerableTargetObjectSchema.VOID,+ "Allow the thread to finish the current subroutine", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to step"));@@ -271,50 +269,50 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestprotected void addBreakpointMethods() {rmiMethodSetHwBreak = new TestRemoteMethod("set_hw_break", ActionName.BREAK_HW_EXECUTE,"Hardware Breakpoint", "Place a hardware execution breakpoint",- EnumerableTargetObjectSchema.VOID,+ PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process in which to place the breakpoint"),- new TestRemoteParameter("address", EnumerableTargetObjectSchema.ADDRESS, true,+ new TestRemoteParameter("address", PrimitiveTraceObjectSchema.ADDRESS, true,null, "Address", "The desired address"));rmiMethodSetSwBreak = new TestRemoteMethod("set_sw_break", ActionName.BREAK_SW_EXECUTE,"Software Breakpoint", "Place a software execution breakpoint",- EnumerableTargetObjectSchema.VOID,+ PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process in which to place the breakpoint"),- new TestRemoteParameter("address", EnumerableTargetObjectSchema.ADDRESS, true,+ new TestRemoteParameter("address", PrimitiveTraceObjectSchema.ADDRESS, true,null, "Address", "The desired address"));rmiMethodSetReadBreak = new TestRemoteMethod("set_read_break", ActionName.BREAK_READ,- "Read Breakpoint", "Place a read breakpoint", EnumerableTargetObjectSchema.VOID,+ "Read Breakpoint", "Place a read breakpoint", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process in which to place the breakpoint"),- new TestRemoteParameter("range", EnumerableTargetObjectSchema.RANGE, true,+ new TestRemoteParameter("range", PrimitiveTraceObjectSchema.RANGE, true,null, "Range", "The desired address range"));rmiMethodSetWriteBreak = new TestRemoteMethod("set_write_break", ActionName.BREAK_WRITE,- "Write Breakpoint", "Place a write breakpoint", EnumerableTargetObjectSchema.VOID,+ "Write Breakpoint", "Place a write breakpoint", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process in which to place the breakpoint"),- new TestRemoteParameter("range", EnumerableTargetObjectSchema.RANGE, true,+ new TestRemoteParameter("range", PrimitiveTraceObjectSchema.RANGE, true,null, "Range", "The desired address range"));rmiMethodSetAccessBreak = new TestRemoteMethod("set_acc_break", ActionName.BREAK_ACCESS,- "Access Breakpoint", "Place an access breakpoint", EnumerableTargetObjectSchema.VOID,+ "Access Breakpoint", "Place an access breakpoint", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null, "Process","The process in which to place the breakpoint"),- new TestRemoteParameter("range", EnumerableTargetObjectSchema.RANGE, true,+ new TestRemoteParameter("range", PrimitiveTraceObjectSchema.RANGE, true,null, "Range", "The desired address range"));rmiMethodToggleBreak = new TestRemoteMethod("toggle_break", ActionName.TOGGLE,- "Toggle Breakpoint", "Toggle a breakpoint", EnumerableTargetObjectSchema.VOID,+ "Toggle Breakpoint", "Toggle a breakpoint", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("breakpoint", new SchemaName("BreakpointSpec"), true, null,"Breakpoint", "The breakpoint to toggle"),- new TestRemoteParameter("enabled", EnumerableTargetObjectSchema.BOOL, true,+ new TestRemoteParameter("enabled", PrimitiveTraceObjectSchema.BOOL, true,null, "Enable", "True to enable. False to disable"));rmiMethodDeleteBreak = new TestRemoteMethod("delete_break", ActionName.DELETE,- "Delete Breakpoint", "Delete a breakpoint", EnumerableTargetObjectSchema.VOID,+ "Delete Breakpoint", "Delete a breakpoint", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("breakpoint", new SchemaName("BreakpointSpec"), true, null,"Breakpoint", "The breakpoint to delete"));@@ -330,17 +328,17 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestprotected void addRegisterMethods() {rmiMethodReadRegs = new TestRemoteMethod("read_regs", ActionName.REFRESH, "Read Registers",- "Read registers", EnumerableTargetObjectSchema.VOID,+ "Read registers", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("container", new SchemaName("RegisterContainer"), true, null,"Registers", "The registers node to read"));rmiMethodWriteReg = new TestRemoteMethod("write_reg", ActionName.WRITE_REG,- "Write Register", "Write a register", EnumerableTargetObjectSchema.VOID,+ "Write Register", "Write a register", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("frame", new SchemaName("Frame"), false, 0, "Frame","The frame to write to"),- new TestRemoteParameter("name", EnumerableTargetObjectSchema.STRING, true,+ new TestRemoteParameter("name", PrimitiveTraceObjectSchema.STRING, true,null, "Register", "The name of the register to write"),- new TestRemoteParameter("value", EnumerableTargetObjectSchema.BYTE_ARR, true,+ new TestRemoteParameter("value", PrimitiveTraceObjectSchema.BYTE_ARR, true,null, "Value", "The desired value"));TestRemoteMethodRegistry reg = rmiCx.getMethods();@@ -370,19 +368,19 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestprotected void addMemoryMethods() {rmiMethodReadMem = new TestRemoteMethod("read_mem", ActionName.READ_MEM, "Read Memory",- "Read memory", EnumerableTargetObjectSchema.VOID,+ "Read memory", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null,"Process", "The process whose memory to read"),- new TestRemoteParameter("range", EnumerableTargetObjectSchema.RANGE, true, null,+ new TestRemoteParameter("range", PrimitiveTraceObjectSchema.RANGE, true, null,"Range", "The address range to read"));rmiMethodWriteMem = new TestRemoteMethod("write_mem", ActionName.WRITE_MEM, "Write Memory",- "Write memory", EnumerableTargetObjectSchema.VOID,+ "Write memory", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("process", new SchemaName("Process"), true, null,"Process", "The process whose memory to read"),- new TestRemoteParameter("start", EnumerableTargetObjectSchema.ADDRESS, true, null,+ new TestRemoteParameter("start", PrimitiveTraceObjectSchema.ADDRESS, true, null,"Start", "The address to start writing"),- new TestRemoteParameter("data", EnumerableTargetObjectSchema.BYTE_ARR, true, null,+ new TestRemoteParameter("data", PrimitiveTraceObjectSchema.BYTE_ARR, true, null,"Data", "The data to write"));TestRemoteMethodRegistry reg = rmiCx.getMethods();@@ -394,7 +392,7 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestAddressRange range, String name, String flags) {String pathStr ="Processes[1].Memory[0x%08x:%s]".formatted(range.getMinAddress().getOffset(), name);- TraceObject regionText = objs.createObject(TraceObjectKeyPath.parse(pathStr));+ TraceObject regionText = objs.createObject(KeyPath.parse(pathStr));regionText.setAttribute(lifespan, "_range", range);regionText.setAttribute(lifespan, "_readable", flags.contains("r"));regionText.setAttribute(lifespan, "_writable", flags.contains("w"));@@ -484,14 +482,14 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestprotected TraceObject ensureBreakpointContainer(TraceObjectManager objs) {try (Transaction tx = tb.startTransaction()) {- return objs.createObject(TraceObjectKeyPath.parse("Processes[1].Breakpoints"));+ return objs.createObject(KeyPath.parse("Processes[1].Breakpoints"));}}protected TraceObject findAndCreateFreeBreakpointSpec(TraceObjectManager objs) {- TraceObjectKeyPath brkConPath = TraceObjectKeyPath.parse("Processes[1].Breakpoints");+ KeyPath brkConPath = KeyPath.parse("Processes[1].Breakpoints");for (int i = 1; i < 10; i++) {- TraceObjectKeyPath path = brkConPath.index(i);+ KeyPath path = brkConPath.index(i);TraceObject exists = objs.getObjectByCanonicalPath(path);if (exists == null) {return objs.createObject(path);@@ -510,7 +508,7 @@ public class AbstractGhidraHeadedDebuggerIntegrationTestspec.setAttribute(lifespan, "_enabled", true);spec.insert(lifespan, ConflictResolution.DENY);- TraceObjectKeyPath specPath = spec.getCanonicalPath();+ KeyPath specPath = spec.getCanonicalPath();TraceObject loc = objs.createObject(specPath.index(0));loc.setAttribute(lifespan, "_display", specPath.index());loc.setAttribute(lifespan, "_range", range);diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.javaindex 938ed0ec30..7034132d41 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerControlPluginTest.java@@ -50,8 +50,6 @@ import ghidra.app.services.DebuggerControlService;import ghidra.app.services.DebuggerEmulationService;import ghidra.app.services.DebuggerEmulationService.CachedEmulator;import ghidra.app.services.DebuggerEmulationService.EmulationResult;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;-import ghidra.dbg.target.TargetSteppable.TargetStepKind;import ghidra.debug.api.control.ControlMode;import ghidra.pcode.exec.SuspendedPcodeExecutionException;import ghidra.program.model.address.Address;@@ -59,6 +57,7 @@ import ghidra.program.model.data.ShortDataType;import ghidra.program.model.listing.Instruction;import ghidra.program.util.ProgramLocation;import ghidra.trace.model.Lifespan;+import ghidra.trace.model.TraceExecutionState;import ghidra.trace.model.memory.TraceMemoryFlag;import ghidra.trace.model.program.TraceVariableSnapProgramView;import ghidra.trace.model.target.TraceObject;@@ -123,7 +122,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerIntegMap<String, Object> args = rmiMethodResume.expect();try (Transaction tx = tb.startTransaction()) {- proc1.setAttribute(Lifespan.nowOn(0), "_state", TargetExecutionState.RUNNING.name());+ proc1.setAttribute(Lifespan.nowOn(0), "_state", TraceExecutionState.RUNNING.name());}rmiMethodResume.result(null);assertEquals(Map.ofEntries(@@ -146,7 +145,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerIntegassertFalse(actionTargetInterrupt.isEnabled());try (Transaction tx = tb.startTransaction()) {- proc1.setAttribute(Lifespan.nowOn(0), "_state", TargetExecutionState.RUNNING.name());+ proc1.setAttribute(Lifespan.nowOn(0), "_state", TraceExecutionState.RUNNING.name());}waitForDomainObject(tb.trace);@@ -154,7 +153,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerIntegMap<String, Object> args = rmiMethodInterrupt.expect();try (Transaction tx = tb.startTransaction()) {- proc1.setAttribute(Lifespan.nowOn(0), "_state", TargetExecutionState.STOPPED.name());+ proc1.setAttribute(Lifespan.nowOn(0), "_state", TraceExecutionState.STOPPED.name());}rmiMethodInterrupt.result(null);assertEquals(Map.ofEntries(@@ -178,7 +177,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerIntegMap<String, Object> args = rmiMethodKill.expect();try (Transaction tx = tb.startTransaction()) {- proc1.setAttribute(Lifespan.nowOn(0), "_state", TargetExecutionState.TERMINATED.name());+ proc1.setAttribute(Lifespan.nowOn(0), "_state", TraceExecutionState.TERMINATED.name());}rmiMethodKill.result(null);assertEquals(Map.ofEntries(@@ -208,7 +207,7 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerInteg}protected void runTestRmiTargetStepAction(Supplier<DockingAction> actionSupplier,- TargetStepKind expected, Supplier<TestRemoteMethod> methodSupplier) throws Throwable {+ Supplier<TestRemoteMethod> methodSupplier) throws Throwable {setUpRmiTarget(); // method is created here, so we accept a supplierTraceObject thread1 = tb.obj("Processes[1].Threads[1]");traceManager.activateObject(thread1);@@ -235,19 +234,19 @@ public class DebuggerControlPluginTest extends AbstractGhidraHeadedDebuggerInteg@Testpublic void testRmiTargetStepIntoAction() throws Throwable {runTestRmiTargetStepAction(() -> controlPlugin.actionTargetStepInto,- TargetStepKind.INTO, () -> rmiMethodStepInto);+ () -> rmiMethodStepInto);}@Testpublic void testRmiTargetStepOverAction() throws Throwable {runTestRmiTargetStepAction(() -> controlPlugin.actionTargetStepOver,- TargetStepKind.OVER, () -> rmiMethodStepOver);+ () -> rmiMethodStepOver);}@Testpublic void testRmiTargetStepOutAction() throws Throwable {runTestRmiTargetStepAction(() -> controlPlugin.actionTargetStepOut,- TargetStepKind.FINISH, () -> rmiMethodStepOut);+ () -> rmiMethodStepOut);}TraceThread createToyLoopTrace() throws Throwable {diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerMethodActionsPluginTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerMethodActionsPluginTest.javaindex 2da6e82135..cd5590c358 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerMethodActionsPluginTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/control/DebuggerMethodActionsPluginTest.java@@ -31,10 +31,10 @@ import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;import ghidra.app.plugin.core.debug.service.tracermi.TestTraceRmiConnection.*;import ghidra.app.services.DebuggerStaticMappingService;-import ghidra.dbg.target.schema.EnumerableTargetObjectSchema;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;import ghidra.program.util.ProgramLocation;import ghidra.trace.model.Lifespan;+import ghidra.trace.model.target.schema.PrimitiveTraceObjectSchema;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebuggerIntegrationTest {DebuggerListingPlugin listingPlugin;@@ -58,36 +58,36 @@ public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebuggeTestRemoteMethodRegistry reg = rmiCx.getMethods();rmiMethodAdvance = new TestRemoteMethod("advance", null, "Advance",- "Advance to the given address", EnumerableTargetObjectSchema.VOID,+ "Advance to the given address", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to advance"),- new TestRemoteParameter("target", EnumerableTargetObjectSchema.ADDRESS, true, null,+ new TestRemoteParameter("target", PrimitiveTraceObjectSchema.ADDRESS, true, null,"Target", "The target address"));reg.add(rmiMethodAdvance);rmiMethodStepExt = new TestRemoteMethod("step_ext", null, "StepExt",- "Step in some special way", EnumerableTargetObjectSchema.VOID,+ "Step in some special way", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to step"));reg.add(rmiMethodStepExt);rmiMethodAdvanceWithFlag = new TestRemoteMethod("advance_flag", null, "Advance With Flag",- "Advance to the given address, with flag", EnumerableTargetObjectSchema.VOID,+ "Advance to the given address, with flag", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to advance"),- new TestRemoteParameter("target", EnumerableTargetObjectSchema.ADDRESS, true, null,+ new TestRemoteParameter("target", PrimitiveTraceObjectSchema.ADDRESS, true, null,"Target", "The target address"),- new TestRemoteParameter("flag", EnumerableTargetObjectSchema.BOOL, true, null,+ new TestRemoteParameter("flag", PrimitiveTraceObjectSchema.BOOL, true, null,"Flag", "The flag"));reg.add(rmiMethodAdvanceWithFlag);rmiMethodBetween = new TestRemoteMethod("between", null, "Between",- "Advance between two given addresses", EnumerableTargetObjectSchema.VOID,+ "Advance between two given addresses", PrimitiveTraceObjectSchema.VOID,new TestRemoteParameter("thread", new SchemaName("Thread"), true, null, "Thread","The thread to advance"),- new TestRemoteParameter("start", EnumerableTargetObjectSchema.ADDRESS, true, null,+ new TestRemoteParameter("start", PrimitiveTraceObjectSchema.ADDRESS, true, null,"Start", "The starting address"),- new TestRemoteParameter("end", EnumerableTargetObjectSchema.ADDRESS, true, null,+ new TestRemoteParameter("end", PrimitiveTraceObjectSchema.ADDRESS, true, null,"End", "The ending address"));reg.add(rmiMethodBetween);}diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchesProviderTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchesProviderTest.javaindex 092055c804..54ae229f0d 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchesProviderTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/watch/DebuggerWatchesProviderTest.java@@ -37,7 +37,6 @@ import ghidra.app.plugin.core.debug.gui.watch.DebuggerWatchesProvider.WatchDataSimport ghidra.app.plugin.core.debug.service.control.DebuggerControlServicePlugin;import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;import ghidra.app.services.DebuggerControlService;-import ghidra.dbg.model.TestTargetRegisterBankInThread;import ghidra.debug.api.control.ControlMode;import ghidra.docking.settings.FormatSettingsDefinition;import ghidra.docking.settings.Settings;@@ -82,8 +81,6 @@ public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerIntprotected Register r1;protected TraceObjectThread thread;- protected TestTargetRegisterBankInThread bank;-@Beforepublic void setUpWatchesProviderTest() throws Exception {// Do this before listing, because DebuggerListing also implements CodeViewerdiff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServiceTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServiceTest.javaindex 972664d80b..30a7b2295e 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServiceTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServiceTest.java@@ -28,9 +28,6 @@ import generic.test.category.NightlyCategory;import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerIntegrationTest;import ghidra.app.plugin.core.debug.service.control.DebuggerControlServicePlugin;import ghidra.app.services.DebuggerControlService;-import ghidra.dbg.target.schema.SchemaContext;-import ghidra.dbg.target.schema.TargetObjectSchema.SchemaName;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.control.ControlMode;import ghidra.debug.api.target.Target;import ghidra.debug.api.tracemgr.DebuggerCoordinates;@@ -40,7 +37,10 @@ import ghidra.trace.database.target.DBTraceObjectManagerTest;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.SchemaContext;+import ghidra.trace.model.target.schema.XmlSchemaContext;+import ghidra.trace.model.target.schema.TraceObjectSchema.SchemaName;import ghidra.trace.model.thread.TraceObjectThread;import ghidra.trace.model.thread.TraceThread;@@ -238,7 +238,7 @@ public class DebuggerTraceManagerServiceTest extends AbstractGhidraHeadedDebuggeDBTraceObjectManager objectManager = tb.trace.getObjectManager();objectManager.createRootObject(ctx.getSchema(new SchemaName("Session"))).getChild();objThread0 =- objectManager.createObject(TraceObjectKeyPath.parse("Targets[0].Threads[0]"));+ objectManager.createObject(KeyPath.parse("Targets[0].Threads[0]"));}// Manager listens for the root-created event to activate it. Wait for it to clear.waitForDomainObject(tb.trace);diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiPerformanceTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiPerformanceTest.javaindex ca251cb7dc..8e274b6043 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiPerformanceTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/tracermi/TraceRmiPerformanceTest.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -33,7 +33,6 @@ import generic.Unique;import generic.test.rule.Repeated;import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerIntegrationTest;import ghidra.app.services.TraceRmiService;-import ghidra.dbg.target.schema.XmlSchemaContext;import ghidra.debug.api.tracermi.TraceRmiAcceptor;import ghidra.debug.api.tracermi.TraceRmiConnection;import ghidra.framework.data.OpenMode;@@ -47,7 +46,8 @@ import ghidra.trace.database.target.DBTraceObject;import ghidra.trace.model.Lifespan;import ghidra.trace.model.Trace;import ghidra.trace.model.target.TraceObject.ConflictResolution;-import ghidra.trace.model.target.TraceObjectKeyPath;+import ghidra.trace.model.target.path.KeyPath;+import ghidra.trace.model.target.schema.XmlSchemaContext;import ghidra.util.LockHold;import ghidra.util.Msg;import ghidra.util.database.*;@@ -120,7 +120,7 @@ public class TraceRmiPerformanceTest extends AbstractGhidraHeadedDebuggerIntegra@Overridepublic void addRegion(String key, AddressRange range, String perms) {DBTraceObject region = tb.trace.getObjectManager()- .createObject(TraceObjectKeyPath.parse("Processes[0].Memory[" + key + "]"));+ .createObject(KeyPath.parse("Processes[0].Memory[" + key + "]"));region.setValue(Lifespan.nowOn(0), "Range", range);region.setValue(Lifespan.nowOn(0), "R", perms.contains("r"));region.setValue(Lifespan.nowOn(0), "W", perms.contains("w"));diff --git a/Ghidra/Test/IntegrationTest/build.gradle b/Ghidra/Test/IntegrationTest/build.gradleindex bb6bdc5e41..58487d1c04 100644--- a/Ghidra/Test/IntegrationTest/build.gradle+++ b/Ghidra/Test/IntegrationTest/build.gradle@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -65,7 +65,6 @@ dependencies {testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')- testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts')testImplementation project(path: ':Debugger', configuration: 'testArtifacts')}diff --git a/GhidraDocs/GhidraClass/Debugger/ghidra_scripts/ZeroTimerScript.java b/GhidraDocs/GhidraClass/Debugger/ghidra_scripts/ZeroTimerScript.javaindex a208618829..c958258858 100644--- a/GhidraDocs/GhidraClass/Debugger/ghidra_scripts/ZeroTimerScript.java+++ b/GhidraDocs/GhidraClass/Debugger/ghidra_scripts/ZeroTimerScript.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -21,13 +21,13 @@ import java.util.concurrent.TimeUnit;import java.util.concurrent.TimeoutException;import ghidra.app.script.GhidraScript;-import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;import ghidra.debug.api.breakpoint.LogicalBreakpoint;import ghidra.debug.flatapi.FlatDebuggerAPI;import ghidra.program.model.address.Address;import ghidra.program.model.listing.Function;import ghidra.program.model.symbol.Symbol;import ghidra.program.util.ProgramLocation;+import ghidra.trace.model.TraceExecutionState;import ghidra.trace.model.Trace;public class ZeroTimerScript extends GhidraScript implements FlatDebuggerAPI {@@ -89,7 +89,7 @@ public class ZeroTimerScript extends GhidraScript implements FlatDebuggerAPI {while (true) {monitor.checkCanceled();- TargetExecutionState execState = getExecutionState(trace);+ TraceExecutionState execState = getExecutionState(trace);switch (execState) {case STOPPED:resume();