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
5class CrashInfo;
6
7class DumpDataTarget : public ICLRDataTarget
8{
9private:
10 LONG m_ref; // reference count
11 pid_t m_pid; // process id
12 int m_fd; // /proc/<pid>/mem handle
13 CrashInfo* m_crashInfo;
14
15public:
16 DumpDataTarget(pid_t pid);
17 virtual ~DumpDataTarget();
18 bool Initialize(CrashInfo* crashInfo);
19
20 //
21 // IUnknown
22 //
23 STDMETHOD(QueryInterface)(___in REFIID InterfaceId, ___out PVOID* Interface);
24 STDMETHOD_(ULONG, AddRef)();
25 STDMETHOD_(ULONG, Release)();
26
27 //
28 // ICLRDataTarget
29 //
30 virtual HRESULT STDMETHODCALLTYPE GetMachineType(
31 /* [out] */ ULONG32 *machine);
32
33 virtual HRESULT STDMETHODCALLTYPE GetPointerSize(
34 /* [out] */ ULONG32 *size);
35
36 virtual HRESULT STDMETHODCALLTYPE GetImageBase(
37 /* [string][in] */ LPCWSTR moduleName,
38 /* [out] */ CLRDATA_ADDRESS *baseAddress);
39
40 virtual HRESULT STDMETHODCALLTYPE ReadVirtual(
41 /* [in] */ CLRDATA_ADDRESS address,
42 /* [length_is][size_is][out] */ PBYTE buffer,
43 /* [in] */ ULONG32 size,
44 /* [optional][out] */ ULONG32 *done);
45
46 virtual HRESULT STDMETHODCALLTYPE WriteVirtual(
47 /* [in] */ CLRDATA_ADDRESS address,
48 /* [size_is][in] */ PBYTE buffer,
49 /* [in] */ ULONG32 size,
50 /* [optional][out] */ ULONG32 *done);
51
52 virtual HRESULT STDMETHODCALLTYPE GetTLSValue(
53 /* [in] */ ULONG32 threadID,
54 /* [in] */ ULONG32 index,
55 /* [out] */ CLRDATA_ADDRESS* value);
56
57 virtual HRESULT STDMETHODCALLTYPE SetTLSValue(
58 /* [in] */ ULONG32 threadID,
59 /* [in] */ ULONG32 index,
60 /* [in] */ CLRDATA_ADDRESS value);
61
62 virtual HRESULT STDMETHODCALLTYPE GetCurrentThreadID(
63 /* [out] */ ULONG32* threadID);
64
65 virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
66 /* [in] */ ULONG32 threadID,
67 /* [in] */ ULONG32 contextFlags,
68 /* [in] */ ULONG32 contextSize,
69 /* [out, size_is(contextSize)] */ PBYTE context);
70
71 virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
72 /* [in] */ ULONG32 threadID,
73 /* [in] */ ULONG32 contextSize,
74 /* [in, size_is(contextSize)] */ PBYTE context);
75
76 virtual HRESULT STDMETHODCALLTYPE Request(
77 /* [in] */ ULONG32 reqCode,
78 /* [in] */ ULONG32 inBufferSize,
79 /* [size_is][in] */ BYTE *inBuffer,
80 /* [in] */ ULONG32 outBufferSize,
81 /* [size_is][out] */ BYTE *outBuffer);
82};
83