gdb: remove end_stepping_range observable

Message ID 20230424151007.54516-1-simon.marchi@efficios.com
State New
Headers
Series gdb: remove end_stepping_range observable |

Commit Message

Simon Marchi April 24, 2023, 3:10 p.m. UTC
  I noticed that this observable was never notified, which means we can
probably safely remove it.

Change-Id: If5da5149276c282d2540097c8c4327ce0f70431a
---
 gdb/cli/cli-interp.c | 17 -----------------
 gdb/mi/mi-interp.c   | 20 --------------------
 gdb/observable.c     |  1 -
 gdb/observable.h     |  3 ---
 4 files changed, 41 deletions(-)
  

Comments

Tom Tromey April 24, 2023, 5 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> I noticed that this observable was never notified, which means we can
Simon> probably safely remove it.

I was curious so I dug in the history.  It looks like the notification
as removed by:

commit 243a925328f8e3184b2356bee497181049c0174f
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Sep 9 18:23:24 2015 +0100

    Replace "struct continuation" mechanism by something more extensible


Anyway, that's long enough ago that I think this is fine.

Simon> -      print_end_stepping_range_reason (cli->interp_ui_out ());

I think nothing calls this now either.

Tom
  
Simon Marchi April 24, 2023, 7:55 p.m. UTC | #2
On 4/24/23 13:00, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> I noticed that this observable was never notified, which means we can
> Simon> probably safely remove it.
> 
> I was curious so I dug in the history.  It looks like the notification
> as removed by:
> 
> commit 243a925328f8e3184b2356bee497181049c0174f
> Author: Pedro Alves <palves@redhat.com>
> Date:   Wed Sep 9 18:23:24 2015 +0100
> 
>     Replace "struct continuation" mechanism by something more extensible
> 
> 
> Anyway, that's long enough ago that I think this is fine.
> 
> Simon> -      print_end_stepping_range_reason (cli->interp_ui_out ());
> 
> I think nothing calls this now either.

Ok, thanks.  I updated the patch and pushed it, as below.

Simon

From 41966608a1ee2bde59772c41aae6ec95b309ff26 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@efficios.com>
Date: Mon, 24 Apr 2023 15:46:00 -0400
Subject: [PATCH] gdb: remove end_stepping_range observable

I noticed that this observable was never notified, which means we can
probably safely remove it.  The notification was removed in:

    commit 243a925328f8e3184b2356bee497181049c0174f
    Author: Pedro Alves <palves@redhat.com>
    Date:   Wed Sep 9 18:23:24 2015 +0100

        Replace "struct continuation" mechanism by something more extensible

print_end_stepping_range_reason in turn becomes unused, so remote it as
well.

Change-Id: If5da5149276c282d2540097c8c4327ce0f70431a
---
 gdb/cli/cli-interp.c | 17 -----------------
 gdb/infrun.c         | 12 ------------
 gdb/infrun.h         |  4 ----
 gdb/mi/mi-interp.c   | 20 --------------------
 gdb/observable.c     |  1 -
 gdb/observable.h     |  3 ---
 6 files changed, 57 deletions(-)

diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 99410147a6ce..5a515c603c6e 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -151,21 +151,6 @@ cli_base_on_signal_received (enum gdb_signal siggnal)
     }
 }

-/* Observer for the end_stepping_range notification.  */
-
-static void
-cli_base_on_end_stepping_range ()
-{
-  SWITCH_THRU_ALL_UIS ()
-    {
-      cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
-      if (cli == nullptr)
-	continue;
-
-      print_end_stepping_range_reason (cli->interp_ui_out ());
-    }
-}
-
 /* Observer for the signalled notification.  */

 static void
@@ -422,8 +407,6 @@ _initialize_cli_interp ()
   /* Note these all work for both the CLI and TUI interpreters.  */
   gdb::observers::normal_stop.attach (cli_base_on_normal_stop,
 				      "cli-interp-base");
