mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-605: Fix for dbgeng
This commit is contained in:
parent
c481a87ab5
commit
aa18341dca
3 changed files with 31 additions and 23 deletions
|
@ -145,7 +145,8 @@ public class DebugSystemObjectsImpl1 implements DebugSystemObjectsInternal {
|
|||
ULONG ulHandle = new ULONG(systemId);
|
||||
ULONGByReference pulId = new ULONGByReference();
|
||||
HRESULT hr = jnaSysobj.GetThreadIdBySystemId(ulHandle, pulId);
|
||||
if (hr.equals(COMUtilsExtra.E_UNEXPECTED) || hr.equals(COMUtilsExtra.E_NOTIMPLEMENTED)) {
|
||||
if (hr.equals(COMUtilsExtra.E_UNEXPECTED) || hr.equals(COMUtilsExtra.E_NOTIMPLEMENTED) ||
|
||||
hr.equals(COMUtilsExtra.E_NOINTERFACE)) {
|
||||
return null;
|
||||
}
|
||||
COMUtils.checkRC(hr);
|
||||
|
|
|
@ -28,29 +28,34 @@ import agent.dbgmodel.dbgmodel.debughost.*;
|
|||
import agent.dbgmodel.dbgmodel.main.ModelObject;
|
||||
import agent.dbgmodel.jna.dbgmodel.DbgModelNative.ModelObjectKind;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
public class HDMAUtil {
|
||||
|
||||
private DataModelManager1 manager;
|
||||
private DebugHost host;
|
||||
private DebugClient client;
|
||||
private HostDataModelAccess access;
|
||||
|
||||
public HDMAUtil(HostDataModelAccess access) {
|
||||
manager = access.getManager();
|
||||
host = access.getHost();
|
||||
client = access.getClient();
|
||||
this.access = access;
|
||||
this.client = access.getClient();
|
||||
}
|
||||
|
||||
public DataModelManager1 getManager() {
|
||||
return manager;
|
||||
return access.getManager();
|
||||
}
|
||||
|
||||
public DebugHost getHost() {
|
||||
return host;
|
||||
return access.getHost();
|
||||
}
|
||||
|
||||
public ModelObject getRootNamespace() {
|
||||
return getManager().getRootNamespace();
|
||||
ModelObject rootNamespace = getManager().getRootNamespace();
|
||||
if (rootNamespace == null) {
|
||||
Msg.debug(this, "resetting HostDataModelAccess manager/host " + access);
|
||||
access.getDataModel();
|
||||
rootNamespace = getManager().getRootNamespace();
|
||||
}
|
||||
return rootNamespace;
|
||||
}
|
||||
|
||||
public DebugHostContext getCurrentContext() {
|
||||
|
@ -110,8 +115,8 @@ public class HDMAUtil {
|
|||
}
|
||||
|
||||
public ModelObject getMethod(List<String> path) {
|
||||
DebugHostEvaluator2 eval = host.asEvaluator();
|
||||
DebugHostContext context = host.getCurrentContext();
|
||||
DebugHostEvaluator2 eval = getHost().asEvaluator();
|
||||
DebugHostContext context = getHost().getCurrentContext();
|
||||
List<String> npath = PathUtils.parent(path);
|
||||
int last = path.size() - 1;
|
||||
String cmd = path.get(last);
|
||||
|
@ -158,24 +163,23 @@ public class HDMAUtil {
|
|||
}
|
||||
|
||||
private ModelObject evaluatePredicate(ModelObject target, String call) {
|
||||
DebugHostEvaluator2 eval = host.asEvaluator();
|
||||
DebugHostContext context = host.getCurrentContext();
|
||||
DebugHostEvaluator2 eval = getHost().asEvaluator();
|
||||
DebugHostContext context = getHost().getCurrentContext();
|
||||
return eval.evaluateExtendedExpression(context, new WString(call), target);
|
||||
}
|
||||
|
||||
public ModelObject getSession(String id) {
|
||||
ModelObject sessions = getRootNamespace().getKeyValue("Debugger").getKeyValue("Sessions");
|
||||
return sessions.getChild(manager, string2variant(id));
|
||||
return getRootNamespace().getKeyValue("Debugger").getKeyValue("Sessions");
|
||||
}
|
||||
|
||||
public ModelObject getProcess(ModelObject session, String id) {
|
||||
ModelObject processes = session.getKeyValue("Processes");
|
||||
return processes.getChild(manager, string2variant(id));
|
||||
return processes.getChild(getManager(), string2variant(id));
|
||||
}
|
||||
|
||||
public ModelObject getThread(ModelObject process, String id) {
|
||||
ModelObject threads = process.getKeyValue("Threads");
|
||||
return threads.getChild(manager, string2variant(id));
|
||||
return threads.getChild(getManager(), string2variant(id));
|
||||
}
|
||||
|
||||
public ModelObject getSettings() {
|
||||
|
@ -215,7 +219,7 @@ public class HDMAUtil {
|
|||
}
|
||||
|
||||
public List<DebugModule> getModuleList() {
|
||||
DebugHostSymbols symbols = host.asSymbols();
|
||||
DebugHostSymbols symbols = getHost().asSymbols();
|
||||
DebugHostSymbolEnumerator enumerator = symbols.enumerateModules(getCurrentContext());
|
||||
List<DebugModule> modules = new ArrayList<DebugModule>();
|
||||
DebugHostSymbol1 next;
|
||||
|
@ -252,12 +256,12 @@ public class HDMAUtil {
|
|||
|
||||
public void setCurrentProcess(ModelObject context, String id) {
|
||||
VARIANT v = new VARIANT(id);
|
||||
context.switchTo(manager, v);
|
||||
context.switchTo(getManager(), v);
|
||||
}
|
||||
|
||||
public void setCurrentThread(ModelObject context, String id) {
|
||||
VARIANT v = new VARIANT(id);
|
||||
context.switchTo(manager, v);
|
||||
context.switchTo(getManager(), v);
|
||||
}
|
||||
|
||||
public String getCtlId(ModelObject object) {
|
||||
|
|
|
@ -130,8 +130,7 @@ public class DataModelManagerImpl1 implements DataModelManagerInternal {
|
|||
public ModelObject createSyntheticObject(DebugHostContext context) {
|
||||
Pointer pContext = context.getPointer();
|
||||
PointerByReference ppObject = new PointerByReference();
|
||||
COMUtils.checkRC(
|
||||
jnaData.CreateSyntheticObject(pContext, ppObject));
|
||||
COMUtils.checkRC(jnaData.CreateSyntheticObject(pContext, ppObject));
|
||||
|
||||
WrapIModelObject wrap = new WrapIModelObject(ppObject.getValue());
|
||||
try {
|
||||
|
@ -289,7 +288,11 @@ public class DataModelManagerImpl1 implements DataModelManagerInternal {
|
|||
PointerByReference ppObject = new PointerByReference();
|
||||
COMUtils.checkRC(jnaData.GetRootNamespace(ppObject));
|
||||
|
||||
WrapIModelObject wrap = new WrapIModelObject(ppObject.getValue());
|
||||
Pointer value = ppObject.getValue();
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
WrapIModelObject wrap = new WrapIModelObject(value);
|
||||
try {
|
||||
return ModelObjectInternal.tryPreferredInterfaces(wrap::QueryInterface);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue