Change debuggerd client param from pid to tid
Change the header param to be `tid` and remove a local `pid` variable
to use `tid` instead.
Test: m
Bug: 316970771
Change-Id: I53c13081d72f46446ac6e85df77a160ef4f50c05
diff --git a/debuggerd/client/debuggerd_client.cpp b/debuggerd/client/debuggerd_client.cpp
index bd1e91d..af1bb81 100644
--- a/debuggerd/client/debuggerd_client.cpp
+++ b/debuggerd/client/debuggerd_client.cpp
@@ -116,7 +116,6 @@
bool debuggerd_trigger_dump(pid_t tid, DebuggerdDumpType dump_type, unsigned int timeout_ms,
unique_fd output_fd) {
- pid_t pid = tid;
if (dump_type == kDebuggerdJavaBacktrace) {
// Java dumps always get sent to the tgid, so we need to resolve our tid to a tgid.
android::procinfo::ProcessInfo procinfo;
@@ -125,10 +124,10 @@
log_error(output_fd, 0, "failed to get process info: %s", error.c_str());
return false;
}
- pid = procinfo.pid;
+ tid = procinfo.pid;
}
- LOG(INFO) << TAG "started dumping process " << pid;
+ LOG(INFO) << TAG "started dumping process " << tid;
// Rather than try to deal with poll() all the way through the flow, we update
// the socket timeout between each step (and only use poll() during the final
@@ -172,7 +171,7 @@
InterceptRequest req = {
.dump_type = dump_type,
- .pid = pid,
+ .pid = tid,
};
// Create an intermediate pipe to pass to the other end.
@@ -235,8 +234,8 @@
// Send the signal.
const int signal = (dump_type == kDebuggerdJavaBacktrace) ? SIGQUIT : BIONIC_SIGNAL_DEBUGGER;
sigval val = {.sival_int = (dump_type == kDebuggerdNativeBacktrace) ? 1 : 0};
- if (sigqueue(pid, signal, val) != 0) {
- log_error(output_fd, errno, "failed to send signal to pid %d", pid);
+ if (sigqueue(tid, signal, val) != 0) {
+ log_error(output_fd, errno, "failed to send signal to pid %d", tid);
return false;
}
@@ -299,7 +298,7 @@
}
}
- LOG(INFO) << TAG "done dumping process " << pid;
+ LOG(INFO) << TAG "done dumping process " << tid;
return true;
}
diff --git a/debuggerd/include/debuggerd/client.h b/debuggerd/include/debuggerd/client.h
index b7284b0..e7401cc 100644
--- a/debuggerd/include/debuggerd/client.h
+++ b/debuggerd/include/debuggerd/client.h
@@ -26,7 +26,7 @@
// Trigger a dump of specified process to output_fd.
// output_fd is consumed, timeout of 0 will wait forever.
-bool debuggerd_trigger_dump(pid_t pid, enum DebuggerdDumpType dump_type, unsigned int timeout_ms,
+bool debuggerd_trigger_dump(pid_t tid, enum DebuggerdDumpType dump_type, unsigned int timeout_ms,
android::base::unique_fd output_fd);
int dump_backtrace_to_file(pid_t tid, enum DebuggerdDumpType dump_type, int output_fd);