mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-14 01:08:01 +08:00
Add ConstThreadState to mach_extensions.h and use it everywhere.
TEST=everything R=rsesek@chromium.org Review URL: https://codereview.chromium.org/1058523002
This commit is contained in:
parent
71b8efef96
commit
40b1d7cb1d
@ -70,9 +70,6 @@ bool DeliverException(thread_t thread,
|
||||
set_state = false;
|
||||
}
|
||||
|
||||
// A const version of thread_state_t.
|
||||
using ConstThreadState = const natural_t*;
|
||||
|
||||
// old_state is only used if the context already captured doesn’t match (or
|
||||
// can’t be converted to) what’s registered for the handler.
|
||||
thread_state_data_t old_state;
|
||||
|
@ -88,7 +88,7 @@ class TestSimulateCrashMac final : public MachMultiprocess,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -88,7 +88,7 @@ kern_return_t CrashReportExceptionHandler::CatchMachException(
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -66,7 +66,7 @@ class CrashReportExceptionHandler : public UniversalMachExcServer::Interface {
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -117,7 +117,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -83,7 +83,7 @@ void InitializeCPUContextX86Debug(
|
||||
thread_state_flavor_t InitializeCPUContextX86Flavor(
|
||||
CPUContextX86* context,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count) {
|
||||
mach_msg_type_number_t expected_state_count;
|
||||
switch (flavor) {
|
||||
@ -131,7 +131,7 @@ thread_state_flavor_t InitializeCPUContextX86Flavor(
|
||||
return InitializeCPUContextX86Flavor(
|
||||
context,
|
||||
x86_thread_state->tsh.flavor,
|
||||
reinterpret_cast<const natural_t*>(&x86_thread_state->uts.ts32),
|
||||
reinterpret_cast<ConstThreadState>(&x86_thread_state->uts.ts32),
|
||||
x86_thread_state->tsh.count);
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ thread_state_flavor_t InitializeCPUContextX86Flavor(
|
||||
return InitializeCPUContextX86Flavor(
|
||||
context,
|
||||
x86_float_state->fsh.flavor,
|
||||
reinterpret_cast<const natural_t*>(&x86_float_state->ufs.fs32),
|
||||
reinterpret_cast<ConstThreadState>(&x86_float_state->ufs.fs32),
|
||||
x86_float_state->fsh.count);
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ thread_state_flavor_t InitializeCPUContextX86Flavor(
|
||||
return InitializeCPUContextX86Flavor(
|
||||
context,
|
||||
x86_debug_state->dsh.flavor,
|
||||
reinterpret_cast<const natural_t*>(&x86_debug_state->uds.ds32),
|
||||
reinterpret_cast<ConstThreadState>(&x86_debug_state->uds.ds32),
|
||||
x86_debug_state->dsh.count);
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ void InitializeCPUContextX86_64Debug(
|
||||
thread_state_flavor_t InitializeCPUContextX86_64Flavor(
|
||||
CPUContextX86_64* context,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count) {
|
||||
mach_msg_type_number_t expected_state_count;
|
||||
switch (flavor) {
|
||||
@ -312,7 +312,7 @@ thread_state_flavor_t InitializeCPUContextX86_64Flavor(
|
||||
return InitializeCPUContextX86_64Flavor(
|
||||
context,
|
||||
x86_thread_state->tsh.flavor,
|
||||
reinterpret_cast<const natural_t*>(&x86_thread_state->uts.ts64),
|
||||
reinterpret_cast<ConstThreadState>(&x86_thread_state->uts.ts64),
|
||||
x86_thread_state->tsh.count);
|
||||
}
|
||||
|
||||
@ -327,7 +327,7 @@ thread_state_flavor_t InitializeCPUContextX86_64Flavor(
|
||||
return InitializeCPUContextX86_64Flavor(
|
||||
context,
|
||||
x86_float_state->fsh.flavor,
|
||||
reinterpret_cast<const natural_t*>(&x86_float_state->ufs.fs64),
|
||||
reinterpret_cast<ConstThreadState>(&x86_float_state->ufs.fs64),
|
||||
x86_float_state->fsh.count);
|
||||
}
|
||||
|
||||
@ -342,7 +342,7 @@ thread_state_flavor_t InitializeCPUContextX86_64Flavor(
|
||||
return InitializeCPUContextX86_64Flavor(
|
||||
context,
|
||||
x86_debug_state->dsh.flavor,
|
||||
reinterpret_cast<const natural_t*>(&x86_debug_state->uds.ds64),
|
||||
reinterpret_cast<ConstThreadState>(&x86_debug_state->uds.ds64),
|
||||
x86_debug_state->dsh.count);
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ namespace internal {
|
||||
|
||||
void InitializeCPUContextX86(CPUContextX86* context,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count,
|
||||
const x86_thread_state32_t* x86_thread_state32,
|
||||
const x86_float_state32_t* x86_float_state32,
|
||||
@ -411,7 +411,7 @@ void InitializeCPUContextX86(CPUContextX86* context,
|
||||
|
||||
void InitializeCPUContextX86_64(CPUContextX86_64* context,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count,
|
||||
const x86_thread_state64_t* x86_thread_state64,
|
||||
const x86_float_state64_t* x86_float_state64,
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "snapshot/cpu_context.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
|
||||
namespace crashpad {
|
||||
namespace internal {
|
||||
@ -60,7 +61,7 @@ namespace internal {
|
||||
//! \param[in] x86_debug_state32 The state of the thread’s debug registers.
|
||||
void InitializeCPUContextX86(CPUContextX86* context,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count,
|
||||
const x86_thread_state32_t* x86_thread_state32,
|
||||
const x86_float_state32_t* x86_float_state32,
|
||||
@ -101,7 +102,7 @@ void InitializeCPUContextX86(CPUContextX86* context,
|
||||
//! \param[in] x86_debug_state64 The state of the thread’s debug registers.
|
||||
void InitializeCPUContextX86_64(CPUContextX86_64* context,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count,
|
||||
const x86_thread_state64_t* x86_thread_state64,
|
||||
const x86_float_state64_t* x86_float_state64,
|
||||
|
@ -45,7 +45,7 @@ bool ExceptionSnapshotMac::Initialize(ProcessReader* process_reader,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count) {
|
||||
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "build/build_config.h"
|
||||
#include "snapshot/cpu_context.h"
|
||||
#include "snapshot/exception_snapshot.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
#include "util/misc/initialization_state_dcheck.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -55,7 +56,7 @@ class ExceptionSnapshotMac final : public ExceptionSnapshot {
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count);
|
||||
|
||||
// ExceptionSnapshot:
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "util/mac/mac_util.h"
|
||||
#include "util/mach/exc_server_variants.h"
|
||||
#include "util/mach/exception_ports.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
#include "util/mach/mach_message.h"
|
||||
#include "util/mach/mach_message_server.h"
|
||||
|
||||
@ -79,7 +80,7 @@ class TestMachOImageAnnotationsReader final
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -62,7 +62,7 @@ bool ProcessSnapshotMac::InitializeException(
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count) {
|
||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||
DCHECK(!exception_);
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "snapshot/process_snapshot.h"
|
||||
#include "snapshot/system_snapshot.h"
|
||||
#include "snapshot/thread_snapshot.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
#include "util/misc/initialization_state_dcheck.h"
|
||||
#include "util/misc/uuid.h"
|
||||
#include "util/stdlib/pointer_container.h"
|
||||
@ -74,7 +75,7 @@ class ProcessSnapshotMac final : public ProcessSnapshot {
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t flavor,
|
||||
const natural_t* state,
|
||||
ConstThreadState state,
|
||||
mach_msg_type_number_t state_count);
|
||||
|
||||
//! \brief Sets the value to be returned by ReportID().
|
||||
|
@ -68,7 +68,7 @@ class ExceptionServer : public UniversalMachExcServer::Interface {
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "base/logging.h"
|
||||
#include "util/mach/exc.h"
|
||||
#include "util/mach/mach_exc.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
@ -31,7 +30,7 @@ kern_return_t UniversalExceptionRaise(exception_behavior_t behavior,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count) {
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include <mach/mach.h>
|
||||
|
||||
#include "util/mach/mach_extensions.h"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
//! \brief Calls the appropriate `*exception_raise*()` function for the
|
||||
@ -73,7 +75,7 @@ kern_return_t UniversalExceptionRaise(exception_behavior_t behavior,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count);
|
||||
|
@ -58,7 +58,7 @@ class TestExcClientVariants : public MachMultiprocess,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -276,7 +276,7 @@ class ExcServer : public MachMessageServer::Interface {
|
||||
const typename Traits::ExceptionCode* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -302,7 +302,7 @@ class ExcServer : public MachMessageServer::Interface {
|
||||
const typename Traits::ExceptionCode* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -523,7 +523,7 @@ class SimplifiedExcServer final : public ExcServer<Traits>,
|
||||
const typename Traits::ExceptionCode* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -577,7 +577,7 @@ class SimplifiedExcServer final : public ExcServer<Traits>,
|
||||
const typename Traits::ExceptionCode* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -608,7 +608,7 @@ class SimplifiedExcServer final : public ExcServer<Traits>,
|
||||
const typename Traits::ExceptionCode* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -669,7 +669,7 @@ class UniversalMachExcServerImpl final
|
||||
const exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -706,7 +706,7 @@ class UniversalMachExcServerImpl final
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -804,7 +804,7 @@ kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior,
|
||||
}
|
||||
|
||||
void ExcServerCopyState(exception_behavior_t behavior,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
#include "util/mach/mach_message_server.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -83,7 +84,7 @@ class UniversalMachExcServer final : public MachMessageServer::Interface {
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -231,7 +232,7 @@ kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior,
|
||||
//! \a behavior is state-carrying, this parameter should be at least as
|
||||
//! large as \a old_state_count.
|
||||
void ExcServerCopyState(exception_behavior_t behavior,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count);
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "test/mac/mach_errors.h"
|
||||
#include "test/mac/mach_multiprocess.h"
|
||||
#include "util/mach/exception_behaviors.h"
|
||||
#include "util/mach/mach_extensions.h"
|
||||
#include "util/mach/mach_message.h"
|
||||
|
||||
namespace crashpad {
|
||||
@ -455,12 +454,12 @@ class MockUniversalMachExcServer : public UniversalMachExcServer::Interface {
|
||||
const mach_exception_data_type_t* code;
|
||||
mach_msg_type_number_t code_count;
|
||||
};
|
||||
struct ThreadState {
|
||||
struct ThreadStateAndCount {
|
||||
thread_state_t state;
|
||||
mach_msg_type_number_t* state_count;
|
||||
};
|
||||
struct ConstThreadState {
|
||||
const natural_t* state;
|
||||
struct ConstThreadStateAndCount {
|
||||
ConstThreadState state;
|
||||
mach_msg_type_number_t* state_count;
|
||||
};
|
||||
|
||||
@ -478,7 +477,7 @@ class MockUniversalMachExcServer : public UniversalMachExcServer::Interface {
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
@ -486,8 +485,9 @@ class MockUniversalMachExcServer : public UniversalMachExcServer::Interface {
|
||||
bool* destroy_complex_request) override {
|
||||
*destroy_complex_request = true;
|
||||
const ConstExceptionCodes exception_codes = {code, code_count};
|
||||
const ConstThreadState old_thread_state = {old_state, &old_state_count};
|
||||
ThreadState new_thread_state = {new_state, new_state_count};
|
||||
const ConstThreadStateAndCount old_thread_state = {old_state,
|
||||
&old_state_count};
|
||||
ThreadStateAndCount new_thread_state = {new_state, new_state_count};
|
||||
return MockCatchMachException(behavior,
|
||||
exception_port,
|
||||
thread,
|
||||
@ -508,8 +508,8 @@ class MockUniversalMachExcServer : public UniversalMachExcServer::Interface {
|
||||
exception_type_t exception,
|
||||
const ConstExceptionCodes* exception_codes,
|
||||
thread_state_flavor_t* flavor,
|
||||
const ConstThreadState* old_thread_state,
|
||||
ThreadState* new_thread_state,
|
||||
const ConstThreadStateAndCount* old_thread_state,
|
||||
ThreadStateAndCount* new_thread_state,
|
||||
const mach_msg_trailer_t* trailer));
|
||||
};
|
||||
|
||||
@ -537,11 +537,11 @@ MATCHER_P2(AreExceptionCodes, code_0, code_1, "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Matcher for ThreadState and ConstThreadState, testing that *state_count is
|
||||
// present and matches the specified value. If 0 is specified for the count,
|
||||
// |state| must be nullptr (not present), otherwise |state| must not be nullptr
|
||||
// (present).
|
||||
MATCHER_P(IsThreadStateCount, state_count, "") {
|
||||
// Matcher for ThreadStateAndCount and ConstThreadStateAndCount, testing that
|
||||
// *state_count is present and matches the specified value. If 0 is specified
|
||||
// for the count, |state| must be nullptr (not present), otherwise |state| must
|
||||
// not be nullptr (present).
|
||||
MATCHER_P(IsThreadStateAndCount, state_count, "") {
|
||||
if (!arg) {
|
||||
return false;
|
||||
}
|
||||
@ -607,8 +607,8 @@ TEST(ExcServerVariants, MockExceptionRaise) {
|
||||
AreExceptionCodes(kTestExceptonCodes[0],
|
||||
kTestExceptonCodes[1]),
|
||||
Pointee(Eq(THREAD_STATE_NONE)),
|
||||
IsThreadStateCount(0u),
|
||||
IsThreadStateCount(0u),
|
||||
IsThreadStateAndCount(0u),
|
||||
IsThreadStateAndCount(0u),
|
||||
Eq(&request.trailer)))
|
||||
.WillOnce(Return(KERN_SUCCESS))
|
||||
.RetiresOnSaturation();
|
||||
@ -653,8 +653,8 @@ TEST(ExcServerVariants, MockExceptionRaiseState) {
|
||||
kExceptionType,
|
||||
AreExceptionCodes(kTestExceptonCodes[0], kTestExceptonCodes[1]),
|
||||
Pointee(Eq(kThreadStateFlavor)),
|
||||
IsThreadStateCount(kThreadStateFlavorCount),
|
||||
IsThreadStateCount(arraysize(reply.new_state)),
|
||||
IsThreadStateAndCount(kThreadStateFlavorCount),
|
||||
IsThreadStateAndCount(arraysize(reply.new_state)),
|
||||
Eq(request.Trailer())))
|
||||
.WillOnce(Return(KERN_SUCCESS))
|
||||
.RetiresOnSaturation();
|
||||
@ -702,8 +702,8 @@ TEST(ExcServerVariants, MockExceptionRaiseStateIdentity) {
|
||||
kExceptionType,
|
||||
AreExceptionCodes(kTestExceptonCodes[0], kTestExceptonCodes[1]),
|
||||
Pointee(Eq(kThreadStateFlavor)),
|
||||
IsThreadStateCount(kThreadStateFlavorCount),
|
||||
IsThreadStateCount(arraysize(reply.new_state)),
|
||||
IsThreadStateAndCount(kThreadStateFlavorCount),
|
||||
IsThreadStateAndCount(arraysize(reply.new_state)),
|
||||
Eq(request.Trailer())))
|
||||
.WillOnce(Return(KERN_SUCCESS))
|
||||
.RetiresOnSaturation();
|
||||
@ -749,8 +749,8 @@ TEST(ExcServerVariants, MockMachExceptionRaise) {
|
||||
AreExceptionCodes(kTestMachExceptionCodes[0],
|
||||
kTestMachExceptionCodes[1]),
|
||||
Pointee(Eq(THREAD_STATE_NONE)),
|
||||
IsThreadStateCount(0u),
|
||||
IsThreadStateCount(0u),
|
||||
IsThreadStateAndCount(0u),
|
||||
IsThreadStateAndCount(0u),
|
||||
Eq(&request.trailer)))
|
||||
.WillOnce(Return(KERN_SUCCESS))
|
||||
.RetiresOnSaturation();
|
||||
@ -796,8 +796,8 @@ TEST(ExcServerVariants, MockMachExceptionRaiseState) {
|
||||
AreExceptionCodes(kTestMachExceptionCodes[0],
|
||||
kTestMachExceptionCodes[1]),
|
||||
Pointee(Eq(kThreadStateFlavor)),
|
||||
IsThreadStateCount(kThreadStateFlavorCount),
|
||||
IsThreadStateCount(arraysize(reply.new_state)),
|
||||
IsThreadStateAndCount(kThreadStateFlavorCount),
|
||||
IsThreadStateAndCount(arraysize(reply.new_state)),
|
||||
Eq(request.Trailer())))
|
||||
.WillOnce(Return(KERN_SUCCESS))
|
||||
.RetiresOnSaturation();
|
||||
@ -846,8 +846,8 @@ TEST(ExcServerVariants, MockMachExceptionRaiseStateIdentity) {
|
||||
AreExceptionCodes(kTestMachExceptionCodes[0],
|
||||
kTestMachExceptionCodes[1]),
|
||||
Pointee(Eq(kThreadStateFlavor)),
|
||||
IsThreadStateCount(kThreadStateFlavorCount),
|
||||
IsThreadStateCount(arraysize(reply.new_state)),
|
||||
IsThreadStateAndCount(kThreadStateFlavorCount),
|
||||
IsThreadStateAndCount(arraysize(reply.new_state)),
|
||||
Eq(request.Trailer())))
|
||||
.WillOnce(Return(KERN_SUCCESS))
|
||||
.RetiresOnSaturation();
|
||||
@ -976,7 +976,7 @@ class TestExcServerVariants : public MachMultiprocess,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -152,7 +152,7 @@ class TestExceptionPorts : public MachMultiprocess,
|
||||
const mach_exception_data_type_t* code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
const natural_t* old_state,
|
||||
ConstThreadState old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count,
|
||||
|
@ -47,6 +47,13 @@ const exception_behavior_t kMachExceptionCodes = MACH_EXCEPTION_CODES;
|
||||
//! \brief An exception type to use for simulated exceptions.
|
||||
const exception_type_t kMachExceptionSimulated = 'CPsx';
|
||||
|
||||
//! \brief A const version of `thread_state_t`.
|
||||
//!
|
||||
//! This is useful as the \a old_state parameter to exception handler functions.
|
||||
//! Normally, these parameters are of type `thread_state_t`, but this allows
|
||||
//! modification of the state, which is conceptually `const`.
|
||||
using ConstThreadState = const natural_t*;
|
||||
|
||||
//! \brief Like `mach_thread_self()`, but without the obligation to release the
|
||||
//! send right.
|
||||
//!
|
||||
|
Loading…
x
Reference in New Issue
Block a user