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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 // Sets the exception port for |target_port|, a send right to a thread, task, or | 274 // Sets the exception port for |target_port|, a send right to a thread, task, or |
275 // host port, to |description|, which identifies what type of port |target_port| | 275 // host port, to |description|, which identifies what type of port |target_port| |
276 // is and describes an exception port to be set. Returns true on success. | 276 // is and describes an exception port to be set. Returns true on success. |
277 // | 277 // |
278 // This function may be called more than once if setting different handlers is | 278 // This function may be called more than once if setting different handlers is |
279 // desired. | 279 // desired. |
280 bool SetExceptionPort(const ExceptionHandlerDescription* description, | 280 bool SetExceptionPort(const ExceptionHandlerDescription* description, |
281 mach_port_t target_port) { | 281 mach_port_t target_port) { |
282 base::mac::ScopedMachSendRight service_port_owner; | 282 base::mac::ScopedMachSendRight service_port_owner; |
283 mach_port_t service_port = MACH_PORT_NULL; | 283 exception_handler_t service_port = MACH_PORT_NULL; |
284 kern_return_t kr; | 284 kern_return_t kr; |
285 if (description->handler.compare( | 285 if (description->handler.compare( |
286 0, strlen(kHandlerBootstrapColon), kHandlerBootstrapColon) == 0) { | 286 0, strlen(kHandlerBootstrapColon), kHandlerBootstrapColon) == 0) { |
287 const char* service_name = | 287 const char* service_name = |
288 description->handler.c_str() + strlen(kHandlerBootstrapColon); | 288 description->handler.c_str() + strlen(kHandlerBootstrapColon); |
289 kr = bootstrap_look_up( | 289 kr = bootstrap_look_up( |
290 bootstrap_port, const_cast<char*>(service_name), &service_port); | 290 bootstrap_port, const_cast<char*>(service_name), &service_port); |
291 if (kr != BOOTSTRAP_SUCCESS) { | 291 if (kr != BOOTSTRAP_SUCCESS) { |
292 BOOTSTRAP_LOG(ERROR, kr) << "bootstrap_look_up " << service_name; | 292 BOOTSTRAP_LOG(ERROR, kr) << "bootstrap_look_up " << service_name; |
293 return false; | 293 return false; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 387 |
388 // Standard options. | 388 // Standard options. |
389 kOptionHelp = -2, | 389 kOptionHelp = -2, |
390 kOptionVersion = -3, | 390 kOptionVersion = -3, |
391 }; | 391 }; |
392 | 392 |
393 struct { | 393 struct { |
394 std::vector<const char*> show_bootstrap; | 394 std::vector<const char*> show_bootstrap; |
395 std::vector<ExceptionHandlerDescription> set_handler; | 395 std::vector<ExceptionHandlerDescription> set_handler; |
396 pid_t pid; | 396 pid_t pid; |
397 mach_port_t alternate_task; | 397 task_t alternate_task; |
398 bool show_host; | 398 bool show_host; |
399 bool show_task; | 399 bool show_task; |
400 bool show_thread; | 400 bool show_thread; |
401 bool show_new_host; | 401 bool show_new_host; |
402 bool show_new_task; | 402 bool show_new_task; |
403 bool show_new_thread; | 403 bool show_new_thread; |
404 bool numeric; | 404 bool numeric; |
405 } options = {}; | 405 } options = {}; |
406 | 406 |
407 const struct option long_options[] = { | 407 const struct option long_options[] = { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 if (argc) { | 580 if (argc) { |
581 // Using the remaining arguments, start a new program with the new set of | 581 // Using the remaining arguments, start a new program with the new set of |
582 // exception ports in effect. | 582 // exception ports in effect. |
583 execvp(argv[0], argv); | 583 execvp(argv[0], argv); |
584 PLOG(ERROR) << "execvp " << argv[0]; | 584 PLOG(ERROR) << "execvp " << argv[0]; |
585 return errno == ENOENT ? kExitExecENOENT : kExitExecFailure; | 585 return errno == ENOENT ? kExitExecENOENT : kExitExecFailure; |
586 } | 586 } |
587 | 587 |
588 return kExitSuccess; | 588 return kExitSuccess; |
589 } | 589 } |
OLD | NEW |