summaryrefslogtreecommitdiff
path: root/src/debug/daccess/datatargetadapter.h
blob: d2620c88e1a97964b186b0139be47e780b34b401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//*****************************************************************************
// DataTargetAdapter.h
// 

// 
// header for compatibility adapter for ICLRDataTarget
//*****************************************************************************

#ifndef DATATARGETADAPTER_H_
#define DATATARGETADAPTER_H_

#include <cordebug.h>

// Forward decl to avoid including clrdata.h here (it's use is being deprecated)
interface ICLRDataTarget;

/*
 * DataTargetAdapter - implements the new ICorDebugDataTarget interfaces
 * by wrapping legacy ICLRDataTarget implementations.  New code should use
 * ICorDebugDataTarget, but we must continue to support ICLRDataTarget
 * for dbgeng (watson, windbg, etc.) and for any other 3rd parties since 
 * it is a documented API for dump generation.
 */
class DataTargetAdapter : public ICorDebugMutableDataTarget
{
public:
    // Create an adapter over the supplied legacy data target interface
    DataTargetAdapter(ICLRDataTarget * pLegacyTarget);
    virtual ~DataTargetAdapter();

    //
    // IUnknown.
    //        
    virtual HRESULT STDMETHODCALLTYPE QueryInterface(
        REFIID riid,
        void** ppInterface);

    virtual ULONG STDMETHODCALLTYPE AddRef();

    virtual ULONG STDMETHODCALLTYPE Release();

    //
    // ICorDebugMutableDataTarget.
    //
    
    virtual HRESULT STDMETHODCALLTYPE GetPlatform( 
        CorDebugPlatform *pPlatform);

    virtual HRESULT STDMETHODCALLTYPE ReadVirtual( 
        CORDB_ADDRESS address,
        PBYTE pBuffer,
        ULONG32 request,
        ULONG32 *pcbRead);

    virtual HRESULT STDMETHODCALLTYPE WriteVirtual( 
        CORDB_ADDRESS address,
        const BYTE * pBuffer,
        ULONG32 request);

    virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
        DWORD dwThreadID,
        ULONG32 contextFlags,
        ULONG32 contextSize,
        PBYTE context);

    virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
        DWORD dwThreadID,
        ULONG32 contextSize,
        const BYTE * context);

    virtual HRESULT STDMETHODCALLTYPE ContinueStatusChanged(
        DWORD dwThreadId,
        CORDB_CONTINUE_STATUS continueStatus);

private:
    LONG m_ref;                         // Reference count.
    ICLRDataTarget * m_pLegacyTarget;   // underlying data target
};


#endif //DATATARGETADAPTER_H_