Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: util/mach/exc_server_variants.h

Issue 766193006: exc_server_variants: Templatize and use CompositeMachMessageServer (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | util/mach/exc_server_variants.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ 15 #ifndef CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_
16 #define CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ 16 #define CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_
17 17
18 #include <mach/mach.h> 18 #include <mach/mach.h>
19 19
20 #include <set> 20 #include <set>
21 21
22 #include "build/build_config.h" 22 #include "base/basictypes.h"
23 #include "base/memory/scoped_ptr.h"
23 #include "util/mach/mach_message_server.h" 24 #include "util/mach/mach_message_server.h"
24 25
25 namespace crashpad { 26 namespace crashpad {
26 27
27 // Routines to provide a single unified front-end to the interfaces in
28 // <mach/exc.defs> and <mach/mach_exc.defs>. The two interfaces are identical,
29 // except that the latter allows for 64-bit exception codes, and is requested by
30 // setting the MACH_EXCEPTION_CODES behavior bit associated with an exception
31 // port.
32
33 namespace internal { 28 namespace internal {
34 29 class UniversalMachExcServerImpl;
35 //! \brief A server interface for the `exc` Mach subsystem.
36 class ExcServer : public MachMessageServer::Interface {
37 public:
38 //! \brief An interface that the different request messages that are a part of
39 //! the `exc` Mach subsystem can be dispatched to.
40 class Interface {
41 public:
42 //! \brief Handles exceptions raised by `exception_raise()`.
43 //!
44 //! This behaves equivalently to a `catch_exception_raise()` function used
45 //! with `exc_server()`.
46 //!
47 //! \param[in] trailer The trailer received with the request message.
48 //! \param[out] destroy_request `true` if the request message is to be
49 //! destroyed even when this method returns success. See
50 //! MachMessageServer::Interface.
51 virtual kern_return_t CatchExceptionRaise(
52 exception_handler_t exception_port,
53 thread_t thread,
54 task_t task,
55 exception_type_t exception,
56 const exception_data_type_t* code,
57 mach_msg_type_number_t code_count,
58 const mach_msg_trailer_t* trailer,
59 bool* destroy_request) = 0;
60
61 //! \brief Handles exceptions raised by `exception_raise_state()`.
62 //!
63 //! This behaves equivalently to a `catch_exception_raise_state()` function
64 //! used with `exc_server()`.
65 //!
66 //! There is no \a destroy_request parameter because, unlike
67 //! CatchExceptionRaise() and CatchExceptionRaiseStateIdentity(), the
68 //! request message is not complex (it does not carry the \a thread or \a
69 //! task port rights) and thus there is nothing to destroy.
70 //!
71 //! \param[in] trailer The trailer received with the request message.
72 virtual kern_return_t CatchExceptionRaiseState(
73 exception_handler_t exception_port,
74 exception_type_t exception,
75 const exception_data_type_t* code,
76 mach_msg_type_number_t code_count,
77 thread_state_flavor_t* flavor,
78 const natural_t* old_state,
79 mach_msg_type_number_t old_state_count,
80 thread_state_t new_state,
81 mach_msg_type_number_t* new_state_count,
82 const mach_msg_trailer_t* trailer) = 0;
83
84 //! \brief Handles exceptions raised by `exception_raise_state_identity()`.
85 //!
86 //! This behaves equivalently to a `catch_exception_raise_state_identity()`
87 //! function used with `exc_server()`.
88 //!
89 //! \param[in] trailer The trailer received with the request message.
90 //! \param[out] destroy_request `true` if the request message is to be
91 //! destroyed even when this method returns success. See
92 //! MachMessageServer::Interface.
93 virtual kern_return_t CatchExceptionRaiseStateIdentity(
94 exception_handler_t exception_port,
95 thread_t thread,
96 task_t task,
97 exception_type_t exception,
98 const exception_data_type_t* code,
99 mach_msg_type_number_t code_count,
100 thread_state_flavor_t* flavor,
101 const natural_t* old_state,
102 mach_msg_type_number_t old_state_count,
103 thread_state_t new_state,
104 mach_msg_type_number_t* new_state_count,
105 const mach_msg_trailer_t* trailer,
106 bool* destroy_request) = 0;
107
108 protected:
109 ~Interface() {}
110 };
111
112 //! \brief Constructs an object of this class.
113 //!
114 //! \param[in] interface The interface to dispatch requests to. Weak.
115 explicit ExcServer(Interface* interface);
116
117 // MachMessageServer::Interface:
118
119 bool MachMessageServerFunction(const mach_msg_header_t* in_header,
120 mach_msg_header_t* out_header,
121 bool* destroy_complex_request) override;
122
123 std::set<mach_msg_id_t> MachMessageServerRequestIDs() override;
124
125 mach_msg_size_t MachMessageServerRequestSize() override;
126 mach_msg_size_t MachMessageServerReplySize() override;
127
128 private:
129 Interface* interface_; // weak
130
131 DISALLOW_COPY_AND_ASSIGN(ExcServer);
132 };
133
134 //! \brief A server interface for the `mach_exc` Mach subsystem.
135 class MachExcServer : public MachMessageServer::Interface {
136 public:
137 //! \brief An interface that the different request messages that are a part of
138 //! the `mach_exc` Mach subsystem can be dispatched to.
139 class Interface {
140 public:
141 //! \brief Handles exceptions raised by `mach_exception_raise()`.
142 //!
143 //! This behaves equivalently to a `catch_mach_exception_raise()` function
144 //! used with `mach_exc_server()`.
145 //!
146 //! \param[in] trailer The trailer received with the request message.
147 //! \param[out] destroy_request `true` if the request message is to be
148 //! destroyed even when this method returns success. See
149 //! MachMessageServer::Interface.
150 virtual kern_return_t CatchMachExceptionRaise(
151 exception_handler_t exception_port,
152 thread_t thread,
153 task_t task,
154 exception_type_t exception,
155 const mach_exception_data_type_t* code,
156 mach_msg_type_number_t code_count,
157 const mach_msg_trailer_t* trailer,
158 bool* destroy_request) = 0;
159
160 //! \brief Handles exceptions raised by `mach_exception_raise_state()`.
161 //!
162 //! This behaves equivalently to a `catch_mach_exception_raise_state()`
163 //! function used with `mach_exc_server()`.
164 //!
165 //! There is no \a destroy_request parameter because, unlike
166 //! CatchMachExceptionRaise() and CatchMachExceptionRaiseStateIdentity(),
167 //! the request message is not complex (it does not carry the \a thread or
168 //! \a task port rights) and thus there is nothing to destroy.
169 //!
170 //! \param[in] trailer The trailer received with the request message.
171 virtual kern_return_t CatchMachExceptionRaiseState(
172 exception_handler_t exception_port,
173 exception_type_t exception,
174 const mach_exception_data_type_t* code,
175 mach_msg_type_number_t code_count,
176 thread_state_flavor_t* flavor,
177 const natural_t* old_state,
178 mach_msg_type_number_t old_state_count,
179 thread_state_t new_state,
180 mach_msg_type_number_t* new_state_count,
181 const mach_msg_trailer_t* trailer) = 0;
182
183 //! \brief Handles exceptions raised by
184 //! `mach_exception_raise_state_identity()`.
185 //!
186 //! This behaves equivalently to a
187 //! `catch_mach_exception_raise_state_identity()` function used with
188 //! `mach_exc_server()`.
189 //!
190 //! \param[in] trailer The trailer received with the request message.
191 //! \param[out] destroy_request `true` if the request message is to be
192 //! destroyed even when this method returns success. See
193 //! MachMessageServer::Interface.
194 virtual kern_return_t CatchMachExceptionRaiseStateIdentity(
195 exception_handler_t exception_port,
196 thread_t thread,
197 task_t task,
198 exception_type_t exception,
199 const mach_exception_data_type_t* code,
200 mach_msg_type_number_t code_count,
201 thread_state_flavor_t* flavor,
202 const natural_t* old_state,
203 mach_msg_type_number_t old_state_count,
204 thread_state_t new_state,
205 mach_msg_type_number_t* new_state_count,
206 const mach_msg_trailer_t* trailer,
207 bool* destroy_request) = 0;
208
209 protected:
210 ~Interface() {}
211 };
212
213 //! \brief Constructs an object of this class.
214 //!
215 //! \param[in] interface The interface to dispatch requests to. Weak.
216 explicit MachExcServer(Interface* interface);
217
218 // MachMessageServer::Interface:
219
220 bool MachMessageServerFunction(const mach_msg_header_t* in_header,
221 mach_msg_header_t* out_header,
222 bool* destroy_complex_request) override;
223
224 std::set<mach_msg_id_t> MachMessageServerRequestIDs() override;
225
226 mach_msg_size_t MachMessageServerRequestSize() override;
227 mach_msg_size_t MachMessageServerReplySize() override;
228
229 private:
230 Interface* interface_; // weak
231
232 DISALLOW_COPY_AND_ASSIGN(MachExcServer);
233 };
234
235 //! \brief A server interface for the `exc` Mach subsystem, simplified to have
236 //! only a single interface method needing implementation.
237 class SimplifiedExcServer : public ExcServer, public ExcServer::Interface {
238 public:
239 //! \brief An interface that the different request messages that are a part of
240 //! the `exc` Mach subsystem can be dispatched to.
241 class Interface {
242 public:
243 //! \brief Handles exceptions raised by `exception_raise()`,
244 //! `exception_raise_state()`, and `exception_raise_state_identity()`.
245 //!
246 //! For convenience in implementation, these different “behaviors” of
247 //! exception messages are all mapped to a single interface method. The
248 //! exception’s original “behavior” is specified in the \a behavior
249 //! parameter. Only parameters that were supplied in the request message
250 //! are populated, other parameters are set to reasonable default values.
251 //!
252 //! The meanings of most parameters are identical to that of
253 //! ExcServer::Interface::CatchExceptionRaiseStateIdentity().
254 //!
255 //! \param[in] behavior `EXCEPTION_DEFAULT`, `EXCEPTION_STATE`, or
256 //! `EXCEPTION_STATE_IDENTITY`, identifying which exception request
257 //! message was processed and thus which other parameters are valid.
258 virtual kern_return_t CatchException(
259 exception_behavior_t behavior,
260 exception_handler_t exception_port,
261 thread_t thread,
262 task_t task,
263 exception_type_t exception,
264 const exception_data_type_t* code,
265 mach_msg_type_number_t code_count,
266 thread_state_flavor_t* flavor,
267 const natural_t* old_state,
268 mach_msg_type_number_t old_state_count,
269 thread_state_t new_state,
270 mach_msg_type_number_t* new_state_count,
271 const mach_msg_trailer_t* trailer,
272 bool* destroy_complex_request) = 0;
273
274 protected:
275 ~Interface() {}
276 };
277
278 //! \brief Constructs an object of this class.
279 //!
280 //! \param[in] interface The interface to dispatch requests to. Weak.
281 explicit SimplifiedExcServer(Interface* interface);
282
283 // ExcServer::Interface:
284
285 kern_return_t CatchExceptionRaise(exception_handler_t exception_port,
286 thread_t thread,
287 task_t task,
288 exception_type_t exception,
289 const exception_data_type_t* code,
290 mach_msg_type_number_t code_count,
291 const mach_msg_trailer_t* trailer,
292 bool* destroy_request) override;
293 kern_return_t CatchExceptionRaiseState(
294 exception_handler_t exception_port,
295 exception_type_t exception,
296 const exception_data_type_t* code,
297 mach_msg_type_number_t code_count,
298 thread_state_flavor_t* flavor,
299 const natural_t* old_state,
300 mach_msg_type_number_t old_state_count,
301 thread_state_t new_state,
302 mach_msg_type_number_t* new_state_count,
303 const mach_msg_trailer_t* trailer) override;
304 kern_return_t CatchExceptionRaiseStateIdentity(
305 exception_handler_t exception_port,
306 thread_t thread,
307 task_t task,
308 exception_type_t exception,
309 const exception_data_type_t* code,
310 mach_msg_type_number_t code_count,
311 thread_state_flavor_t* flavor,
312 const natural_t* old_state,
313 mach_msg_type_number_t old_state_count,
314 thread_state_t new_state,
315 mach_msg_type_number_t* new_state_count,
316 const mach_msg_trailer_t* trailer,
317 bool* destroy_request) override;
318
319 private:
320 Interface* interface_; // weak
321
322 DISALLOW_COPY_AND_ASSIGN(SimplifiedExcServer);
323 };
324
325 //! \brief A server interface for the `mach_exc` Mach subsystem, simplified to
326 //! have only a single interface method needing implementation.
327 class SimplifiedMachExcServer : public MachExcServer,
328 public MachExcServer::Interface {
329 public:
330 //! \brief An interface that the different request messages that are a part of
331 //! the `mach_exc` Mach subsystem can be dispatched to.
332 class Interface {
333 public:
334 //! \brief Handles exceptions raised by `mach_exception_raise()`,
335 //! `mach_exception_raise_state()`, and
336 //! `mach_exception_raise_state_identity()`.
337 //!
338 //! For convenience in implementation, these different “behaviors” of
339 //! exception messages are all mapped to a single interface method. The
340 //! exception’s original “behavior” is specified in the \a behavior
341 //! parameter. Only parameters that were supplied in the request message
342 //! are populated, other parameters are set to reasonable default values.
343 //!
344 //! The meanings of most parameters are identical to that of
345 //! MachExcServer::Interface::CatchMachExceptionRaiseStateIdentity().
346 //!
347 //! \param[in] behavior `MACH_EXCEPTION_CODES | EXCEPTION_DEFAULT`,
348 //! `MACH_EXCEPTION_CODES | EXCEPTION_STATE`, or
349 //! `MACH_EXCEPTION_CODES | EXCEPTION_STATE_IDENTITY`, identifying which
350 //! exception request message was processed and thus which other
351 //! parameters are valid.
352 virtual kern_return_t CatchMachException(
353 exception_behavior_t behavior,
354 exception_handler_t exception_port,
355 thread_t thread,
356 task_t task,
357 exception_type_t exception,
358 const mach_exception_data_type_t* code,
359 mach_msg_type_number_t code_count,
360 thread_state_flavor_t* flavor,
361 const natural_t* old_state,
362 mach_msg_type_number_t old_state_count,
363 thread_state_t new_state,
364 mach_msg_type_number_t* new_state_count,
365 const mach_msg_trailer_t* trailer,
366 bool* destroy_complex_request) = 0;
367
368 protected:
369 ~Interface() {}
370 };
371
372 //! \brief Constructs an object of this class.
373 //!
374 //! \param[in] interface The interface to dispatch requests to. Weak.
375 explicit SimplifiedMachExcServer(Interface* interface);
376
377 // MachExcServer::Interface:
378
379 kern_return_t CatchMachExceptionRaise(exception_handler_t exception_port,
380 thread_t thread,
381 task_t task,
382 exception_type_t exception,
383 const mach_exception_data_type_t* code,
384 mach_msg_type_number_t code_count,
385 const mach_msg_trailer_t* trailer,
386 bool* destroy_request) override;
387 kern_return_t CatchMachExceptionRaiseState(
388 exception_handler_t exception_port,
389 exception_type_t exception,
390 const mach_exception_data_type_t* code,
391 mach_msg_type_number_t code_count,
392 thread_state_flavor_t* flavor,
393 const natural_t* old_state,
394 mach_msg_type_number_t old_state_count,
395 thread_state_t new_state,
396 mach_msg_type_number_t* new_state_count,
397 const mach_msg_trailer_t* trailer) override;
398 kern_return_t CatchMachExceptionRaiseStateIdentity(
399 exception_handler_t exception_port,
400 thread_t thread,
401 task_t task,
402 exception_type_t exception,
403 const mach_exception_data_type_t* code,
404 mach_msg_type_number_t code_count,
405 thread_state_flavor_t* flavor,
406 const natural_t* old_state,
407 mach_msg_type_number_t old_state_count,
408 thread_state_t new_state,
409 mach_msg_type_number_t* new_state_count,
410 const mach_msg_trailer_t* trailer,
411 bool* destroy_request) override;
412
413 private:
414 Interface* interface_; // weak
415
416 DISALLOW_COPY_AND_ASSIGN(SimplifiedMachExcServer);
417 };
418
419 } // namespace internal 30 } // namespace internal
420 31
421 //! \brief A server interface for the `exc` and `mach_exc` Mach subsystems, 32 //! \brief A server interface for the `exc` and `mach_exc` Mach subsystems,
422 //! unified to handle exceptions delivered to either subsystem, and 33 //! unified to handle exceptions delivered to either subsystem, and
423 //! simplified to have only a single interface method needing 34 //! simplified to have only a single interface method needing
424 //! implementation. 35 //! implementation.
425 //! 36 //!
37 //! The `<mach/exc.defs>` and `<mach/mach_exc.defs>` interfaces are identical,
38 //! except that the latter allows for 64-bit exception codes, and is requested
39 //! by setting the MACH_EXCEPTION_CODES behavior bit associated with an
40 //! exception port.
41 //!
426 //! UniversalMachExcServer operates by translating messages received in the 42 //! UniversalMachExcServer operates by translating messages received in the
427 //! `exc` subsystem to a variant that is compatible with the `mach_exc` 43 //! `exc` subsystem to a variant that is compatible with the `mach_exc`
428 //! subsystem. This involves changing the format of \a code, the exception code 44 //! subsystem. This involves changing the format of \a code, the exception code
429 //! field, from `exception_data_type_t` to `mach_exception_data_type_t`. 45 //! field, from `exception_data_type_t` to `mach_exception_data_type_t`.
430 //! This is achieved by implementing SimplifiedExcServer::Interface and having 46 class UniversalMachExcServer final : public MachMessageServer::Interface {
431 //! it forward translated messages to SimplifiedMachExcServer::Interface, which
432 //! is left unimplemented here so that users of this class can provide their own
433 //! implementations.
434 class UniversalMachExcServer
435 : public MachMessageServer::Interface,
436 public internal::SimplifiedExcServer::Interface,
437 public internal::SimplifiedMachExcServer::Interface {
438 public: 47 public:
439 //! \brief An interface that the different request messages that are a part of 48 //! \brief An interface that the different request messages that are a part of
440 //! the `exc` and `mach_exc` Mach subsystems can be dispatched to. 49 //! the `exc` and `mach_exc` Mach subsystems can be dispatched to.
441 class Interface { 50 class Interface {
442 public: 51 public:
443 //! \brief Handles exceptions raised by `exception_raise()`, 52 //! \brief Handles exceptions raised by `exception_raise()`,
444 //! `exception_raise_state()`, `exception_raise_state_identity()`, 53 //! `exception_raise_state()`, `exception_raise_state_identity()`,
445 //! `mach_exception_raise()`, `mach_exception_raise_state()`, and 54 //! `mach_exception_raise()`, `mach_exception_raise_state()`, and
446 //! `mach_exception_raise_state_identity()`. 55 //! `mach_exception_raise_state_identity()`.
447 //! 56 //!
448 //! For convenience in implementation, these different “behaviors” of 57 //! For convenience in implementation, these different “behaviors” of
449 //! exception messages are all mapped to a single interface method. The 58 //! exception messages are all mapped to a single interface method. The
450 //! exception’s original “behavior” is specified in the \a behavior 59 //! exception’s original “behavior” is specified in the \a behavior
451 //! parameter. Only parameters that were supplied in the request message 60 //! parameter. Only parameters that were supplied in the request message
452 //! are populated, other parameters are set to reasonable default values. 61 //! are populated, other parameters are set to reasonable default values.
453 //! 62 //!
454 //! The meanings of most parameters are identical to that of 63 //! This behaves equivalently to a `catch_exception_raise_state_identity()`
455 //! MachExcServer::Interface::CatchMachExceptionRaiseStateIdentity(). 64 //! function used with `exc_server()`, or a
65 //! `catch_mach_exception_raise_state_identity()` function used with
66 //! `mach_exc_server()`. The meanings of most parameters are identical to
67 //! their meanings to these functions.
456 //! 68 //!
457 //! \param[in] behavior `EXCEPTION_DEFAULT`, `EXCEPTION_STATE`, 69 //! \param[in] behavior `EXCEPTION_DEFAULT`, `EXCEPTION_STATE`,
458 //! or `EXCEPTION_STATE_IDENTITY`, possibly with `MACH_EXCEPTION_CODES` 70 //! or `EXCEPTION_STATE_IDENTITY`, possibly with `MACH_EXCEPTION_CODES`
459 //! ORed in. This identifies which exception request message was 71 //! ORed in. This identifies which exception request message was
460 //! processed and thus which other parameters are valid. 72 //! processed and thus which other parameters are valid.
73 //! \param[in] trailer The trailer received with the request message.
74 //! \param[out] destroy_request `true` if the request message is to be
75 //! destroyed even when this method returns success. See
76 //! MachMessageServer::Interface.
461 virtual kern_return_t CatchMachException( 77 virtual kern_return_t CatchMachException(
462 exception_behavior_t behavior, 78 exception_behavior_t behavior,
463 exception_handler_t exception_port, 79 exception_handler_t exception_port,
464 thread_t thread, 80 thread_t thread,
465 task_t task, 81 task_t task,
466 exception_type_t exception, 82 exception_type_t exception,
467 const mach_exception_data_type_t* code, 83 const mach_exception_data_type_t* code,
468 mach_msg_type_number_t code_count, 84 mach_msg_type_number_t code_count,
469 thread_state_flavor_t* flavor, 85 thread_state_flavor_t* flavor,
470 const natural_t* old_state, 86 const natural_t* old_state,
471 mach_msg_type_number_t old_state_count, 87 mach_msg_type_number_t old_state_count,
472 thread_state_t new_state, 88 thread_state_t new_state,
473 mach_msg_type_number_t* new_state_count, 89 mach_msg_type_number_t* new_state_count,
474 const mach_msg_trailer_t* trailer, 90 const mach_msg_trailer_t* trailer,
475 bool* destroy_complex_request) = 0; 91 bool* destroy_complex_request) = 0;
476 92
477 protected: 93 protected:
478 ~Interface() {} 94 ~Interface() {}
479 }; 95 };
480 96
481 //! \brief Constructs an object of this class. 97 //! \brief Constructs an object of this class.
482 //! 98 //!
483 //! \param[in] interface The interface to dispatch requests to. Weak. 99 //! \param[in] interface The interface to dispatch requests to. Weak.
484 explicit UniversalMachExcServer(Interface* interface); 100 explicit UniversalMachExcServer(Interface* interface);
485 101
102 ~UniversalMachExcServer();
103
486 // MachMessageServer::Interface: 104 // MachMessageServer::Interface:
487 105
488 bool MachMessageServerFunction(const mach_msg_header_t* in_header, 106 bool MachMessageServerFunction(const mach_msg_header_t* in_header,
489 mach_msg_header_t* out_header, 107 mach_msg_header_t* out_header,
490 bool* destroy_complex_request) override; 108 bool* destroy_complex_request) override;
491 109
492 std::set<mach_msg_id_t> MachMessageServerRequestIDs() override; 110 std::set<mach_msg_id_t> MachMessageServerRequestIDs() override;
493 111
494 mach_msg_size_t MachMessageServerRequestSize() override; 112 mach_msg_size_t MachMessageServerRequestSize() override;
495 mach_msg_size_t MachMessageServerReplySize() override; 113 mach_msg_size_t MachMessageServerReplySize() override;
496 114
497 // internal::SimplifiedExcServer::Interface:
498
499 kern_return_t CatchException(exception_behavior_t behavior,
500 exception_handler_t exception_port,
501 thread_t thread,
502 task_t task,
503 exception_type_t exception,
504 const exception_data_type_t* code,
505 mach_msg_type_number_t code_count,
506 thread_state_flavor_t* flavor,
507 const natural_t* old_state,
508 mach_msg_type_number_t old_state_count,
509 thread_state_t new_state,
510 mach_msg_type_number_t* new_state_count,
511 const mach_msg_trailer_t* trailer,
512 bool* destroy_complex_request) override;
513
514 // internal::SimplifiedMachExcServer::Interface:
515
516 kern_return_t CatchMachException(exception_behavior_t behavior,
517 exception_handler_t exception_port,
518 thread_t thread,
519 task_t task,
520 exception_type_t exception,
521 const mach_exception_data_type_t* code,
522 mach_msg_type_number_t code_count,
523 thread_state_flavor_t* flavor,
524 const natural_t* old_state,
525 mach_msg_type_number_t old_state_count,
526 thread_state_t new_state,
527 mach_msg_type_number_t* new_state_count,
528 const mach_msg_trailer_t* trailer,
529 bool* destroy_complex_request) override;
530
531 private: 115 private:
532 internal::SimplifiedExcServer exc_server_; 116 scoped_ptr<internal::UniversalMachExcServerImpl> impl_;
533 internal::SimplifiedMachExcServer mach_exc_server_;
534 Interface* interface_; // weak
535 117
536 DISALLOW_COPY_AND_ASSIGN(UniversalMachExcServer); 118 DISALLOW_COPY_AND_ASSIGN(UniversalMachExcServer);
537 }; 119 };
538 120
539 //! \brief Recovers the original exception, first exception code, and signal 121 //! \brief Recovers the original exception, first exception code, and signal
540 //! from the encoded form of the first exception code delivered with 122 //! from the encoded form of the first exception code delivered with
541 //! `EXC_CRASH` exceptions. 123 //! `EXC_CRASH` exceptions.
542 //! 124 //!
543 //! `EXC_CRASH` exceptions are generated when the kernel has committed to 125 //! `EXC_CRASH` exceptions are generated when the kernel has committed to
544 //! terminating a process as a result of a core-generating POSIX signal and, for 126 //! terminating a process as a result of a core-generating POSIX signal and, for
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 //! \a behavior is not a state-carrying behavior, or when it is a 198 //! \a behavior is not a state-carrying behavior, or when it is a
617 //! state-carrying behavior and \a set_thread_state is `true`. 199 //! state-carrying behavior and \a set_thread_state is `true`.
618 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying 200 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying
619 //! behavior and \a set_thread_state is `false`. 201 //! behavior and \a set_thread_state is `false`.
620 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, 202 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior,
621 bool set_thread_state); 203 bool set_thread_state);
622 204
623 } // namespace crashpad 205 } // namespace crashpad
624 206
625 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ 207 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_
OLDNEW
« no previous file with comments | « no previous file | util/mach/exc_server_variants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698