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 | // DataTargetAdapter.h |
6 | // |
7 | |
8 | // |
9 | // header for compatibility adapter for ICLRDataTarget |
10 | //***************************************************************************** |
11 | |
12 | #ifndef DATATARGETADAPTER_H_ |
13 | #define DATATARGETADAPTER_H_ |
14 | |
15 | #include <cordebug.h> |
16 | |
17 | // Forward decl to avoid including clrdata.h here (it's use is being deprecated) |
18 | interface ICLRDataTarget; |
19 | |
20 | /* |
21 | * DataTargetAdapter - implements the new ICorDebugDataTarget interfaces |
22 | * by wrapping legacy ICLRDataTarget implementations. New code should use |
23 | * ICorDebugDataTarget, but we must continue to support ICLRDataTarget |
24 | * for dbgeng (watson, windbg, etc.) and for any other 3rd parties since |
25 | * it is a documented API for dump generation. |
26 | */ |
27 | class DataTargetAdapter : public ICorDebugMutableDataTarget |
28 | { |
29 | public: |
30 | // Create an adapter over the supplied legacy data target interface |
31 | DataTargetAdapter(ICLRDataTarget * pLegacyTarget); |
32 | virtual ~DataTargetAdapter(); |
33 | |
34 | // |
35 | // IUnknown. |
36 | // |
37 | virtual HRESULT STDMETHODCALLTYPE QueryInterface( |
38 | REFIID riid, |
39 | void** ppInterface); |
40 | |
41 | virtual ULONG STDMETHODCALLTYPE AddRef(); |
42 | |
43 | virtual ULONG STDMETHODCALLTYPE Release(); |
44 | |
45 | // |
46 | // ICorDebugMutableDataTarget. |
47 | // |
48 | |
49 | virtual HRESULT STDMETHODCALLTYPE GetPlatform( |
50 | CorDebugPlatform *pPlatform); |
51 | |
52 | virtual HRESULT STDMETHODCALLTYPE ReadVirtual( |
53 | CORDB_ADDRESS address, |
54 | PBYTE pBuffer, |
55 | ULONG32 request, |
56 | ULONG32 *pcbRead); |
57 | |
58 | virtual HRESULT STDMETHODCALLTYPE WriteVirtual( |
59 | CORDB_ADDRESS address, |
60 | const BYTE * pBuffer, |
61 | ULONG32 request); |
62 | |
63 | virtual HRESULT STDMETHODCALLTYPE GetThreadContext( |
64 | DWORD dwThreadID, |
65 | ULONG32 contextFlags, |
66 | ULONG32 contextSize, |
67 | PBYTE context); |
68 | |
69 | virtual HRESULT STDMETHODCALLTYPE SetThreadContext( |
70 | DWORD dwThreadID, |
71 | ULONG32 contextSize, |
72 | const BYTE * context); |
73 | |
74 | virtual HRESULT STDMETHODCALLTYPE ContinueStatusChanged( |
75 | DWORD dwThreadId, |
76 | CORDB_CONTINUE_STATUS continueStatus); |
77 | |
78 | private: |
79 | LONG m_ref; // Reference count. |
80 | ICLRDataTarget * m_pLegacyTarget; // underlying data target |
81 | }; |
82 | |
83 | |
84 | #endif //DATATARGETADAPTER_H_ |
85 | |