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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
/*++
Module Name:
include/pal/seh.hpp
Abstract:
Header file for public Structured Exception Handling stuff
--*/
#ifndef _PAL_SEH_HPP_
#define _PAL_SEH_HPP_
#include "config.h"
#include "pal/palinternal.h"
#include "pal/corunix.hpp"
// Uncomment this define to turn off the signal handling thread.
// #define DO_NOT_USE_SIGNAL_HANDLING_THREAD
/*++
Function :
SEHInitialize
Initialize all SEH-related stuff (signals, etc)
Parameters:
CPalThread * pthrCurrent : reference to the current thread.
flags : PAL initialize flags
Return value:
TRUE if SEH support initialization succeeded,
FALSE otherwise
--*/
BOOL
SEHInitialize(CorUnix::CPalThread *pthrCurrent, DWORD flags);
/*++
Function :
SEHCleanup
Clean up SEH-related stuff(signals, etc)
Parameters:
None
(no return value)
--*/
VOID
SEHCleanup();
/*++
Function:
SEHProcessException
Build the PAL exception and sent it to any handler registered.
Parameters:
None
Return value:
Does not return
--*/
VOID
SEHProcessException(PEXCEPTION_POINTERS pointers);
#if !HAVE_MACH_EXCEPTIONS
// TODO: Implement for Mach exceptions. Not in CoreCLR surface area.
/*++
Function :
SEHHandleControlEvent
handle Control-C and Control-Break events (call handler routines,
notify debugger)
Parameters :
DWORD event : event that occurred
LPVOID eip : instruction pointer when exception occurred
(no return value)
Notes :
Handlers are called on a last-installed, first called basis, until a
handler returns TRUE. If no handler returns TRUE (or no hanlder is
installed), the default behavior is to call ExitProcess
--*/
void SEHHandleControlEvent(DWORD event, LPVOID eip);
#endif // !HAVE_MACH_EXCEPTIONS
#if !HAVE_MACH_EXCEPTIONS
/*++
Function :
SEHSetSafeState
specify whether the current thread is in a state where exception handling
of signals can be done safely
Parameters:
CPalThread * pthrCurrent : reference to the current thread.
BOOL state : TRUE if the thread is safe, FALSE otherwise
(no return value)
--*/
void SEHSetSafeState(CorUnix::CPalThread *pthrCurrent, BOOL state);
/*++
Function :
SEHGetSafeState
determine whether the current thread is in a state where exception handling
of signals can be done safely
Parameters:
CPalThread * pthrCurrent : reference to the current thread.
Return value :
TRUE if the thread is in a safe state, FALSE otherwise
--*/
BOOL SEHGetSafeState(CorUnix::CPalThread *pthrCurrent);
#endif // !HAVE_MACH_EXCEPTIONS
extern "C"
{
#ifdef FEATURE_PAL_SXS
/*++
Function :
SEHEnable
Enable SEH-related stuff on this thread
Parameters:
CPalThread * pthrCurrent : reference to the current thread.
Return value :
ERROR_SUCCESS, if enabling succeeded
an error code, otherwise
--*/
CorUnix::PAL_ERROR SEHEnable(CorUnix::CPalThread *pthrCurrent);
/*++
Function :
SEHDisable
Disable SEH-related stuff on this thread
Parameters:
CPalThread * pthrCurrent : reference to the current thread.
Return value :
ERROR_SUCCESS, if enabling succeeded
an error code, otherwise
--*/
CorUnix::PAL_ERROR SEHDisable(CorUnix::CPalThread *pthrCurrent);
#endif // FEATURE_PAL_SXS
}
#endif /* _PAL_SEH_HPP_ */
|