OLD | NEW |
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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (!file_owner.get()) { | 268 if (!file_owner.get()) { |
269 PLOG(ERROR) << "fopen " << options.file_path; | 269 PLOG(ERROR) << "fopen " << options.file_path; |
270 return EXIT_FAILURE; | 270 return EXIT_FAILURE; |
271 } | 271 } |
272 options.file = file_owner.get(); | 272 options.file = file_owner.get(); |
273 } | 273 } |
274 | 274 |
275 int exceptions_handled = 0; | 275 int exceptions_handled = 0; |
276 ExceptionServer exception_server(options, me, &exceptions_handled); | 276 ExceptionServer exception_server(options, me, &exceptions_handled); |
277 | 277 |
| 278 // Assume that if persistent mode has been requested, it’s desirable to ignore |
| 279 // large messages and keep running. |
| 280 MachMessageServer::ReceiveLarge receive_large = |
| 281 (options.persistent == MachMessageServer::kPersistent) |
| 282 ? MachMessageServer::kReceiveLargeIgnore |
| 283 : MachMessageServer::kReceiveLargeError; |
| 284 |
278 mach_msg_timeout_t timeout_ms = options.timeout_secs | 285 mach_msg_timeout_t timeout_ms = options.timeout_secs |
279 ? options.timeout_secs * 1000 | 286 ? options.timeout_secs * 1000 |
280 : MACH_MSG_TIMEOUT_NONE; | 287 : MACH_MSG_TIMEOUT_NONE; |
281 | 288 |
282 mach_msg_return_t mr = MachMessageServer::Run(&exception_server, | 289 mach_msg_return_t mr = MachMessageServer::Run(&exception_server, |
283 service_port, | 290 service_port, |
284 MACH_MSG_OPTION_NONE, | 291 MACH_MSG_OPTION_NONE, |
285 options.persistent, | 292 options.persistent, |
286 options.nonblocking, | 293 options.nonblocking, |
| 294 receive_large, |
287 timeout_ms); | 295 timeout_ms); |
288 if (mr == MACH_RCV_TIMED_OUT && options.timeout_secs && options.persistent && | 296 if (mr == MACH_RCV_TIMED_OUT && options.timeout_secs && options.persistent && |
289 exceptions_handled) { | 297 exceptions_handled) { |
290 // This is not an error: when exiting on timeout during persistent | 298 // This is not an error: when exiting on timeout during persistent |
291 // processing and at least one exception was handled, it’s considered a | 299 // processing and at least one exception was handled, it’s considered a |
292 // success. | 300 // success. |
293 } else if (mr != MACH_MSG_SUCCESS) { | 301 } else if (mr != MACH_MSG_SUCCESS) { |
294 MACH_LOG(ERROR, mr) << "MachMessageServer::Run"; | 302 MACH_LOG(ERROR, mr) << "MachMessageServer::Run"; |
295 return EXIT_FAILURE; | 303 return EXIT_FAILURE; |
296 } | 304 } |
297 | 305 |
298 return EXIT_SUCCESS; | 306 return EXIT_SUCCESS; |
299 } | 307 } |
300 | 308 |
301 } // namespace | 309 } // namespace |
302 } // namespace crashpad | 310 } // namespace crashpad |
303 | 311 |
304 int main(int argc, char* argv[]) { | 312 int main(int argc, char* argv[]) { |
305 return crashpad::CatchExceptionToolMain(argc, argv); | 313 return crashpad::CatchExceptionToolMain(argc, argv); |
306 } | 314 } |
OLD | NEW |