GP-2177: schema fix for missing registers

GP-2177(SQRB): fire threadCreated
GP-2177_SQRB: spare the VM on E_NOINTERFACE
GP-2177_SQRB: check id plus pid/tid
GP-2177_SQRB: init for dbgmodel RegisterBanks plus bandaid for recorder
GP-2177_SQRB: filter nulls from traceToTarget
GP-2177: extraneous cleanup
GP-2177: clear bpts on process death
GP-2968: fixes from review
GP-2177: not directly related, but...
GP-2177: CACHE needs to be cleared and must follow actual native delete
GP-2177: first pass at bpt errors
This commit is contained in:
d-millar 2023-01-23 15:46:11 -05:00
parent ba0b42dc82
commit dee3de5672
19 changed files with 171 additions and 57 deletions

View file

@ -23,8 +23,10 @@ import com.sun.jna.platform.win32.OleAuto;
import com.sun.jna.platform.win32.WTypes.BSTR;
import com.sun.jna.platform.win32.WTypes.BSTRByReference;
import com.sun.jna.platform.win32.WinDef.*;
import com.sun.jna.platform.win32.WinNT.HRESULT;
import com.sun.jna.platform.win32.COM.COMUtils;
import agent.dbgeng.dbgeng.COMUtilsExtra;
import agent.dbgmodel.dbgmodel.DbgModel;
import agent.dbgmodel.dbgmodel.DbgModel.OpaqueCleanable;
import agent.dbgmodel.dbgmodel.debughost.DebugHostContext;
@ -55,8 +57,11 @@ public class DebugHostMemoryImpl1 implements DebugHostMemoryInternal {
Pointer pContext = context.getPointer();
ULONGLONG pulBufferSize = new ULONGLONG(bufferSize);
ULONGLONGByReference pulBytesRead = new ULONGLONGByReference();
COMUtils.checkRC(
jnaData.ReadBytes(pContext, location, buffer, pulBufferSize, pulBytesRead));
HRESULT hr = jnaData.ReadBytes(pContext, location, buffer, pulBufferSize, pulBytesRead);
if (hr.equals(COMUtilsExtra.E_NOTIMPLEMENTED)) {
return 0;
}
COMUtils.checkRC(hr);
long read = pulBytesRead.getValue().longValue();
buffer.position((int) (read + buffer.position()));
return read;

View file

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

View file

@ -249,15 +249,9 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
}
if (proxy instanceof TargetExecutionStateful) {
if (isValid()) {
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);
}
TargetExecutionStateful stateful = (TargetExecutionStateful) proxy;
TargetExecutionState state = stateful.getExecutionState();
attrs.put(TargetExecutionStateful.STATE_ATTRIBUTE_NAME, state);
}
}
if (proxy instanceof TargetAttacher) {

View file

@ -285,8 +285,9 @@ public class DbgModel2TargetRootImpl extends DbgModel2DefaultTargetModelRoot
List<String> xpath = new ArrayList<>();
xpath.addAll(objPath);
xpath.addAll(ext);
// NB: fetchModelObject may have to be called with false
return AsyncUtils.sequence(TypeSpec.cls(DbgModelTargetObject.class)).then(seq -> {
getModel().fetchModelObject(xpath).handle(seq::next);
getModel().fetchModelObject(xpath, false).handle(seq::next);
}, TypeSpec.cls(TargetObject.class)).then((pobj, seq) -> {
if (pobj == null) {
seq.exit();

View file

@ -263,7 +263,14 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
}
}
if (proxy instanceof TargetExecutionStateful) {
setExecutionState(exec, "Refreshed");
if (proxy instanceof DbgModelTargetSession) {
if (state != DbgState.EXIT) {
setExecutionState(exec, "Refreshed");
}
}
else {
setExecutionState(exec, "Refreshed");
}
}
}
@ -306,6 +313,7 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
return;
}
if (proxy instanceof DbgModelTargetRegisterContainer || //
proxy instanceof DbgModelTargetRegisterBank || //
proxy.getName().equals("Stack") ||
proxy.getName().equals("Debug")) {
requestAttributes(false);
@ -403,9 +411,11 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
List<DelegateDbgModel2TargetObject> delegates = new ArrayList<>();
TargetObject stack =
(TargetObject) getCachedAttribute("Stack");
DbgModelTargetStack frames =
(DbgModelTargetStack) stack.getCachedAttribute("Frames");
delegates.add((DelegateDbgModel2TargetObject) frames.getDelegate());
if (stack != null) {
DbgModelTargetStack frames =
(DbgModelTargetStack) stack.getCachedAttribute("Frames");
delegates.add((DelegateDbgModel2TargetObject) frames.getDelegate());
}
DbgModelTargetRegisterContainer container =
(DbgModelTargetRegisterContainer) getCachedAttribute("Registers");
delegates.add((DelegateDbgModel2TargetObject) container.getDelegate());

View file

@ -454,6 +454,7 @@
<attribute name="rdi" schema="RegisterDescriptor" required="yes" />
<attribute name="rsi" schema="RegisterDescriptor" required="yes" />
<attribute name="rip" schema="RegisterDescriptor" required="yes" />
<attribute name="rbp" schema="RegisterDescriptor" required="yes" />
<attribute name="rsp" schema="RegisterDescriptor" required="yes" />
<attribute name="r8" schema="RegisterDescriptor" required="yes" />
<attribute name="r9" schema="RegisterDescriptor" required="yes" />
@ -464,6 +465,31 @@
<attribute name="r14" schema="RegisterDescriptor" required="yes" />
<attribute name="r15" schema="RegisterDescriptor" required="yes" />
<attribute name="efl" schema="RegisterDescriptor" required="yes" />
<attribute name="dr0" schema="RegisterDescriptor" required="no" />
<attribute name="dr1" schema="RegisterDescriptor" required="no" />
<attribute name="dr2" schema="RegisterDescriptor" required="no" />
<attribute name="dr3" schema="RegisterDescriptor" required="no" />
<attribute name="dr6" schema="RegisterDescriptor" required="no" />
<attribute name="dr7" schema="RegisterDescriptor" required="no" />
<attribute name="cs" schema="RegisterDescriptor" required="no" />
<attribute name="ds" schema="RegisterDescriptor" required="no" />
<attribute name="es" schema="RegisterDescriptor" required="no" />
<attribute name="fs" schema="RegisterDescriptor" required="no" />
<attribute name="gs" schema="RegisterDescriptor" required="no" />
<attribute name="ss" schema="RegisterDescriptor" required="no" />
<attribute name="af" schema="RegisterDescriptor" required="no" />
<attribute name="cf" schema="RegisterDescriptor" required="no" />
<attribute name="df" schema="RegisterDescriptor" required="no" />
<attribute name="if" schema="RegisterDescriptor" required="no" />
<attribute name="of" schema="RegisterDescriptor" required="no" />
<attribute name="pf" schema="RegisterDescriptor" required="no" />
<attribute name="sf" schema="RegisterDescriptor" required="no" />
<attribute name="tf" schema="RegisterDescriptor" required="no" />
<attribute name="zf" schema="RegisterDescriptor" required="no" />
<attribute name="iopl" schema="RegisterDescriptor" required="no" />
<attribute name="vif" schema="RegisterDescriptor" required="no" />
<attribute name="vip" schema="RegisterDescriptor" required="no" />
<attribute name="rflags" schema="RegisterDescriptor" required="no" />
<attribute schema="OBJECT" />
</schema>
<schema name="Stack" canonical="yes" elementResync="NEVER" attributeResync="NEVER">