GP-3207: Fix JNA/COM interface priority (dbgeng/model)

This commit is contained in:
Dan 2023-03-16 15:07:43 -04:00
parent 628642461c
commit 70e0170e03
69 changed files with 589 additions and 762 deletions

View file

@ -16,10 +16,12 @@
package agent.dbgeng.impl.dbgeng; package agent.dbgeng.impl.dbgeng;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import com.sun.jna.Pointer; 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.Guid.REFIID;
import com.sun.jna.platform.win32.WinDef.ULONG; import com.sun.jna.platform.win32.WinDef.ULONG;
import com.sun.jna.platform.win32.WinNT.HRESULT; import com.sun.jna.platform.win32.WinNT.HRESULT;
@ -35,28 +37,33 @@ public abstract class DbgEngUtil {
private DbgEngUtil() { private DbgEngUtil() {
} }
public record Preferred<T> (REFIID refiid, Class<? extends T> cls) {
public Preferred(IID iid, Class<? extends T> cls) {
this(new REFIID(iid), cls);
}
}
public static interface InterfaceSupplier { public static interface InterfaceSupplier {
HRESULT get(REFIID refiid, PointerByReference pClient); HRESULT get(REFIID refiid, PointerByReference pClient);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <I> I tryPreferredInterfaces(Class<I> cls, public static <I, T> I tryPreferredInterfaces(Class<I> cls, List<Preferred<T>> preferred,
Map<REFIID, ? extends Class<?>> preferred, InterfaceSupplier supplier) { InterfaceSupplier supplier) {
PointerByReference ppClient = new PointerByReference(); PointerByReference ppClient = new PointerByReference();
for (Map.Entry<REFIID, ? extends Class<?>> ent : preferred.entrySet()) { for (Preferred<T> pref : preferred) {
try { try {
COMUtils.checkRC(supplier.get(ent.getKey(), ppClient)); COMUtils.checkRC(supplier.get(pref.refiid, ppClient));
if (ppClient.getValue() == null) { if (ppClient.getValue() == null) {
continue; continue;
} }
Object impl = T impl = pref.cls.getConstructor(Pointer.class).newInstance(ppClient.getValue());
ent.getValue().getConstructor(Pointer.class).newInstance(ppClient.getValue()); Method instanceFor = cls.getMethod("instanceFor", pref.cls);
Method instanceFor = cls.getMethod("instanceFor", ent.getValue());
Object instance = instanceFor.invoke(null, impl); Object instance = instanceFor.invoke(null, impl);
return (I) instance; return (I) instance;
} }
catch (COMException e) { catch (COMException e) {
Msg.debug(DbgEngUtil.class, e + " (" + ent.getValue() + ")"); Msg.debug(DbgEngUtil.class, e + " (" + pref.cls + ")");
// TODO: Only try next on E_NOINTERFACE? // TODO: Only try next on E_NOINTERFACE?
// Try next // Try next
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgeng.impl.dbgeng.advanced; package agent.dbgeng.impl.dbgeng.advanced;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugAdvanced; import agent.dbgeng.dbgeng.DebugAdvanced;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.advanced.*; import agent.dbgeng.jna.dbgeng.advanced.*;
import ghidra.comm.util.BitmaskUniverse; import ghidra.comm.util.BitmaskUniverse;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -42,11 +43,10 @@ public interface DebugAdvancedInternal extends DebugAdvanced {
return DbgEngUtil.lazyWeakCache(CACHE, advanced, DebugAdvancedImpl3::new); return DbgEngUtil.lazyWeakCache(CACHE, advanced, DebugAdvancedImpl3::new);
} }
Map<REFIID, Class<? extends WrapIDebugAdvanced>> PREFERRED_ADVANCED_IIDS = List<Preferred<WrapIDebugAdvanced>> PREFERRED_ADVANCED_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugAdvanced3.IID_IDEBUG_ADVANCED3, WrapIDebugAdvanced3.class),
Map.entry(new REFIID(IDebugAdvanced3.IID_IDEBUG_ADVANCED3), WrapIDebugAdvanced3.class), new Preferred<>(IDebugAdvanced2.IID_IDEBUG_ADVANCED2, WrapIDebugAdvanced2.class),
Map.entry(new REFIID(IDebugAdvanced2.IID_IDEBUG_ADVANCED2), WrapIDebugAdvanced2.class), new Preferred<>(IDebugAdvanced.IID_IDEBUG_ADVANCED, WrapIDebugAdvanced.class));
Map.entry(new REFIID(IDebugAdvanced.IID_IDEBUG_ADVANCED), WrapIDebugAdvanced.class));
static DebugAdvancedInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugAdvancedInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugAdvancedInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugAdvancedInternal.class,

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgeng.impl.dbgeng.breakpoint; package agent.dbgeng.impl.dbgeng.breakpoint;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugBreakpoint; import agent.dbgeng.dbgeng.DebugBreakpoint;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.impl.dbgeng.control.DebugControlInternal; import agent.dbgeng.impl.dbgeng.control.DebugControlInternal;
import agent.dbgeng.jna.dbgeng.breakpoint.*; import agent.dbgeng.jna.dbgeng.breakpoint.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -42,14 +43,10 @@ public interface DebugBreakpointInternal extends DebugBreakpoint {
return DbgEngUtil.lazyWeakCache(CACHE, bp, DebugBreakpointImpl3::new); return DbgEngUtil.lazyWeakCache(CACHE, bp, DebugBreakpointImpl3::new);
} }
Map<REFIID, Class<? extends WrapIDebugBreakpoint>> PREFERRED_BREAKPOINT_IIDS = List<Preferred<WrapIDebugBreakpoint>> PREFERRED_BREAKPOINT_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugBreakpoint3.IID_IDEBUG_BREAKPOINT3, WrapIDebugBreakpoint3.class),
Map.entry(new REFIID(IDebugBreakpoint3.IID_IDEBUG_BREAKPOINT3), new Preferred<>(IDebugBreakpoint2.IID_IDEBUG_BREAKPOINT2, WrapIDebugBreakpoint2.class),
WrapIDebugBreakpoint3.class), new Preferred<>(IDebugBreakpoint.IID_IDEBUG_BREAKPOINT, WrapIDebugBreakpoint.class));
Map.entry(new REFIID(IDebugBreakpoint2.IID_IDEBUG_BREAKPOINT2),
WrapIDebugBreakpoint2.class),
Map.entry(new REFIID(IDebugBreakpoint.IID_IDEBUG_BREAKPOINT),
WrapIDebugBreakpoint.class));
static DebugBreakpointInternal tryPreferredInterfaces(DebugControlInternal control, static DebugBreakpointInternal tryPreferredInterfaces(DebugControlInternal control,
InterfaceSupplier supplier) { InterfaceSupplier supplier) {

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgeng.impl.dbgeng.client; package agent.dbgeng.impl.dbgeng.client;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugClient; import agent.dbgeng.dbgeng.DebugClient;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.impl.dbgeng.control.DebugControlInternal; import agent.dbgeng.impl.dbgeng.control.DebugControlInternal;
import agent.dbgeng.jna.dbgeng.client.*; import agent.dbgeng.jna.dbgeng.client.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -66,15 +67,14 @@ public interface DebugClientInternal extends DebugClient {
return DbgEngUtil.lazyWeakCache(CACHE, client, DebugClientImpl7::new); return DbgEngUtil.lazyWeakCache(CACHE, client, DebugClientImpl7::new);
} }
Map<REFIID, Class<? extends WrapIDebugClient>> PREFERRED_CLIENT_IIDS = List<Preferred<WrapIDebugClient>> PREFERRED_CLIENT_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugClient7.IID_IDEBUG_CLIENT7, WrapIDebugClient7.class),
Map.entry(new REFIID(IDebugClient7.IID_IDEBUG_CLIENT7), WrapIDebugClient7.class), new Preferred<>(IDebugClient6.IID_IDEBUG_CLIENT6, WrapIDebugClient6.class),
Map.entry(new REFIID(IDebugClient6.IID_IDEBUG_CLIENT6), WrapIDebugClient6.class), new Preferred<>(IDebugClient5.IID_IDEBUG_CLIENT5, WrapIDebugClient5.class),
Map.entry(new REFIID(IDebugClient5.IID_IDEBUG_CLIENT5), WrapIDebugClient5.class), new Preferred<>(IDebugClient4.IID_IDEBUG_CLIENT4, WrapIDebugClient4.class),
Map.entry(new REFIID(IDebugClient4.IID_IDEBUG_CLIENT4), WrapIDebugClient4.class), new Preferred<>(IDebugClient3.IID_IDEBUG_CLIENT3, WrapIDebugClient3.class),
Map.entry(new REFIID(IDebugClient3.IID_IDEBUG_CLIENT3), WrapIDebugClient3.class), new Preferred<>(IDebugClient2.IID_IDEBUG_CLIENT2, WrapIDebugClient2.class),
Map.entry(new REFIID(IDebugClient2.IID_IDEBUG_CLIENT2), WrapIDebugClient2.class), new Preferred<>(IDebugClient.IID_IDEBUG_CLIENT, WrapIDebugClient.class));
Map.entry(new REFIID(IDebugClient.IID_IDEBUG_CLIENT), WrapIDebugClient.class));
static DebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugClientInternal.class, PREFERRED_CLIENT_IIDS, return DbgEngUtil.tryPreferredInterfaces(DebugClientInternal.class, PREFERRED_CLIENT_IIDS,

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgeng.impl.dbgeng.control; package agent.dbgeng.impl.dbgeng.control;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugControl; import agent.dbgeng.dbgeng.DebugControl;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; 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.breakpoint.IDebugBreakpoint;
import agent.dbgeng.jna.dbgeng.control.*; import agent.dbgeng.jna.dbgeng.control.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -58,15 +59,14 @@ public interface DebugControlInternal extends DebugControl {
return DbgEngUtil.lazyWeakCache(CACHE, control, DebugControlImpl7::new); return DbgEngUtil.lazyWeakCache(CACHE, control, DebugControlImpl7::new);
} }
Map<REFIID, Class<? extends WrapIDebugControl>> PREFERRED_CONTROL_IIDS = List<Preferred<WrapIDebugControl>> PREFERRED_CONTROL_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugControl7.IID_IDEBUG_CONTROL7, WrapIDebugControl7.class),
Map.entry(new REFIID(IDebugControl7.IID_IDEBUG_CONTROL7), WrapIDebugControl7.class), new Preferred<>(IDebugControl6.IID_IDEBUG_CONTROL6, WrapIDebugControl6.class),
Map.entry(new REFIID(IDebugControl6.IID_IDEBUG_CONTROL6), WrapIDebugControl6.class), new Preferred<>(IDebugControl5.IID_IDEBUG_CONTROL5, WrapIDebugControl5.class),
Map.entry(new REFIID(IDebugControl5.IID_IDEBUG_CONTROL5), WrapIDebugControl5.class), new Preferred<>(IDebugControl4.IID_IDEBUG_CONTROL4, WrapIDebugControl4.class),
Map.entry(new REFIID(IDebugControl4.IID_IDEBUG_CONTROL4), WrapIDebugControl4.class), new Preferred<>(IDebugControl3.IID_IDEBUG_CONTROL3, WrapIDebugControl3.class),
Map.entry(new REFIID(IDebugControl3.IID_IDEBUG_CONTROL3), WrapIDebugControl3.class), new Preferred<>(IDebugControl2.IID_IDEBUG_CONTROL2, WrapIDebugControl2.class),
Map.entry(new REFIID(IDebugControl2.IID_IDEBUG_CONTROL2), WrapIDebugControl2.class), new Preferred<>(IDebugControl.IID_IDEBUG_CONTROL, WrapIDebugControl.class));
Map.entry(new REFIID(IDebugControl.IID_IDEBUG_CONTROL), WrapIDebugControl.class));
static DebugControlInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugControlInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugControlInternal.class, PREFERRED_CONTROL_IIDS, return DbgEngUtil.tryPreferredInterfaces(DebugControlInternal.class, PREFERRED_CONTROL_IIDS,

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgeng.impl.dbgeng.dataspaces; package agent.dbgeng.impl.dbgeng.dataspaces;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugDataSpaces; import agent.dbgeng.dbgeng.DebugDataSpaces;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.dataspaces.*; import agent.dbgeng.jna.dbgeng.dataspaces.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -45,16 +46,11 @@ public interface DebugDataSpacesInternal extends DebugDataSpaces {
return DbgEngUtil.lazyWeakCache(CACHE, data, DebugDataSpacesImpl4::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugDataSpacesImpl4::new);
} }
Map<REFIID, Class<? extends WrapIDebugDataSpaces>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugDataSpaces>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugDataSpaces4.IID_IDEBUG_DATA_SPACES4, WrapIDebugDataSpaces4.class),
Map.entry(new REFIID(IDebugDataSpaces4.IID_IDEBUG_DATA_SPACES4), new Preferred<>(IDebugDataSpaces3.IID_IDEBUG_DATA_SPACES3, WrapIDebugDataSpaces3.class),
WrapIDebugDataSpaces4.class), new Preferred<>(IDebugDataSpaces2.IID_IDEBUG_DATA_SPACES2, WrapIDebugDataSpaces2.class),
Map.entry(new REFIID(IDebugDataSpaces3.IID_IDEBUG_DATA_SPACES3), new Preferred<>(IDebugDataSpaces.IID_IDEBUG_DATA_SPACES, WrapIDebugDataSpaces.class));
WrapIDebugDataSpaces3.class),
Map.entry(new REFIID(IDebugDataSpaces2.IID_IDEBUG_DATA_SPACES2),
WrapIDebugDataSpaces2.class),
Map.entry(new REFIID(IDebugDataSpaces.IID_IDEBUG_DATA_SPACES),
WrapIDebugDataSpaces.class));
static DebugDataSpacesInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugDataSpacesInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugDataSpacesInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugDataSpacesInternal.class,

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgeng.impl.dbgeng.registers; package agent.dbgeng.impl.dbgeng.registers;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugRegisters; import agent.dbgeng.dbgeng.DebugRegisters;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.registers.*; import agent.dbgeng.jna.dbgeng.registers.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -37,12 +38,9 @@ public interface DebugRegistersInternal extends DebugRegisters {
return DbgEngUtil.lazyWeakCache(CACHE, registers, DebugRegistersImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, registers, DebugRegistersImpl2::new);
} }
Map<REFIID, Class<? extends WrapIDebugRegisters>> PREFERRED_REGISTERS_IIDS = List<Preferred<WrapIDebugRegisters>> PREFERRED_REGISTERS_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugRegisters2.IID_IDEBUG_REGISTERS2, WrapIDebugRegisters2.class),
Map.entry(new REFIID(IDebugRegisters2.IID_IDEBUG_REGISTERS2), new Preferred<>(IDebugRegisters.IID_IDEBUG_REGISTERS, WrapIDebugRegisters.class));
WrapIDebugRegisters2.class),
Map.entry(new REFIID(IDebugRegisters.IID_IDEBUG_REGISTERS),
WrapIDebugRegisters.class));
static DebugRegistersInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugRegistersInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugRegistersInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugRegistersInternal.class,

