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
This commit is contained in:
parent
761db93167
commit
b56e4743f6
2 changed files with 7 additions and 8 deletions
|
@ -116,7 +116,6 @@ static std::string get_wchan_data(int fd, pid_t pid) {
|
|||
|
||||
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 @@ bool debuggerd_trigger_dump(pid_t tid, DebuggerdDumpType dump_type, unsigned int
|
|||
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 @@ bool debuggerd_trigger_dump(pid_t tid, DebuggerdDumpType dump_type, unsigned int
|
|||
|
||||
InterceptRequest req = {
|
||||
.dump_type = dump_type,
|
||||
.pid = pid,
|
||||
.pid = tid,
|
||||
};
|
||||
|
||||
// Create an intermediate pipe to pass to the other end.
|
||||
|
@ -235,8 +234,8 @@ bool debuggerd_trigger_dump(pid_t tid, DebuggerdDumpType dump_type, unsigned int
|
|||
// 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 @@ bool debuggerd_trigger_dump(pid_t tid, DebuggerdDumpType dump_type, unsigned int
|
|||
}
|
||||
}
|
||||
|
||||
LOG(INFO) << TAG "done dumping process " << pid;
|
||||
LOG(INFO) << TAG "done dumping process " << tid;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue