[binutils-gdb] Fix gdbserver/linux target_waitstatus logging assert

Pedro Alves palves@sourceware.org
Thu Mar 10 11:41:42 GMT 2022


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e48359eaa8c4c79a40a21726c9fa823241793b1e

commit e48359eaa8c4c79a40a21726c9fa823241793b1e
Author: Pedro Alves <pedro@palves.net>
Date:   Fri Feb 18 16:42:06 2022 +0000

    Fix gdbserver/linux target_waitstatus logging assert
    
    Turning on debug output in gdbserver leads to an assertion failure if
    gdbserver reports a non-signal event:
    
        [threads] wait_1: LWP 3273770: extended event with waitstatus status->kind = EXECD, execd_pathname = gdb.threads/non-ldr-exc-1/non-ldr-exc-1
        [threads] wait_1: Hit a non-gdbserver trap event.
      ../../src/gdbserver/../gdb/target/waitstatus.h:365: A problem internal to GDBserver has been detected.
      sig: Assertion `m_kind == TARGET_WAITKIND_STOPPED || m_kind == TARGET_WAITKIND_SIGNALLED' failed.
    
    Fix it in the obvious way, using target_waitstatus::to_string(),
    resulting in, for example:
    
      [threads] wait_1: ret = LWP 1542412.1542412, status->kind = STOPPED, sig = GDB_SIGNAL_TRAP
    
    Change-Id: Ia4832f9b4fa39f4af67fcaf21fd4d909a285a645

Diff:
---
 gdbserver/linux-low.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 0a5b6063104..db482b2f48e 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -3493,9 +3493,9 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
 
   gdb_assert (step_over_bkpt == null_ptid);
 
-  threads_debug_printf ("ret = %s, %d, %d",
+  threads_debug_printf ("ret = %s, %s",
 			target_pid_to_str (ptid_of (current_thread)).c_str (),
-			ourstatus->kind (), ourstatus->sig ());
+			ourstatus->to_string ().c_str ());
 
   if (ourstatus->kind () == TARGET_WAITKIND_EXITED)
     return filter_exit_event (event_child, ourstatus);


More information about the Gdb-cvs mailing list