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

Unified Diff: client/simulate_crash_mac.cc

Issue 1368023004: Use references instead of pointers for CPU context in SimulateCrash (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 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 | « client/simulate_crash_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/simulate_crash_mac.cc
diff --git a/client/simulate_crash_mac.cc b/client/simulate_crash_mac.cc
index 763cb87e54db432dfaa0813ee551148a3f0004d9..1884262f185d4975c646375daaadbdd522bec004 100644
--- a/client/simulate_crash_mac.cc
+++ b/client/simulate_crash_mac.cc
@@ -59,7 +59,7 @@ bool DeliverException(thread_t thread,
exception_type_t exception,
const mach_exception_data_t code,
mach_msg_type_number_t code_count,
- const NativeCPUContext* cpu_context,
+ const NativeCPUContext& cpu_context,
const ExceptionPorts::ExceptionHandler& handler,
bool set_state) {
kern_return_t kr;
@@ -81,18 +81,18 @@ bool DeliverException(thread_t thread,
switch (flavor) {
#if defined(ARCH_CPU_X86_FAMILY)
case x86_THREAD_STATE:
- state = reinterpret_cast<ConstThreadState>(cpu_context);
+ state = reinterpret_cast<ConstThreadState>(&cpu_context);
state_count = x86_THREAD_STATE_COUNT;
break;
#if defined(ARCH_CPU_X86)
case x86_THREAD_STATE32:
- state = reinterpret_cast<ConstThreadState>(&cpu_context->uts.ts32);
- state_count = cpu_context->tsh.count;
+ state = reinterpret_cast<ConstThreadState>(&cpu_context.uts.ts32);
+ state_count = cpu_context.tsh.count;
break;
#elif defined(ARCH_CPU_X86_64)
case x86_THREAD_STATE64:
- state = reinterpret_cast<ConstThreadState>(&cpu_context->uts.ts64);
- state_count = cpu_context->tsh.count;
+ state = reinterpret_cast<ConstThreadState>(&cpu_context.uts.ts64);
+ state_count = cpu_context.tsh.count;
break;
#endif
#else
@@ -176,16 +176,16 @@ bool DeliverException(thread_t thread,
} // namespace
-void SimulateCrash(const NativeCPUContext* cpu_context) {
+void SimulateCrash(const NativeCPUContext& cpu_context) {
#if defined(ARCH_CPU_X86)
- DCHECK_EQ(cpu_context->tsh.flavor,
+ DCHECK_EQ(cpu_context.tsh.flavor,
implicit_cast<thread_state_flavor_t>(x86_THREAD_STATE32));
- DCHECK_EQ(implicit_cast<mach_msg_type_number_t>(cpu_context->tsh.count),
+ DCHECK_EQ(implicit_cast<mach_msg_type_number_t>(cpu_context.tsh.count),
x86_THREAD_STATE32_COUNT);
#elif defined(ARCH_CPU_X86_64)
- DCHECK_EQ(cpu_context->tsh.flavor,
+ DCHECK_EQ(cpu_context.tsh.flavor,
implicit_cast<thread_state_flavor_t>(x86_THREAD_STATE64));
- DCHECK_EQ(implicit_cast<mach_msg_type_number_t>(cpu_context->tsh.count),
+ DCHECK_EQ(implicit_cast<mach_msg_type_number_t>(cpu_context.tsh.count),
x86_THREAD_STATE64_COUNT);
#endif
« no previous file with comments | « client/simulate_crash_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698