1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//*****************************************************************************
5// debugshim.h
6//
7
8//
9//*****************************************************************************
10
11#ifndef _DEBUG_SHIM_
12#define _DEBUG_SHIM_
13
14#include "cor.h"
15#include "cordebug.h"
16#include <wchar.h>
17#include <metahost.h>
18
19#define CORECLR_DAC_MODULE_NAME_W W("mscordaccore")
20#define CLR_DAC_MODULE_NAME_W W("mscordacwks")
21#define MAIN_DBI_MODULE_NAME_W W("mscordbi")
22
23// forward declaration
24struct ICorDebugDataTarget;
25
26// ICLRDebugging implementation.
27class CLRDebuggingImpl : public ICLRDebugging
28{
29
30public:
31 CLRDebuggingImpl(GUID skuId) : m_cRef(0), m_skuId(skuId)
32 {
33 }
34
35 virtual ~CLRDebuggingImpl() {}
36
37public:
38 // ICLRDebugging methods:
39 STDMETHOD(OpenVirtualProcess(
40 ULONG64 moduleBaseAddress,
41 IUnknown * pDataTarget,
42 ICLRDebuggingLibraryProvider * pLibraryProvider,
43 CLR_DEBUGGING_VERSION * pMaxDebuggerSupportedVersion,
44 REFIID riidProcess,
45 IUnknown ** ppProcess,
46 CLR_DEBUGGING_VERSION * pVersion,
47 CLR_DEBUGGING_PROCESS_FLAGS * pFlags));
48
49 STDMETHOD(CanUnloadNow(HMODULE hModule));
50
51 //IUnknown methods:
52 STDMETHOD(QueryInterface(
53 REFIID riid,
54 void **ppvObject));
55
56 // Standard AddRef implementation
57 STDMETHOD_(ULONG, AddRef());
58
59 // Standard Release implementation.
60 STDMETHOD_(ULONG, Release());
61
62
63
64private:
65 VOID RetargetDacIfNeeded(DWORD* pdwTimeStamp,
66 DWORD* pdwSizeOfImage);
67
68 HRESULT GetCLRInfo(ICorDebugDataTarget * pDataTarget,
69 ULONG64 moduleBaseAddress,
70 CLR_DEBUGGING_VERSION * pVersion,
71 DWORD * pdwDbiTimeStamp,
72 DWORD * pdwDbiSizeOfImage,
73 __out_z __inout_ecount(dwDbiNameCharCount) WCHAR * pDbiName,
74 DWORD dwDbiNameCharCount,
75 DWORD * pdwDacTimeStamp,
76 DWORD * pdwDacSizeOfImage,
77 __out_z __inout_ecount(dwDacNameCharCount) WCHAR * pDacName,
78 DWORD dwDacNameCharCount);
79
80 HRESULT FormatLongDacModuleName(__out_z __inout_ecount(cchBuffer) WCHAR * pBuffer,
81 DWORD cchBuffer,
82 DWORD targetImageFileMachine,
83 VS_FIXEDFILEINFO * pVersion);
84
85 volatile LONG m_cRef;
86 GUID m_skuId;
87
88}; // class CLRDebuggingImpl
89
90#endif
91