mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
Use a more specific type, mach_exception_code_t, when possible.
mach_exception_data_type_t is more generic and is used for any element of a codes[] array. For individual elements, the typedefs mach_exception_code_t and mach_exception_subcode_t are available. Using mach_exception_code_t when possible gives slightly more descriptive code. No functional change. TEST=util_test ExcServerVariants.* R=rsesek@chromium.org Review URL: https://codereview.chromium.org/585473003
This commit is contained in:
parent
3f2ba965f5
commit
021c93c2e0
@ -117,7 +117,7 @@ class ExceptionServer : public UniversalMachExcServer {
|
||||
}
|
||||
|
||||
if (exception == EXC_CRASH) {
|
||||
mach_exception_data_type_t original_code_0;
|
||||
mach_exception_code_t original_code_0;
|
||||
int signal;
|
||||
exception_type_t original_exception =
|
||||
ExcCrashRecoverOriginalException(code[0], &original_code_0, &signal);
|
||||
|
@ -724,8 +724,8 @@ kern_return_t UniversalMachExcServer::CatchException(
|
||||
}
|
||||
|
||||
exception_type_t ExcCrashRecoverOriginalException(
|
||||
mach_exception_data_type_t code_0,
|
||||
mach_exception_data_type_t* original_code_0,
|
||||
mach_exception_code_t code_0,
|
||||
mach_exception_code_t* original_code_0,
|
||||
int* signal) {
|
||||
// 10.9.4 xnu-2422.110.17/bsd/kern/kern_exit.c proc_prepareexit() sets code[0]
|
||||
// based on the signal value, original exception type, and low 20 bits of the
|
||||
|
@ -459,8 +459,8 @@ class UniversalMachExcServer
|
||||
//! signal that caused termination was not sent as a result of a hardware
|
||||
//! exception, this will be `0`.
|
||||
exception_type_t ExcCrashRecoverOriginalException(
|
||||
mach_exception_data_type_t code_0,
|
||||
mach_exception_data_type_t* original_code_0,
|
||||
mach_exception_code_t code_0,
|
||||
mach_exception_code_t* original_code_0,
|
||||
int* signal);
|
||||
|
||||
//! \brief Computes an approriate successful return value for an exception
|
||||
|
@ -51,9 +51,9 @@ const exception_data_type_t kTestExceptonCodes[] = {
|
||||
static_cast<exception_data_type_t>(0xfedcba98),
|
||||
};
|
||||
|
||||
const exception_data_type_t kTestMachExceptionCodes[] = {
|
||||
const mach_exception_data_type_t kTestMachExceptionCodes[] = {
|
||||
KERN_PROTECTION_FAILURE,
|
||||
static_cast<exception_data_type_t>(0xfedcba9876543210),
|
||||
static_cast<mach_exception_data_type_t>(0xfedcba9876543210),
|
||||
};
|
||||
|
||||
const thread_state_flavor_t kThreadStateFlavor = MACHINE_THREAD_STATE;
|
||||
@ -1076,9 +1076,9 @@ TEST(ExcServerVariants, ThreadStates) {
|
||||
|
||||
TEST(ExcServerVariants, ExcCrashRecoverOriginalException) {
|
||||
struct TestData {
|
||||
mach_exception_data_type_t code_0;
|
||||
mach_exception_code_t code_0;
|
||||
exception_type_t exception;
|
||||
mach_exception_data_type_t original_code_0;
|
||||
mach_exception_code_t original_code_0;
|
||||
int signal;
|
||||
};
|
||||
const TestData kTestData[] = {
|
||||
@ -1088,7 +1088,9 @@ TEST(ExcServerVariants, ExcCrashRecoverOriginalException) {
|
||||
{0x4200001, EXC_BAD_INSTRUCTION, 1, SIGILL},
|
||||
{0x8300001, EXC_ARITHMETIC, 1, SIGFPE},
|
||||
{0x5600002, EXC_BREAKPOINT, 2, SIGTRAP},
|
||||
{0x3000000, 0, 0, SIGQUIT},
|
||||
{0x6000000, 0, 0, SIGABRT},
|
||||
{0xc000000, 0, 0, SIGSYS},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
@ -1098,7 +1100,7 @@ TEST(ExcServerVariants, ExcCrashRecoverOriginalException) {
|
||||
index,
|
||||
test_data.code_0));
|
||||
|
||||
mach_exception_data_type_t original_code_0;
|
||||
mach_exception_code_t original_code_0;
|
||||
int signal;
|
||||
exception_type_t exception =
|
||||
ExcCrashRecoverOriginalException(test_data.code_0,
|
||||
@ -1117,7 +1119,7 @@ TEST(ExcServerVariants, ExcCrashRecoverOriginalException) {
|
||||
EXPECT_EQ(test_data.exception,
|
||||
ExcCrashRecoverOriginalException(test_data.code_0, NULL, NULL));
|
||||
|
||||
mach_exception_data_type_t original_code_0;
|
||||
mach_exception_code_t original_code_0;
|
||||
EXPECT_EQ(test_data.exception,
|
||||
ExcCrashRecoverOriginalException(
|
||||
test_data.code_0, &original_code_0, NULL));
|
||||
|
Loading…
x
Reference in New Issue
Block a user