Merge remote-tracking branch 'origin/GP-2023_d-millar_opendump_REBASED'

Conflicts:
	Ghidra/Debug/Debugger-agent-dbgmodel/src/main/resources/agent/dbgmodel/model/impl/dbgmodel_schema.xml
This commit is contained in:
Ryan Kurtz 2022-06-22 00:42:04 -04:00
commit c79bc9e773
40 changed files with 562 additions and 78 deletions

View file

@ -338,6 +338,11 @@ public class WrappedDbgModel
return client.getDataSpaces().queryVirtual(offset);
}
@Override
public long virtualToPhysical(long offset) {
return client.getDataSpaces().virtualToPhysical(offset);
}
// REGISTERS INTERFACE
public DebugRegisterDescription getRegisterDescription(int i) {

View file

@ -28,6 +28,7 @@ import agent.dbgmodel.dbgmodel.DbgModel;
import agent.dbgmodel.dbgmodel.DbgModel.OpaqueCleanable;
import agent.dbgmodel.dbgmodel.main.ModelObject;
import agent.dbgmodel.jna.dbgmodel.main.IKeyEnumerator;
import ghidra.util.Msg;
public class KeyEnumeratorImpl implements KeyEnumeratorInternal {
@SuppressWarnings("unused")
@ -56,12 +57,17 @@ public class KeyEnumeratorImpl implements KeyEnumeratorInternal {
BSTRByReference bref = new BSTRByReference();
PointerByReference ppValue = new PointerByReference();
PointerByReference ppMetaData = new PointerByReference();
HRESULT hr = jnaData.GetNext(bref, ppValue, ppMetaData);
if (hr.equals(COMUtilsExtra.E_BOUNDS) || hr.equals(COMUtilsExtra.E_FAIL)) {
//System.err.println("ret null");
return null;
try {
HRESULT hr = jnaData.GetNext(bref, ppValue, ppMetaData);
if (hr.equals(COMUtilsExtra.E_BOUNDS) || hr.equals(COMUtilsExtra.E_FAIL)) {
//System.err.println("ret null");
return null;
}
COMUtils.checkRC(hr);
}
catch (Error e) {
Msg.error(this, e.getMessage());
}
COMUtils.checkRC(hr);
Pointer val = ppValue.getValue();
if (val != null) {

View file

@ -152,6 +152,10 @@ public class ModelObjectImpl implements ModelObjectInternal {
Msg.debug(this, searchKey + " scope not found");
return null;
}
if (hr.equals(COMUtilsExtra.E_CANNOT_READ)) {
Msg.debug(this, searchKey + " cannot be read");
return null;
}
COMUtils.checkRC(hr);
ModelObject retval = getObjectWithMetadata(ppObject, ppMetadata);

View file

@ -72,6 +72,7 @@ public class DbgModel2Impl extends AbstractDbgModel
protected DbgModelTargetSession session;
protected Map<Object, TargetObject> objectMap = new HashMap<>();
private boolean suppressDescent = false;
public DbgModel2Impl() {
this.dbg = new DbgManager2Impl();
@ -198,4 +199,13 @@ public class DbgModel2Impl extends AbstractDbgModel
return ExceptionUtils.rethrow(ex);
});
}
@Override
public boolean isSuppressDescent() {
return suppressDescent;
}
public void setSuppressDescent(boolean suppressDescent) {
this.suppressDescent = suppressDescent;
}
}

View file

@ -250,9 +250,14 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
}
if (proxy instanceof TargetExecutionStateful) {
if (isValid()) {
TargetExecutionStateful stateful = (TargetExecutionStateful) proxy;
TargetExecutionState state = stateful.getExecutionState();
attrs.put(TargetExecutionStateful.STATE_ATTRIBUTE_NAME, state);
if (attributes.containsKey(TargetExecutionStateful.STATE_ATTRIBUTE_NAME)) {
TargetExecutionStateful stateful = (TargetExecutionStateful) proxy;
TargetExecutionState state = stateful.getExecutionState();
attrs.put(TargetExecutionStateful.STATE_ATTRIBUTE_NAME, state);
} else {
attrs.put(TargetExecutionStateful.STATE_ATTRIBUTE_NAME,
TargetExecutionState.INACTIVE);
}
}
}
if (proxy instanceof TargetAttacher) {

View file

@ -284,6 +284,21 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
if (PathUtils.isLink(parent.getPath(), proxy.getName(), proxy.getPath())) {
return;
}
if (proxy instanceof DbgModelTargetSession) {
DbgModelTargetSession targetSession = (DbgModelTargetSession) proxy;
targetSession.getSession(false);
}
if (proxy instanceof DbgModelTargetProcess) {
DbgModelTargetProcess targetProcess = (DbgModelTargetProcess) proxy;
targetProcess.getProcess(false);
}
if (proxy instanceof DbgModelTargetThread) {
DbgModelTargetThread targetThread = (DbgModelTargetThread) proxy;
targetThread.getThread(false);
}
if (getModel().isSuppressDescent()) {
return;
}
if (proxy instanceof DbgModelTargetSession || //
proxy instanceof DbgModelTargetProcess || //
proxy instanceof DbgModelTargetThread) {
@ -402,7 +417,9 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
}
}
if (proxy instanceof TargetRegisterContainer) {
requestElements(false);
if (!getModel().isSuppressDescent()) {
requestElements(false);
}
requestAttributes(false);
}
if (proxy instanceof TargetRegisterBank) {

View file

@ -222,7 +222,7 @@
<interface name="Access" />
<interface name="Attacher" />
<interface name="Attachable" />
<!-- <interface name="Launcher" /> -->
<!-- interface name="Launcher" / -->
<interface name="Deletable" />
<interface name="Detachable" />
<interface name="Killable" />