[RFC,3/8] gdb, infrun: simplify print_stop_location()

Message ID 20261001102847.576880-4-markus.t.metzger@intel.com
State New
Headers
Series breakpoint handling |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Skipped because it is an RFC
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Skipped because it is an RFC

Commit Message

Metzger, Markus T Oct. 1, 2026, 10:28 a.m. UTC
  print_stop_location() expects its argument waitstatus to match
inferior_thread()'s control.stop_bpstat.

Instead, use inferior_thread()'s last waitstatus that the parent patch
stored in control.stop_ws.

This removes the need for a waitstatus parameter.  Change it to take the
thread to print the stop location for.
---
 gdb/infrun.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
  

Patch

diff --git a/gdb/infrun.c b/gdb/infrun.c
index b347459f335..8ba5937fa73 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -9441,14 +9441,14 @@  print_no_history_reason (struct ui_out *uiout)
    based on the event(s) that just occurred.  */
 
 static void
-print_stop_location (const target_waitstatus &ws)
+print_stop_location (thread_info *tp)
 {
   int bpstat_ret;
   enum print_what source_flag;
   int do_frame_printing = 1;
-  struct thread_info *tp = inferior_thread ();
 
-  bpstat_ret = bpstat_print (tp->control.stop_bpstat, ws.kind ());
+  bpstat_ret = bpstat_print (tp->control.stop_bpstat,
+			     tp->control.stop_ws.kind ());
   /* Function bpstat_print selects the frame to print.  Typically, that is the
      stop frame, in other words get_current_frame ().  But bpstat_print may
      select a different frame, see for instance ada_catchpoint::print_it.  */
@@ -9516,22 +9516,17 @@  print_stop_location (const target_waitstatus &ws)
 static void
 do_print_stop_event (struct ui_out *uiout, bool displays)
 {
-  struct target_waitstatus last;
-  struct thread_info *tp;
-
-  get_last_target_status (nullptr, nullptr, &last);
-
+  struct thread_info *tp = inferior_thread ();
   {
     scoped_restore save_uiout = make_scoped_restore (&current_uiout, uiout);
 
-    print_stop_location (last);
+    print_stop_location (tp);
 
     /* Display the auto-display expressions.  */
     if (displays)
       do_displays ();
   }
 
-  tp = inferior_thread ();
   if (tp->thread_fsm () != nullptr
       && tp->thread_fsm ()->finished_p ())
     {