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

Unified Diff: util/mach/mach_extensions.h

Issue 545053003: Add exc_server_variants including UniversalMachExcServer and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/mach/exc_server_variants_test.cc ('k') | util/mach/mach_message_server_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/mach_extensions.h
diff --git a/util/mach/mach_extensions.h b/util/mach/mach_extensions.h
new file mode 100644
index 0000000000000000000000000000000000000000..81e9a86a97f6f72b486f53606e3d594827010696
--- /dev/null
+++ b/util/mach/mach_extensions.h
@@ -0,0 +1,44 @@
+// Copyright 2014 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_
+#define CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_
+
+#include <mach/mach.h>
+
+namespace crashpad {
+
+//! \brief `MACH_PORT_NULL` with the correct type for a Mach port,
+//! `mach_port_t`.
+//!
+//! For situations where implicit conversions between signed and unsigned types
+//! are not performed, use kMachPortNull instead of an explicit `static_cast` of
+//! `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing
+//! assertions.
+const mach_port_t kMachPortNull = MACH_PORT_NULL;
+
+// Because exception_mask_t is an int and has one bit for each defined
+// exception_type_t, it’s reasonable to assume that there cannot be any
+// officially-defined exception_type_t values higher than 31.
+// kMachExceptionSimulated uses a value well outside this range because it does
+// not require a corresponding mask value. Simulated exceptions are delivered to
+// the exception handler registered for EXC_CRASH exceptions using
+// EXC_MASK_CRASH.
+
+//! \brief An exception type to use for simulated exceptions.
+const exception_type_t kMachExceptionSimulated = 'CPsx';
+
+} // namespace crashpad
+
+#endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_
« no previous file with comments | « util/mach/exc_server_variants_test.cc ('k') | util/mach/mach_message_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698