public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Minor rearrangement in tui-regs.c
@ 2019-08-20 22:49 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-08-20 22:49 UTC (permalink / raw)
  To: gdb-cvs

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

commit 1a4f81dd7e06f54f4b84f276447eb167f7529b09
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Jul 13 15:55:02 2019 -0600

    Minor rearrangement in tui-regs.c
    
    This moves a couple of functions earlier in tui-regs.c.  Previously
    they were in the "command" section of the file, but really they belong
    in the "window implementation" section.
    
    gdb/ChangeLog
    2019-08-20  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui-regs.c (tui_register_format, tui_get_register): Move
    	earlier.

Diff:
---
 gdb/ChangeLog      |   5 +++
 gdb/tui/tui-regs.c | 101 +++++++++++++++++++++++++----------------------------
 2 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ce64e7a..346cc35 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-08-20  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-regs.c (tui_register_format, tui_get_register): Move
+	earlier.
+
+2019-08-20  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-regs.c (tui_reg_command): Remove NULL check.
 
 2019-08-20  Tom Tromey  <tom@tromey.com>
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index b3c7ce6..9ea6e72 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -49,10 +49,55 @@ static void tui_show_register_group (tui_data_window *win_info,
 				     struct frame_info *frame,
 				     int refresh_values_only);
 
-static void tui_get_register (struct frame_info *frame,
-			      struct tui_data_item_window *data,
-			      int regnum, bool *changedp);
+/* Get the register from the frame and return a printable
+   representation of it.  */
+
+static char *
+tui_register_format (struct frame_info *frame, int regnum)
+{
+  struct gdbarch *gdbarch = get_frame_arch (frame);
 
+  string_file stream;
+
+  scoped_restore save_pagination
+    = make_scoped_restore (&pagination_enabled, 0);
+  scoped_restore save_stdout
+    = make_scoped_restore (&gdb_stdout, &stream);
+
+  gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1);
+
+  /* Remove the possible \n.  */
+  std::string &str = stream.string ();
+  if (!str.empty () && str.back () == '\n')
+    str.resize (str.size () - 1);
+
+  /* Expand tabs into spaces, since ncurses on MS-Windows doesn't.  */
+  return tui_expand_tabs (str.c_str (), 0);
+}
+
+/* Get the register value from the given frame and format it for the
+   display.  When changep is set, check if the new register value has
+   changed with respect to the previous call.  */
+static void
+tui_get_register (struct frame_info *frame,
+                  struct tui_data_item_window *data, 
+		  int regnum, bool *changedp)
+{
+  if (changedp)
+    *changedp = false;
+  if (target_has_registers)
+    {
+      char *prev_content = data->content;
+
+      data->content = tui_register_format (frame, regnum);
+
+      if (changedp != NULL
+	  && strcmp (prev_content, data->content) != 0)
+	*changedp = true;
+
+      xfree (prev_content);
+    }
+}
 
 /* See tui-regs.h.  */
 
@@ -739,56 +784,6 @@ tui_reggroup_completer (struct cmd_list_element *ignore,
     }
 }
 
-/* Get the register from the frame and return a printable
-   representation of it.  */
-
-static char *
-tui_register_format (struct frame_info *frame, int regnum)
-{
-  struct gdbarch *gdbarch = get_frame_arch (frame);
-
-  string_file stream;
-
-  scoped_restore save_pagination
-    = make_scoped_restore (&pagination_enabled, 0);
-  scoped_restore save_stdout
-    = make_scoped_restore (&gdb_stdout, &stream);
-
-  gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1);
-
-  /* Remove the possible \n.  */
-  std::string &str = stream.string ();
-  if (!str.empty () && str.back () == '\n')
-    str.resize (str.size () - 1);
-
-  /* Expand tabs into spaces, since ncurses on MS-Windows doesn't.  */
-  return tui_expand_tabs (str.c_str (), 0);
-}
-
-/* Get the register value from the given frame and format it for the
-   display.  When changep is set, check if the new register value has
-   changed with respect to the previous call.  */
-static void
-tui_get_register (struct frame_info *frame,
-                  struct tui_data_item_window *data, 
-		  int regnum, bool *changedp)
-{
-  if (changedp)
-    *changedp = false;
-  if (target_has_registers)
-    {
-      char *prev_content = data->content;
-
-      data->content = tui_register_format (frame, regnum);
-
-      if (changedp != NULL
-	  && strcmp (prev_content, data->content) != 0)
-	*changedp = true;
-
-      xfree (prev_content);
-    }
-}
-
 void
 _initialize_tui_regs (void)
 {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-20 22:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 22:49 [binutils-gdb] Minor rearrangement in tui-regs.c Tom Tromey

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).