diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/DbgEngUtil.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/DbgEngUtil.java index 429a63e862..7ce3e51094 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/DbgEngUtil.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/DbgEngUtil.java @@ -16,10 +16,12 @@ package agent.dbgeng.impl.dbgeng; import java.lang.reflect.Method; +import java.util.List; import java.util.Map; import java.util.function.Function; import com.sun.jna.Pointer; +import com.sun.jna.platform.win32.Guid.IID; import com.sun.jna.platform.win32.Guid.REFIID; import com.sun.jna.platform.win32.WinDef.ULONG; import com.sun.jna.platform.win32.WinNT.HRESULT; @@ -35,28 +37,33 @@ public abstract class DbgEngUtil { private DbgEngUtil() { } + public record Preferred (REFIID refiid, Class cls) { + public Preferred(IID iid, Class cls) { + this(new REFIID(iid), cls); + } + } + public static interface InterfaceSupplier { HRESULT get(REFIID refiid, PointerByReference pClient); } @SuppressWarnings("unchecked") - public static I tryPreferredInterfaces(Class cls, - Map> preferred, InterfaceSupplier supplier) { + public static I tryPreferredInterfaces(Class cls, List> preferred, + InterfaceSupplier supplier) { PointerByReference ppClient = new PointerByReference(); - for (Map.Entry> ent : preferred.entrySet()) { + for (Preferred pref : preferred) { try { - COMUtils.checkRC(supplier.get(ent.getKey(), ppClient)); + COMUtils.checkRC(supplier.get(pref.refiid, ppClient)); if (ppClient.getValue() == null) { continue; } - Object impl = - ent.getValue().getConstructor(Pointer.class).newInstance(ppClient.getValue()); - Method instanceFor = cls.getMethod("instanceFor", ent.getValue()); + T impl = pref.cls.getConstructor(Pointer.class).newInstance(ppClient.getValue()); + Method instanceFor = cls.getMethod("instanceFor", pref.cls); Object instance = instanceFor.invoke(null, impl); return (I) instance; } catch (COMException e) { - Msg.debug(DbgEngUtil.class, e + " (" + ent.getValue() + ")"); + Msg.debug(DbgEngUtil.class, e + " (" + pref.cls + ")"); // TODO: Only try next on E_NOINTERFACE? // Try next } diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/advanced/DebugAdvancedInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/advanced/DebugAdvancedInternal.java index 2609b6d72d..a5e50594d2 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/advanced/DebugAdvancedInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/advanced/DebugAdvancedInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgeng.impl.dbgeng.advanced; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.DebugAdvanced; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.jna.dbgeng.advanced.*; import ghidra.comm.util.BitmaskUniverse; import ghidra.util.datastruct.WeakValueHashMap; @@ -42,11 +43,10 @@ public interface DebugAdvancedInternal extends DebugAdvanced { return DbgEngUtil.lazyWeakCache(CACHE, advanced, DebugAdvancedImpl3::new); } - Map> PREFERRED_ADVANCED_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugAdvanced3.IID_IDEBUG_ADVANCED3), WrapIDebugAdvanced3.class), - Map.entry(new REFIID(IDebugAdvanced2.IID_IDEBUG_ADVANCED2), WrapIDebugAdvanced2.class), - Map.entry(new REFIID(IDebugAdvanced.IID_IDEBUG_ADVANCED), WrapIDebugAdvanced.class)); + List> PREFERRED_ADVANCED_IIDS = List.of( + new Preferred<>(IDebugAdvanced3.IID_IDEBUG_ADVANCED3, WrapIDebugAdvanced3.class), + new Preferred<>(IDebugAdvanced2.IID_IDEBUG_ADVANCED2, WrapIDebugAdvanced2.class), + new Preferred<>(IDebugAdvanced.IID_IDEBUG_ADVANCED, WrapIDebugAdvanced.class)); static DebugAdvancedInternal tryPreferredInterfaces(InterfaceSupplier supplier) { return DbgEngUtil.tryPreferredInterfaces(DebugAdvancedInternal.class, diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/breakpoint/DebugBreakpointInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/breakpoint/DebugBreakpointInternal.java index 9578f9e28f..6ed0dbb4d2 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/breakpoint/DebugBreakpointInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/breakpoint/DebugBreakpointInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgeng.impl.dbgeng.breakpoint; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.DebugBreakpoint; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.impl.dbgeng.control.DebugControlInternal; import agent.dbgeng.jna.dbgeng.breakpoint.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -42,14 +43,10 @@ public interface DebugBreakpointInternal extends DebugBreakpoint { return DbgEngUtil.lazyWeakCache(CACHE, bp, DebugBreakpointImpl3::new); } - Map> PREFERRED_BREAKPOINT_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugBreakpoint3.IID_IDEBUG_BREAKPOINT3), - WrapIDebugBreakpoint3.class), - Map.entry(new REFIID(IDebugBreakpoint2.IID_IDEBUG_BREAKPOINT2), - WrapIDebugBreakpoint2.class), - Map.entry(new REFIID(IDebugBreakpoint.IID_IDEBUG_BREAKPOINT), - WrapIDebugBreakpoint.class)); + List> PREFERRED_BREAKPOINT_IIDS = List.of( + new Preferred<>(IDebugBreakpoint3.IID_IDEBUG_BREAKPOINT3, WrapIDebugBreakpoint3.class), + new Preferred<>(IDebugBreakpoint2.IID_IDEBUG_BREAKPOINT2, WrapIDebugBreakpoint2.class), + new Preferred<>(IDebugBreakpoint.IID_IDEBUG_BREAKPOINT, WrapIDebugBreakpoint.class)); static DebugBreakpointInternal tryPreferredInterfaces(DebugControlInternal control, InterfaceSupplier supplier) { diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/client/DebugClientInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/client/DebugClientInternal.java index db60176a9e..2ac51026b6 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/client/DebugClientInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/client/DebugClientInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgeng.impl.dbgeng.client; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.DebugClient; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.impl.dbgeng.control.DebugControlInternal; import agent.dbgeng.jna.dbgeng.client.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -66,15 +67,14 @@ public interface DebugClientInternal extends DebugClient { return DbgEngUtil.lazyWeakCache(CACHE, client, DebugClientImpl7::new); } - Map> PREFERRED_CLIENT_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugClient7.IID_IDEBUG_CLIENT7), WrapIDebugClient7.class), - Map.entry(new REFIID(IDebugClient6.IID_IDEBUG_CLIENT6), WrapIDebugClient6.class), - Map.entry(new REFIID(IDebugClient5.IID_IDEBUG_CLIENT5), WrapIDebugClient5.class), - Map.entry(new REFIID(IDebugClient4.IID_IDEBUG_CLIENT4), WrapIDebugClient4.class), - Map.entry(new REFIID(IDebugClient3.IID_IDEBUG_CLIENT3), WrapIDebugClient3.class), - Map.entry(new REFIID(IDebugClient2.IID_IDEBUG_CLIENT2), WrapIDebugClient2.class), - Map.entry(new REFIID(IDebugClient.IID_IDEBUG_CLIENT), WrapIDebugClient.class)); + List> PREFERRED_CLIENT_IIDS = List.of( + new Preferred<>(IDebugClient7.IID_IDEBUG_CLIENT7, WrapIDebugClient7.class), + new Preferred<>(IDebugClient6.IID_IDEBUG_CLIENT6, WrapIDebugClient6.class), + new Preferred<>(IDebugClient5.IID_IDEBUG_CLIENT5, WrapIDebugClient5.class), + new Preferred<>(IDebugClient4.IID_IDEBUG_CLIENT4, WrapIDebugClient4.class), + new Preferred<>(IDebugClient3.IID_IDEBUG_CLIENT3, WrapIDebugClient3.class), + new Preferred<>(IDebugClient2.IID_IDEBUG_CLIENT2, WrapIDebugClient2.class), + new Preferred<>(IDebugClient.IID_IDEBUG_CLIENT, WrapIDebugClient.class)); static DebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) { return DbgEngUtil.tryPreferredInterfaces(DebugClientInternal.class, PREFERRED_CLIENT_IIDS, diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/control/DebugControlInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/control/DebugControlInternal.java index bd635b1910..bd23831d68 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/control/DebugControlInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/control/DebugControlInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgeng.impl.dbgeng.control; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.DebugControl; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.jna.dbgeng.breakpoint.IDebugBreakpoint; import agent.dbgeng.jna.dbgeng.control.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -58,15 +59,14 @@ public interface DebugControlInternal extends DebugControl { return DbgEngUtil.lazyWeakCache(CACHE, control, DebugControlImpl7::new); } - Map> PREFERRED_CONTROL_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugControl7.IID_IDEBUG_CONTROL7), WrapIDebugControl7.class), - Map.entry(new REFIID(IDebugControl6.IID_IDEBUG_CONTROL6), WrapIDebugControl6.class), - Map.entry(new REFIID(IDebugControl5.IID_IDEBUG_CONTROL5), WrapIDebugControl5.class), - Map.entry(new REFIID(IDebugControl4.IID_IDEBUG_CONTROL4), WrapIDebugControl4.class), - Map.entry(new REFIID(IDebugControl3.IID_IDEBUG_CONTROL3), WrapIDebugControl3.class), - Map.entry(new REFIID(IDebugControl2.IID_IDEBUG_CONTROL2), WrapIDebugControl2.class), - Map.entry(new REFIID(IDebugControl.IID_IDEBUG_CONTROL), WrapIDebugControl.class)); + List> PREFERRED_CONTROL_IIDS = List.of( + new Preferred<>(IDebugControl7.IID_IDEBUG_CONTROL7, WrapIDebugControl7.class), + new Preferred<>(IDebugControl6.IID_IDEBUG_CONTROL6, WrapIDebugControl6.class), + new Preferred<>(IDebugControl5.IID_IDEBUG_CONTROL5, WrapIDebugControl5.class), + new Preferred<>(IDebugControl4.IID_IDEBUG_CONTROL4, WrapIDebugControl4.class), + new Preferred<>(IDebugControl3.IID_IDEBUG_CONTROL3, WrapIDebugControl3.class), + new Preferred<>(IDebugControl2.IID_IDEBUG_CONTROL2, WrapIDebugControl2.class), + new Preferred<>(IDebugControl.IID_IDEBUG_CONTROL, WrapIDebugControl.class)); static DebugControlInternal tryPreferredInterfaces(InterfaceSupplier supplier) { return DbgEngUtil.tryPreferredInterfaces(DebugControlInternal.class, PREFERRED_CONTROL_IIDS, diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/dataspaces/DebugDataSpacesInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/dataspaces/DebugDataSpacesInternal.java index 69bb9fdb42..deeac27a78 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/dataspaces/DebugDataSpacesInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/dataspaces/DebugDataSpacesInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgeng.impl.dbgeng.dataspaces; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.DebugDataSpaces; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.jna.dbgeng.dataspaces.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -45,16 +46,11 @@ public interface DebugDataSpacesInternal extends DebugDataSpaces { return DbgEngUtil.lazyWeakCache(CACHE, data, DebugDataSpacesImpl4::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugDataSpaces4.IID_IDEBUG_DATA_SPACES4), - WrapIDebugDataSpaces4.class), - Map.entry(new REFIID(IDebugDataSpaces3.IID_IDEBUG_DATA_SPACES3), - WrapIDebugDataSpaces3.class), - Map.entry(new REFIID(IDebugDataSpaces2.IID_IDEBUG_DATA_SPACES2), - WrapIDebugDataSpaces2.class), - Map.entry(new REFIID(IDebugDataSpaces.IID_IDEBUG_DATA_SPACES), - WrapIDebugDataSpaces.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugDataSpaces4.IID_IDEBUG_DATA_SPACES4, WrapIDebugDataSpaces4.class), + new Preferred<>(IDebugDataSpaces3.IID_IDEBUG_DATA_SPACES3, WrapIDebugDataSpaces3.class), + new Preferred<>(IDebugDataSpaces2.IID_IDEBUG_DATA_SPACES2, WrapIDebugDataSpaces2.class), + new Preferred<>(IDebugDataSpaces.IID_IDEBUG_DATA_SPACES, WrapIDebugDataSpaces.class)); static DebugDataSpacesInternal tryPreferredInterfaces(InterfaceSupplier supplier) { return DbgEngUtil.tryPreferredInterfaces(DebugDataSpacesInternal.class, diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/registers/DebugRegistersInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/registers/DebugRegistersInternal.java index fafe9cdd91..8aaf42b5ac 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/registers/DebugRegistersInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/registers/DebugRegistersInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgeng.impl.dbgeng.registers; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.DebugRegisters; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.jna.dbgeng.registers.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -37,12 +38,9 @@ public interface DebugRegistersInternal extends DebugRegisters { return DbgEngUtil.lazyWeakCache(CACHE, registers, DebugRegistersImpl2::new); } - Map> PREFERRED_REGISTERS_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugRegisters2.IID_IDEBUG_REGISTERS2), - WrapIDebugRegisters2.class), - Map.entry(new REFIID(IDebugRegisters.IID_IDEBUG_REGISTERS), - WrapIDebugRegisters.class)); + List> PREFERRED_REGISTERS_IIDS = List.of( + new Preferred<>(IDebugRegisters2.IID_IDEBUG_REGISTERS2, WrapIDebugRegisters2.class), + new Preferred<>(IDebugRegisters.IID_IDEBUG_REGISTERS, WrapIDebugRegisters.class)); static DebugRegistersInternal tryPreferredInterfaces(InterfaceSupplier supplier) { return DbgEngUtil.tryPreferredInterfaces(DebugRegistersInternal.class, diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/symbols/DebugSymbolsInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/symbols/DebugSymbolsInternal.java index b414b0cea8..6879338755 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/symbols/DebugSymbolsInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/symbols/DebugSymbolsInternal.java @@ -15,15 +15,16 @@ */ package agent.dbgeng.impl.dbgeng.symbols; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.*; import agent.dbgeng.dbgeng.DebugModule.DebugModuleName; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.jna.dbgeng.symbols.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -50,13 +51,12 @@ public interface DebugSymbolsInternal extends DebugSymbols { return DbgEngUtil.lazyWeakCache(CACHE, symbols, DebugSymbolsImpl5::new); } - Map> PREFFERED_SYMBOLS_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugSymbols5.IID_IDEBUG_SYMBOLS5), WrapIDebugSymbols5.class), - Map.entry(new REFIID(IDebugSymbols4.IID_IDEBUG_SYMBOLS4), WrapIDebugSymbols4.class), - Map.entry(new REFIID(IDebugSymbols3.IID_IDEBUG_SYMBOLS3), WrapIDebugSymbols3.class), - Map.entry(new REFIID(IDebugSymbols2.IID_IDEBUG_SYMBOLS2), WrapIDebugSymbols2.class), - Map.entry(new REFIID(IDebugSymbols.IID_IDEBUG_SYMBOLS), WrapIDebugSymbols.class)); + List> PREFFERED_SYMBOLS_IIDS = List.of( + new Preferred<>(IDebugSymbols5.IID_IDEBUG_SYMBOLS5, WrapIDebugSymbols5.class), + new Preferred<>(IDebugSymbols4.IID_IDEBUG_SYMBOLS4, WrapIDebugSymbols4.class), + new Preferred<>(IDebugSymbols3.IID_IDEBUG_SYMBOLS3, WrapIDebugSymbols3.class), + new Preferred<>(IDebugSymbols2.IID_IDEBUG_SYMBOLS2, WrapIDebugSymbols2.class), + new Preferred<>(IDebugSymbols.IID_IDEBUG_SYMBOLS, WrapIDebugSymbols.class)); static DebugSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) { return DbgEngUtil.tryPreferredInterfaces(DebugSymbolsInternal.class, PREFFERED_SYMBOLS_IIDS, diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/sysobj/DebugSystemObjectsInternal.java b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/sysobj/DebugSystemObjectsInternal.java index 4c1870dfa1..d269551c9f 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/sysobj/DebugSystemObjectsInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/java/agent/dbgeng/impl/dbgeng/sysobj/DebugSystemObjectsInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgeng.impl.dbgeng.sysobj; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import agent.dbgeng.dbgeng.DebugSystemObjects; import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgeng.jna.dbgeng.sysobj.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -45,16 +46,15 @@ public interface DebugSystemObjectsInternal extends DebugSystemObjects { return DbgEngUtil.lazyWeakCache(CACHE, sysobj, DebugSystemObjectsImpl4::new); } - Map> PREFERRED_SYSTEM_OBJECTS_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugSystemObjects4.IID_IDEBUG_SYSTEM_OBJECTS4), - WrapIDebugSystemObjects4.class), - Map.entry(new REFIID(IDebugSystemObjects3.IID_IDEBUG_SYSTEM_OBJECTS3), - WrapIDebugSystemObjects3.class), - Map.entry(new REFIID(IDebugSystemObjects2.IID_IDEBUG_SYSTEM_OBJECTS2), - WrapIDebugSystemObjects2.class), - Map.entry(new REFIID(IDebugSystemObjects.IID_IDEBUG_SYSTEM_OBJECTS), - WrapIDebugSystemObjects.class)); + List> PREFERRED_SYSTEM_OBJECTS_IIDS = List.of( + new Preferred<>(IDebugSystemObjects4.IID_IDEBUG_SYSTEM_OBJECTS4, + WrapIDebugSystemObjects4.class), + new Preferred<>(IDebugSystemObjects3.IID_IDEBUG_SYSTEM_OBJECTS3, + WrapIDebugSystemObjects3.class), + new Preferred<>(IDebugSystemObjects2.IID_IDEBUG_SYSTEM_OBJECTS2, + WrapIDebugSystemObjects2.class), + new Preferred<>(IDebugSystemObjects.IID_IDEBUG_SYSTEM_OBJECTS, + WrapIDebugSystemObjects.class)); static DebugSystemObjectsInternal tryPreferredInterfaces(InterfaceSupplier supplier) { return DbgEngUtil.tryPreferredInterfaces(DebugSystemObjectsInternal.class, diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/dbgmodel/err/DbgModelException.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/dbgmodel/err/DbgModelException.java deleted file mode 100644 index 26ecf263e0..0000000000 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/dbgmodel/err/DbgModelException.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 agent.dbgmodel.dbgmodel.err; - -/** - * The base exception for checked {@code dbgmodel.dll} wrapper-related errors. - */ -public class DbgModelException extends Exception { - public DbgModelException() { - super(); - } - - public DbgModelException(String message) { - super(message); - } -} diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/dbgmodel/err/DbgModelRuntimeException.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/dbgmodel/err/DbgModelRuntimeException.java deleted file mode 100644 index 5ea342d289..0000000000 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/dbgmodel/err/DbgModelRuntimeException.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 agent.dbgmodel.dbgmodel.err; - -/** - * The base exception for unchecked {@code dbgmodel.dll} wrapper-related errors. - */ -public class DbgModelRuntimeException extends RuntimeException { - public DbgModelRuntimeException() { - super(); - } - - public DbgModelRuntimeException(String message) { - super(message); - } -} diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/DbgModelUtil.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/DbgModelUtil.java deleted file mode 100644 index 006975c9d4..0000000000 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/DbgModelUtil.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 agent.dbgmodel.impl.dbgmodel; - -import java.lang.reflect.Method; -import java.util.Map; -import java.util.function.Function; - -import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; -import com.sun.jna.platform.win32.WinDef.ULONG; -import com.sun.jna.platform.win32.WinNT.HRESULT; -import com.sun.jna.platform.win32.COM.*; -import com.sun.jna.ptr.PointerByReference; - -import agent.dbgmodel.dbgmodel.err.DbgModelRuntimeException; -import ghidra.util.Msg; - -public abstract class DbgModelUtil { - public static final ULONG DEBUG_ANY_ID = new ULONG(-1); - - private DbgModelUtil() { - } - - public static interface InterfaceSupplier { - HRESULT get(REFIID refiid, PointerByReference pClient); - } - - @SuppressWarnings("unchecked") - public static I tryPreferredInterfaces(Class cls, - Map> preferred, InterfaceSupplier supplier) { - PointerByReference ppClient = new PointerByReference(); - for (Map.Entry> ent : preferred.entrySet()) { - try { - COMUtils.checkRC(supplier.get(ent.getKey(), ppClient)); - if (ppClient.getValue() == null) { - continue; - } - Object impl = - ent.getValue().getConstructor(Pointer.class).newInstance(ppClient.getValue()); - Method instanceFor = cls.getMethod("instanceFor", ent.getValue()); - Object instance = instanceFor.invoke(null, impl); - return (I) instance; - } - catch (COMException e) { - Msg.debug(DbgModelUtil.class, e + " (" + ent.getValue() + ")"); - // TODO: Only try next on E_NOINTERFACE? - // Try next - } - catch (Exception e) { - throw new AssertionError("INTERNAL: Unexpected exception", e); - } - } - throw new DbgModelRuntimeException("None of the preferred interfaces are supported"); - } - - public static U lazyWeakCache(Map cache, T unk, - Function forNew) { - synchronized (cache) { - U present = cache.get(unk.getPointer()); - if (present != null) { - unk.Release(); - return present; - } - U absent = forNew.apply(unk); - cache.put(unk.getPointer(), absent); - return absent; - } - } - - public static void dbgline() { - System.out.println(new Exception().getStackTrace()[1]); - System.out.flush(); - } -} diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/UnknownExInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/UnknownExInternal.java index d844dde7fd..ed5c3ae42d 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/UnknownExInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/UnknownExInternal.java @@ -15,14 +15,16 @@ */ package agent.dbgmodel.impl.dbgmodel; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; import com.sun.jna.platform.win32.COM.IUnknown; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.UnknownEx; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.WrapIUnknownEx; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,15 +32,14 @@ public interface UnknownExInternal extends UnknownEx { Map CACHE = new WeakValueHashMap<>(); static UnknownExInternal instanceFor(WrapIUnknownEx data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, UnknownExImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, UnknownExImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IUnknown.IID_IUNKNOWN), WrapIUnknownEx.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IUnknown.IID_IUNKNOWN, WrapIUnknownEx.class)); static UnknownExInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(UnknownExInternal.class, + return DbgEngUtil.tryPreferredInterfaces(UnknownExInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/bridge/HostDataModelAccessInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/bridge/HostDataModelAccessInternal.java index 28cc777f7c..2b38de6f8a 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/bridge/HostDataModelAccessInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/bridge/HostDataModelAccessInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.bridge; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.bridge.HostDataModelAccess; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.bridge.IHostDataModelAccess; import agent.dbgmodel.jna.dbgmodel.bridge.WrapIHostDataModelAccess; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface HostDataModelAccessInternal extends HostDataModelAccess { Map CACHE = new WeakValueHashMap<>(); static HostDataModelAccessInternal instanceFor(WrapIHostDataModelAccess data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, HostDataModelAccessImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, HostDataModelAccessImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IHostDataModelAccess.IID_IHOST_DATA_MODEL_ACCESS), - WrapIHostDataModelAccess.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IHostDataModelAccess.IID_IHOST_DATA_MODEL_ACCESS, + WrapIHostDataModelAccess.class)); static HostDataModelAccessInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(HostDataModelAccessInternal.class, + return DbgEngUtil.tryPreferredInterfaces(HostDataModelAccessInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/ComparableConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/ComparableConceptInternal.java index d168e6cd0a..4d1ee354e1 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/ComparableConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/ComparableConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.ComparableConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IComparableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIComparableConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface ComparableConceptInternal extends ComparableConcept { Map CACHE = new WeakValueHashMap<>(); static ComparableConceptInternal instanceFor(WrapIComparableConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, ComparableConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, ComparableConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IComparableConcept.IID_ICOMPARABLE_CONCEPT), - WrapIComparableConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IComparableConcept.IID_ICOMPARABLE_CONCEPT, WrapIComparableConcept.class)); static ComparableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(ComparableConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(ComparableConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DataModelConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DataModelConceptInternal.java index 263591f799..3a60e83f80 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DataModelConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DataModelConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.DataModelConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IDataModelConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIDataModelConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface DataModelConceptInternal extends DataModelConcept { Map CACHE = new WeakValueHashMap<>(); static DataModelConceptInternal instanceFor(WrapIDataModelConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelConcept.IID_IDATA_MODEL_CONCEPT), - WrapIDataModelConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelConcept.IID_IDATA_MODEL_CONCEPT, WrapIDataModelConcept.class)); static DataModelConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicConceptProviderConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicConceptProviderConceptInternal.java index 4a412e7fc8..a8e2eeb5de 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicConceptProviderConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicConceptProviderConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.DynamicConceptProviderConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IDynamicConceptProviderConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicConceptProviderConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -32,19 +33,16 @@ public interface DynamicConceptProviderConceptInternal extends DynamicConceptPro static DynamicConceptProviderConceptInternal instanceFor( WrapIDynamicConceptProviderConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DynamicConceptProviderConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DynamicConceptProviderConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID( - IDynamicConceptProviderConcept.IID_IDYNAMIC_CONCEPT_PROVIDER_CONCEPT), - WrapIDynamicConceptProviderConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDynamicConceptProviderConcept.IID_IDYNAMIC_CONCEPT_PROVIDER_CONCEPT, + WrapIDynamicConceptProviderConcept.class)); static DynamicConceptProviderConceptInternal tryPreferredInterfaces( InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DynamicConceptProviderConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DynamicConceptProviderConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicKeyProviderConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicKeyProviderConceptInternal.java index d19c689bce..26128e5efd 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicKeyProviderConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/DynamicKeyProviderConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.DynamicKeyProviderConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IDynamicKeyProviderConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicKeyProviderConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DynamicKeyProviderConceptInternal extends DynamicKeyProviderCon Map CACHE = new WeakValueHashMap<>(); static DynamicKeyProviderConceptInternal instanceFor(WrapIDynamicKeyProviderConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DynamicKeyProviderConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DynamicKeyProviderConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDynamicKeyProviderConcept.IID_IDYNAMIC_KEY_PROVIDER_CONCEPT), - WrapIDynamicKeyProviderConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDynamicKeyProviderConcept.IID_IDYNAMIC_KEY_PROVIDER_CONCEPT, + WrapIDynamicKeyProviderConcept.class)); static DynamicKeyProviderConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DynamicKeyProviderConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DynamicKeyProviderConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/EquatableConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/EquatableConceptInternal.java index 3b0ca95d4e..2921b43dd5 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/EquatableConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/EquatableConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.EquatableConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IEquatableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIEquatableConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface EquatableConceptInternal extends EquatableConcept { Map CACHE = new WeakValueHashMap<>(); static EquatableConceptInternal instanceFor(WrapIEquatableConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, EquatableConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, EquatableConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IEquatableConcept.IID_IEQUATABLE_CONCEPT), - WrapIEquatableConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IEquatableConcept.IID_IEQUATABLE_CONCEPT, WrapIEquatableConcept.class)); static EquatableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(EquatableConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(EquatableConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IndexableConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IndexableConceptInternal.java index bd38b0cde6..c348a20910 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IndexableConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IndexableConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.IndexableConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IIndexableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIIndexableConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface IndexableConceptInternal extends IndexableConcept { Map CACHE = new WeakValueHashMap<>(); static IndexableConceptInternal instanceFor(WrapIIndexableConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, IndexableConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, IndexableConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IIndexableConcept.IID_IINDEXABLE_CONCEPT), - WrapIIndexableConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IIndexableConcept.IID_IINDEXABLE_CONCEPT, WrapIIndexableConcept.class)); static IndexableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(IndexableConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(IndexableConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IterableConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IterableConceptInternal.java index ad72ecc4d4..d71e21f782 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IterableConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/IterableConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.IterableConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IIterableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIIterableConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface IterableConceptInternal extends IterableConcept { Map CACHE = new WeakValueHashMap<>(); static IterableConceptInternal instanceFor(WrapIIterableConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, IterableConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, IterableConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IIterableConcept.IID_IITERABLE_CONCEPT), - WrapIIterableConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IIterableConcept.IID_IITERABLE_CONCEPT, WrapIIterableConcept.class)); static IterableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(IterableConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(IterableConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/PreferredRuntimeTypeConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/PreferredRuntimeTypeConceptInternal.java index c9f028b847..bb8b476ee0 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/PreferredRuntimeTypeConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/PreferredRuntimeTypeConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.PreferredRuntimeTypeConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IPreferredRuntimeTypeConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIPreferredRuntimeTypeConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface PreferredRuntimeTypeConceptInternal extends PreferredRuntimeTyp Map CACHE = new WeakValueHashMap<>(); static PreferredRuntimeTypeConceptInternal instanceFor(WrapIPreferredRuntimeTypeConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, PreferredRuntimeTypeConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, PreferredRuntimeTypeConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IPreferredRuntimeTypeConcept.IID_IPREFERRED_RUNTIME_TYPE_CONCEPT), - WrapIPreferredRuntimeTypeConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IPreferredRuntimeTypeConcept.IID_IPREFERRED_RUNTIME_TYPE_CONCEPT, + WrapIPreferredRuntimeTypeConcept.class)); static PreferredRuntimeTypeConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(PreferredRuntimeTypeConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(PreferredRuntimeTypeConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/StringDisplayableConceptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/StringDisplayableConceptInternal.java index bf98d5e8c0..416bbc922e 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/StringDisplayableConceptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/concept/StringDisplayableConceptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.concept; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.concept.StringDisplayableConcept; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.concept.IStringDisplayableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIStringDisplayableConcept; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface StringDisplayableConceptInternal extends StringDisplayableConce Map CACHE = new WeakValueHashMap<>(); static StringDisplayableConceptInternal instanceFor(WrapIStringDisplayableConcept data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, StringDisplayableConceptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, StringDisplayableConceptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IStringDisplayableConcept.IID_ISTRING_DISPLAYABLE_CONCEPT), - WrapIStringDisplayableConcept.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IStringDisplayableConcept.IID_ISTRING_DISPLAYABLE_CONCEPT, + WrapIStringDisplayableConcept.class)); static StringDisplayableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(StringDisplayableConceptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(StringDisplayableConceptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/DataModelManagerInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/DataModelManagerInternal.java index d7bb6d138a..04589e0540 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/DataModelManagerInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/DataModelManagerInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.DataModelManager1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,22 +31,19 @@ public interface DataModelManagerInternal extends DataModelManager1 { Map CACHE = new WeakValueHashMap<>(); static DataModelManagerInternal instanceFor(WrapIDataModelManager1 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl1::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl1::new); } static DataModelManagerInternal instanceFor(WrapIDataModelManager2 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl2::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl2::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelManager2.IID_IDATA_MODEL_MANAGER2), - WrapIDataModelManager2.class), - Map.entry(new REFIID(IDataModelManager1.IID_IDATA_MODEL_MANAGER), - WrapIDataModelManager1.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelManager2.IID_IDATA_MODEL_MANAGER2, WrapIDataModelManager2.class), + new Preferred<>(IDataModelManager1.IID_IDATA_MODEL_MANAGER, WrapIDataModelManager1.class)); static DataModelManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelManagerInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelManagerInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelNameBinderInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelNameBinderInternal.java index 61a2c4554e..47c089d564 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelNameBinderInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelNameBinderInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelNameBinder; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelNameBinder; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelNameBinder; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DataModelNameBinderInternal extends DataModelNameBinder { Map CACHE = new WeakValueHashMap<>(); static DataModelNameBinderInternal instanceFor(WrapIDataModelNameBinder data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelNameBinderImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelNameBinderImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelNameBinder.IID_IDATA_MODEL_NAME_BINDER), - WrapIDataModelNameBinder.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelNameBinder.IID_IDATA_MODEL_NAME_BINDER, + WrapIDataModelNameBinder.class)); static DataModelNameBinderInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelNameBinderInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelNameBinderInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptClientInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptClientInternal.java index 333b283e63..6de1a6e747 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptClientInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptClientInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptClient; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptClient; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptClient; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DataModelScriptClientInternal extends DataModelScriptClient { Map CACHE = new WeakValueHashMap<>(); static DataModelScriptClientInternal instanceFor(WrapIDataModelScriptClient data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptClientImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptClientImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelScriptClient.IID_IDATA_MODEL_SCRIPT_CLIENT), - WrapIDataModelScriptClient.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptClient.IID_IDATA_MODEL_SCRIPT_CLIENT, + WrapIDataModelScriptClient.class)); static DataModelScriptClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptClientInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptClientInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptHostContextInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptHostContextInternal.java index 36fb692e50..a5ec3d9e5e 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptHostContextInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptHostContextInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptHostContext; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptHostContext; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptHostContext; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DataModelScriptHostContextInternal extends DataModelScriptHostC Map CACHE = new WeakValueHashMap<>(); static DataModelScriptHostContextInternal instanceFor(WrapIDataModelScriptHostContext data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptHostContextImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptHostContextImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelScriptHostContext.IID_IDATA_MODEL_SCRIPT_HOST_CONTEXT), - WrapIDataModelScriptHostContext.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptHostContext.IID_IDATA_MODEL_SCRIPT_HOST_CONTEXT, + WrapIDataModelScriptHostContext.class)); static DataModelScriptHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptHostContextInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptHostContextInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptInternal.java index 56e67eaa6a..b4a53d03cc 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScript; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScript; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScript; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DataModelScriptInternal extends DataModelScript { Map CACHE = new WeakValueHashMap<>(); static DataModelScriptInternal instanceFor(WrapIDataModelScript data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelScript.IID_IDATA_MODEL_SCRIPT), - WrapIDataModelScript.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScript.IID_IDATA_MODEL_SCRIPT, + WrapIDataModelScript.class)); static DataModelScriptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptManagerInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptManagerInternal.java index e80a6a2bf2..46f33bc99c 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptManagerInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptManagerInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptManager; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptManager; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptManager; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DataModelScriptManagerInternal extends DataModelScriptManager { Map CACHE = new WeakValueHashMap<>(); static DataModelScriptManagerInternal instanceFor(WrapIDataModelScriptManager data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptManagerImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptManagerImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelScriptManager.IID_IDATA_MODEL_SCRIPT_MANAGER), - WrapIDataModelScriptManager.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptManager.IID_IDATA_MODEL_SCRIPT_MANAGER, + WrapIDataModelScriptManager.class)); static DataModelScriptManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptManagerInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptManagerInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderEnumeratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderEnumeratorInternal.java index b7a5ff041e..6a844bcacf 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderEnumeratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderEnumeratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptProviderEnumerator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptProviderEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProviderEnumerator; import ghidra.util.datastruct.WeakValueHashMap; @@ -33,19 +34,17 @@ public interface DataModelScriptProviderEnumeratorInternal static DataModelScriptProviderEnumeratorInternal instanceFor( WrapIDataModelScriptProviderEnumerator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderEnumeratorImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderEnumeratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID( - IDataModelScriptProviderEnumerator.IID_IDATA_MODEL_SCRIPT_PROVIDER_ENUMERATOR), - WrapIDataModelScriptProviderEnumerator.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>( + IDataModelScriptProviderEnumerator.IID_IDATA_MODEL_SCRIPT_PROVIDER_ENUMERATOR, + WrapIDataModelScriptProviderEnumerator.class)); static DataModelScriptProviderEnumeratorInternal tryPreferredInterfaces( InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptProviderEnumeratorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptProviderEnumeratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderInternal.java index 6e773b89ad..0dbcef6d1d 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptProviderInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptProvider; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptProvider; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProvider; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DataModelScriptProviderInternal extends DataModelScriptProvider Map CACHE = new WeakValueHashMap<>(); static DataModelScriptProviderInternal instanceFor(WrapIDataModelScriptProvider data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelScriptProvider.IID_IDATA_MODEL_SCRIPT_PROVIDER), - WrapIDataModelScriptProvider.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptProvider.IID_IDATA_MODEL_SCRIPT_PROVIDER, + WrapIDataModelScriptProvider.class)); static DataModelScriptProviderInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptProviderInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptProviderInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateEnumeratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateEnumeratorInternal.java index 7223b11ceb..f015b60d69 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateEnumeratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateEnumeratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptTemplateEnumerator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptTemplateEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplateEnumerator; import ghidra.util.datastruct.WeakValueHashMap; @@ -33,18 +34,17 @@ public interface DataModelScriptTemplateEnumeratorInternal static DataModelScriptTemplateEnumeratorInternal instanceFor( WrapIDataModelScriptTemplateEnumerator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateEnumeratorImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateEnumeratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID( - IDataModelScriptTemplateEnumerator.IID_IDATA_MODEL_SCRIPT_TEMPLATE_ENUMERATOR), - WrapIDataModelScriptTemplateEnumerator.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>( + IDataModelScriptTemplateEnumerator.IID_IDATA_MODEL_SCRIPT_TEMPLATE_ENUMERATOR, + WrapIDataModelScriptTemplateEnumerator.class)); static DataModelScriptTemplateEnumeratorInternal tryPreferredInterfaces( InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptTemplateEnumeratorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptTemplateEnumeratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateInternal.java index a06f3a3144..2fb57f0bd4 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/DataModelScriptTemplateInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.DataModelScriptTemplate; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.IDataModelScriptTemplate; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplate; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DataModelScriptTemplateInternal extends DataModelScriptTemplate Map CACHE = new WeakValueHashMap<>(); static DataModelScriptTemplateInternal instanceFor(WrapIDataModelScriptTemplate data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelScriptTemplate.IID_IDATA_MODEL_SCRIPT_TEMPLATE), - WrapIDataModelScriptTemplate.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptTemplate.IID_IDATA_MODEL_SCRIPT_TEMPLATE, + WrapIDataModelScriptTemplate.class)); static DataModelScriptTemplateInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptTemplateInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptTemplateInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointEnumeratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointEnumeratorInternal.java index 1a6581fba6..a4d25796db 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointEnumeratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointEnumeratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugBreakpointEnumerator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugBreakpointEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpointEnumerator; import ghidra.util.datastruct.WeakValueHashMap; @@ -33,20 +34,19 @@ public interface DataModelScriptDebugBreakpointEnumeratorInternal static DataModelScriptDebugBreakpointEnumeratorInternal instanceFor( WrapIDataModelScriptDebugBreakpointEnumerator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugBreakpointEnumeratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID( - IDataModelScriptDebugBreakpointEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT_ENUMERATOR), + List> PREFERRED_DATA_SPACES_IIDS = + List.of( + new Preferred<>( + IDataModelScriptDebugBreakpointEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT_ENUMERATOR, WrapIDataModelScriptDebugBreakpointEnumerator.class)); static DataModelScriptDebugBreakpointEnumeratorInternal tryPreferredInterfaces( InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces( + return DbgEngUtil.tryPreferredInterfaces( DataModelScriptDebugBreakpointEnumeratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointInternal.java index ce505e9356..57cabc851e 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugBreakpointInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugBreakpoint; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugBreakpoint; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpoint; import ghidra.util.datastruct.WeakValueHashMap; @@ -32,19 +33,18 @@ public interface DataModelScriptDebugBreakpointInternal extends DataModelScriptD static DataModelScriptDebugBreakpointInternal instanceFor( WrapIDataModelScriptDebugBreakpoint data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugBreakpointImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugBreakpointImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID( - IDataModelScriptDebugBreakpoint.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT), + List> PREFERRED_DATA_SPACES_IIDS = + List.of( + new Preferred<>( + IDataModelScriptDebugBreakpoint.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT, WrapIDataModelScriptDebugBreakpoint.class)); static DataModelScriptDebugBreakpointInternal tryPreferredInterfaces( InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugBreakpointInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugBreakpointInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugClientInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugClientInternal.java index a18df300d4..3bb58d63a9 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugClientInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugClientInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugClient; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugClient; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugClient; import ghidra.util.datastruct.WeakValueHashMap; @@ -32,17 +33,15 @@ public interface DataModelScriptDebugClientInternal extends DataModelScriptDebug static DataModelScriptDebugClientInternal instanceFor( WrapIDataModelScriptDebugClient data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugClientImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugClientImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID(IDataModelScriptDebugClient.IID_IDATA_MODEL_SCRIPT_DEBUG_CLIENT), - WrapIDataModelScriptDebugClient.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptDebugClient.IID_IDATA_MODEL_SCRIPT_DEBUG_CLIENT, + WrapIDataModelScriptDebugClient.class)); static DataModelScriptDebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugClientInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugClientInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugInternal.java index 1d99b853cb..2dda316792 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebug1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,18 +31,17 @@ public interface DataModelScriptDebugInternal extends DataModelScriptDebug1 { Map CACHE = new WeakValueHashMap<>(); static DataModelScriptDebugInternal instanceFor(WrapIDataModelScriptDebug data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDataModelScriptDebug2.IID_IDATA_MODEL_SCRIPT_DEBUG2), - WrapIDataModelScriptDebug.class), - Map.entry(new REFIID(IDataModelScriptDebug.IID_IDATA_MODEL_SCRIPT_DEBUG), - WrapIDataModelScriptDebug.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptDebug2.IID_IDATA_MODEL_SCRIPT_DEBUG2, + WrapIDataModelScriptDebug.class), + new Preferred<>(IDataModelScriptDebug.IID_IDATA_MODEL_SCRIPT_DEBUG, + WrapIDataModelScriptDebug.class)); static DataModelScriptDebugInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackFrameInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackFrameInternal.java index a495b2f528..c0b9e97f38 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackFrameInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackFrameInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugStackFrame; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugStackFrame; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStackFrame; import ghidra.util.datastruct.WeakValueHashMap; @@ -32,19 +33,16 @@ public interface DataModelScriptDebugStackFrameInternal extends DataModelScriptD static DataModelScriptDebugStackFrameInternal instanceFor( WrapIDataModelScriptDebugStackFrame data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackFrameImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackFrameImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID( - IDataModelScriptDebugStackFrame.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK_FRAME), - WrapIDataModelScriptDebugStackFrame.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptDebugStackFrame.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK_FRAME, + WrapIDataModelScriptDebugStackFrame.class)); static DataModelScriptDebugStackFrameInternal tryPreferredInterfaces( InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugStackFrameInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugStackFrameInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackInternal.java index 5847e117ae..7a65ca31c7 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugStackInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugStack; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugStack; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStack; import ghidra.util.datastruct.WeakValueHashMap; @@ -32,17 +33,15 @@ public interface DataModelScriptDebugStackInternal extends DataModelScriptDebugS static DataModelScriptDebugStackInternal instanceFor( WrapIDataModelScriptDebugStack data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID(IDataModelScriptDebugStack.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK), - WrapIDataModelScriptDebugStack.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDataModelScriptDebugStack.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK, + WrapIDataModelScriptDebugStack.class)); static DataModelScriptDebugStackInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugStackInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugStackInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugVariableSetEnumeratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugVariableSetEnumeratorInternal.java index a44c2ffb0e..db5c911dd8 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugVariableSetEnumeratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/datamodel/script/debug/DataModelScriptDebugVariableSetEnumeratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.datamodel.script.debug.DataModelScriptDebugVariableSetEnumerator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.IDataModelScriptDebugVariableSetEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugVariableSetEnumerator; import ghidra.util.datastruct.WeakValueHashMap; @@ -34,20 +35,19 @@ public interface DataModelScriptDebugVariableSetEnumeratorInternal static DataModelScriptDebugVariableSetEnumeratorInternal instanceFor( WrapIDataModelScriptDebugVariableSetEnumerator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, + return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugVariableSetEnumeratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry( - new REFIID( - IDataModelScriptDebugVariableSetEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_VARIABLE_SET_ENUMERATOR), + List> PREFERRED_DATA_SPACES_IIDS = + List.of( + new Preferred<>( + IDataModelScriptDebugVariableSetEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_VARIABLE_SET_ENUMERATOR, WrapIDataModelScriptDebugVariableSetEnumerator.class)); static DataModelScriptDebugVariableSetEnumeratorInternal tryPreferredInterfaces( InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces( + return DbgEngUtil.tryPreferredInterfaces( DataModelScriptDebugVariableSetEnumeratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostBaseClassInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostBaseClassInternal.java index 697c2e7d37..08d500ca9d 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostBaseClassInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostBaseClassInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostBase; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.X_IDebugHostBaseClass; import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass; import ghidra.util.datastruct.WeakValueHashMap; @@ -32,16 +33,15 @@ public interface DebugHostBaseClassInternal extends DebugHostBase { Map CACHE = new WeakValueHashMap<>(); static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS), - X_WrapIDebugHostBaseClass.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS, + X_WrapIDebugHostBaseClass.class)); static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class, + return DbgEngUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostConstantInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostConstantInternal.java index 0ca397dd01..8f0bc3b019 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostConstantInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostConstantInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostConstant; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostConstant; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostConstant; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostConstantInternal extends DebugHostConstant { Map CACHE = new WeakValueHashMap<>(); static DebugHostConstantInternal instanceFor(WrapIDebugHostConstant data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostConstantImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostConstantImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostConstant.IID_IDEBUG_HOST_CONSTANT), - WrapIDebugHostConstant.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostConstant.IID_IDEBUG_HOST_CONSTANT, + WrapIDebugHostConstant.class)); static DebugHostConstantInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostConstantInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostConstantInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostContextInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostContextInternal.java index 784477d9ff..b9ff6fd6a9 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostContextInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostContextInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostContext; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostContext; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostContext; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostContextInternal extends DebugHostContext { Map CACHE = new WeakValueHashMap<>(); static DebugHostContextInternal instanceFor(WrapIDebugHostContext data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostContextImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostContextImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostContext.IID_IDEBUG_HOST_CONTEXT), - WrapIDebugHostContext.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostContext.IID_IDEBUG_HOST_CONTEXT, + WrapIDebugHostContext.class)); static DebugHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostContextInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostContextInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostDataInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostDataInternal.java index 340a556ca0..7a4c41167c 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostDataInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostDataInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostData; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostData; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostData; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface DebugHostDataInternal extends DebugHostData { Map CACHE = new WeakValueHashMap<>(); static DebugHostDataInternal instanceFor(WrapIDebugHostData data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostDataImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostDataImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostData.IID_IDEBUG_HOST_DATA), WrapIDebugHostData.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostData.IID_IDEBUG_HOST_DATA, WrapIDebugHostData.class)); static DebugHostDataInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostDataInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostDataInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostErrorSinkInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostErrorSinkInternal.java index 3e9553f19e..ac794e1d13 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostErrorSinkInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostErrorSinkInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostErrorSink; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostErrorSink; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostErrorSink; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostErrorSinkInternal extends DebugHostErrorSink { Map CACHE = new WeakValueHashMap<>(); static DebugHostErrorSinkInternal instanceFor(WrapIDebugHostErrorSink data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostErrorSinkImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostErrorSinkImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostErrorSink.IID_IDEBUG_HOST_ERROR_SINK), - WrapIDebugHostErrorSink.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostErrorSink.IID_IDEBUG_HOST_ERROR_SINK, + WrapIDebugHostErrorSink.class)); static DebugHostErrorSinkInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostErrorSinkInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostErrorSinkInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostEvaluatorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostEvaluatorInternal.java index cf8767d91d..2aadeccabd 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostEvaluatorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostEvaluatorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostEvaluator1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,22 +31,21 @@ public interface DebugHostEvaluatorInternal extends DebugHostEvaluator1 { Map CACHE = new WeakValueHashMap<>(); static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator1 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl1::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl1::new); } static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator2 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl2::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl2::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostEvaluator2.IID_IDEBUG_HOST_EVALUATOR2), - WrapIDebugHostEvaluator2.class), - Map.entry(new REFIID(IDebugHostEvaluator1.IID_IDEBUG_HOST_EVALUATOR), - WrapIDebugHostEvaluator1.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostEvaluator2.IID_IDEBUG_HOST_EVALUATOR2, + WrapIDebugHostEvaluator2.class), + new Preferred<>(IDebugHostEvaluator1.IID_IDEBUG_HOST_EVALUATOR, + WrapIDebugHostEvaluator1.class)); static DebugHostEvaluatorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostEvaluatorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostEvaluatorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostExtensabilityInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostExtensabilityInternal.java index 87186a76d1..f20bfa8b7f 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostExtensabilityInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostExtensabilityInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostExtensability; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostExtensability; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostExtensability; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostExtensabilityInternal extends DebugHostExtensability { Map CACHE = new WeakValueHashMap<>(); static DebugHostExtensabilityInternal instanceFor(WrapIDebugHostExtensability data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostExtensabilityImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostExtensabilityImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostExtensability.IID_IDEBUG_HOST_EXTENSABILITY), - WrapIDebugHostExtensability.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostExtensability.IID_IDEBUG_HOST_EXTENSABILITY, + WrapIDebugHostExtensability.class)); static DebugHostExtensabilityInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostExtensabilityInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostExtensabilityInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostFieldInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostFieldInternal.java index e213546e8c..4876dec469 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostFieldInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostFieldInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostField; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostField; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostField; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface DebugHostFieldInternal extends DebugHostField { Map CACHE = new WeakValueHashMap<>(); static DebugHostFieldInternal instanceFor(WrapIDebugHostField data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostFieldImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostFieldImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostField.IID_IDEBUG_HOST_FIELD), - WrapIDebugHostField.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostField.IID_IDEBUG_HOST_FIELD, WrapIDebugHostField.class)); static DebugHostFieldInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostFieldInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostFieldInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostInternal.java index cd3203f350..d48741c4a6 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHost; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHost; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHost; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface DebugHostInternal extends DebugHost { Map CACHE = new WeakValueHashMap<>(); static DebugHostInternal instanceFor(WrapIDebugHost data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHost.IID_IDEBUG_HOST), WrapIDebugHost.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHost.IID_IDEBUG_HOST, WrapIDebugHost.class)); static DebugHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostMemoryInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostMemoryInternal.java index 976fcb7994..d42ed50753 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostMemoryInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostMemoryInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostMemory1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,22 +31,19 @@ public interface DebugHostMemoryInternal extends DebugHostMemory1 { Map CACHE = new WeakValueHashMap<>(); static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory1 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl1::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl1::new); } static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory2 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl2::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl2::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostMemory2.IID_IDEBUG_HOST_MEMORY2), - WrapIDebugHostMemory2.class), - Map.entry(new REFIID(IDebugHostMemory1.IID_IDEBUG_HOST_MEMORY), - WrapIDebugHostMemory1.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostMemory2.IID_IDEBUG_HOST_MEMORY2, WrapIDebugHostMemory2.class), + new Preferred<>(IDebugHostMemory1.IID_IDEBUG_HOST_MEMORY, WrapIDebugHostMemory1.class)); static DebugHostMemoryInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostMemoryInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostMemoryInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleInternal.java index 2829ca3199..36e5391b91 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostModule1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,22 +31,19 @@ public interface DebugHostModuleInternal extends DebugHostModule1 { Map CACHE = new WeakValueHashMap<>(); static DebugHostModuleInternal instanceFor(WrapIDebugHostModule1 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl1::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl1::new); } static DebugHostModuleInternal instanceFor(WrapIDebugHostModule2 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl2::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl2::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostModule2.IID_IDEBUG_HOST_MODULE2), - WrapIDebugHostModule2.class), - Map.entry(new REFIID(IDebugHostModule1.IID_IDEBUG_HOST_MODULE), - WrapIDebugHostModule1.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostModule2.IID_IDEBUG_HOST_MODULE2, WrapIDebugHostModule2.class), + new Preferred<>(IDebugHostModule1.IID_IDEBUG_HOST_MODULE, WrapIDebugHostModule1.class)); static DebugHostModuleInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostModuleInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostModuleInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleSignatureInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleSignatureInternal.java index b52439eff4..5e325536f7 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleSignatureInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostModuleSignatureInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostModuleSignature; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostModuleSignature; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostModuleSignature; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostModuleSignatureInternal extends DebugHostModuleSignatu Map CACHE = new WeakValueHashMap<>(); static DebugHostModuleSignatureInternal instanceFor(WrapIDebugHostModuleSignature data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleSignatureImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleSignatureImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostModuleSignature.IID_IDEBUG_HOST_MODULE_SIGNATURE), - WrapIDebugHostModuleSignature.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostModuleSignature.IID_IDEBUG_HOST_MODULE_SIGNATURE, + WrapIDebugHostModuleSignature.class)); static DebugHostModuleSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostModuleSignatureInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostModuleSignatureInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostPublicInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostPublicInternal.java index 5b3a6339c6..4e8eb156cb 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostPublicInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostPublicInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostPublic; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostPublic; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostPublic; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface DebugHostPublicInternal extends DebugHostPublic { Map CACHE = new WeakValueHashMap<>(); static DebugHostPublicInternal instanceFor(WrapIDebugHostPublic data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostPublicImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostPublicImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostPublic.IID_IDEBUG_HOST_PUBLIC), - WrapIDebugHostPublic.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostPublic.IID_IDEBUG_HOST_PUBLIC, WrapIDebugHostPublic.class)); static DebugHostPublicInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostPublicInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostPublicInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostScriptHostInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostScriptHostInternal.java index 1cc55eaba2..34f43d399b 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostScriptHostInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostScriptHostInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostScriptHost; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostScriptHost; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostScriptHost; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostScriptHostInternal extends DebugHostScriptHost { Map CACHE = new WeakValueHashMap<>(); static DebugHostScriptHostInternal instanceFor(WrapIDebugHostScriptHost data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostScriptHostImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostScriptHostImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostScriptHost.IID_IDEBUG_HOST_SCRIPT_HOST), - WrapIDebugHostScriptHost.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostScriptHost.IID_IDEBUG_HOST_SCRIPT_HOST, + WrapIDebugHostScriptHost.class)); static DebugHostScriptHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostScriptHostInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostScriptHostInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostStatusInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostStatusInternal.java index ffd4313970..73c6d49681 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostStatusInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostStatusInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostStatus; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostStatus; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostStatus; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface DebugHostStatusInternal extends DebugHostStatus { Map CACHE = new WeakValueHashMap<>(); static DebugHostStatusInternal instanceFor(WrapIDebugHostStatus data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostStatusImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostStatusImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostStatus.IID_IDEBUG_HOST_STATUS), - WrapIDebugHostStatus.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostStatus.IID_IDEBUG_HOST_STATUS, WrapIDebugHostStatus.class)); static DebugHostStatusInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostStatusInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostStatusInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolEnumeratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolEnumeratorInternal.java index 897dac77ec..b04b6f1bd3 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolEnumeratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolEnumeratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostSymbolEnumerator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostSymbolEnumerator; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbolEnumerator; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostSymbolEnumeratorInternal extends DebugHostSymbolEnumer Map CACHE = new WeakValueHashMap<>(); static DebugHostSymbolEnumeratorInternal instanceFor(WrapIDebugHostSymbolEnumerator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolEnumeratorImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolEnumeratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostSymbolEnumerator.IID_IDEBUG_HOST_SYMBOL_ENUMERATOR), - WrapIDebugHostSymbolEnumerator.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostSymbolEnumerator.IID_IDEBUG_HOST_SYMBOL_ENUMERATOR, + WrapIDebugHostSymbolEnumerator.class)); static DebugHostSymbolEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolEnumeratorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolEnumeratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolInternal.java index c6755f6a1f..819ef20164 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostSymbol1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,22 +31,19 @@ public interface DebugHostSymbolInternal extends DebugHostSymbol1 { Map CACHE = new WeakValueHashMap<>(); static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol1 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl1::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl1::new); } static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol2 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl2::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl2::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostSymbol2.IID_IDEBUG_HOST_SYMBOL2), - WrapIDebugHostSymbol2.class), - Map.entry(new REFIID(IDebugHostSymbol1.IID_IDEBUG_HOST_SYMBOL), - WrapIDebugHostSymbol1.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostSymbol2.IID_IDEBUG_HOST_SYMBOL2, WrapIDebugHostSymbol2.class), + new Preferred<>(IDebugHostSymbol1.IID_IDEBUG_HOST_SYMBOL, WrapIDebugHostSymbol1.class)); static DebugHostSymbolInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolsInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolsInternal.java index 3a1d53fab4..797af945a1 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolsInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostSymbolsInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostSymbols; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostSymbols; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbols; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,14 @@ public interface DebugHostSymbolsInternal extends DebugHostSymbols { Map CACHE = new WeakValueHashMap<>(); static DebugHostSymbolsInternal instanceFor(WrapIDebugHostSymbols data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolsImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolsImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostSymbols.IID_IDEBUG_HOST_SYMBOLS), - WrapIDebugHostSymbols.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostSymbols.IID_IDEBUG_HOST_SYMBOLS, WrapIDebugHostSymbols.class)); static DebugHostSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolsInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolsInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeInternal.java index 0451cd90f1..9ae5e96c1d 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostType1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,20 +31,19 @@ public interface DebugHostTypeInternal extends DebugHostType1 { Map CACHE = new WeakValueHashMap<>(); static DebugHostTypeInternal instanceFor(WrapIDebugHostType1 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl1::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl1::new); } static DebugHostTypeInternal instanceFor(WrapIDebugHostType2 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl2::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl2::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostType2.IID_IDEBUG_HOST_TYPE2), WrapIDebugHostType2.class), - Map.entry(new REFIID(IDebugHostType1.IID_IDEBUG_HOST_TYPE), WrapIDebugHostType1.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostType2.IID_IDEBUG_HOST_TYPE2, WrapIDebugHostType2.class), + new Preferred<>(IDebugHostType1.IID_IDEBUG_HOST_TYPE, WrapIDebugHostType1.class)); static DebugHostTypeInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostTypeInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostTypeInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeSignatureInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeSignatureInternal.java index ebb53b4bfb..fe897afe63 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeSignatureInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/DebugHostTypeSignatureInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostTypeSignature; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.IDebugHostTypeSignature; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostTypeSignature; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface DebugHostTypeSignatureInternal extends DebugHostTypeSignature { Map CACHE = new WeakValueHashMap<>(); static DebugHostTypeSignatureInternal instanceFor(WrapIDebugHostTypeSignature data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeSignatureImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeSignatureImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IDebugHostTypeSignature.IID_IDEBUG_HOST_TYPE_SIGNATURE), - WrapIDebugHostTypeSignature.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IDebugHostTypeSignature.IID_IDEBUG_HOST_TYPE_SIGNATURE, + WrapIDebugHostTypeSignature.class)); static DebugHostTypeSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(DebugHostTypeSignatureInternal.class, + return DbgEngUtil.tryPreferredInterfaces(DebugHostTypeSignatureInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/X_DebugHostBaseClassInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/X_DebugHostBaseClassInternal.java index cc2d0b311e..27bcb8c77c 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/X_DebugHostBaseClassInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/debughost/X_DebugHostBaseClassInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.debughost; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.debughost.DebugHostBaseClass; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.debughost.X_IDebugHostBaseClass; import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface X_DebugHostBaseClassInternal extends DebugHostBaseClass { Map CACHE = new WeakValueHashMap<>(); static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS), - X_WrapIDebugHostBaseClass.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS, + X_WrapIDebugHostBaseClass.class)); static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class, + return DbgEngUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyEnumeratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyEnumeratorInternal.java index 082a18f417..8b0e511056 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyEnumeratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyEnumeratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.KeyEnumerator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.IKeyEnumerator; import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyEnumerator; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface KeyEnumeratorInternal extends KeyEnumerator { Map CACHE = new WeakValueHashMap<>(); static KeyEnumeratorInternal instanceFor(WrapIKeyEnumerator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, KeyEnumeratorImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, KeyEnumeratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IKeyEnumerator.IID_IKEY_ENUMERATOR), WrapIKeyEnumerator.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IKeyEnumerator.IID_IKEY_ENUMERATOR, WrapIKeyEnumerator.class)); static KeyEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(KeyEnumeratorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(KeyEnumeratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyStoreInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyStoreInternal.java index d5b44d7a6b..a45b7907da 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyStoreInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/KeyStoreInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.KeyStore; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.IKeyStore; import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyStore; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface KeyStoreInternal extends KeyStore { Map CACHE = new WeakValueHashMap<>(); static KeyStoreInternal instanceFor(WrapIKeyStore data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, KeyStoreImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, KeyStoreImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IKeyStore.IID_IKEY_STORE), WrapIKeyStore.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IKeyStore.IID_IKEY_STORE, WrapIKeyStore.class)); static KeyStoreInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(KeyStoreInternal.class, + return DbgEngUtil.tryPreferredInterfaces(KeyStoreInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelIteratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelIteratorInternal.java index 16184fa139..079e822da6 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelIteratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelIteratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.ModelIterator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.IModelIterator; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelIterator; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface ModelIteratorInternal extends ModelIterator { Map CACHE = new WeakValueHashMap<>(); static ModelIteratorInternal instanceFor(WrapIModelIterator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, ModelIteratorImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, ModelIteratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IModelIterator.IID_IMODEL_ITERATOR), WrapIModelIterator.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IModelIterator.IID_IMODEL_ITERATOR, WrapIModelIterator.class)); static ModelIteratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(ModelIteratorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(ModelIteratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelKeyReferenceInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelKeyReferenceInternal.java index ec1eec99fb..71b0474773 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelKeyReferenceInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelKeyReferenceInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.ModelKeyReference1; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.*; import ghidra.util.datastruct.WeakValueHashMap; @@ -30,22 +31,19 @@ public interface ModelKeyReferenceInternal extends ModelKeyReference1 { Map CACHE = new WeakValueHashMap<>(); static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference1 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl1::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl1::new); } static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference2 data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl2::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl2::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IModelKeyReference2.IID_IMODEL_REFERENCE2), - WrapIModelKeyReference2.class), - Map.entry(new REFIID(IModelKeyReference.IID_IMODEL_REFERENCE), - WrapIModelKeyReference1.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IModelKeyReference2.IID_IMODEL_REFERENCE2, WrapIModelKeyReference2.class), + new Preferred<>(IModelKeyReference.IID_IMODEL_REFERENCE, WrapIModelKeyReference1.class)); static ModelKeyReferenceInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(ModelKeyReferenceInternal.class, + return DbgEngUtil.tryPreferredInterfaces(ModelKeyReferenceInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelMethodInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelMethodInternal.java index aacbabe51b..b606d6b5af 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelMethodInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelMethodInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.ModelMethod; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.IModelMethod; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelMethod; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface ModelMethodInternal extends ModelMethod { Map CACHE = new WeakValueHashMap<>(); static ModelMethodInternal instanceFor(WrapIModelMethod data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, ModelMethodImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, ModelMethodImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IModelMethod.IID_IMODEL_METHOD), WrapIModelMethod.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IModelMethod.IID_IMODEL_METHOD, WrapIModelMethod.class)); static ModelMethodInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(ModelMethodInternal.class, + return DbgEngUtil.tryPreferredInterfaces(ModelMethodInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelObjectInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelObjectInternal.java index 32d5542481..860ccf2eaa 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelObjectInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelObjectInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.ModelObject; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.IModelObject; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelObject; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface ModelObjectInternal extends ModelObject { Map CACHE = new WeakValueHashMap<>(); static ModelObjectInternal instanceFor(WrapIModelObject data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, ModelObjectImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, ModelObjectImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IModelObject.IID_IMODEL_OBJECT), WrapIModelObject.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IModelObject.IID_IMODEL_OBJECT, WrapIModelObject.class)); static ModelObjectInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(ModelObjectInternal.class, + return DbgEngUtil.tryPreferredInterfaces(ModelObjectInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelPropertyAccessorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelPropertyAccessorInternal.java index 2d43de3336..ecf54e2184 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelPropertyAccessorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/ModelPropertyAccessorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.ModelPropertyAccessor; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.IModelPropertyAccessor; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelPropertyAccessor; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,16 +32,15 @@ public interface ModelPropertyAccessorInternal extends ModelPropertyAccessor { Map CACHE = new WeakValueHashMap<>(); static ModelPropertyAccessorInternal instanceFor(WrapIModelPropertyAccessor data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, ModelPropertyAccessorImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, ModelPropertyAccessorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IModelPropertyAccessor.IID_IMODEL_PROPERTY_ACCESSOR), - WrapIModelPropertyAccessor.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IModelPropertyAccessor.IID_IMODEL_PROPERTY_ACCESSOR, + WrapIModelPropertyAccessor.class)); static ModelPropertyAccessorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(ModelPropertyAccessorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(ModelPropertyAccessorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } } diff --git a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/RawEnumeratorInternal.java b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/RawEnumeratorInternal.java index fb8d09aae0..69ff7983e4 100644 --- a/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/RawEnumeratorInternal.java +++ b/Ghidra/Debug/Debugger-agent-dbgmodel/src/main/java/agent/dbgmodel/impl/dbgmodel/main/RawEnumeratorInternal.java @@ -15,14 +15,15 @@ */ package agent.dbgmodel.impl.dbgmodel.main; +import java.util.List; import java.util.Map; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.Guid.REFIID; +import agent.dbgeng.impl.dbgeng.DbgEngUtil; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; +import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred; import agent.dbgmodel.dbgmodel.main.RawEnumerator; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil; -import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier; import agent.dbgmodel.jna.dbgmodel.main.IRawEnumerator; import agent.dbgmodel.jna.dbgmodel.main.WrapIRawEnumerator; import ghidra.util.datastruct.WeakValueHashMap; @@ -31,15 +32,14 @@ public interface RawEnumeratorInternal extends RawEnumerator { Map CACHE = new WeakValueHashMap<>(); static RawEnumeratorInternal instanceFor(WrapIRawEnumerator data) { - return DbgModelUtil.lazyWeakCache(CACHE, data, RawEnumeratorImpl::new); + return DbgEngUtil.lazyWeakCache(CACHE, data, RawEnumeratorImpl::new); } - Map> PREFERRED_DATA_SPACES_IIDS = - Map.ofEntries( - Map.entry(new REFIID(IRawEnumerator.IID_IRAW_ENUMERATOR), WrapIRawEnumerator.class)); + List> PREFERRED_DATA_SPACES_IIDS = List.of( + new Preferred<>(IRawEnumerator.IID_IRAW_ENUMERATOR, WrapIRawEnumerator.class)); static RawEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { - return DbgModelUtil.tryPreferredInterfaces(RawEnumeratorInternal.class, + return DbgEngUtil.tryPreferredInterfaces(RawEnumeratorInternal.class, PREFERRED_DATA_SPACES_IIDS, supplier); } }