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

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

Issue 1066243002: Accept non-fatal resource exceptions without generating crash reports (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Swallow non-fatal EXC_RESOURCE Created 5 years, 8 months 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 | « util/mach/exception_ports_test.cc ('k') | util/mach/exception_types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_UTIL_MACH_EXCEPTION_TYPES_H_
16 #define CRASHPAD_UTIL_MACH_EXCEPTION_TYPES_H_
17
18 #include <mach/mach.h>
19 #include <sys/types.h>
20
21 namespace crashpad {
22
23 //! \brief Recovers the original exception, first exception code, and signal
24 //! from the encoded form of the first exception code delivered with
25 //! `EXC_CRASH` exceptions.
26 //!
27 //! `EXC_CRASH` exceptions are generated when the kernel has committed to
28 //! terminating a process as a result of a core-generating POSIX signal and, for
29 //! hardware exceptions, an earlier Mach exception. Information about this
30 //! earlier exception and signal is made available to the `EXC_CRASH` handler
31 //! via its `code[0]` parameter. This function recovers the original exception,
32 //! the value of `code[0]` from the original exception, and the value of the
33 //! signal responsible for process termination.
34 //!
35 //! \param[in] code_0 The first exception code (`code[0]`) passed to a Mach
36 //! exception handler in an `EXC_CRASH` exception. It is invalid to call
37 //! this function with an exception code from any exception other than
38 //! `EXC_CRASH`.
39 //! \param[out] original_code_0 The first exception code (`code[0]`) passed to
40 //! the Mach exception handler for a hardware exception that resulted in the
41 //! generation of a POSIX signal that caused process termination. If the
42 //! signal that caused termination was not sent as a result of a hardware
43 //! exception, this will be `0`. Callers that do not need this value may
44 //! pass `nullptr`.
45 //! \param[out] signal The POSIX signal that caused process termination. Callers
46 //! that do not need this value may pass `nullptr`.
47 //!
48 //! \return The original exception for a hardware exception that resulted in the
49 //! generation of a POSIX signal that caused process termination. If the
50 //! signal that caused termination was not sent as a result of a hardware
51 //! exception, this will be `0`.
52 exception_type_t ExcCrashRecoverOriginalException(
53 mach_exception_code_t code_0,
54 mach_exception_code_t* original_code_0,
55 int* signal);
56
57 //! \brief Determines whether an exception is a non-fatal `EXC_RESOURCE`.
58 //!
59 //! \param[in] exception The exception type as received by a Mach exception
60 //! handler.
61 //! \param[in] code_0 The first exception code (`code[0]`) as received by a
62 //! Mach exception handler.
63 //! \param[in] pid The process ID that the exception occurred in. In some cases,
64 //! process may need to be queried to determine whether an `EXC_RESOURCE`
65 //! exception is fatal.
66 //!
67 //! \return `true` if the exception is a non-fatal `EXC_RESOURCE`. `false`
68 //! otherwise. If the exception is `EXC_RESOURCE` of a recognized type but
69 //! it is not possible to determine whether it is fatal, returns `true`
70 //! under the assumption that all known `EXC_RESOURCE` exceptions are
71 //! non-fatal by default. If the exception is not `EXC_RESOURCE` or is an
72 //! unknown `EXC_RESOURCE` type, returns `false`.
73 bool IsExceptionNonfatalResource(exception_type_t exception,
74 mach_exception_code_t code_0,
75 pid_t pid);
76
77 } // namespace crashpad
78
79 #endif // CRASHPAD_UTIL_MACH_EXCEPTION_TYPES_H_
OLDNEW
« no previous file with comments | « util/mach/exception_ports_test.cc ('k') | util/mach/exception_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698