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

Side by Side Diff: handler/mac/crash_report_exception_handler.cc

Issue 1391453002: mac: Revise incorrect comments about EXC_RESOURCE and EXC_GUARD (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 2 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // from the process itself to be suspicious. 103 // from the process itself to be suspicious.
104 const pid_t pid = process_snapshot.ProcessID(); 104 const pid_t pid = process_snapshot.ProcessID();
105 pid_t audit_pid = AuditPIDFromMachMessageTrailer(trailer); 105 pid_t audit_pid = AuditPIDFromMachMessageTrailer(trailer);
106 if (audit_pid != -1 && audit_pid != 0) { 106 if (audit_pid != -1 && audit_pid != 0) {
107 if (audit_pid != pid) { 107 if (audit_pid != pid) {
108 LOG(WARNING) << "exception for pid " << pid << " sent by pid " 108 LOG(WARNING) << "exception for pid " << pid << " sent by pid "
109 << audit_pid; 109 << audit_pid;
110 } 110 }
111 } 111 }
112 112
113 if (IsExceptionNonfatalResource(exception, code[0], pid)) {
114 // Swallow non-fatal resource exceptions.
115 //
116 // Normally, all EXC_RESOURCE exceptions go to the host-level EXC_RESOURCE
117 // handler, com.apple.ReportCrash.root, which invokes spindump to handle
118 // them. These non-fatal exceptions are never user-visible and are not
119 // currently of interest to Crashpad. Returning success here gets the
120 // process going again quickly, without generating a crash report.
121 //
122 // Alternatively, this could return KERN_FAILURE to let the exception go to
123 // the host-level handler, but there doesn’t seem to be much value in doing
124 // so.
125 ExcServerCopyState(
126 behavior, old_state, old_state_count, new_state, new_state_count);
127 return ExcServerSuccessfulReturnValue(exception, behavior, false);
128 }
129
130 CrashpadInfoClientOptions client_options; 113 CrashpadInfoClientOptions client_options;
131 process_snapshot.GetCrashpadOptions(&client_options); 114 process_snapshot.GetCrashpadOptions(&client_options);
132 115
133 if (client_options.crashpad_handler_behavior != TriState::kDisabled) { 116 if (client_options.crashpad_handler_behavior != TriState::kDisabled &&
117 !IsExceptionNonfatalResource(exception, code[0], pid)) {
118 // Non-fatal resource exceptions are never user-visible and are not
119 // currently of interest to Crashpad.
120
134 if (!process_snapshot.InitializeException(behavior, 121 if (!process_snapshot.InitializeException(behavior,
135 thread, 122 thread,
136 exception, 123 exception,
137 code, 124 code,
138 code_count, 125 code_count,
139 *flavor, 126 *flavor,
140 old_state, 127 old_state,
141 old_state_count)) { 128 old_state_count)) {
142 return KERN_FAILURE; 129 return KERN_FAILURE;
143 } 130 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 exception == EXC_RESOURCE || 177 exception == EXC_RESOURCE ||
191 exception == EXC_GUARD)) { 178 exception == EXC_GUARD)) {
192 // Don’t forward simulated exceptions such as kMachExceptionSimulated to the 179 // Don’t forward simulated exceptions such as kMachExceptionSimulated to the
193 // system crash reporter. Only forward the types of exceptions that it would 180 // system crash reporter. Only forward the types of exceptions that it would
194 // receive under normal conditions. Although the system crash reporter is 181 // receive under normal conditions. Although the system crash reporter is
195 // able to deal with other exceptions including simulated ones, forwarding 182 // able to deal with other exceptions including simulated ones, forwarding
196 // them to the system crash reporter could present the system’s crash UI for 183 // them to the system crash reporter could present the system’s crash UI for
197 // processes that haven’t actually crashed, and could result in reports not 184 // processes that haven’t actually crashed, and could result in reports not
198 // actually associated with crashes being sent to the operating system 185 // actually associated with crashes being sent to the operating system
199 // vendor. 186 // vendor.
200 //
201 // Note that normally, EXC_RESOURCE and EXC_GUARD exceptions are sent to the
202 // system-level com.apple.ReportCrash.Root job, and not to the user-level
203 // job that they are forwarded to here.
204 base::mac::ScopedMachSendRight 187 base::mac::ScopedMachSendRight
205 system_crash_reporter_handler(SystemCrashReporterHandler()); 188 system_crash_reporter_handler(SystemCrashReporterHandler());
206 if (system_crash_reporter_handler) { 189 if (system_crash_reporter_handler) {
207 // Make copies of mutable out parameters so that the system crash reporter 190 // Make copies of mutable out parameters so that the system crash reporter
208 // can’t influence the state returned by this method. 191 // can’t influence the state returned by this method.
209 thread_state_flavor_t flavor_forward = *flavor; 192 thread_state_flavor_t flavor_forward = *flavor;
210 mach_msg_type_number_t new_state_forward_count = *new_state_count; 193 mach_msg_type_number_t new_state_forward_count = *new_state_count;
211 std::vector<natural_t> new_state_forward( 194 std::vector<natural_t> new_state_forward(
212 new_state, new_state + new_state_forward_count); 195 new_state, new_state + new_state_forward_count);
213 196
(...skipping 23 matching lines...) Expand all
237 } 220 }
238 } 221 }
239 222
240 ExcServerCopyState( 223 ExcServerCopyState(
241 behavior, old_state, old_state_count, new_state, new_state_count); 224 behavior, old_state, old_state_count, new_state, new_state_count);
242 225
243 return ExcServerSuccessfulReturnValue(exception, behavior, false); 226 return ExcServerSuccessfulReturnValue(exception, behavior, false);
244 } 227 }
245 228
246 } // namespace crashpad 229 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698