debuggerd: dump frozen Java processes

Test: stacks <pid>
Test: adb shell debuggerd -b <pid>
Bug: 319754740
Change-Id: Iae230ff34409bee4a325113aed65433292975427
This commit is contained in:
Andy Hung 2024-01-11 18:57:27 -08:00
parent bc645a1c47
commit 42f8cd3bf9

View file

@ -91,6 +91,15 @@ int main(int argc, char* argv[]) {
}
}
// unfreeze if pid is frozen.
const std::string freeze_file = android::base::StringPrintf(
"/sys/fs/cgroup/uid_%d/pid_%d/cgroup.freeze", proc_info.uid, proc_info.pid);
if (std::string freeze_status;
android::base::ReadFileToString(freeze_file, &freeze_status) && freeze_status[0] == '1') {
android::base::WriteStringToFile("0", freeze_file);
// we don't restore the frozen state as this is considered a benign change.
}
unique_fd output_fd(fcntl(STDOUT_FILENO, F_DUPFD_CLOEXEC, 0));
if (output_fd.get() == -1) {
err(1, "failed to fcntl dup stdout");