public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 04/16] gdb: switch to using 'const reggroup *' in tui-regs.{c, h}
Date: Thu, 31 Mar 2022 22:04:10 +0100	[thread overview]
Message-ID: <602a33867531cafed1e83f8182699f6bfcd34b43.1648760270.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1648760270.git.aburgess@redhat.com>

Make uses of 'reggroup *' const throughout tui-regs.{c,h}.

There should be no user visible changes after this commit.
---
 gdb/tui/tui-regs.c | 22 +++++++++++-----------
 gdb/tui/tui-regs.h |  9 +++++----
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 190985321eb..5c6189a59b1 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -177,7 +177,7 @@ tui_data_window::first_reg_element_no_inline (int line_no) const
 /* Show the registers of the given group in the data window
    and refresh the window.  */
 void
-tui_data_window::show_registers (struct reggroup *group)
+tui_data_window::show_registers (const reggroup *group)
 {
   if (group == 0)
     group = general_reggroup;
@@ -207,7 +207,7 @@ tui_data_window::show_registers (struct reggroup *group)
    refresh_values_only is true.  */
 
 void
-tui_data_window::show_register_group (struct reggroup *group,
+tui_data_window::show_register_group (const reggroup *group,
 				      struct frame_info *frame, 
 				      bool refresh_values_only)
 {
@@ -518,10 +518,10 @@ tui_data_item_window::rerender (WINDOW *handle, int field_width)
    around behaviour.  Returns the next register group, or NULL if the
    register window is not currently being displayed.  */
 
-static struct reggroup *
-tui_reg_next (struct reggroup *current_group, struct gdbarch *gdbarch)
+static const reggroup *
+tui_reg_next (const reggroup *current_group, struct gdbarch *gdbarch)
 {
-  struct reggroup *group = NULL;
+  const reggroup *group = NULL;
 
   if (current_group != NULL)
     {
@@ -536,10 +536,10 @@ tui_reg_next (struct reggroup *current_group, struct gdbarch *gdbarch)
    around behaviour.  Returns the previous register group, or NULL if the
    register window is not currently being displayed.  */
 
-static struct reggroup *
-tui_reg_prev (struct reggroup *current_group, struct gdbarch *gdbarch)
+static const reggroup *
+tui_reg_prev (const reggroup *current_group, struct gdbarch *gdbarch)
 {
-  struct reggroup *group = NULL;
+  const reggroup *group = NULL;
 
   if (current_group != NULL)
     {
@@ -561,7 +561,7 @@ tui_reg_command (const char *args, int from_tty)
 
   if (args != NULL)
     {
-      struct reggroup *group, *match = NULL;
+      const reggroup *group, *match = NULL;
       size_t len = strlen (args);
 
       /* Make sure the curses mode is enabled.  */
@@ -575,7 +575,7 @@ tui_reg_command (const char *args, int from_tty)
       if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible ())
 	tui_regs_layout ();
 
-      struct reggroup *current_group = TUI_DATA_WIN->get_current_group ();
+      const reggroup *current_group = TUI_DATA_WIN->get_current_group ();
       if (strncmp (args, "next", len) == 0)
 	match = tui_reg_next (current_group, gdbarch);
       else if (strncmp (args, "prev", len) == 0)
@@ -603,7 +603,7 @@ tui_reg_command (const char *args, int from_tty)
     }
   else
     {
-      struct reggroup *group;
+      const reggroup *group;
       int first;
 
       gdb_printf (_("\"tui reg\" must be followed by the name of "
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index 9192a73b177..5289d3a892d 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -23,6 +23,7 @@
 #define TUI_TUI_REGS_H
 
 #include "tui/tui-data.h"
+#include "reggroups.h"
 
 /* A data item window.  */
 
@@ -60,9 +61,9 @@ struct tui_data_window : public tui_win_info
 
   void check_register_values (struct frame_info *frame);
 
-  void show_registers (struct reggroup *group);
+  void show_registers (const reggroup *group);
 
-  struct reggroup *get_current_group () const
+  const reggroup *get_current_group () const
   {
     return m_current_group;
   }
@@ -99,7 +100,7 @@ struct tui_data_window : public tui_win_info
      display off the end of the register display.  */
   void display_reg_element_at_line (int start_element_no, int start_line_no);
 
-  void show_register_group (struct reggroup *group,
+  void show_register_group (const reggroup *group,
 			    struct frame_info *frame,
 			    bool refresh_values_only);
 
@@ -125,7 +126,7 @@ struct tui_data_window : public tui_win_info
   /* Windows that are used to display registers.  */
   std::vector<tui_data_item_window> m_regs_content;
   int m_regs_column_count = 0;
-  struct reggroup *m_current_group = nullptr;
+  const reggroup *m_current_group = nullptr;
 
   /* Width of each register's display area.  */
   int m_item_width = 0;
-- 
2.25.4


  parent reply	other threads:[~2022-03-31 21:04 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 21:04 [PATCH 00/16] Default register groups, and general related cleanup Andrew Burgess
2022-03-31 21:04 ` [PATCH 01/16] gdb: don't try to use readline before it's initialized Andrew Burgess
2022-03-31 21:04 ` [PATCH 02/16] gdb: add some const in gdb/reggroups.c Andrew Burgess
2022-03-31 21:04 ` [PATCH 03/16] gdb: make gdbarch_register_reggroup_p take a const reggroup * Andrew Burgess
2022-04-04 22:35   ` Lancelot SIX
2022-04-05  8:24     ` Andrew Burgess
2022-03-31 21:04 ` Andrew Burgess [this message]
2022-03-31 21:04 ` [PATCH 05/16] gdb: use 'const reggroup *' in python/py-registers.c file Andrew Burgess
2022-03-31 21:04 ` [PATCH 06/16] gdb: have reggroup_find return a const Andrew Burgess
2022-03-31 21:04 ` [PATCH 07/16] gdb/tui: avoid theoretical bug with 'tui reg' command Andrew Burgess
2022-03-31 21:04 ` [PATCH 08/16] gdb/tui: fix 'tui reg next/prev' command when data window is hidden Andrew Burgess
2022-03-31 21:04 ` [PATCH 09/16] gdb: always add the default register groups Andrew Burgess
2022-03-31 21:04 ` [PATCH 10/16] gdb: convert reggroups to use a std::vector Andrew Burgess
2022-03-31 21:04 ` [PATCH 11/16] gdb: remove reggroup_next and reggroup_prev Andrew Burgess
2022-04-05 23:11   ` Lancelot SIX
2022-04-06 12:06     ` Andrew Burgess
2022-03-31 21:04 ` [PATCH 12/16] gdb: more 'const' in gdb/reggroups.{c,h} Andrew Burgess
2022-03-31 21:04 ` [PATCH 13/16] gdb: make the pre-defined register groups const Andrew Burgess
2022-03-31 21:04 ` [PATCH 14/16] gdb: convert reggroup to a C++ class with constructor, etc Andrew Burgess
2022-03-31 21:04 ` [PATCH 15/16] gdb: move struct reggroup into reggroups.h header Andrew Burgess
2022-03-31 21:04 ` [PATCH 16/16] gdb: update comments throughout reggroups.{c,h} files Andrew Burgess
2022-04-06 14:28   ` Simon Marchi
2022-04-06 12:04 ` [PATCHv2 00/16] Default register groups, and general related cleanup Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 01/16] gdb: don't try to use readline before it's initialized Andrew Burgess
2022-04-06 12:57     ` Simon Marchi
2022-04-06 12:04   ` [PATCHv2 02/16] gdb: add some const in gdb/reggroups.c Andrew Burgess
2022-04-06 12:58     ` Simon Marchi
2022-04-06 12:04   ` [PATCHv2 03/16] gdb: make gdbarch_register_reggroup_p take a const reggroup * Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 04/16] gdb: switch to using 'const reggroup *' in tui-regs.{c, h} Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 05/16] gdb: use 'const reggroup *' in python/py-registers.c file Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 06/16] gdb: have reggroup_find return a const Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 07/16] gdb/tui: avoid theoretical bug with 'tui reg' command Andrew Burgess
2022-04-06 13:02     ` Simon Marchi
2022-04-06 12:04   ` [PATCHv2 08/16] gdb/tui: fix 'tui reg next/prev' command when data window is hidden Andrew Burgess
2022-04-06 13:13     ` Simon Marchi
2022-04-06 12:04   ` [PATCHv2 09/16] gdb: always add the default register groups Andrew Burgess
2022-04-06 13:22     ` Simon Marchi
2022-04-06 12:04   ` [PATCHv2 10/16] gdb: convert reggroups to use a std::vector Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 11/16] gdb: remove reggroup_next and reggroup_prev Andrew Burgess
2022-04-06 14:22     ` Simon Marchi
2022-04-06 14:23       ` Simon Marchi
2022-04-06 12:04   ` [PATCHv2 12/16] gdb: more 'const' in gdb/reggroups.{c,h} Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 13/16] gdb: make the pre-defined register groups const Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 14/16] gdb: convert reggroup to a C++ class with constructor, etc Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 15/16] gdb: move struct reggroup into reggroups.h header Andrew Burgess
2022-04-06 12:04   ` [PATCHv2 16/16] gdb: update comments throughout reggroups.{c, h} files Andrew Burgess
2022-04-06 14:34   ` [PATCHv2 00/16] Default register groups, and general related cleanup Simon Marchi
2022-04-07 15:16     ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=602a33867531cafed1e83f8182699f6bfcd34b43.1648760270.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).