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

Unified Diff: tools/exception_port_tool.cc

Issue 728973002: Add TaskForPID() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@process_info
Patch Set: Rebase Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/exception_port_tool.ad ('k') | util/mach/task_for_pid.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/exception_port_tool.cc
diff --git a/tools/exception_port_tool.cc b/tools/exception_port_tool.cc
index c20db73e14e887ada986a76054ee3c369d16c41a..bcca29fcdd5ec0096f11c181fd20ffe4fe2e0750 100644
--- a/tools/exception_port_tool.cc
+++ b/tools/exception_port_tool.cc
@@ -33,6 +33,7 @@
#include "util/mach/exception_ports.h"
#include "util/mach/mach_extensions.h"
#include "util/mach/symbolic_constants_mach.h"
+#include "util/mach/task_for_pid.h"
#include "util/stdlib/string_number_conversion.h"
namespace crashpad {
@@ -319,7 +320,6 @@ void Usage(const std::string& me) {
" --show_bootstrap=SERVICE look up and display a service registered with\n"
" the bootstrap server\n"
" -p, --pid=PID operate on PID instead of the current task\n"
-" (must be superuser or permitted by taskgated)\n"
" -h, --show_host display original host exception ports\n"
" -t, --show_task display original task exception ports\n"
" --show_thread display original thread exception ports\n"
@@ -496,12 +496,8 @@ int ExceptionPortToolMain(int argc, char* argv[]) {
return kExitFailure;
}
- // This is only expected to work as root or if taskgated approves.
- // taskgated does not normally approve.
- kern_return_t kr =
- task_for_pid(mach_task_self(), options.pid, &options.alternate_task);
- if (kr != KERN_SUCCESS) {
- MACH_LOG(ERROR, kr) << "task_for_pid";
+ options.alternate_task = TaskForPID(options.pid);
+ if (options.alternate_task == TASK_NULL) {
return kExitFailure;
}
alternate_task_owner.reset(options.alternate_task);
« no previous file with comments | « tools/exception_port_tool.ad ('k') | util/mach/task_for_pid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698