Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ecbf7ad

Browse files
author
Mike McLaughlin
authored
Fix Unable to step through Visual Studio remote debugger with coreclr executables on Nano Server (#7326)
Needed to add back a dummy version of ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly interface so VS doesn't get the QI failure and stop working by not calling the "Continue" method. Issue #7316
1 parent b9d1aae commit ecbf7ad

File tree

8 files changed

+157
-0
lines changed

8 files changed

+157
-0
lines changed

clr.coreclr.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<FeatureCominteropWinRTManagedActivation>true</FeatureCominteropWinRTManagedActivation>
6161
<FeatureHostAssemblyResolver>true</FeatureHostAssemblyResolver>
6262
<FeatureLazyCOWPages Condition="('$(TargetArch)' == 'i386') or ('$(TargetArch)' == 'arm')">true</FeatureLazyCOWPages>
63+
<FeatureLegacyNetCFDbgHostControl>true</FeatureLegacyNetCFDbgHostControl>
6364
<FeatureRandomizedStringHashing>true</FeatureRandomizedStringHashing>
6465
<!-- The rejit feature is available only on supported architectures (x86 & x64) -->
6566
<FeatureReJIT Condition="('$(TargetArch)' == 'i386') or ('$(TargetArch)' == 'amd64')">true</FeatureReJIT>

clr.defines.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<CDefines Condition="'$(FeatureIsymReader)' == 'true'">$(CDefines);FEATURE_ISYM_READER</CDefines>
5555
<CDefines Condition="'$(FeatureLazyCOWPages)' == 'true'">$(CDefines);FEATURE_LAZY_COW_PAGES</CDefines>
5656
<CDefines Condition="'$(FeatureLeakCultureInfo)' == 'true'">$(CDefines);FEATURE_LEAK_CULTURE_INFO</CDefines>
57+
<CDefines Condition="'$(FeatureLegacyNetCFDbgHostControl)' == 'true'">$(CDefines);FEATURE_LEGACYNETCF_DBG_HOST_CONTROL</CDefines>
5758
<CDefines Condition="'$(FeatureLegacySurface)' == 'true'">$(CDefines);FEATURE_LEGACYSURFACE</CDefines>
5859
<CDefines Condition="'$(FeatureLoaderOptimization)' == 'true'">$(CDefines);FEATURE_LOADER_OPTIMIZATION</CDefines>
5960
<CDefines Condition="'$(FeatureMacl)' == 'true'">$(CDefines);FEATURE_MACL</CDefines>

clrdefinitions.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ endif(WIN32)
185185
if(NOT CLR_CMAKE_PLATFORM_UNIX)
186186
add_definitions(-DFEATURE_WIN32_REGISTRY)
187187
endif(NOT CLR_CMAKE_PLATFORM_UNIX)
188+
add_definitions(-DFEATURE_LEGACYNETCF_DBG_HOST_CONTROL)
188189
add_definitions(-DFEATURE_WINDOWSPHONE)
189190
add_definitions(-DFEATURE_WINMD_RESILIENT)
190191
add_definitions(-D_SECURE_SCL=0)

src/debug/di/process.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,12 @@ HRESULT CordbProcess::QueryInterface(REFIID id, void **pInterface)
21422142
{
21432143
*pInterface = static_cast<ICorDebugProcess8*>(this);
21442144
}
2145+
#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
2146+
else if (id == IID_ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly)
2147+
{
2148+
*pInterface = static_cast<ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly*>(this);
2149+
}
2150+
#endif
21452151
else if (id == IID_IUnknown)
21462152
{
21472153
*pInterface = static_cast<IUnknown*>(static_cast<ICorDebugProcess*>(this));
@@ -2495,6 +2501,20 @@ COM_METHOD CordbProcess::EnableExceptionCallbacksOutsideOfMyCode(BOOL enableExce
24952501
return hr;
24962502
}
24972503

2504+
#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
2505+
2506+
COM_METHOD CordbProcess::InvokePauseCallback()
2507+
{
2508+
return S_OK;
2509+
}
2510+
2511+
COM_METHOD CordbProcess::InvokeResumeCallback()
2512+
{
2513+
return S_OK;
2514+
}
2515+
2516+
#endif
2517+
24982518
HRESULT CordbProcess::GetTypeForObject(CORDB_ADDRESS addr, CordbType **ppType, CordbAppDomain **pAppDomain)
24992519
{
25002520
VMPTR_AppDomain appDomain;

src/debug/di/rspriv.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,6 +2924,9 @@ class CordbProcess :
29242924
public IDacDbiInterface::IAllocator,
29252925
public IDacDbiInterface::IMetaDataLookup,
29262926
public IProcessShimHooks
2927+
#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
2928+
, public ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly
2929+
#endif
29272930
{
29282931
// Ctor is private. Use OpenVirtualProcess instead.
29292932
CordbProcess(ULONG64 clrInstanceId, IUnknown * pDataTarget, HMODULE hDacModule, Cordb * pCordb, DWORD dwProcessID, ShimProcess * pShim);
@@ -3129,6 +3132,16 @@ class CordbProcess :
31293132
//-----------------------------------------------------------
31303133
COM_METHOD EnableExceptionCallbacksOutsideOfMyCode(BOOL enableExceptionsOutsideOfJMC);
31313134

3135+
#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
3136+
// ---------------------------------------------------------------
3137+
// ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly
3138+
// ---------------------------------------------------------------
3139+
3140+
COM_METHOD InvokePauseCallback();
3141+
COM_METHOD InvokeResumeCallback();
3142+
3143+
#endif
3144+
31323145
//-----------------------------------------------------------
31333146
// Methods not exposed via a COM interface.
31343147
//-----------------------------------------------------------

src/inc/xcordebug.idl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,32 @@ interface ICorDebugProcess4 : IUnknown
5454
HRESULT ProcessStateChanged([in] CorDebugStateChange eChange);
5555

5656
};
57+
58+
#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
59+
60+
/* A private API for use on Windows phone to invoke CLR hosting
61+
* callbacks on IHostNetCFDebugControlManager. This allows the
62+
* host's UI thread to be suspended and resumed on demand.
63+
*
64+
* This API should not be used for anything other than the
65+
* Windows Phone scenario, it should never be made public,
66+
* and as soon as we support mixed-mode debugging it should
67+
* be retired by removing the interface and failing any
68+
* QueryInterface call for it.
69+
*/
70+
[
71+
object,
72+
local,
73+
uuid(34B27FB0-A318-450D-A0DD-11B70B21F41D),
74+
pointer_default(unique)
75+
]
76+
interface ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly : IUnknown
77+
{
78+
// Invokes IHostNetCFDebugControlManager::NotifyPause() on the debuggee's host
79+
HRESULT InvokePauseCallback();
80+
81+
// Invokes IHostNetCFDebugControlManager::NotifyResume() on the debuggee's host
82+
HRESULT InvokeResumeCallback();
83+
};
84+
85+
#endif

src/pal/prebuilt/idl/xcordebug_i.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ typedef IID CLSID;
6363

6464
MIDL_DEFINE_GUID(IID, IID_ICorDebugProcess4,0xE930C679,0x78AF,0x4953,0x8A,0xB7,0xB0,0xAA,0xBF,0x0F,0x9F,0x80);
6565

66+
MIDL_DEFINE_GUID(IID, IID_ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly,0x34B27FB0,0xA318,0x450D,0xA0,0xDD,0x11,0xB7,0x0B,0x21,0xF4,0x1D);
67+
6668
#undef MIDL_DEFINE_GUID
6769

6870
#ifdef __cplusplus

src/pal/prebuilt/inc/xcordebug.h

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ typedef interface ICorDebugProcess4 ICorDebugProcess4;
4545

4646
#endif /* __ICorDebugProcess4_FWD_DEFINED__ */
4747

48+
#ifndef __ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_FWD_DEFINED__
49+
#define __ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_FWD_DEFINED__
50+
typedef interface ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly;
51+
52+
#endif /* __ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_FWD_DEFINED__ */
4853

4954
/* header files for imported files */
5055
#include "cordebug.h"
@@ -155,6 +160,91 @@ EXTERN_C const IID IID_ICorDebugProcess4;
155160

156161
#endif /* __ICorDebugProcess4_INTERFACE_DEFINED__ */
157162

163+
#ifndef __ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_INTERFACE_DEFINED__
164+
#define __ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_INTERFACE_DEFINED__
165+
166+
/* interface ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly */
167+
/* [unique][uuid][local][object] */
168+
169+
170+
EXTERN_C const IID IID_ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly;
171+
172+
#if defined(__cplusplus) && !defined(CINTERFACE)
173+
174+
MIDL_INTERFACE("34B27FB0-A318-450D-A0DD-11B70B21F41D")
175+
ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly : public IUnknown
176+
{
177+
public:
178+
virtual HRESULT STDMETHODCALLTYPE InvokePauseCallback( void) = 0;
179+
180+
virtual HRESULT STDMETHODCALLTYPE InvokeResumeCallback( void) = 0;
181+
182+
};
183+
184+
185+
#else /* C style interface */
186+
187+
typedef struct ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnlyVtbl
188+
{
189+
BEGIN_INTERFACE
190+
191+
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
192+
ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly * This,
193+
/* [in] */ REFIID riid,
194+
/* [annotation][iid_is][out] */
195+
_COM_Outptr_ void **ppvObject);
196+
197+
ULONG ( STDMETHODCALLTYPE *AddRef )(
198+
ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly * This);
199+
200+
ULONG ( STDMETHODCALLTYPE *Release )(
201+
ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly * This);
202+
203+
HRESULT ( STDMETHODCALLTYPE *InvokePauseCallback )(
204+
ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly * This);
205+
206+
HRESULT ( STDMETHODCALLTYPE *InvokeResumeCallback )(
207+
ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly * This);
208+
209+
END_INTERFACE
210+
} ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnlyVtbl;
211+
212+
interface ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly
213+
{
214+
CONST_VTBL struct ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnlyVtbl *lpVtbl;
215+
};
216+
217+
218+
219+
#ifdef COBJMACROS
220+
221+
222+
#define ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_QueryInterface(This,riid,ppvObject) \
223+
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
224+
225+
#define ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_AddRef(This) \
226+
( (This)->lpVtbl -> AddRef(This) )
227+
228+
#define ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_Release(This) \
229+
( (This)->lpVtbl -> Release(This) )
230+
231+
232+
#define ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_InvokePauseCallback(This) \
233+
( (This)->lpVtbl -> InvokePauseCallback(This) )
234+
235+
#define ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_InvokeResumeCallback(This) \
236+
( (This)->lpVtbl -> InvokeResumeCallback(This) )
237+
238+
#endif /* COBJMACROS */
239+
240+
241+
#endif /* C style interface */
242+
243+
244+
245+
246+
#endif /* __ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly_INTERFACE_DEFINED__ */
247+
158248

159249
/* Additional Prototypes for ALL interfaces */
160250

0 commit comments

Comments
 (0)