-  gdb::observers::end_stepping_range.attach (cli_base_on_end_stepping_range,
-					     "cli-interp-base");
   gdb::observers::signal_received.attach (cli_base_on_signal_received,
 					  "cli-interp-base");
   gdb::observers::signal_exited.attach (cli_base_on_signal_exited,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b79642e4d1e2..2f1c6cd694be 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8498,18 +8498,6 @@ end_stepping_range (struct execution_control_state *ecs)
    the interpreters, through observers.  Interpreters then call these
    with whatever uiout is right.  */

-void
-print_end_stepping_range_reason (struct ui_out *uiout)
-{
-  /* For CLI-like interpreters, print nothing.  */
-
-  if (uiout->is_mi_like_p ())
-    {
-      uiout->field_string ("reason",
-			   async_reason_lookup (EXEC_ASYNC_END_STEPPING_RANGE));
-    }
-}
-
 void
 print_signal_exited_reason (struct ui_out *uiout, enum gdb_signal siggnal)
 {
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 9b3c89629399..9513bc570e46 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -217,10 +217,6 @@ extern void set_step_info (thread_info *tp,
 extern void print_signal_received_reason (struct ui_out *uiout,
 					  enum gdb_signal siggnal);

-/* Print why the inferior has stopped.  We are done with a
-   step/next/si/ni command, print why the inferior has stopped.  */
-extern void print_end_stepping_range_reason (struct ui_out *uiout);
-
 /* The inferior was terminated by a signal, print why it stopped.  */
 extern void print_signal_exited_reason (struct ui_out *uiout,
 					enum gdb_signal siggnal);
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 4f0bbd40f9d7..ce78b0c2b58a 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -61,7 +61,6 @@ static void mi_insert_notify_hooks (void);
 static void mi_remove_notify_hooks (void);

 static void mi_on_signal_received (enum gdb_signal siggnal);
-static void mi_on_end_stepping_range (void);
 static void mi_on_signal_exited (enum gdb_signal siggnal);
 static void mi_on_exited (int exitstatus);
 static void mi_on_normal_stop (struct bpstat *bs, int print_frame);
@@ -542,23 +541,6 @@ mi_on_signal_received (enum gdb_signal siggnal)
     }
 }

-/* Observer for the end_stepping_range notification.  */
-
-static void
-mi_on_end_stepping_range (void)
-{
-  SWITCH_THRU_ALL_UIS ()
-    {
-      struct mi_interp *mi = find_mi_interp ();
-
-      if (mi == NULL)
-	continue;
-
-      print_end_stepping_range_reason (mi->mi_uiout);
-      print_end_stepping_range_reason (mi->cli_uiout);
-    }
-}
-
 /* Observer for the signal_exited notification.  */

 static void
@@ -1317,8 +1299,6 @@ _initialize_mi_interp ()
   interp_factory_register (INTERP_MI, mi_interp_factory);

   gdb::observers::signal_received.attach (mi_on_signal_received, "mi-interp");
-  gdb::observers::end_stepping_range.attach (mi_on_end_stepping_range,
-					     "mi-interp");
   gdb::observers::signal_exited.attach (mi_on_signal_exited, "mi-interp");
   gdb::observers::exited.attach (mi_on_exited, "mi-interp");
   gdb::observers::no_history.attach (mi_on_no_history, "mi-interp");
diff --git a/gdb/observable.c b/gdb/observable.c
index 49de89c25e04..82563e3fab47 100644
--- a/gdb/observable.c
+++ b/gdb/observable.c
@@ -34,7 +34,6 @@ bool observer_debug = false;

 DEFINE_OBSERVABLE (normal_stop);
 DEFINE_OBSERVABLE (signal_received);
-DEFINE_OBSERVABLE (end_stepping_range);
 DEFINE_OBSERVABLE (signal_exited);
 DEFINE_OBSERVABLE (exited);
 DEFINE_OBSERVABLE (no_history);
diff --git a/gdb/observable.h b/gdb/observable.h
index 3066cf68f314..e4e6f021f1a9 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -57,9 +57,6 @@ extern observable<struct bpstat */* bs */, int /* print_frame */> normal_stop;
 /* The inferior was stopped by a signal.  */
 extern observable<enum gdb_signal /* siggnal */> signal_received;

-/* We are done with a step/next/si/ni command.  */
-extern observable<> end_stepping_range;
-
 /* The inferior was terminated by a signal.  */
 extern observable<enum gdb_signal /* siggnal */> signal_exited;
  
Terekhov, Mikhail via Gdb-patches April 25, 2023, 12:16 p.m. UTC | #3
On Monday, April 24, 2023 9:55 PM, Simon Marchi wrote:
> From 41966608a1ee2bde59772c41aae6ec95b309ff26 Mon Sep 17 00:00:00 2001
> From: Simon Marchi <simon.marchi@efficios.com>
> Date: Mon, 24 Apr 2023 15:46:00 -0400
> Subject: [PATCH] gdb: remove end_stepping_range observable
> 
> I noticed that this observable was never notified, which means we can
> probably safely remove it.  The notification was removed in:
> 
>     commit 243a925328f8e3184b2356bee497181049c0174f
>     Author: Pedro Alves <palves@redhat.com>
>     Date:   Wed Sep 9 18:23:24 2015 +0100
> 
>         Replace "struct continuation" mechanism by something more extensible
> 
> print_end_stepping_range_reason in turn becomes unused, so remote it as
> well.

Hello Simon,

As a somewhat related topic, any chance for reviewing the patch at
https://sourceware.org/pipermail/gdb-patches/2022-November/193891.html ? :)

Thanks,
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
  
Simon Marchi April 27, 2023, 1:36 p.m. UTC | #4
On 4/25/23 08:16, Aktemur, Tankut Baris wrote:
> On Monday, April 24, 2023 9:55 PM, Simon Marchi wrote:
>> From 41966608a1ee2bde59772c41aae6ec95b309ff26 Mon Sep 17 00:00:00 2001
>> From: Simon Marchi <simon.marchi@efficios.com>
>> Date: Mon, 24 Apr 2023 15:46:00 -0400
>> Subject: [PATCH] gdb: remove end_stepping_range observable
>>
>> I noticed that this observable was never notified, which means we can
>> probably safely remove it.  The notification was removed in:
>>
>>     commit 243a925328f8e3184b2356bee497181049c0174f
>>     Author: Pedro Alves <palves@redhat.com>
>>     Date:   Wed Sep 9 18:23:24 2015 +0100
>>
>>         Replace "struct continuation" mechanism by something more extensible
>>
>> print_end_stepping_range_reason in turn becomes unused, so remote it as
>> well.
> 
> Hello Simon,
> 
> As a somewhat related topic, any chance for reviewing the patch at
> https://sourceware.org/pipermail/gdb-patches/2022-November/193891.html ? :)
> 
> Thanks,
> -Baris

I'll take a look.  I guess we were hoping for Pedro to review this patch (he's
the best person to review almost anything in GDB :)), but he's a bit overloaded,
so I'll give it a shot.