View file

@ -15,15 +15,16 @@
*/ */
package agent.dbgeng.impl.dbgeng.symbols; package agent.dbgeng.impl.dbgeng.symbols;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.*; import agent.dbgeng.dbgeng.*;
import agent.dbgeng.dbgeng.DebugModule.DebugModuleName; import agent.dbgeng.dbgeng.DebugModule.DebugModuleName;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.symbols.*; import agent.dbgeng.jna.dbgeng.symbols.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -50,13 +51,12 @@ public interface DebugSymbolsInternal extends DebugSymbols {
return DbgEngUtil.lazyWeakCache(CACHE, symbols, DebugSymbolsImpl5::new); return DbgEngUtil.lazyWeakCache(CACHE, symbols, DebugSymbolsImpl5::new);
} }
Map<REFIID, Class<? extends WrapIDebugSymbols>> PREFFERED_SYMBOLS_IIDS = List<Preferred<WrapIDebugSymbols>> PREFFERED_SYMBOLS_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugSymbols5.IID_IDEBUG_SYMBOLS5, WrapIDebugSymbols5.class),
Map.entry(new REFIID(IDebugSymbols5.IID_IDEBUG_SYMBOLS5), WrapIDebugSymbols5.class), new Preferred<>(IDebugSymbols4.IID_IDEBUG_SYMBOLS4, WrapIDebugSymbols4.class),
Map.entry(new REFIID(IDebugSymbols4.IID_IDEBUG_SYMBOLS4), WrapIDebugSymbols4.class), new Preferred<>(IDebugSymbols3.IID_IDEBUG_SYMBOLS3, WrapIDebugSymbols3.class),
Map.entry(new REFIID(IDebugSymbols3.IID_IDEBUG_SYMBOLS3), WrapIDebugSymbols3.class), new Preferred<>(IDebugSymbols2.IID_IDEBUG_SYMBOLS2, WrapIDebugSymbols2.class),
Map.entry(new REFIID(IDebugSymbols2.IID_IDEBUG_SYMBOLS2), WrapIDebugSymbols2.class), new Preferred<>(IDebugSymbols.IID_IDEBUG_SYMBOLS, WrapIDebugSymbols.class));
Map.entry(new REFIID(IDebugSymbols.IID_IDEBUG_SYMBOLS), WrapIDebugSymbols.class));
static DebugSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugSymbolsInternal.class, PREFFERED_SYMBOLS_IIDS, return DbgEngUtil.tryPreferredInterfaces(DebugSymbolsInternal.class, PREFFERED_SYMBOLS_IIDS,

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgeng.impl.dbgeng.sysobj; package agent.dbgeng.impl.dbgeng.sysobj;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import agent.dbgeng.dbgeng.DebugSystemObjects; import agent.dbgeng.dbgeng.DebugSystemObjects;
import agent.dbgeng.impl.dbgeng.DbgEngUtil; import agent.dbgeng.impl.dbgeng.DbgEngUtil;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier; import agent.dbgeng.impl.dbgeng.DbgEngUtil.InterfaceSupplier;
import agent.dbgeng.impl.dbgeng.DbgEngUtil.Preferred;
import agent.dbgeng.jna.dbgeng.sysobj.*; import agent.dbgeng.jna.dbgeng.sysobj.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -45,16 +46,15 @@ public interface DebugSystemObjectsInternal extends DebugSystemObjects {
return DbgEngUtil.lazyWeakCache(CACHE, sysobj, DebugSystemObjectsImpl4::new); return DbgEngUtil.lazyWeakCache(CACHE, sysobj, DebugSystemObjectsImpl4::new);
} }
Map<REFIID, Class<? extends WrapIDebugSystemObjects>> PREFERRED_SYSTEM_OBJECTS_IIDS = List<Preferred<WrapIDebugSystemObjects>> PREFERRED_SYSTEM_OBJECTS_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugSystemObjects4.IID_IDEBUG_SYSTEM_OBJECTS4,
Map.entry(new REFIID(IDebugSystemObjects4.IID_IDEBUG_SYSTEM_OBJECTS4), WrapIDebugSystemObjects4.class),
WrapIDebugSystemObjects4.class), new Preferred<>(IDebugSystemObjects3.IID_IDEBUG_SYSTEM_OBJECTS3,
Map.entry(new REFIID(IDebugSystemObjects3.IID_IDEBUG_SYSTEM_OBJECTS3), WrapIDebugSystemObjects3.class),
WrapIDebugSystemObjects3.class), new Preferred<>(IDebugSystemObjects2.IID_IDEBUG_SYSTEM_OBJECTS2,
Map.entry(new REFIID(IDebugSystemObjects2.IID_IDEBUG_SYSTEM_OBJECTS2), WrapIDebugSystemObjects2.class),
WrapIDebugSystemObjects2.class), new Preferred<>(IDebugSystemObjects.IID_IDEBUG_SYSTEM_OBJECTS,
Map.entry(new REFIID(IDebugSystemObjects.IID_IDEBUG_SYSTEM_OBJECTS), WrapIDebugSystemObjects.class));
WrapIDebugSystemObjects.class));
static DebugSystemObjectsInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugSystemObjectsInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgEngUtil.tryPreferredInterfaces(DebugSystemObjectsInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugSystemObjectsInternal.class,

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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> I tryPreferredInterfaces(Class<I> cls,
Map<REFIID, ? extends Class<?>> preferred, InterfaceSupplier supplier) {
PointerByReference ppClient = new PointerByReference();
for (Map.Entry<REFIID, ? extends Class<?>> 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 <T extends Unknown, U> U lazyWeakCache(Map<Pointer, U> cache, T unk,
Function<T, U> 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();
}
}

View file

@ -15,14 +15,16 @@
*/ */
package agent.dbgmodel.impl.dbgmodel; package agent.dbgmodel.impl.dbgmodel;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Guid.REFIID;
import com.sun.jna.platform.win32.COM.IUnknown; 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.dbgmodel.UnknownEx;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.WrapIUnknownEx; import agent.dbgmodel.jna.dbgmodel.WrapIUnknownEx;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,15 +32,14 @@ public interface UnknownExInternal extends UnknownEx {
Map<Pointer, UnknownExInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, UnknownExInternal> CACHE = new WeakValueHashMap<>();
static UnknownExInternal instanceFor(WrapIUnknownEx data) { static UnknownExInternal instanceFor(WrapIUnknownEx data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, UnknownExImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, UnknownExImpl::new);
} }
Map<REFIID, Class<? extends WrapIUnknownEx>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIUnknownEx>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IUnknown.IID_IUNKNOWN, WrapIUnknownEx.class));
Map.entry(new REFIID(IUnknown.IID_IUNKNOWN), WrapIUnknownEx.class));
static UnknownExInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static UnknownExInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(UnknownExInternal.class, return DbgEngUtil.tryPreferredInterfaces(UnknownExInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.bridge; package agent.dbgmodel.impl.dbgmodel.bridge;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IHostDataModelAccess;
import agent.dbgmodel.jna.dbgmodel.bridge.WrapIHostDataModelAccess; import agent.dbgmodel.jna.dbgmodel.bridge.WrapIHostDataModelAccess;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface HostDataModelAccessInternal extends HostDataModelAccess {
Map<Pointer, HostDataModelAccessInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, HostDataModelAccessInternal> CACHE = new WeakValueHashMap<>();
static HostDataModelAccessInternal instanceFor(WrapIHostDataModelAccess data) { static HostDataModelAccessInternal instanceFor(WrapIHostDataModelAccess data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, HostDataModelAccessImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, HostDataModelAccessImpl::new);
} }
Map<REFIID, Class<? extends WrapIHostDataModelAccess>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIHostDataModelAccess>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IHostDataModelAccess.IID_IHOST_DATA_MODEL_ACCESS,
Map.entry(new REFIID(IHostDataModelAccess.IID_IHOST_DATA_MODEL_ACCESS), WrapIHostDataModelAccess.class));
WrapIHostDataModelAccess.class));
static HostDataModelAccessInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static HostDataModelAccessInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(HostDataModelAccessInternal.class, return DbgEngUtil.tryPreferredInterfaces(HostDataModelAccessInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IComparableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIComparableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIComparableConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface ComparableConceptInternal extends ComparableConcept {
Map<Pointer, ComparableConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, ComparableConceptInternal> CACHE = new WeakValueHashMap<>();
static ComparableConceptInternal instanceFor(WrapIComparableConcept data) { static ComparableConceptInternal instanceFor(WrapIComparableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ComparableConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, ComparableConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIComparableConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIComparableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IComparableConcept.IID_ICOMPARABLE_CONCEPT, WrapIComparableConcept.class));
Map.entry(new REFIID(IComparableConcept.IID_ICOMPARABLE_CONCEPT),
WrapIComparableConcept.class));
static ComparableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static ComparableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ComparableConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(ComparableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIDataModelConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIDataModelConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DataModelConceptInternal extends DataModelConcept {
Map<Pointer, DataModelConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelConceptInternal> CACHE = new WeakValueHashMap<>();
static DataModelConceptInternal instanceFor(WrapIDataModelConcept data) { static DataModelConceptInternal instanceFor(WrapIDataModelConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelConcept.IID_IDATA_MODEL_CONCEPT, WrapIDataModelConcept.class));
Map.entry(new REFIID(IDataModelConcept.IID_IDATA_MODEL_CONCEPT),
WrapIDataModelConcept.class));
static DataModelConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDynamicConceptProviderConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicConceptProviderConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicConceptProviderConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -32,19 +33,16 @@ public interface DynamicConceptProviderConceptInternal extends DynamicConceptPro
static DynamicConceptProviderConceptInternal instanceFor( static DynamicConceptProviderConceptInternal instanceFor(
WrapIDynamicConceptProviderConcept data) { WrapIDynamicConceptProviderConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DynamicConceptProviderConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DynamicConceptProviderConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIDynamicConceptProviderConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDynamicConceptProviderConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDynamicConceptProviderConcept.IID_IDYNAMIC_CONCEPT_PROVIDER_CONCEPT,
Map.entry( WrapIDynamicConceptProviderConcept.class));
new REFIID(
IDynamicConceptProviderConcept.IID_IDYNAMIC_CONCEPT_PROVIDER_CONCEPT),
WrapIDynamicConceptProviderConcept.class));
static DynamicConceptProviderConceptInternal tryPreferredInterfaces( static DynamicConceptProviderConceptInternal tryPreferredInterfaces(
InterfaceSupplier supplier) { InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DynamicConceptProviderConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(DynamicConceptProviderConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDynamicKeyProviderConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicKeyProviderConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIDynamicKeyProviderConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DynamicKeyProviderConceptInternal extends DynamicKeyProviderCon
Map<Pointer, DynamicKeyProviderConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DynamicKeyProviderConceptInternal> CACHE = new WeakValueHashMap<>();
static DynamicKeyProviderConceptInternal instanceFor(WrapIDynamicKeyProviderConcept data) { static DynamicKeyProviderConceptInternal instanceFor(WrapIDynamicKeyProviderConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DynamicKeyProviderConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DynamicKeyProviderConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIDynamicKeyProviderConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDynamicKeyProviderConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDynamicKeyProviderConcept.IID_IDYNAMIC_KEY_PROVIDER_CONCEPT,
Map.entry(new REFIID(IDynamicKeyProviderConcept.IID_IDYNAMIC_KEY_PROVIDER_CONCEPT), WrapIDynamicKeyProviderConcept.class));
WrapIDynamicKeyProviderConcept.class));
static DynamicKeyProviderConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DynamicKeyProviderConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DynamicKeyProviderConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(DynamicKeyProviderConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IEquatableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIEquatableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIEquatableConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface EquatableConceptInternal extends EquatableConcept {
Map<Pointer, EquatableConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, EquatableConceptInternal> CACHE = new WeakValueHashMap<>();
static EquatableConceptInternal instanceFor(WrapIEquatableConcept data) { static EquatableConceptInternal instanceFor(WrapIEquatableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, EquatableConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, EquatableConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIEquatableConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIEquatableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IEquatableConcept.IID_IEQUATABLE_CONCEPT, WrapIEquatableConcept.class));
Map.entry(new REFIID(IEquatableConcept.IID_IEQUATABLE_CONCEPT),
WrapIEquatableConcept.class));
static EquatableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static EquatableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(EquatableConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(EquatableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IIndexableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIIndexableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIIndexableConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface IndexableConceptInternal extends IndexableConcept {
Map<Pointer, IndexableConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, IndexableConceptInternal> CACHE = new WeakValueHashMap<>();
static IndexableConceptInternal instanceFor(WrapIIndexableConcept data) { static IndexableConceptInternal instanceFor(WrapIIndexableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, IndexableConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, IndexableConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIIndexableConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIIndexableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IIndexableConcept.IID_IINDEXABLE_CONCEPT, WrapIIndexableConcept.class));
Map.entry(new REFIID(IIndexableConcept.IID_IINDEXABLE_CONCEPT),
WrapIIndexableConcept.class));
static IndexableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static IndexableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(IndexableConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(IndexableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IIterableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIIterableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIIterableConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface IterableConceptInternal extends IterableConcept {
Map<Pointer, IterableConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, IterableConceptInternal> CACHE = new WeakValueHashMap<>();
static IterableConceptInternal instanceFor(WrapIIterableConcept data) { static IterableConceptInternal instanceFor(WrapIIterableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, IterableConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, IterableConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIIterableConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIIterableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IIterableConcept.IID_IITERABLE_CONCEPT, WrapIIterableConcept.class));
Map.entry(new REFIID(IIterableConcept.IID_IITERABLE_CONCEPT),
WrapIIterableConcept.class));
static IterableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static IterableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(IterableConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(IterableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IPreferredRuntimeTypeConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIPreferredRuntimeTypeConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIPreferredRuntimeTypeConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface PreferredRuntimeTypeConceptInternal extends PreferredRuntimeTyp
Map<Pointer, PreferredRuntimeTypeConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, PreferredRuntimeTypeConceptInternal> CACHE = new WeakValueHashMap<>();
static PreferredRuntimeTypeConceptInternal instanceFor(WrapIPreferredRuntimeTypeConcept data) { static PreferredRuntimeTypeConceptInternal instanceFor(WrapIPreferredRuntimeTypeConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, PreferredRuntimeTypeConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, PreferredRuntimeTypeConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIPreferredRuntimeTypeConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIPreferredRuntimeTypeConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IPreferredRuntimeTypeConcept.IID_IPREFERRED_RUNTIME_TYPE_CONCEPT,
Map.entry(new REFIID(IPreferredRuntimeTypeConcept.IID_IPREFERRED_RUNTIME_TYPE_CONCEPT), WrapIPreferredRuntimeTypeConcept.class));
WrapIPreferredRuntimeTypeConcept.class));
static PreferredRuntimeTypeConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static PreferredRuntimeTypeConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(PreferredRuntimeTypeConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(PreferredRuntimeTypeConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.concept; package agent.dbgmodel.impl.dbgmodel.concept;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IStringDisplayableConcept;
import agent.dbgmodel.jna.dbgmodel.concept.WrapIStringDisplayableConcept; import agent.dbgmodel.jna.dbgmodel.concept.WrapIStringDisplayableConcept;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface StringDisplayableConceptInternal extends StringDisplayableConce
Map<Pointer, StringDisplayableConceptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, StringDisplayableConceptInternal> CACHE = new WeakValueHashMap<>();
static StringDisplayableConceptInternal instanceFor(WrapIStringDisplayableConcept data) { static StringDisplayableConceptInternal instanceFor(WrapIStringDisplayableConcept data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, StringDisplayableConceptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, StringDisplayableConceptImpl::new);
} }
Map<REFIID, Class<? extends WrapIStringDisplayableConcept>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIStringDisplayableConcept>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IStringDisplayableConcept.IID_ISTRING_DISPLAYABLE_CONCEPT,
Map.entry(new REFIID(IStringDisplayableConcept.IID_ISTRING_DISPLAYABLE_CONCEPT), WrapIStringDisplayableConcept.class));
WrapIStringDisplayableConcept.class));
static StringDisplayableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static StringDisplayableConceptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(StringDisplayableConceptInternal.class, return DbgEngUtil.tryPreferredInterfaces(StringDisplayableConceptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel; package agent.dbgmodel.impl.dbgmodel.datamodel;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.dbgmodel.datamodel.DataModelManager1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.datamodel.*; import agent.dbgmodel.jna.dbgmodel.datamodel.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DataModelManagerInternal extends DataModelManager1 {
Map<Pointer, DataModelManagerInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelManagerInternal> CACHE = new WeakValueHashMap<>();
static DataModelManagerInternal instanceFor(WrapIDataModelManager1 data) { static DataModelManagerInternal instanceFor(WrapIDataModelManager1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl1::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl1::new);
} }
static DataModelManagerInternal instanceFor(WrapIDataModelManager2 data) { static DataModelManagerInternal instanceFor(WrapIDataModelManager2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelManagerImpl2::new);
} }
Map<REFIID, Class<? extends WrapIDataModelManager1>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelManager1>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelManager2.IID_IDATA_MODEL_MANAGER2, WrapIDataModelManager2.class),
Map.entry(new REFIID(IDataModelManager2.IID_IDATA_MODEL_MANAGER2), new Preferred<>(IDataModelManager1.IID_IDATA_MODEL_MANAGER, WrapIDataModelManager1.class));
WrapIDataModelManager2.class),
Map.entry(new REFIID(IDataModelManager1.IID_IDATA_MODEL_MANAGER),
WrapIDataModelManager1.class));
static DataModelManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelManagerInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelManagerInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelNameBinder;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelNameBinder; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelNameBinder;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelNameBinderInternal extends DataModelNameBinder {
Map<Pointer, DataModelNameBinderInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelNameBinderInternal> CACHE = new WeakValueHashMap<>();
static DataModelNameBinderInternal instanceFor(WrapIDataModelNameBinder data) { static DataModelNameBinderInternal instanceFor(WrapIDataModelNameBinder data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelNameBinderImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelNameBinderImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelNameBinder>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelNameBinder>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelNameBinder.IID_IDATA_MODEL_NAME_BINDER,
Map.entry(new REFIID(IDataModelNameBinder.IID_IDATA_MODEL_NAME_BINDER), WrapIDataModelNameBinder.class));
WrapIDataModelNameBinder.class));
static DataModelNameBinderInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelNameBinderInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelNameBinderInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelNameBinderInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptClient;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptClient; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptClient;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptClientInternal extends DataModelScriptClient {
Map<Pointer, DataModelScriptClientInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelScriptClientInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptClientInternal instanceFor(WrapIDataModelScriptClient data) { static DataModelScriptClientInternal instanceFor(WrapIDataModelScriptClient data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptClientImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptClientImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptClient>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptClient>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptClient.IID_IDATA_MODEL_SCRIPT_CLIENT,
Map.entry(new REFIID(IDataModelScriptClient.IID_IDATA_MODEL_SCRIPT_CLIENT), WrapIDataModelScriptClient.class));
WrapIDataModelScriptClient.class));
static DataModelScriptClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptClientInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptClientInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptHostContext;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptHostContext; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptHostContext;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptHostContextInternal extends DataModelScriptHostC
Map<Pointer, DataModelScriptHostContextInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelScriptHostContextInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptHostContextInternal instanceFor(WrapIDataModelScriptHostContext data) { static DataModelScriptHostContextInternal instanceFor(WrapIDataModelScriptHostContext data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptHostContextImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptHostContextImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptHostContext>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptHostContext>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptHostContext.IID_IDATA_MODEL_SCRIPT_HOST_CONTEXT,
Map.entry(new REFIID(IDataModelScriptHostContext.IID_IDATA_MODEL_SCRIPT_HOST_CONTEXT), WrapIDataModelScriptHostContext.class));
WrapIDataModelScriptHostContext.class));
static DataModelScriptHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptHostContextInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptHostContextInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScript;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScript; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScript;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptInternal extends DataModelScript {
Map<Pointer, DataModelScriptInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelScriptInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptInternal instanceFor(WrapIDataModelScript data) { static DataModelScriptInternal instanceFor(WrapIDataModelScript data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScript>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScript>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScript.IID_IDATA_MODEL_SCRIPT,
Map.entry(new REFIID(IDataModelScript.IID_IDATA_MODEL_SCRIPT), WrapIDataModelScript.class));
WrapIDataModelScript.class));
static DataModelScriptInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptManager;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptManager; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptManager;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptManagerInternal extends DataModelScriptManager {
Map<Pointer, DataModelScriptManagerInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelScriptManagerInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptManagerInternal instanceFor(WrapIDataModelScriptManager data) { static DataModelScriptManagerInternal instanceFor(WrapIDataModelScriptManager data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptManagerImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptManagerImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptManager>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptManager>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptManager.IID_IDATA_MODEL_SCRIPT_MANAGER,
Map.entry(new REFIID(IDataModelScriptManager.IID_IDATA_MODEL_SCRIPT_MANAGER), WrapIDataModelScriptManager.class));
WrapIDataModelScriptManager.class));
static DataModelScriptManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptManagerInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptManagerInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptManagerInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptProviderEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProviderEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProviderEnumerator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -33,19 +34,17 @@ public interface DataModelScriptProviderEnumeratorInternal
static DataModelScriptProviderEnumeratorInternal instanceFor( static DataModelScriptProviderEnumeratorInternal instanceFor(
WrapIDataModelScriptProviderEnumerator data) { WrapIDataModelScriptProviderEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderEnumeratorImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderEnumeratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptProviderEnumerator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptProviderEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(
Map.entry( IDataModelScriptProviderEnumerator.IID_IDATA_MODEL_SCRIPT_PROVIDER_ENUMERATOR,
new REFIID( WrapIDataModelScriptProviderEnumerator.class));
IDataModelScriptProviderEnumerator.IID_IDATA_MODEL_SCRIPT_PROVIDER_ENUMERATOR),
WrapIDataModelScriptProviderEnumerator.class));
static DataModelScriptProviderEnumeratorInternal tryPreferredInterfaces( static DataModelScriptProviderEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) { InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptProviderEnumeratorInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptProviderEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptProvider;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProvider; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptProvider;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptProviderInternal extends DataModelScriptProvider
Map<Pointer, DataModelScriptProviderInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelScriptProviderInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptProviderInternal instanceFor(WrapIDataModelScriptProvider data) { static DataModelScriptProviderInternal instanceFor(WrapIDataModelScriptProvider data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptProviderImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptProvider>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptProvider>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptProvider.IID_IDATA_MODEL_SCRIPT_PROVIDER,
Map.entry(new REFIID(IDataModelScriptProvider.IID_IDATA_MODEL_SCRIPT_PROVIDER), WrapIDataModelScriptProvider.class));
WrapIDataModelScriptProvider.class));
static DataModelScriptProviderInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptProviderInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptProviderInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptProviderInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptTemplateEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplateEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplateEnumerator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -33,18 +34,17 @@ public interface DataModelScriptTemplateEnumeratorInternal
static DataModelScriptTemplateEnumeratorInternal instanceFor( static DataModelScriptTemplateEnumeratorInternal instanceFor(
WrapIDataModelScriptTemplateEnumerator data) { WrapIDataModelScriptTemplateEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateEnumeratorImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateEnumeratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptTemplateEnumerator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptTemplateEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(
Map.entry(new REFIID( IDataModelScriptTemplateEnumerator.IID_IDATA_MODEL_SCRIPT_TEMPLATE_ENUMERATOR,
IDataModelScriptTemplateEnumerator.IID_IDATA_MODEL_SCRIPT_TEMPLATE_ENUMERATOR), WrapIDataModelScriptTemplateEnumerator.class));
WrapIDataModelScriptTemplateEnumerator.class));
static DataModelScriptTemplateEnumeratorInternal tryPreferredInterfaces( static DataModelScriptTemplateEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) { InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptTemplateEnumeratorInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptTemplateEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script; package agent.dbgmodel.impl.dbgmodel.datamodel.script;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptTemplate;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplate; import agent.dbgmodel.jna.dbgmodel.datamodel.script.WrapIDataModelScriptTemplate;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DataModelScriptTemplateInternal extends DataModelScriptTemplate
Map<Pointer, DataModelScriptTemplateInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelScriptTemplateInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptTemplateInternal instanceFor(WrapIDataModelScriptTemplate data) { static DataModelScriptTemplateInternal instanceFor(WrapIDataModelScriptTemplate data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptTemplateImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptTemplate>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptTemplate>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptTemplate.IID_IDATA_MODEL_SCRIPT_TEMPLATE,
Map.entry(new REFIID(IDataModelScriptTemplate.IID_IDATA_MODEL_SCRIPT_TEMPLATE), WrapIDataModelScriptTemplate.class));
WrapIDataModelScriptTemplate.class));
static DataModelScriptTemplateInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptTemplateInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptTemplateInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptTemplateInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptDebugBreakpointEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpointEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpointEnumerator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -33,20 +34,19 @@ public interface DataModelScriptDebugBreakpointEnumeratorInternal
static DataModelScriptDebugBreakpointEnumeratorInternal instanceFor( static DataModelScriptDebugBreakpointEnumeratorInternal instanceFor(
WrapIDataModelScriptDebugBreakpointEnumerator data) { WrapIDataModelScriptDebugBreakpointEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, return DbgEngUtil.lazyWeakCache(CACHE, data,
DataModelScriptDebugBreakpointEnumeratorImpl::new); DataModelScriptDebugBreakpointEnumeratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptDebugBreakpointEnumerator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptDebugBreakpointEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries( List.of(
Map.entry( new Preferred<>(
new REFIID( IDataModelScriptDebugBreakpointEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT_ENUMERATOR,
IDataModelScriptDebugBreakpointEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT_ENUMERATOR),
WrapIDataModelScriptDebugBreakpointEnumerator.class)); WrapIDataModelScriptDebugBreakpointEnumerator.class));
static DataModelScriptDebugBreakpointEnumeratorInternal tryPreferredInterfaces( static DataModelScriptDebugBreakpointEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) { InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces( return DbgEngUtil.tryPreferredInterfaces(
DataModelScriptDebugBreakpointEnumeratorInternal.class, DataModelScriptDebugBreakpointEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptDebugBreakpoint;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpoint; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugBreakpoint;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -32,19 +33,18 @@ public interface DataModelScriptDebugBreakpointInternal extends DataModelScriptD
static DataModelScriptDebugBreakpointInternal instanceFor( static DataModelScriptDebugBreakpointInternal instanceFor(
WrapIDataModelScriptDebugBreakpoint data) { WrapIDataModelScriptDebugBreakpoint data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugBreakpointImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugBreakpointImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptDebugBreakpoint>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptDebugBreakpoint>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries( List.of(
Map.entry( new Preferred<>(
new REFIID( IDataModelScriptDebugBreakpoint.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT,
IDataModelScriptDebugBreakpoint.IID_IDATA_MODEL_SCRIPT_DEBUG_BREAKPOINT),
WrapIDataModelScriptDebugBreakpoint.class)); WrapIDataModelScriptDebugBreakpoint.class));
static DataModelScriptDebugBreakpointInternal tryPreferredInterfaces( static DataModelScriptDebugBreakpointInternal tryPreferredInterfaces(
InterfaceSupplier supplier) { InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugBreakpointInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugBreakpointInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptDebugClient;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugClient; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugClient;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -32,17 +33,15 @@ public interface DataModelScriptDebugClientInternal extends DataModelScriptDebug
static DataModelScriptDebugClientInternal instanceFor( static DataModelScriptDebugClientInternal instanceFor(
WrapIDataModelScriptDebugClient data) { WrapIDataModelScriptDebugClient data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugClientImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugClientImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptDebugClient>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptDebugClient>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptDebugClient.IID_IDATA_MODEL_SCRIPT_DEBUG_CLIENT,
Map.entry( WrapIDataModelScriptDebugClient.class));
new REFIID(IDataModelScriptDebugClient.IID_IDATA_MODEL_SCRIPT_DEBUG_CLIENT),
WrapIDataModelScriptDebugClient.class));
static DataModelScriptDebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptDebugClientInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugClientInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugClientInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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 agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,18 +31,17 @@ public interface DataModelScriptDebugInternal extends DataModelScriptDebug1 {
Map<Pointer, DataModelScriptDebugInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DataModelScriptDebugInternal> CACHE = new WeakValueHashMap<>();
static DataModelScriptDebugInternal instanceFor(WrapIDataModelScriptDebug data) { static DataModelScriptDebugInternal instanceFor(WrapIDataModelScriptDebug data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptDebug>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptDebug>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptDebug2.IID_IDATA_MODEL_SCRIPT_DEBUG2,
Map.entry(new REFIID(IDataModelScriptDebug2.IID_IDATA_MODEL_SCRIPT_DEBUG2), WrapIDataModelScriptDebug.class),
WrapIDataModelScriptDebug.class), new Preferred<>(IDataModelScriptDebug.IID_IDATA_MODEL_SCRIPT_DEBUG,
Map.entry(new REFIID(IDataModelScriptDebug.IID_IDATA_MODEL_SCRIPT_DEBUG), WrapIDataModelScriptDebug.class));
WrapIDataModelScriptDebug.class));
static DataModelScriptDebugInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptDebugInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptDebugStackFrame;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStackFrame; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStackFrame;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -32,19 +33,16 @@ public interface DataModelScriptDebugStackFrameInternal extends DataModelScriptD
static DataModelScriptDebugStackFrameInternal instanceFor( static DataModelScriptDebugStackFrameInternal instanceFor(
WrapIDataModelScriptDebugStackFrame data) { WrapIDataModelScriptDebugStackFrame data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackFrameImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackFrameImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptDebugStackFrame>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptDebugStackFrame>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptDebugStackFrame.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK_FRAME,
Map.entry( WrapIDataModelScriptDebugStackFrame.class));
new REFIID(
IDataModelScriptDebugStackFrame.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK_FRAME),
WrapIDataModelScriptDebugStackFrame.class));
static DataModelScriptDebugStackFrameInternal tryPreferredInterfaces( static DataModelScriptDebugStackFrameInternal tryPreferredInterfaces(
InterfaceSupplier supplier) { InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugStackFrameInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugStackFrameInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptDebugStack;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStack; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugStack;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -32,17 +33,15 @@ public interface DataModelScriptDebugStackInternal extends DataModelScriptDebugS
static DataModelScriptDebugStackInternal instanceFor( static DataModelScriptDebugStackInternal instanceFor(
WrapIDataModelScriptDebugStack data) { WrapIDataModelScriptDebugStack data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DataModelScriptDebugStackImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptDebugStack>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptDebugStack>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDataModelScriptDebugStack.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK,
Map.entry( WrapIDataModelScriptDebugStack.class));
new REFIID(IDataModelScriptDebugStack.IID_IDATA_MODEL_SCRIPT_DEBUG_STACK),
WrapIDataModelScriptDebugStack.class));
static DataModelScriptDebugStackInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DataModelScriptDebugStackInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DataModelScriptDebugStackInternal.class, return DbgEngUtil.tryPreferredInterfaces(DataModelScriptDebugStackInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug; package agent.dbgmodel.impl.dbgmodel.datamodel.script.debug;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDataModelScriptDebugVariableSetEnumerator;
import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugVariableSetEnumerator; import agent.dbgmodel.jna.dbgmodel.datamodel.script.debug.WrapIDataModelScriptDebugVariableSetEnumerator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -34,20 +35,19 @@ public interface DataModelScriptDebugVariableSetEnumeratorInternal
static DataModelScriptDebugVariableSetEnumeratorInternal instanceFor( static DataModelScriptDebugVariableSetEnumeratorInternal instanceFor(
WrapIDataModelScriptDebugVariableSetEnumerator data) { WrapIDataModelScriptDebugVariableSetEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, return DbgEngUtil.lazyWeakCache(CACHE, data,
DataModelScriptDebugVariableSetEnumeratorImpl::new); DataModelScriptDebugVariableSetEnumeratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIDataModelScriptDebugVariableSetEnumerator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDataModelScriptDebugVariableSetEnumerator>> PREFERRED_DATA_SPACES_IIDS =
Map.ofEntries( List.of(
Map.entry( new Preferred<>(
new REFIID( IDataModelScriptDebugVariableSetEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_VARIABLE_SET_ENUMERATOR,
IDataModelScriptDebugVariableSetEnumerator.IID_IDATA_MODEL_SCRIPT_DEBUG_VARIABLE_SET_ENUMERATOR),
WrapIDataModelScriptDebugVariableSetEnumerator.class)); WrapIDataModelScriptDebugVariableSetEnumerator.class));
static DataModelScriptDebugVariableSetEnumeratorInternal tryPreferredInterfaces( static DataModelScriptDebugVariableSetEnumeratorInternal tryPreferredInterfaces(
InterfaceSupplier supplier) { InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces( return DbgEngUtil.tryPreferredInterfaces(
DataModelScriptDebugVariableSetEnumeratorInternal.class, DataModelScriptDebugVariableSetEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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_IDebugHostBaseClass;
import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass; import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -32,16 +33,15 @@ public interface DebugHostBaseClassInternal extends DebugHostBase {
Map<Pointer, X_DebugHostBaseClassInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, X_DebugHostBaseClassInternal> CACHE = new WeakValueHashMap<>();
static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) { static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new);
} }
Map<REFIID, Class<? extends X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS,
Map.entry(new REFIID(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS), X_WrapIDebugHostBaseClass.class));
X_WrapIDebugHostBaseClass.class));
static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class, return DbgEngUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostConstant;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostConstant; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostConstant;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostConstantInternal extends DebugHostConstant {
Map<Pointer, DebugHostConstantInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostConstantInternal> CACHE = new WeakValueHashMap<>();
static DebugHostConstantInternal instanceFor(WrapIDebugHostConstant data) { static DebugHostConstantInternal instanceFor(WrapIDebugHostConstant data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostConstantImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostConstantImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostConstant>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostConstant>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostConstant.IID_IDEBUG_HOST_CONSTANT,
Map.entry(new REFIID(IDebugHostConstant.IID_IDEBUG_HOST_CONSTANT), WrapIDebugHostConstant.class));
WrapIDebugHostConstant.class));
static DebugHostConstantInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostConstantInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostConstantInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostConstantInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostContext;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostContext; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostContext;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostContextInternal extends DebugHostContext {
Map<Pointer, DebugHostContextInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostContextInternal> CACHE = new WeakValueHashMap<>();
static DebugHostContextInternal instanceFor(WrapIDebugHostContext data) { static DebugHostContextInternal instanceFor(WrapIDebugHostContext data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostContextImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostContextImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostContext>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostContext>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostContext.IID_IDEBUG_HOST_CONTEXT,
Map.entry(new REFIID(IDebugHostContext.IID_IDEBUG_HOST_CONTEXT), WrapIDebugHostContext.class));
WrapIDebugHostContext.class));
static DebugHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostContextInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostContextInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostContextInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostData;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostData; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostData;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface DebugHostDataInternal extends DebugHostData {
Map<Pointer, DebugHostDataInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostDataInternal> CACHE = new WeakValueHashMap<>();
static DebugHostDataInternal instanceFor(WrapIDebugHostData data) { static DebugHostDataInternal instanceFor(WrapIDebugHostData data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostDataImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostDataImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostData>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostData>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostData.IID_IDEBUG_HOST_DATA, WrapIDebugHostData.class));
Map.entry(new REFIID(IDebugHostData.IID_IDEBUG_HOST_DATA), WrapIDebugHostData.class));
static DebugHostDataInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostDataInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostDataInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostDataInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostErrorSink;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostErrorSink; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostErrorSink;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostErrorSinkInternal extends DebugHostErrorSink {
Map<Pointer, DebugHostErrorSinkInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostErrorSinkInternal> CACHE = new WeakValueHashMap<>();
static DebugHostErrorSinkInternal instanceFor(WrapIDebugHostErrorSink data) { static DebugHostErrorSinkInternal instanceFor(WrapIDebugHostErrorSink data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostErrorSinkImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostErrorSinkImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostErrorSink>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostErrorSink>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostErrorSink.IID_IDEBUG_HOST_ERROR_SINK,
Map.entry(new REFIID(IDebugHostErrorSink.IID_IDEBUG_HOST_ERROR_SINK), WrapIDebugHostErrorSink.class));
WrapIDebugHostErrorSink.class));
static DebugHostErrorSinkInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostErrorSinkInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostErrorSinkInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostErrorSinkInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.dbgmodel.debughost.DebugHostEvaluator1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*; import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,21 @@ public interface DebugHostEvaluatorInternal extends DebugHostEvaluator1 {
Map<Pointer, DebugHostEvaluatorInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostEvaluatorInternal> CACHE = new WeakValueHashMap<>();
static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator1 data) { static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl1::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl1::new);
} }
static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator2 data) { static DebugHostEvaluatorInternal instanceFor(WrapIDebugHostEvaluator2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostEvaluatorImpl2::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostEvaluator1>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostEvaluator1>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostEvaluator2.IID_IDEBUG_HOST_EVALUATOR2,
Map.entry(new REFIID(IDebugHostEvaluator2.IID_IDEBUG_HOST_EVALUATOR2), WrapIDebugHostEvaluator2.class),
WrapIDebugHostEvaluator2.class), new Preferred<>(IDebugHostEvaluator1.IID_IDEBUG_HOST_EVALUATOR,
Map.entry(new REFIID(IDebugHostEvaluator1.IID_IDEBUG_HOST_EVALUATOR), WrapIDebugHostEvaluator1.class));
WrapIDebugHostEvaluator1.class));
static DebugHostEvaluatorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostEvaluatorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostEvaluatorInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostEvaluatorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostExtensability;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostExtensability; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostExtensability;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostExtensabilityInternal extends DebugHostExtensability {
Map<Pointer, DebugHostExtensabilityInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostExtensabilityInternal> CACHE = new WeakValueHashMap<>();
static DebugHostExtensabilityInternal instanceFor(WrapIDebugHostExtensability data) { static DebugHostExtensabilityInternal instanceFor(WrapIDebugHostExtensability data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostExtensabilityImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostExtensabilityImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostExtensability>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostExtensability>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostExtensability.IID_IDEBUG_HOST_EXTENSABILITY,
Map.entry(new REFIID(IDebugHostExtensability.IID_IDEBUG_HOST_EXTENSABILITY), WrapIDebugHostExtensability.class));
WrapIDebugHostExtensability.class));
static DebugHostExtensabilityInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostExtensabilityInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostExtensabilityInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostExtensabilityInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostField;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostField; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostField;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostFieldInternal extends DebugHostField {
Map<Pointer, DebugHostFieldInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostFieldInternal> CACHE = new WeakValueHashMap<>();
static DebugHostFieldInternal instanceFor(WrapIDebugHostField data) { static DebugHostFieldInternal instanceFor(WrapIDebugHostField data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostFieldImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostFieldImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostField>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostField>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostField.IID_IDEBUG_HOST_FIELD, WrapIDebugHostField.class));
Map.entry(new REFIID(IDebugHostField.IID_IDEBUG_HOST_FIELD),
WrapIDebugHostField.class));
static DebugHostFieldInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostFieldInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostFieldInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostFieldInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHost;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHost; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHost;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface DebugHostInternal extends DebugHost {
Map<Pointer, DebugHostInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostInternal> CACHE = new WeakValueHashMap<>();
static DebugHostInternal instanceFor(WrapIDebugHost data) { static DebugHostInternal instanceFor(WrapIDebugHost data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHost>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHost>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHost.IID_IDEBUG_HOST, WrapIDebugHost.class));
Map.entry(new REFIID(IDebugHost.IID_IDEBUG_HOST), WrapIDebugHost.class));
static DebugHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.dbgmodel.debughost.DebugHostMemory1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*; import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DebugHostMemoryInternal extends DebugHostMemory1 {
Map<Pointer, DebugHostMemoryInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostMemoryInternal> CACHE = new WeakValueHashMap<>();
static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory1 data) { static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl1::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl1::new);
} }
static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory2 data) { static DebugHostMemoryInternal instanceFor(WrapIDebugHostMemory2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostMemoryImpl2::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostMemory1>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostMemory1>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostMemory2.IID_IDEBUG_HOST_MEMORY2, WrapIDebugHostMemory2.class),
Map.entry(new REFIID(IDebugHostMemory2.IID_IDEBUG_HOST_MEMORY2), new Preferred<>(IDebugHostMemory1.IID_IDEBUG_HOST_MEMORY, WrapIDebugHostMemory1.class));
WrapIDebugHostMemory2.class),
Map.entry(new REFIID(IDebugHostMemory1.IID_IDEBUG_HOST_MEMORY),
WrapIDebugHostMemory1.class));
static DebugHostMemoryInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostMemoryInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostMemoryInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostMemoryInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.dbgmodel.debughost.DebugHostModule1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*; import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DebugHostModuleInternal extends DebugHostModule1 {
Map<Pointer, DebugHostModuleInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostModuleInternal> CACHE = new WeakValueHashMap<>();
static DebugHostModuleInternal instanceFor(WrapIDebugHostModule1 data) { static DebugHostModuleInternal instanceFor(WrapIDebugHostModule1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl1::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl1::new);
} }
static DebugHostModuleInternal instanceFor(WrapIDebugHostModule2 data) { static DebugHostModuleInternal instanceFor(WrapIDebugHostModule2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleImpl2::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostModule1>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostModule1>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostModule2.IID_IDEBUG_HOST_MODULE2, WrapIDebugHostModule2.class),
Map.entry(new REFIID(IDebugHostModule2.IID_IDEBUG_HOST_MODULE2), new Preferred<>(IDebugHostModule1.IID_IDEBUG_HOST_MODULE, WrapIDebugHostModule1.class));
WrapIDebugHostModule2.class),
Map.entry(new REFIID(IDebugHostModule1.IID_IDEBUG_HOST_MODULE),
WrapIDebugHostModule1.class));
static DebugHostModuleInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostModuleInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostModuleInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostModuleInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostModuleSignature;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostModuleSignature; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostModuleSignature;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostModuleSignatureInternal extends DebugHostModuleSignatu
Map<Pointer, DebugHostModuleSignatureInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostModuleSignatureInternal> CACHE = new WeakValueHashMap<>();
static DebugHostModuleSignatureInternal instanceFor(WrapIDebugHostModuleSignature data) { static DebugHostModuleSignatureInternal instanceFor(WrapIDebugHostModuleSignature data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostModuleSignatureImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostModuleSignatureImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostModuleSignature>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostModuleSignature>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostModuleSignature.IID_IDEBUG_HOST_MODULE_SIGNATURE,
Map.entry(new REFIID(IDebugHostModuleSignature.IID_IDEBUG_HOST_MODULE_SIGNATURE), WrapIDebugHostModuleSignature.class));
WrapIDebugHostModuleSignature.class));
static DebugHostModuleSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostModuleSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostModuleSignatureInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostModuleSignatureInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostPublic;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostPublic; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostPublic;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostPublicInternal extends DebugHostPublic {
Map<Pointer, DebugHostPublicInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostPublicInternal> CACHE = new WeakValueHashMap<>();
static DebugHostPublicInternal instanceFor(WrapIDebugHostPublic data) { static DebugHostPublicInternal instanceFor(WrapIDebugHostPublic data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostPublicImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostPublicImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostPublic>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostPublic>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostPublic.IID_IDEBUG_HOST_PUBLIC, WrapIDebugHostPublic.class));
Map.entry(new REFIID(IDebugHostPublic.IID_IDEBUG_HOST_PUBLIC),
WrapIDebugHostPublic.class));
static DebugHostPublicInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostPublicInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostPublicInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostPublicInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostScriptHost;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostScriptHost; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostScriptHost;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostScriptHostInternal extends DebugHostScriptHost {
Map<Pointer, DebugHostScriptHostInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostScriptHostInternal> CACHE = new WeakValueHashMap<>();
static DebugHostScriptHostInternal instanceFor(WrapIDebugHostScriptHost data) { static DebugHostScriptHostInternal instanceFor(WrapIDebugHostScriptHost data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostScriptHostImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostScriptHostImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostScriptHost>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostScriptHost>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostScriptHost.IID_IDEBUG_HOST_SCRIPT_HOST,
Map.entry(new REFIID(IDebugHostScriptHost.IID_IDEBUG_HOST_SCRIPT_HOST), WrapIDebugHostScriptHost.class));
WrapIDebugHostScriptHost.class));
static DebugHostScriptHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostScriptHostInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostScriptHostInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostScriptHostInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostStatus;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostStatus; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostStatus;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostStatusInternal extends DebugHostStatus {
Map<Pointer, DebugHostStatusInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostStatusInternal> CACHE = new WeakValueHashMap<>();
static DebugHostStatusInternal instanceFor(WrapIDebugHostStatus data) { static DebugHostStatusInternal instanceFor(WrapIDebugHostStatus data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostStatusImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostStatusImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostStatus>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostStatus>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostStatus.IID_IDEBUG_HOST_STATUS, WrapIDebugHostStatus.class));
Map.entry(new REFIID(IDebugHostStatus.IID_IDEBUG_HOST_STATUS),
WrapIDebugHostStatus.class));
static DebugHostStatusInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostStatusInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostStatusInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostStatusInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostSymbolEnumerator;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbolEnumerator; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbolEnumerator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostSymbolEnumeratorInternal extends DebugHostSymbolEnumer
Map<Pointer, DebugHostSymbolEnumeratorInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostSymbolEnumeratorInternal> CACHE = new WeakValueHashMap<>();
static DebugHostSymbolEnumeratorInternal instanceFor(WrapIDebugHostSymbolEnumerator data) { static DebugHostSymbolEnumeratorInternal instanceFor(WrapIDebugHostSymbolEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolEnumeratorImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolEnumeratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostSymbolEnumerator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostSymbolEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostSymbolEnumerator.IID_IDEBUG_HOST_SYMBOL_ENUMERATOR,
Map.entry(new REFIID(IDebugHostSymbolEnumerator.IID_IDEBUG_HOST_SYMBOL_ENUMERATOR), WrapIDebugHostSymbolEnumerator.class));
WrapIDebugHostSymbolEnumerator.class));
static DebugHostSymbolEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostSymbolEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolEnumeratorInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.dbgmodel.debughost.DebugHostSymbol1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*; import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface DebugHostSymbolInternal extends DebugHostSymbol1 {
Map<Pointer, DebugHostSymbolInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostSymbolInternal> CACHE = new WeakValueHashMap<>();
static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol1 data) { static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl1::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl1::new);
} }
static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol2 data) { static DebugHostSymbolInternal instanceFor(WrapIDebugHostSymbol2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolImpl2::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostSymbol1>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostSymbol1>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostSymbol2.IID_IDEBUG_HOST_SYMBOL2, WrapIDebugHostSymbol2.class),
Map.entry(new REFIID(IDebugHostSymbol2.IID_IDEBUG_HOST_SYMBOL2), new Preferred<>(IDebugHostSymbol1.IID_IDEBUG_HOST_SYMBOL, WrapIDebugHostSymbol1.class));
WrapIDebugHostSymbol2.class),
Map.entry(new REFIID(IDebugHostSymbol1.IID_IDEBUG_HOST_SYMBOL),
WrapIDebugHostSymbol1.class));
static DebugHostSymbolInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostSymbolInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostSymbols;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbols; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostSymbols;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,14 @@ public interface DebugHostSymbolsInternal extends DebugHostSymbols {
Map<Pointer, DebugHostSymbolsInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostSymbolsInternal> CACHE = new WeakValueHashMap<>();
static DebugHostSymbolsInternal instanceFor(WrapIDebugHostSymbols data) { static DebugHostSymbolsInternal instanceFor(WrapIDebugHostSymbols data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostSymbolsImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostSymbolsImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostSymbols>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostSymbols>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostSymbols.IID_IDEBUG_HOST_SYMBOLS, WrapIDebugHostSymbols.class));
Map.entry(new REFIID(IDebugHostSymbols.IID_IDEBUG_HOST_SYMBOLS),
WrapIDebugHostSymbols.class));
static DebugHostSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostSymbolsInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostSymbolsInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostSymbolsInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.dbgmodel.debughost.DebugHostType1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.debughost.*; import agent.dbgmodel.jna.dbgmodel.debughost.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,20 +31,19 @@ public interface DebugHostTypeInternal extends DebugHostType1 {
Map<Pointer, DebugHostTypeInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostTypeInternal> CACHE = new WeakValueHashMap<>();
static DebugHostTypeInternal instanceFor(WrapIDebugHostType1 data) { static DebugHostTypeInternal instanceFor(WrapIDebugHostType1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl1::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl1::new);
} }
static DebugHostTypeInternal instanceFor(WrapIDebugHostType2 data) { static DebugHostTypeInternal instanceFor(WrapIDebugHostType2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeImpl2::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostType1>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostType1>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostType2.IID_IDEBUG_HOST_TYPE2, WrapIDebugHostType2.class),
Map.entry(new REFIID(IDebugHostType2.IID_IDEBUG_HOST_TYPE2), WrapIDebugHostType2.class), new Preferred<>(IDebugHostType1.IID_IDEBUG_HOST_TYPE, WrapIDebugHostType1.class));
Map.entry(new REFIID(IDebugHostType1.IID_IDEBUG_HOST_TYPE), WrapIDebugHostType1.class));
static DebugHostTypeInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostTypeInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostTypeInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostTypeInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IDebugHostTypeSignature;
import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostTypeSignature; import agent.dbgmodel.jna.dbgmodel.debughost.WrapIDebugHostTypeSignature;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface DebugHostTypeSignatureInternal extends DebugHostTypeSignature {
Map<Pointer, DebugHostTypeSignatureInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, DebugHostTypeSignatureInternal> CACHE = new WeakValueHashMap<>();
static DebugHostTypeSignatureInternal instanceFor(WrapIDebugHostTypeSignature data) { static DebugHostTypeSignatureInternal instanceFor(WrapIDebugHostTypeSignature data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, DebugHostTypeSignatureImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, DebugHostTypeSignatureImpl::new);
} }
Map<REFIID, Class<? extends WrapIDebugHostTypeSignature>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIDebugHostTypeSignature>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IDebugHostTypeSignature.IID_IDEBUG_HOST_TYPE_SIGNATURE,
Map.entry(new REFIID(IDebugHostTypeSignature.IID_IDEBUG_HOST_TYPE_SIGNATURE), WrapIDebugHostTypeSignature.class));
WrapIDebugHostTypeSignature.class));
static DebugHostTypeSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static DebugHostTypeSignatureInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(DebugHostTypeSignatureInternal.class, return DbgEngUtil.tryPreferredInterfaces(DebugHostTypeSignatureInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.debughost; package agent.dbgmodel.impl.dbgmodel.debughost;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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_IDebugHostBaseClass;
import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass; import agent.dbgmodel.jna.dbgmodel.debughost.X_WrapIDebugHostBaseClass;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface X_DebugHostBaseClassInternal extends DebugHostBaseClass {
Map<Pointer, X_DebugHostBaseClassInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, X_DebugHostBaseClassInternal> CACHE = new WeakValueHashMap<>();
static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) { static X_DebugHostBaseClassInternal instanceFor(X_WrapIDebugHostBaseClass data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, X_DebugHostBaseClassImpl::new);
} }
Map<REFIID, Class<? extends X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<X_WrapIDebugHostBaseClass>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS,
Map.entry(new REFIID(X_IDebugHostBaseClass.IID_IDEBUG_HOST_BASE_CLASS), X_WrapIDebugHostBaseClass.class));
X_WrapIDebugHostBaseClass.class));
static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static X_DebugHostBaseClassInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class, return DbgEngUtil.tryPreferredInterfaces(X_DebugHostBaseClassInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IKeyEnumerator;
import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyEnumerator; import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyEnumerator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface KeyEnumeratorInternal extends KeyEnumerator {
Map<Pointer, KeyEnumeratorInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, KeyEnumeratorInternal> CACHE = new WeakValueHashMap<>();
static KeyEnumeratorInternal instanceFor(WrapIKeyEnumerator data) { static KeyEnumeratorInternal instanceFor(WrapIKeyEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, KeyEnumeratorImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, KeyEnumeratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIKeyEnumerator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIKeyEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IKeyEnumerator.IID_IKEY_ENUMERATOR, WrapIKeyEnumerator.class));
Map.entry(new REFIID(IKeyEnumerator.IID_IKEY_ENUMERATOR), WrapIKeyEnumerator.class));
static KeyEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static KeyEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(KeyEnumeratorInternal.class, return DbgEngUtil.tryPreferredInterfaces(KeyEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IKeyStore;
import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyStore; import agent.dbgmodel.jna.dbgmodel.main.WrapIKeyStore;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface KeyStoreInternal extends KeyStore {
Map<Pointer, KeyStoreInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, KeyStoreInternal> CACHE = new WeakValueHashMap<>();
static KeyStoreInternal instanceFor(WrapIKeyStore data) { static KeyStoreInternal instanceFor(WrapIKeyStore data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, KeyStoreImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, KeyStoreImpl::new);
} }
Map<REFIID, Class<? extends WrapIKeyStore>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIKeyStore>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IKeyStore.IID_IKEY_STORE, WrapIKeyStore.class));
Map.entry(new REFIID(IKeyStore.IID_IKEY_STORE), WrapIKeyStore.class));
static KeyStoreInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static KeyStoreInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(KeyStoreInternal.class, return DbgEngUtil.tryPreferredInterfaces(KeyStoreInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IModelIterator;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelIterator; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelIterator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface ModelIteratorInternal extends ModelIterator {
Map<Pointer, ModelIteratorInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, ModelIteratorInternal> CACHE = new WeakValueHashMap<>();
static ModelIteratorInternal instanceFor(WrapIModelIterator data) { static ModelIteratorInternal instanceFor(WrapIModelIterator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelIteratorImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, ModelIteratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIModelIterator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIModelIterator>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IModelIterator.IID_IMODEL_ITERATOR, WrapIModelIterator.class));
Map.entry(new REFIID(IModelIterator.IID_IMODEL_ITERATOR), WrapIModelIterator.class));
static ModelIteratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static ModelIteratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelIteratorInternal.class, return DbgEngUtil.tryPreferredInterfaces(ModelIteratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.dbgmodel.main.ModelKeyReference1;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil;
import agent.dbgmodel.impl.dbgmodel.DbgModelUtil.InterfaceSupplier;
import agent.dbgmodel.jna.dbgmodel.main.*; import agent.dbgmodel.jna.dbgmodel.main.*;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -30,22 +31,19 @@ public interface ModelKeyReferenceInternal extends ModelKeyReference1 {
Map<Pointer, ModelKeyReferenceInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, ModelKeyReferenceInternal> CACHE = new WeakValueHashMap<>();
static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference1 data) { static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference1 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl1::new); return DbgEngUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl1::new);
} }
static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference2 data) { static ModelKeyReferenceInternal instanceFor(WrapIModelKeyReference2 data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl2::new); return DbgEngUtil.lazyWeakCache(CACHE, data, ModelKeyReferenceImpl2::new);
} }
Map<REFIID, Class<? extends WrapIModelKeyReference1>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIModelKeyReference1>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IModelKeyReference2.IID_IMODEL_REFERENCE2, WrapIModelKeyReference2.class),
Map.entry(new REFIID(IModelKeyReference2.IID_IMODEL_REFERENCE2), new Preferred<>(IModelKeyReference.IID_IMODEL_REFERENCE, WrapIModelKeyReference1.class));
WrapIModelKeyReference2.class),
Map.entry(new REFIID(IModelKeyReference.IID_IMODEL_REFERENCE),
WrapIModelKeyReference1.class));
static ModelKeyReferenceInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static ModelKeyReferenceInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelKeyReferenceInternal.class, return DbgEngUtil.tryPreferredInterfaces(ModelKeyReferenceInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IModelMethod;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelMethod; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelMethod;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface ModelMethodInternal extends ModelMethod {
Map<Pointer, ModelMethodInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, ModelMethodInternal> CACHE = new WeakValueHashMap<>();
static ModelMethodInternal instanceFor(WrapIModelMethod data) { static ModelMethodInternal instanceFor(WrapIModelMethod data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelMethodImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, ModelMethodImpl::new);
} }
Map<REFIID, Class<? extends WrapIModelMethod>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIModelMethod>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IModelMethod.IID_IMODEL_METHOD, WrapIModelMethod.class));
Map.entry(new REFIID(IModelMethod.IID_IMODEL_METHOD), WrapIModelMethod.class));
static ModelMethodInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static ModelMethodInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelMethodInternal.class, return DbgEngUtil.tryPreferredInterfaces(ModelMethodInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IModelObject;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelObject; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelObject;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface ModelObjectInternal extends ModelObject {
Map<Pointer, ModelObjectInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, ModelObjectInternal> CACHE = new WeakValueHashMap<>();
static ModelObjectInternal instanceFor(WrapIModelObject data) { static ModelObjectInternal instanceFor(WrapIModelObject data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelObjectImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, ModelObjectImpl::new);
} }
Map<REFIID, Class<? extends WrapIModelObject>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIModelObject>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IModelObject.IID_IMODEL_OBJECT, WrapIModelObject.class));
Map.entry(new REFIID(IModelObject.IID_IMODEL_OBJECT), WrapIModelObject.class));
static ModelObjectInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static ModelObjectInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelObjectInternal.class, return DbgEngUtil.tryPreferredInterfaces(ModelObjectInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IModelPropertyAccessor;
import agent.dbgmodel.jna.dbgmodel.main.WrapIModelPropertyAccessor; import agent.dbgmodel.jna.dbgmodel.main.WrapIModelPropertyAccessor;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,16 +32,15 @@ public interface ModelPropertyAccessorInternal extends ModelPropertyAccessor {
Map<Pointer, ModelPropertyAccessorInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, ModelPropertyAccessorInternal> CACHE = new WeakValueHashMap<>();
static ModelPropertyAccessorInternal instanceFor(WrapIModelPropertyAccessor data) { static ModelPropertyAccessorInternal instanceFor(WrapIModelPropertyAccessor data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, ModelPropertyAccessorImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, ModelPropertyAccessorImpl::new);
} }
Map<REFIID, Class<? extends WrapIModelPropertyAccessor>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIModelPropertyAccessor>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IModelPropertyAccessor.IID_IMODEL_PROPERTY_ACCESSOR,
Map.entry(new REFIID(IModelPropertyAccessor.IID_IMODEL_PROPERTY_ACCESSOR), WrapIModelPropertyAccessor.class));
WrapIModelPropertyAccessor.class));
static ModelPropertyAccessorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static ModelPropertyAccessorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(ModelPropertyAccessorInternal.class, return DbgEngUtil.tryPreferredInterfaces(ModelPropertyAccessorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }

View file

@ -15,14 +15,15 @@
*/ */
package agent.dbgmodel.impl.dbgmodel.main; package agent.dbgmodel.impl.dbgmodel.main;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.sun.jna.Pointer; 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.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.IRawEnumerator;
import agent.dbgmodel.jna.dbgmodel.main.WrapIRawEnumerator; import agent.dbgmodel.jna.dbgmodel.main.WrapIRawEnumerator;
import ghidra.util.datastruct.WeakValueHashMap; import ghidra.util.datastruct.WeakValueHashMap;
@ -31,15 +32,14 @@ public interface RawEnumeratorInternal extends RawEnumerator {
Map<Pointer, RawEnumeratorInternal> CACHE = new WeakValueHashMap<>(); Map<Pointer, RawEnumeratorInternal> CACHE = new WeakValueHashMap<>();
static RawEnumeratorInternal instanceFor(WrapIRawEnumerator data) { static RawEnumeratorInternal instanceFor(WrapIRawEnumerator data) {
return DbgModelUtil.lazyWeakCache(CACHE, data, RawEnumeratorImpl::new); return DbgEngUtil.lazyWeakCache(CACHE, data, RawEnumeratorImpl::new);
} }
Map<REFIID, Class<? extends WrapIRawEnumerator>> PREFERRED_DATA_SPACES_IIDS = List<Preferred<WrapIRawEnumerator>> PREFERRED_DATA_SPACES_IIDS = List.of(
Map.ofEntries( new Preferred<>(IRawEnumerator.IID_IRAW_ENUMERATOR, WrapIRawEnumerator.class));
Map.entry(new REFIID(IRawEnumerator.IID_IRAW_ENUMERATOR), WrapIRawEnumerator.class));
static RawEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) { static RawEnumeratorInternal tryPreferredInterfaces(InterfaceSupplier supplier) {
return DbgModelUtil.tryPreferredInterfaces(RawEnumeratorInternal.class, return DbgEngUtil.tryPreferredInterfaces(RawEnumeratorInternal.class,
PREFERRED_DATA_SPACES_IIDS, supplier); PREFERRED_DATA_SPACES_IIDS, supplier);
} }
} }