From 394edf40a089ac3fae5415dba8235b89c7133319 Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Wed, 26 Jun 2019 10:11:56 -0700 Subject: Delegate inspection API in the DBI (#25362) * Add ICorDebugDelegateObjectValue interfaces * Expose appropriate HR (CORDBG_E_UNSUPPORTED_DELEGATE) * Partially DACize DelegateObject * Add DacDbi method for delegate inspection --- src/vm/comdelegate.cpp | 10 ++++++++++ src/vm/common.h | 1 + 2 files changed, 11 insertions(+) (limited to 'src/vm') diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp index a7ed685c3e..7ee85b6136 100644 --- a/src/vm/comdelegate.cpp +++ b/src/vm/comdelegate.cpp @@ -1617,6 +1617,9 @@ extern "C" void * _ReturnAddress(void); FCIMPL3(void, COMDelegate::DelegateConstruct, Object* refThisUNSAFE, Object* targetUNSAFE, PCODE method) { FCALL_CONTRACT; + // If you modify this logic, please update DacDbiInterfaceImpl::GetDelegateType, DacDbiInterfaceImpl::GetDelegateType, + // DacDbiInterfaceImpl::GetDelegateFunctionData, and DacDbiInterfaceImpl::GetDelegateTargetObject. + struct _gc { @@ -1785,6 +1788,9 @@ MethodDesc *COMDelegate::GetMethodDesc(OBJECTREF orDelegate) } CONTRACTL_END; + // If you modify this logic, please update DacDbiInterfaceImpl::GetDelegateType, DacDbiInterfaceImpl::GetDelegateType, + // DacDbiInterfaceImpl::GetDelegateFunctionData, and DacDbiInterfaceImpl::GetDelegateTargetObject. + MethodDesc *pMethodHandle = NULL; DELEGATEREF thisDel = (DELEGATEREF) orDelegate; @@ -3060,6 +3066,10 @@ MethodDesc* COMDelegate::GetDelegateCtor(TypeHandle delegateType, MethodDesc *pT // // Another is to pass a gchandle to the delegate ctor. This is fastest, but only works if we can predict the gc handle at this time. // We will use this for the non secure variants + // + // If you modify this logic, please update DacDbiInterfaceImpl::GetDelegateType, DacDbiInterfaceImpl::GetDelegateType, + // DacDbiInterfaceImpl::GetDelegateFunctionData, and DacDbiInterfaceImpl::GetDelegateTargetObject. + if (invokeArgCount == methodArgCount) { diff --git a/src/vm/common.h b/src/vm/common.h index 18044b5b13..6abe996e90 100644 --- a/src/vm/common.h +++ b/src/vm/common.h @@ -153,6 +153,7 @@ typedef DPTR(class NDirectMethodDesc) PTR_NDirectMethodDesc; typedef VPTR(class Thread) PTR_Thread; typedef DPTR(class Object) PTR_Object; typedef DPTR(PTR_Object) PTR_PTR_Object; +typedef DPTR(class DelegateObject) PTR_DelegateObject; typedef DPTR(class ObjHeader) PTR_ObjHeader; typedef DPTR(class Precode) PTR_Precode; typedef VPTR(class ReflectionModule) PTR_ReflectionModule; -- cgit v1.2.3