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

Side by Side Diff: client/simulate_crash_mac.cc

Issue 1058523002: Add ConstThreadState to mach_extensions.h and use it everywhere (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: clang-unformat 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 | « no previous file | client/simulate_crash_mac_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 bool set_state) { 63 bool set_state) {
64 kern_return_t kr; 64 kern_return_t kr;
65 65
66 bool handler_wants_state = ExceptionBehaviorHasState(handler.behavior); 66 bool handler_wants_state = ExceptionBehaviorHasState(handler.behavior);
67 if (!handler_wants_state) { 67 if (!handler_wants_state) {
68 // Regardless of the passed-in value of |set_state|, if the handler won’t be 68 // Regardless of the passed-in value of |set_state|, if the handler won’t be
69 // dealing with any state at all, no state should be set. 69 // dealing with any state at all, no state should be set.
70 set_state = false; 70 set_state = false;
71 } 71 }
72 72
73 // A const version of thread_state_t.
74 using ConstThreadState = const natural_t*;
75
76 // old_state is only used if the context already captured doesn’t match (or 73 // old_state is only used if the context already captured doesn’t match (or
77 // can’t be converted to) what’s registered for the handler. 74 // can’t be converted to) what’s registered for the handler.
78 thread_state_data_t old_state; 75 thread_state_data_t old_state;
79 76
80 thread_state_flavor_t flavor = handler.flavor; 77 thread_state_flavor_t flavor = handler.flavor;
81 ConstThreadState state; 78 ConstThreadState state;
82 mach_msg_type_number_t state_count; 79 mach_msg_type_number_t state_count;
83 switch (flavor) { 80 switch (flavor) {
84 #if defined(ARCH_CPU_X86_FAMILY) 81 #if defined(ARCH_CPU_X86_FAMILY)
85 case x86_THREAD_STATE: 82 case x86_THREAD_STATE:
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 false); 232 false);
236 } 233 }
237 } 234 }
238 } 235 }
239 236
240 LOG_IF(WARNING, !success) 237 LOG_IF(WARNING, !success)
241 << "SimulateCrash did not find an appropriate exception handler"; 238 << "SimulateCrash did not find an appropriate exception handler";
242 } 239 }
243 240
244 } // namespace crashpad 241 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | client/simulate_crash_mac_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698