Ghidra is a software reverse engineering (SRE) framework
GP-572: Schema implementation for dbgmodel. Some dbgeng fixes.
d-millarbdfeae4baf5a
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/iface2/DbgModelTargetBreakpointContainer.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/iface2/DbgModelTargetBreakpointContainer.javaindex 7d80dd29de..9fa88029eb 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/iface2/DbgModelTargetBreakpointContainer.java+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/iface2/DbgModelTargetBreakpointContainer.java@@ -19,9 +19,7 @@ import java.util.Set;import java.util.concurrent.CompletableFuture;import java.util.function.Function;-import agent.dbgeng.manager.DbgCause;import agent.dbgeng.manager.DbgEventsListenerAdapter;-import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;import agent.dbgeng.manager.breakpoint.DbgBreakpointType;import ghidra.async.AsyncFence;import ghidra.dbg.target.TargetBreakpointContainer;@@ -30,25 +28,25 @@ import ghidra.dbg.target.schema.*;import ghidra.program.model.address.AddressRange;@TargetObjectSchemaInfo(name = "BreakpointContainer", elements = {- @TargetElementType(type = DbgModelTargetBreakpointSpec.class)-}, attributes = {- @TargetAttributeType(type = Void.class)-}, canonicalContainer = true)+ @TargetElementType(type = DbgModelTargetBreakpointSpec.class) }, attributes = {+ @TargetAttributeType(type = Void.class) }, canonicalContainer = true)public interface DbgModelTargetBreakpointContainer extends DbgModelTargetObject,TargetBreakpointContainer<DbgModelTargetBreakpointContainer>, DbgEventsListenerAdapter {+ /*@Overridepublic void breakpointCreated(DbgBreakpointInfo info, DbgCause cause);-+@Overridepublic void breakpointModified(DbgBreakpointInfo newInfo, DbgBreakpointInfo oldInfo,DbgCause cause);-+@Overridepublic void breakpointDeleted(DbgBreakpointInfo info, DbgCause cause);-+@Overridepublic void breakpointHit(DbgBreakpointInfo info, DbgCause cause);+ */public default CompletableFuture<Void> doPlaceBreakpoint(Set<TargetBreakpointKind> kinds,Function<DbgBreakpointType, CompletableFuture<?>> placer) {diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/impl/DbgModelTargetBreakpointSpecImpl.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/impl/DbgModelTargetBreakpointSpecImpl.javaindex 018f9fd66b..939571288d 100644--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/impl/DbgModelTargetBreakpointSpecImpl.java+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/model/impl/DbgModelTargetBreakpointSpecImpl.java@@ -32,8 +32,12 @@ import ghidra.util.datastruct.ListenerSet;name = TargetBreakpointSpec.CONTAINER_ATTRIBUTE_NAME, //type = DbgModelTargetBreakpointContainerImpl.class), //@TargetAttributeType( //- name = TargetBreakpointLocation.SPEC_ATTRIBUTE_NAME, //- type = DbgModelTargetBreakpointSpecImpl.class), //+ name = TargetBreakpointLocation.SPEC_ATTRIBUTE_NAME, //+ type = DbgModelTargetBreakpointSpecImpl.class), //+ @TargetAttributeType(name = DbgModelTargetBreakpointSpecImpl.BPT_TYPE_ATTRIBUTE_NAME, type = String.class), //+ @TargetAttributeType(name = DbgModelTargetBreakpointSpecImpl.BPT_DISP_ATTRIBUTE_NAME, type = String.class), //+ @TargetAttributeType(name = DbgModelTargetBreakpointSpecImpl.BPT_PENDING_ATTRIBUTE_NAME, type = String.class), //+ @TargetAttributeType(name = DbgModelTargetBreakpointSpecImpl.BPT_TIMES_ATTRIBUTE_NAME, type = Integer.class), //@TargetAttributeType(type = Void.class) //}, canonicalContainer = true)public class DbgModelTargetBreakpointSpecImpl extends DbgModelTargetObjectImpldiff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/certification.manifest b/Ghidra/Debug/Debugger-agent-dbgmodel/certification.manifestindex fc6bcc9c98..294a1fa195 100644--- a/Ghidra/Debug/Debugger-agent-dbgmodel/certification.manifest+++ b/Ghidra/Debug/Debugger-agent-dbgmodel/certification.manifest@@ -6,3 +6,4 @@ Module.manifest||GHIDRA||||END|build.gradle||GHIDRA||||END|src/javaprovider/def/javaprovider.def||GHIDRA||||END|src/javaprovider/rc/javaprovider.rc||GHIDRA||||END|+sxrc/main/resources/agent/dbgmodel/model/impl/dbgmodel_schema.xml||GHIDRA||||END|diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2Impl.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2Impl.javaindex e24fcdacdd..2a1c0d1cac 100644--- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2Impl.java+++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2Impl.java@@ -18,11 +18,16 @@ package agent.dbgmodel.model.impl;import java.io.IOException;import java.util.concurrent.CompletableFuture;+import org.jdom.JDOMException;+import agent.dbgeng.manager.impl.DbgManagerImpl;import agent.dbgeng.model.AbstractDbgModel;import agent.dbgeng.model.iface2.DbgModelTargetSession;import agent.dbgmodel.manager.DbgManager2Impl;import ghidra.dbg.target.TargetObject;+import ghidra.dbg.target.schema.TargetObjectSchema;+import ghidra.dbg.target.schema.XmlSchemaContext;+import ghidra.framework.Application;import ghidra.program.model.address.*;public class DbgModel2Impl extends AbstractDbgModel {@@ -30,7 +35,22 @@ public class DbgModel2Impl extends AbstractDbgModel {// The model must convert to and from Ghidra's address space namesprotected static final String SPACE_NAME = "ram";- // Don't make this static, so each model has a unique "GDB" space+ public static final XmlSchemaContext SCHEMA_CTX;+ public static final TargetObjectSchema ROOT_SCHEMA;+ static {+ try {+ //SCHEMA_CTX =+ // XmlSchemaContext.deserialize(ResourceManager.getResourceAsStream("dbgmodel.xml"));+ SCHEMA_CTX = XmlSchemaContext+ .deserialize(DbgModel2Impl.class.getResourceAsStream("dbgmodel_schema.xml"));+ ROOT_SCHEMA = SCHEMA_CTX.getSchema(SCHEMA_CTX.name("Debugger"));+ }+ catch (IOException | JDOMException e) {+ throw new AssertionError(e);+ }+ }++ // Don't make this static, so each model has a unique "ram" spaceprotected final AddressSpace space =new GenericAddressSpace(SPACE_NAME, 64, AddressSpace.TYPE_RAM, 0);protected final AddressFactory addressFactory =@@ -44,7 +64,8 @@ public class DbgModel2Impl extends AbstractDbgModel {public DbgModel2Impl() {this.dbg = new DbgManager2Impl();- this.root = new DbgModel2TargetRootImpl(this, null);+ //System.out.println(XmlSchemaContext.serialize(SCHEMA_CTX));+ this.root = new DbgModel2TargetRootImpl(this, ROOT_SCHEMA);this.completedRoot = CompletableFuture.completedFuture(root);}@@ -77,6 +98,11 @@ public class DbgModel2Impl extends AbstractDbgModel {dbg.terminate();}+ @Override+ public TargetObjectSchema getRootSchema() {+ return root.getSchema();+ }+@Overridepublic CompletableFuture<? extends TargetObject> fetchModelRoot() {return completedRoot;diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2TargetRootImpl.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2TargetRootImpl.javaindex 392379ac16..e3886196ce 100644--- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2TargetRootImpl.java+++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DbgModel2TargetRootImpl.java@@ -484,7 +484,7 @@ public class DbgModel2TargetRootImpl extends DbgModel2DefaultTargetModelRootif (map == null) {return;}- setAttributes(List.of(), map, "Refreshed");+ changeAttributes(List.of(), map, "Refreshed");});}diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DelegateDbgModel2TargetObject.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DelegateDbgModel2TargetObject.javaindex 90e9a971ef..8905cf4c71 100644--- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DelegateDbgModel2TargetObject.java+++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/model/impl/DelegateDbgModel2TargetObject.java@@ -139,6 +139,8 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl impList<Class<? extends TargetObject>> mixins = new ArrayList<>();String lkey = key;String pname = parent.getName();++ /*if (object.getKind().equals(ModelObjectKind.OBJECT_METHOD) || lkey.contains(")")) {mixins.add(DbgModelTargetMethod.class);// NB: We're passing the parent's mixin model to the method on the assumption@@ -147,9 +149,16 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl implkey = pname;pname = "";}- Class<? extends DbgModelTargetObject> mixin = lookupWrapperType(lkey, pname);- if (mixin != null) {- mixins.add(mixin);+ */++ if (object.getKind().equals(ModelObjectKind.OBJECT_METHOD)) {+ mixins.add(DbgModelTargetMethod.class);+ }+ else {+ Class<? extends DbgModelTargetObject> mixin = lookupWrapperType(lkey, pname);+ if (mixin != null) {+ mixins.add(mixin);+ }}return new DelegateDbgModel2TargetObject(model, parent, key, object, mixins).proxy;}diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/sxrc/main/resources/agent/dbgmodel/model/impl/dbgmodel_schema.xml b/Ghidra/Debug/Debugger-agent-dbgmodel/sxrc/main/resources/agent/dbgmodel/model/impl/dbgmodel_schema.xmlnew file mode 100644index 0000000000..2e52b324cc--- /dev/null+++ b/Ghidra/Debug/Debugger-agent-dbgmodel/sxrc/main/resources/agent/dbgmodel/model/impl/dbgmodel_schema.xml@@ -0,0 +1,555 @@+<?xml version="1.0" ?>+<context>+ <schema name="Debugger">+ <interface name="Access" />+ <interface name="Attacher" />+ <interface name="EventScope" />+ <interface name="Launcher" />+ <interface name="FocusScope" />+ <interface name="Aggregate" />+ <element schema="VOID" />+ <attribute name="_accessible" 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="_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="_supported_attach_kinds" schema="SET_ATTACH_KIND" required="yes" hidden="yes" />+ <attribute name="_event_process" schema="STRING" hidden="yes" />+ <attribute name="_event_thread" schema="STRING" hidden="yes" />+ <attribute name="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" />+ <attribute name="_focus" schema="OBJECT" required="yes" hidden="yes" />+ <attribute name="_system" schema="OBJECT" hidden="yes" />+ <attribute name="Available" schema="AvailableContainer" required="yes" fixed="yes" />+ <attribute name="Connectors" schema="ConnectorContainer" required="yes" fixed="yes" />+ <attribute name="Sessions" schema="SessionContainer" required="yes" fixed="yes" />+ <attribute name="Settings" schema="OBJECT" />+ <attribute name="State" schema="OBJECT" />+ <attribute name="Utility" schema="OBJECT" />+ <attribute schema="VOID" />+ </schema>+ <schema name="SessionContainer" canonical="yes">+ <element schema="Session" />+ <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="VOID" />+ </schema>+ <schema name="ConnectorContainer" canonical="yes">+ <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="Launch process" schema="ProcessLaunchConnector" required="yes" fixed="yes" />+ <attribute name="Attach to process" schema="ProcessAttachConnector" required="yes" fixed="yes" />+ <attribute name="Load trace/dump" schema="TraceOrDumpConnector" required="yes" fixed="yes" />+ <attribute name="Attach to kernel" schema="KernelConnector" required="yes" fixed="yes" />+ <attribute schema="VOID" />+ </schema>+ <schema name="AvailableContainer" canonical="yes">+ <element schema="Available" />+ <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="VOID" />+ </schema>+ <schema name="KernelConnector">+ <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="_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="VOID" />+ </schema>+ <schema name="ProcessAttachConnector">+ <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="_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="VOID" />+ </schema>+ <schema name="ProcessLaunchConnector">+ <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="_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="VOID" />+ </schema>+ <schema name="TraceOrDumpConnector">+ <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="_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="VOID" />+ </schema>+ <schema name="Session">+ <interface name="Aggregate" />+ <interface name="Access" />+ <interface name="ExecutionStateful" />+ <interface name="Interpreter" />+ <interface name="Interruptible" />+ <interface name="Resumable" />+ <element schema="VOID" />+ <attribute name="_accessible" 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="_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="_state" schema="EXECUTION_STATE" required="yes" hidden="yes" />+ <attribute name="_prompt" schema="STRING" required="yes" hidden="yes" />+ <attribute name="Attributes" schema="SessionAttributes" fixed="yes" />+ <attribute name="Devices" schema="OBJECT" />+ <attribute name="Processes" schema="ProcessContainer" required="yes" fixed="yes" />+ <attribute schema="VOID" />+ </schema>+ <schema name="Available">+ <interface name="Attachable" />+ <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="_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="VOID" />+ </schema>+ <schema name="SessionAttributes">+ <interface name="Environment" />+ <element schema="VOID" />+ <attribute name="_os" schema="STRING" hidden="yes" />+ <attribute name="_debugger" schema="STRING" hidden="yes" />+ <attribute name="_endian" schema="STRING" hidden="yes" />+ <attribute name="_arch" 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="_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="Machine" schema="SessionAttributesMachine" fixed="yes" />+ <attribute name="Target" schema="OBJECT" />+ <attribute schema="VOID" />+ </schema>+ <schema name="ProcessContainer" canonical="yes">+ <interface name="EventScope" />+ <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="_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="VOID" />+ </schema>+ <schema name="SessionAttributesMachine">+ <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="_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="Arch" schema="STRING" />+ <attribute name="Debugger" schema="STRING" />+ <attribute name="OS" schema="STRING" />+ <attribute name="Mode" schema="STRING" />+ <attribute schema="VOID" />+ </schema>+ <schema name="Process">+ <interface name="Aggregate" />+ <interface name="Process" />+ <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" />+ <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="_state" schema="EXECUTION_STATE" required="yes" 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="_parameters" schema="MAP_PARAMETERS" required="yes" fixed="yes" hidden="yes" />+ <attribute name="_supported_step_kinds" schema="SET_STEP_KIND" required="yes" fixed="yes" hidden="yes" />+ <attribute name="Debug" schema="DebugContainer" required="yes" fixed="yes" />+ <attribute name="Memory" schema="Memory" required="yes" fixed="yes" />+ <attribute name="Modules" schema="ModuleContainer" 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="STRING" />+ <attribute schema="VOID" />+ </schema>+ <schema name="Memory" canonical="yes">+ <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="_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="VOID" />+ </schema>+ <schema name="ModuleContainer" canonical="yes">+ <interface name="ModuleContainer" />+ <interface name="EventScope" />+ <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="_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="VOID" />+ </schema>+ <schema name="DebugContainer" canonical="yes">+ <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="yes" />+ <attribute schema="VOID" />+ </schema>+ <schema name="ThreadContainer" canonical="yes">+ <interface name="EventScope" />+ <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="_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="VOID" />+ </schema>+ <schema name="MemoryRegion">+ <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="_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="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">+ <interface name="Thread" />+ <interface name="Access" />+ <interface name="ExecutionStateful" />+ <interface name="Steppable" />+ <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="_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="_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="Registers" schema="RegisterContainer" required="yes" fixed="yes" />+ <attribute name="Stack" schema="Stack" required="yes" fixed="yes" />+ <attribute name="Environment" schema="OBJECT" />+ <attribute name="Id" schema="OBJECT" />+ <attribute name="Name" schema="STRING" />+ <attribute name="_arch" schema="STRING" />+ <attribute schema="VOID" />+ </schema>+ <schema name="Module">+ <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="_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="Symbols" schema="SymbolContainer" required="yes" fixed="yes" />+ <attribute name="BaseAddress" schema="ADDRESS" />+ <attribute name="ImageName" schema="STRING" />+ <attribute name="TimeStamp" schema="INT" />+ <attribute name="Len" schema="STRING" />+ <attribute schema="VOID" />+ </schema>+ <schema name="BreakpointContainer" canonical="yes">+ <interface name="BreakpointContainer" />+ <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" />+ <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="VOID" />+ </schema>+ <schema name="SymbolContainer" canonical="yes">+ <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="VOID" />+ </schema>+ <schema name="RegisterContainer" canonical="yes">+ <interface name="RegisterContainer" />+ <element schema="VOID" />+ <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="_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="FloatingPoint" schema="OBJECT" />+ <attribute name="Kernel" schema="OBJECT" />+ <attribute name="SIMD" schema="OBJECT" />+ <attribute name="User" schema="RegisterBank" />+ <attribute name="VFP" schema="OBJECT" />+ <attribute schema="VOID" />+ </schema>+ <schema name="RegisterBank">+ <interface name="RegisterBank" />+ <element schema="VOID" />+ <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="_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="OBJECT" />+ </schema>+ <schema name="Stack" canonical="yes">+ <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="_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="VOID" />+ </schema>+ <schema name="BreakpointSpec" canonical="yes">+ <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="BreakpointSpec" />+ <attribute name="_length" schema="INT" hidden="yes" />+ <attribute name="_address" 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="_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="Type" schema="STRING" />+ <attribute name="Disposition" schema="STRING" />+ <attribute name="Pending" schema="STRING" />+ <attribute name="Times" schema="INT" />+ <attribute schema="VOID" />+ </schema>+ <schema name="StackFrame">+ <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="_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="Attributes" schema="StackFrameAttributes" />+ <attribute schema="VOID" />+ </schema>+ <schema name="StackFrameAttributes">+ <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="_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="FrameNumber" schema="STRING" />+ <attribute name="FrameOffset" schema="STRING" />+ <attribute name="FuncTableEntry" schema="STRING" />+ <attribute name="InstructionOffset" schema="STRING" />+ <attribute name="ReturnOffset" schema="STRING" />+ <attribute name="StackOffset" schema="STRING" />+ <attribute name="Virtual" schema="STRING" />+ <attribute schema="VOID" />+ </schema>+ <schema name="Symbol">+ <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="RegisterDescriptor">+ <interface name="Register" />+ <element schema="VOID" />+ <attribute name="_length" schema="INT" required="yes" 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" hidden="yes" />+ <attribute name="_type" schema="STRING" hidden="yes" />+ <attribute name="_order" schema="INT" hidden="yes" />+ <attribute schema="VOID" />+ </schema>+</context>diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/ObjectContainer.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/ObjectContainer.javaindex 406a5ca403..df02f50ca2 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/ObjectContainer.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/ObjectContainer.java@@ -409,6 +409,100 @@ public class ObjectContainer implements Comparable {return result;}+ /*+ public void toXmlSchema(Element root) {+ Element element = this.toXmlSchema();+ root.addContent(element);++ for (ObjectContainer child : getCurrentChildren()) {+ String key = child.getShortName();+ if (attributeMap.containsKey(key)) {+ if (!(child.targetObject instanceof DummyTargetObject)) {+ child.toXmlSchema(root);+ }+ }+ }+ for (ObjectContainer child : getCurrentChildren()) {+ if (elementMap.containsValue(child.targetObject)) {+ child.toXmlSchema(root);+ break;+ }+ }+ }++ public Element toXmlSchema() {+ String name = getPrefixedName();+ if (name == null) {+ name = provider.getRoot().getName();+ }+ name = sanitize(name);+ Element result = new Element("schema");+ XmlUtilities.setStringAttr(result, "name", name);+ for (ObjectContainer child : getCurrentChildren()) {+ String key = child.getShortName();+ if (attributeMap.containsKey(key)) {+ Element n = new Element("attribute");+ String typeHint = null;+ if (child.targetObject != null) {+ typeHint = child.targetObject.getTypeHint();+ }+ XmlUtilities.setStringAttr(n, "name", key);+ if (typeHint != null) {+ XmlUtilities.setStringAttr(n, "schema", typeHint);+ }+ if (key.startsWith("_")) {+ XmlUtilities.setStringAttr(n, "hidden", "yes");+ }+ result.addContent(n);+ }+ }+ if (elementMap.isEmpty()) {+ Element n = new Element("element");+ XmlUtilities.setStringAttr(n, "schema", "VOID");+ result.addContent(n);+ }+ else {+ for (ObjectContainer child : getCurrentChildren()) {+ if (elementMap.containsValue(child.targetObject)) {+ Element n = new Element("element");+ String typeHint = null;+ if (child.targetObject != null) {+ typeHint = child.targetObject.getTypeHint();+ }+ XmlUtilities.setStringAttr(n, "name", child.getName());+ if (typeHint != null) {+ Element ifc = new Element("interface");+ try {+ XmlUtilities.setStringAttr(n, "name", sanitize(typeHint));+ }+ catch (Exception e) {+ //do nothing+ }+ result.addContent(ifc);+ }+ result.addContent(n);+ break;+ }+ }+ }+ Element n = new Element("attribute");+ XmlUtilities.setStringAttr(n, "schema", "VOID");+ result.addContent(n);+ return result;+ }++ private String sanitize(String name) {+ name = name.replaceAll(" ", "_");+ name = name.replaceAll("/", "_");+ if (name.contains("[")) {+ name = name.replaceAll("\\[", "_");+ name = name.replaceAll("\\]", "");+ name = name.replaceAll("/", "_");+ }+ return name;+ }+ */+public boolean isImmutable() {return immutable;}@@ -502,4 +596,5 @@ public class ObjectContainer implements Comparable {}return this.hashCode() - that.hashCode();}+}diff --git a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/XmlSchemaContext.java b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/XmlSchemaContext.javaindex 7192ebef91..8475d81506 100644--- a/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/XmlSchemaContext.java+++ b/Ghidra/Debug/Framework-Debugging/src/main/java/ghidra/dbg/target/schema/XmlSchemaContext.java@@ -15,8 +15,7 @@*/package ghidra.dbg.target.schema;-import java.io.ByteArrayInputStream;-import java.io.IOException;+import java.io.*;import java.util.*;import org.jdom.*;@@ -82,8 +81,7 @@ public class XmlSchemaContext extends DefaultSchemaContext {XmlUtilities.setStringAttr(result, "name", schema.getName().toString());for (Class<? extends TargetObject> iface : schema.getInterfaces()) {Element ifElem = new Element("interface");- XmlUtilities.setStringAttr(ifElem, "name",- DebuggerObjectModel.requireIfaceName(iface));+ XmlUtilities.setStringAttr(ifElem, "name", DebuggerObjectModel.requireIfaceName(iface));result.addContent(ifElem);}@@ -98,8 +96,7 @@ public class XmlSchemaContext extends DefaultSchemaContext {result.addContent(elemElem);}Element deElem = new Element("element");- XmlUtilities.setStringAttr(deElem, "schema",- schema.getDefaultElementSchema().toString());+ XmlUtilities.setStringAttr(deElem, "schema", schema.getDefaultElementSchema().toString());result.addContent(deElem);for (AttributeSchema as : schema.getAttributeSchemas().values()) {@@ -119,15 +116,23 @@ public class XmlSchemaContext extends DefaultSchemaContext {public static XmlSchemaContext deserialize(byte[] xml) throws JDOMException {try {- SAXBuilder sb = XmlUtilities.createSecureSAXBuilder(false, false);- Document doc = sb.build(new ByteArrayInputStream(xml));- return contextFromXml(doc.getRootElement());+ return deserialize(new ByteArrayInputStream(xml));}catch (IOException e) {throw new AssertionError(e);}}+ public static XmlSchemaContext deserialize(File file) throws JDOMException, IOException {+ return deserialize(new FileInputStream(file));+ }++ public static XmlSchemaContext deserialize(InputStream is) throws JDOMException, IOException {+ SAXBuilder sb = XmlUtilities.createSecureSAXBuilder(false, false);+ Document doc = sb.build(Objects.requireNonNull(is));+ return contextFromXml(doc.getRootElement());+ }+public static XmlSchemaContext contextFromXml(Element contextElem) {XmlSchemaContext ctx = new XmlSchemaContext();for (Element schemaElem : XmlUtilities.getChildren(contextElem, "schema")) {