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 | // stdafx.h |
6 | // |
7 | |
8 | // |
9 | // Common include file for utility code. |
10 | //***************************************************************************** |
11 | #include <stdio.h> |
12 | #include <windows.h> |
13 | #include <winnt.h> |
14 | |
15 | #include <dbgtargetcontext.h> |
16 | |
17 | #define RIGHT_SIDE_COMPILE |
18 | |
19 | //----------------------------------------------------------------------------- |
20 | // Contracts for RS threading. |
21 | // We only do this for debug builds and not for inproc |
22 | //----------------------------------------------------------------------------- |
23 | #if defined(_DEBUG) |
24 | #define RSCONTRACTS |
25 | #endif |
26 | |
27 | |
28 | // In case of FEATURE_DBGIPC_TRANSPORT_DI we use pipe for debugger debugee communication |
29 | // and event redirection is not needed. (won't work anyway) |
30 | #ifndef FEATURE_DBGIPC_TRANSPORT_DI |
31 | // Currently, we only can redirect exception events. Since real interop-debugging |
32 | // neeeds all events, redirection can't work in real-interop. |
33 | // However, whether we're interop-debugging is determined at runtime, so we always |
34 | // enable at compile time and then we need a runtime check later. |
35 | #define ENABLE_EVENT_REDIRECTION_PIPELINE |
36 | #endif |
37 | |
38 | #include "ex.h" |
39 | |
40 | #include "sigparser.h" |
41 | #include "corpub.h" |
42 | #include "rspriv.h" |
43 | |
44 | // This is included to deal with GCC limitations around templates. |
45 | // For GCC, if a compilation unit refers to a templated class (like Ptr<T>), GCC requires the compilation |
46 | // unit to have T's definitions for anything that Ptr may call. |
47 | // RsPriv.h has a RSExtSmartPtr<ShimProcess>, which will call ShimProcess::AddRef, which means the same compilation unit |
48 | // must have the definition of ShimProcess::AddRef, and therefore the whole ShimProcess class. |
49 | // CL.exe does not have this problem. |
50 | // Practically, this means that anybody that includes rspriv.h must include shimpriv.h. |
51 | #include "shimpriv.h" |
52 | |
53 | #ifdef _DEBUG |
54 | #include "utilcode.h" |
55 | #endif |
56 | |
57 | #ifndef _TARGET_ARM_ |
58 | #define DbiGetThreadContext(hThread, lpContext) ::GetThreadContext(hThread, (CONTEXT*)(lpContext)) |
59 | #define DbiSetThreadContext(hThread, lpContext) ::SetThreadContext(hThread, (CONTEXT*)(lpContext)) |
60 | #else |
61 | BOOL DbiGetThreadContext(HANDLE hThread, DT_CONTEXT *lpContext); |
62 | BOOL DbiSetThreadContext(HANDLE hThread, const DT_CONTEXT *lpContext); |
63 | #endif |
64 | |