Simon
  

Patch

diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 99410147a6ce..5a515c603c6e 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -151,21 +151,6 @@  cli_base_on_signal_received (enum gdb_signal siggnal)
     }
 }
 
-/* Observer for the end_stepping_range notification.  */
-
-static void
-cli_base_on_end_stepping_range ()
-{
-  SWITCH_THRU_ALL_UIS ()
-    {
-      cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
-      if (cli == nullptr)
-	continue;
-
-      print_end_stepping_range_reason (cli->interp_ui_out ());
-    }
-}
-
 /* Observer for the signalled notification.  */
 
 static void
@@ -422,8 +407,6 @@  _initialize_cli_interp ()
   /* Note these all work for both the CLI and TUI interpreters.  */
   gdb::observers::normal_stop.attach (cli_base_on_normal_stop,
 				      "cli-interp-base");
-  gdb::observers::end_stepping_range.attach (cli_base_on_end_stepping_range,
-					     "cli-interp-base");
   gdb::observers::signal_received.attach (cli_base_on_signal_received,
 					  "cli-interp-base");
   gdb::observers::signal_exited.attach (cli_base_on_signal_exited,
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 4f0bbd40f9d7..ce78b0c2b58a 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -61,7 +61,6 @@  static void mi_insert_notify_hooks (void);
 static void mi_remove_notify_hooks (void);
 
 static void mi_on_signal_received (enum gdb_signal siggnal);
-static void mi_on_end_stepping_range (void);
 static void mi_on_signal_exited (enum gdb_signal siggnal);
 static void mi_on_exited (int exitstatus);
 static void mi_on_normal_stop (struct bpstat *bs, int print_frame);
@@ -542,23 +541,6 @@  mi_on_signal_received (enum gdb_signal siggnal)
     }
 }
 
-/* Observer for the end_stepping_range notification.  */
-
-static void
-mi_on_end_stepping_range (void)
-{
-  SWITCH_THRU_ALL_UIS ()
-    {
-      struct mi_interp *mi = find_mi_interp ();
-
-      if (mi == NULL)
-	continue;
-
-      print_end_stepping_range_reason (mi->mi_uiout);
-      print_end_stepping_range_reason (mi->cli_uiout);
-    }
-}
-
 /* Observer for the signal_exited notification.  */
 
 static void
@@ -1317,8 +1299,6 @@  _initialize_mi_interp ()
   interp_factory_register (INTERP_MI, mi_interp_factory);
 
   gdb::observers::signal_received.attach (mi_on_signal_received, "mi-interp");
-  gdb::observers::end_stepping_range.attach (mi_on_end_stepping_range,
-					     "mi-interp");
   gdb::observers::signal_exited.attach (mi_on_signal_exited, "mi-interp");
   gdb::observers::exited.attach (mi_on_exited, "mi-interp");
   gdb::observers::no_history.attach (mi_on_no_history, "mi-interp");
diff --git a/gdb/observable.c b/gdb/observable.c
index 49de89c25e04..82563e3fab47 100644
--- a/gdb/observable.c
+++ b/gdb/observable.c
@@ -34,7 +34,6 @@  bool observer_debug = false;
 
 DEFINE_OBSERVABLE (normal_stop);
 DEFINE_OBSERVABLE (signal_received);
-DEFINE_OBSERVABLE (end_stepping_range);
 DEFINE_OBSERVABLE (signal_exited);
 DEFINE_OBSERVABLE (exited);
 DEFINE_OBSERVABLE (no_history);
diff --git a/gdb/observable.h b/gdb/observable.h
index 3066cf68f314..e4e6f021f1a9 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -57,9 +57,6 @@  extern observable<struct bpstat */* bs */, int /* print_frame */> normal_stop;
 /* The inferior was stopped by a signal.  */
 extern observable<enum gdb_signal /* siggnal */> signal_received;
 
-/* We are done with a step/next/si/ni command.  */
-extern observable<> end_stepping_range;
-
 /* The inferior was terminated by a signal.  */
 extern observable<enum gdb_signal /* siggnal */> signal_exited;