Print thread state after failure to suspend
This may help us debug some issues where the thread is failing to
suspend.
Bug: b/151318587
Change-Id: I133ea323b1a653cb1041d1336b020767ba09736f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2103411
Commit-Queue: John Bauman <jbauman@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
GitOrigin-RevId: 9a31d3f8e9815774026a753a1ff6155347cd549f
diff --git a/util/fuchsia/scoped_task_suspend.cc b/util/fuchsia/scoped_task_suspend.cc
index 4b4ffe7..8591d55 100644
--- a/util/fuchsia/scoped_task_suspend.cc
+++ b/util/fuchsia/scoped_task_suspend.cc
@@ -41,7 +41,7 @@
for (const auto& thread : GetThreadHandles(process)) {
// We omit the crashed thread (blocked in an exception) as it is technically
// not suspended, cf. ZX-3772.
- zx_info_thread info;
+ zx_info_thread_t info;
if (thread.get_info(
ZX_INFO_THREAD, &info, sizeof(info), nullptr, nullptr) == ZX_OK) {
if (info.state == ZX_THREAD_STATE_BLOCKED_EXCEPTION) {
@@ -52,8 +52,16 @@
zx_signals_t observed = 0u;
const zx_status_t wait_status = thread.wait_one(
ZX_THREAD_SUSPENDED, zx::deadline_after(zx::msec(50)), &observed);
- ZX_LOG_IF(ERROR, wait_status != ZX_OK, wait_status)
- << "thread failed to suspend";
+ if (wait_status != ZX_OK) {
+ zx_info_thread_t info = {};
+ zx_status_t info_status = thread.get_info(
+ ZX_INFO_THREAD, &info, sizeof(info), nullptr, nullptr);
+ ZX_LOG(ERROR, wait_status) << "thread failed to suspend";
+ LOG(ERROR) << "Thread info status " << info_status;
+ if (info_status == ZX_OK) {
+ LOG(ERROR) << "Thread state " << info.state;
+ }
+ }
}
}