]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
linux-nat: introduce pending_status_str
authorPedro Alves <pedro@palves.net>
Fri, 12 Nov 2021 20:50:29 +0000 (20:50 +0000)
committerPedro Alves <pedro@palves.net>
Mon, 18 Jul 2022 16:33:30 +0000 (17:33 +0100)
I noticed that some debug log output printing an lwp's pending status
wasn't considering lp->waitstatus.  This fixes it, by introducing a
new pending_status_str function.

Change-Id: I66e5c7a363d30a925b093b195d72925ce5b6b980

gdb/linux-nat.c

index 0a93ab5c6ae534125d161eb59859be1fc2c48df1..57cab4ce50ab2057fb85a204700e3a4f85488496 100644 (file)
@@ -255,6 +255,17 @@ is_leader (lwp_info *lp)
   return lp->ptid.pid () == lp->ptid.lwp ();
 }
 
+/* Convert an LWP's pending status to a std::string.  */
+
+static std::string
+pending_status_str (lwp_info *lp)
+{
+  if (lp->waitstatus.kind () != TARGET_WAITKIND_IGNORE)
+    return lp->waitstatus.to_string ();
+  else
+    return status_to_str (lp->status);
+}
+
 \f
 /* LWP accessors.  */
 
@@ -1647,8 +1658,8 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
         this thread with a signal?  */
       gdb_assert (signo == GDB_SIGNAL_0);
 
-      linux_nat_debug_printf ("Short circuiting for status 0x%x",
-                             lp->status);
+      linux_nat_debug_printf ("Short circuiting for status %s",
+                             pending_status_str (lp).c_str ());
 
       if (target_can_async_p ())
        {
@@ -3141,7 +3152,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
   if (lp != NULL)
     {
       linux_nat_debug_printf ("Using pending wait status %s for %s.",
-                             status_to_str (lp->status).c_str (),
+                             pending_status_str (lp).c_str (),
                              lp->ptid.to_string ().c_str ());
     }