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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 | 311 |
312 return true; | 312 return true; |
313 } | 313 } |
314 | 314 |
315 void Usage(const std::string& me) { | 315 void Usage(const std::string& me) { |
316 fprintf(stderr, | 316 fprintf(stderr, |
317 "Usage: %s [OPTION]... [COMMAND [ARG]...]\n" | 317 "Usage: %s [OPTION]... [COMMAND [ARG]...]\n" |
318 "View and change Mach exception ports, and run COMMAND if supplied.\n" | 318 "View and change Mach exception ports, and run COMMAND if supplied.\n" |
319 "\n" | 319 "\n" |
320 " -s, --set_handler=DESCRIPTION set an exception port to DESCRIPTION, see belo
w\n" | 320 " -s, --set-handler=DESCRIPTION set an exception port to DESCRIPTION, see belo
w\n" |
321 " --show_bootstrap=SERVICE look up and display a service registered with\
n" | 321 " --show-bootstrap=SERVICE look up and display a service registered with\
n" |
322 " the bootstrap server\n" | 322 " the bootstrap server\n" |
323 " -p, --pid=PID operate on PID instead of the current task\n" | 323 " -p, --pid=PID operate on PID instead of the current task\n" |
324 " -h, --show_host display original host exception ports\n" | 324 " -h, --show-host display original host exception ports\n" |
325 " -t, --show_task display original task exception ports\n" | 325 " -t, --show-task display original task exception ports\n" |
326 " --show_thread display original thread exception ports\n" | 326 " --show-thread display original thread exception ports\n" |
327 " -H, --show_new_host display modified host exception ports\n" | 327 " -H, --show-new-host display modified host exception ports\n" |
328 " -T, --show_new_task display modified task exception ports\n" | 328 " -T, --show-new-task display modified task exception ports\n" |
329 " --show_new_thread display modified thread exception ports\n" | 329 " --show-new-thread display modified thread exception ports\n" |
330 " -n, --numeric display values numerically, not symbolically\n
" | 330 " -n, --numeric display values numerically, not symbolically\n
" |
331 " --help display this help and exit\n" | 331 " --help display this help and exit\n" |
332 " --version output version information and exit\n" | 332 " --version output version information and exit\n" |
333 "\n" | 333 "\n" |
334 "Any operations on host exception ports require superuser permissions.\n" | 334 "Any operations on host exception ports require superuser permissions.\n" |
335 "\n" | 335 "\n" |
336 "DESCRIPTION is formatted as a comma-separated sequence of tokens, where each\n" | 336 "DESCRIPTION is formatted as a comma-separated sequence of tokens, where each\n" |
337 "token consists of a key and value separated by an equals sign. Available keys:\
n" | 337 "token consists of a key and value separated by an equals sign. Available keys:\
n" |
338 " target which target's exception ports to set: host, task, or thread\n" | 338 " target which target's exception ports to set: host, task, or thread\n" |
339 " mask the mask of exception types to handle: CRASH, ALL, or others\n" | 339 " mask the mask of exception types to handle: CRASH, ALL, or others\n" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 bool show_host; | 396 bool show_host; |
397 bool show_task; | 397 bool show_task; |
398 bool show_thread; | 398 bool show_thread; |
399 bool show_new_host; | 399 bool show_new_host; |
400 bool show_new_task; | 400 bool show_new_task; |
401 bool show_new_thread; | 401 bool show_new_thread; |
402 bool numeric; | 402 bool numeric; |
403 } options = {}; | 403 } options = {}; |
404 | 404 |
405 const struct option long_options[] = { | 405 const struct option long_options[] = { |
406 {"set_handler", required_argument, nullptr, kOptionSetPort}, | 406 {"set-handler", required_argument, nullptr, kOptionSetPort}, |
407 {"show_bootstrap", required_argument, nullptr, kOptionShowBootstrap}, | 407 {"show-bootstrap", required_argument, nullptr, kOptionShowBootstrap}, |
408 {"pid", required_argument, nullptr, kOptionPid}, | 408 {"pid", required_argument, nullptr, kOptionPid}, |
409 {"show_host", no_argument, nullptr, kOptionShowHost}, | 409 {"show-host", no_argument, nullptr, kOptionShowHost}, |
410 {"show_task", no_argument, nullptr, kOptionShowTask}, | 410 {"show-task", no_argument, nullptr, kOptionShowTask}, |
411 {"show_thread", no_argument, nullptr, kOptionShowThread}, | 411 {"show-thread", no_argument, nullptr, kOptionShowThread}, |
412 {"show_new_host", no_argument, nullptr, kOptionShowNewHost}, | 412 {"show-new-host", no_argument, nullptr, kOptionShowNewHost}, |
413 {"show_new_task", no_argument, nullptr, kOptionShowNewTask}, | 413 {"show-new-task", no_argument, nullptr, kOptionShowNewTask}, |
414 {"show_new_thread", no_argument, nullptr, kOptionShowNewThread}, | 414 {"show-new-thread", no_argument, nullptr, kOptionShowNewThread}, |
415 {"numeric", no_argument, nullptr, kOptionNumeric}, | 415 {"numeric", no_argument, nullptr, kOptionNumeric}, |
416 {"help", no_argument, nullptr, kOptionHelp}, | 416 {"help", no_argument, nullptr, kOptionHelp}, |
417 {"version", no_argument, nullptr, kOptionVersion}, | 417 {"version", no_argument, nullptr, kOptionVersion}, |
418 {nullptr, 0, nullptr, 0}, | 418 {nullptr, 0, nullptr, 0}, |
419 }; | 419 }; |
420 | 420 |
421 int opt; | 421 int opt; |
422 while ((opt = getopt_long(argc, argv, "+s:p:htHTn", long_options, nullptr)) != | 422 while ((opt = getopt_long(argc, argv, "+s:p:htHTn", long_options, nullptr)) != |
423 -1) { | 423 -1) { |
424 switch (opt) { | 424 switch (opt) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 585 |
586 return kExitSuccess; | 586 return kExitSuccess; |
587 } | 587 } |
588 | 588 |
589 } // namespace | 589 } // namespace |
590 } // namespace crashpad | 590 } // namespace crashpad |
591 | 591 |
592 int main(int argc, char* argv[]) { | 592 int main(int argc, char* argv[]) { |
593 return crashpad::ExceptionPortToolMain(argc, argv); | 593 return crashpad::ExceptionPortToolMain(argc, argv); |
594 } | 594 } |
OLD | NEW |