public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use field_string in more places
@ 2019-07-15 15:36 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-07-15 15:36 UTC (permalink / raw)
  To: gdb-cvs

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

commit 33eca68072e73d984fc139dde45b8140b94757cb
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Jul 1 12:08:15 2019 -0600

    Use field_string in more places
    
    This replaces uses of field_fmt with a "%s" format string to use
    field_string instead.  Also, one use of "%9lx" is replaced with a call
    to phex_nz; the '9' is dropped as it is implicit in the field width.
    
    2019-07-15  Tom Tromey  <tromey@adacore.com>
    
    	* mi/mi-main.c (list_available_thread_groups): Use field_string.
    	* mi/mi-interp.c (mi_memory_changed): Use field_string.
    	* target.c (flash_erase_command): Use field_string.
    	* infrun.c (print_signal_received_reason): Use field_string.
    	* i386-tdep.c (i386_mpx_print_bounds): Use field_string.
    	* breakpoint.c (maybe_print_thread_hit_breakpoint): Use
    	field_string.
    	* ada-tasks.c (print_ada_task_info): Use field_string.

Diff:
---
 gdb/ChangeLog      | 11 +++++++++++
 gdb/ada-tasks.c    | 10 +++++-----
 gdb/breakpoint.c   |  4 ++--
 gdb/i386-tdep.c    |  2 +-
 gdb/infrun.c       |  4 ++--
 gdb/mi/mi-interp.c |  2 +-
 gdb/mi/mi-main.c   |  2 +-
 gdb/target.c       |  2 +-
 8 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c8d0c6a..ae33039 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,16 @@
 2019-07-15  Tom Tromey  <tromey@adacore.com>
 
+	* mi/mi-main.c (list_available_thread_groups): Use field_string.
+	* mi/mi-interp.c (mi_memory_changed): Use field_string.
+	* target.c (flash_erase_command): Use field_string.
+	* infrun.c (print_signal_received_reason): Use field_string.
+	* i386-tdep.c (i386_mpx_print_bounds): Use field_string.
+	* breakpoint.c (maybe_print_thread_hit_breakpoint): Use
+	field_string.
+	* ada-tasks.c (print_ada_task_info): Use field_string.
+
+2019-07-15  Tom Tromey  <tromey@adacore.com>
+
 	* target.c (flash_erase_command): Use field_core_addr.
 	* symfile.c (generic_load): Use field_core_addr.
 	* sparc64-linux-tdep.c (sparc64_linux_handle_segmentation_fault):
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 9c07f0c..71800d1 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1089,7 +1089,8 @@ print_ada_task_info (struct ui_out *uiout,
       uiout->field_int ("id", taskno);
 
       /* Print the Task ID.  */
-      uiout->field_fmt ("task-id", "%9lx", (long) task_info->task_id);
+      uiout->field_string ("task-id", phex_nz (task_info->task_id,
+					       sizeof (CORE_ADDR)));
 
       /* Print the associated Thread ID.  */
       if (uiout->is_mi_like_p ())
@@ -1129,10 +1130,9 @@ print_ada_task_info (struct ui_out *uiout,
 	uiout->field_string ("state", task_states[task_info->state]);
 
       /* Finally, print the task name.  */
-      uiout->field_fmt ("name",
-			"%s",
-			task_info->name[0] != '\0' ? task_info->name
-						   : _("<no name>"));
+      uiout->field_string ("name",
+			   task_info->name[0] != '\0' ? task_info->name
+			   : _("<no name>"));
 
       uiout->text ("\n");
     }
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 87ec7b8..b345379 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -4483,13 +4483,13 @@ maybe_print_thread_hit_breakpoint (struct ui_out *uiout)
       struct thread_info *thr = inferior_thread ();
 
       uiout->text ("Thread ");
-      uiout->field_fmt ("thread-id", "%s", print_thread_id (thr));
+      uiout->field_string ("thread-id", print_thread_id (thr));
 
       name = thr->name != NULL ? thr->name : target_thread_name (thr);
       if (name != NULL)
 	{
 	  uiout->text (" \"");
-	  uiout->field_fmt ("name", "%s", name);
+	  uiout->field_string ("name", name);
 	  uiout->text ("\"");
 	}
 
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 3b8dac7..aac9baa 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8914,7 +8914,7 @@ i386_mpx_print_bounds (const CORE_ADDR bt_entry[4])
 
       size = (size > -1 ? size + 1 : size);
       uiout->text (", size = ");
-      uiout->field_fmt ("size", "%s", plongest (size));
+      uiout->field_string ("size", plongest (size));
 
       uiout->text (", metadata = ");
       uiout->field_core_addr ("metadata", gdbarch, bt_entry[3]);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index c60ed30..2dc4189 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7690,13 +7690,13 @@ print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal)
       const char *name;
 
       uiout->text ("\nThread ");
-      uiout->field_fmt ("thread-id", "%s", print_thread_id (thr));
+      uiout->field_string ("thread-id", print_thread_id (thr));
 
       name = thr->name != NULL ? thr->name : target_thread_name (thr);
       if (name != NULL)
 	{
 	  uiout->text (" \"");
-	  uiout->field_fmt ("name", "%s", name);
+	  uiout->field_string ("name", name);
 	  uiout->text ("\"");
 	}
     }
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index ab1f913..03ab169 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -1172,7 +1172,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
 
       mi_uiout->field_fmt ("thread-group", "i%d", inferior->num);
       mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr);
-      mi_uiout->field_fmt ("len", "%s", hex_string (len));
+      mi_uiout->field_string ("len", hex_string (len));
 
       /* Append 'type=code' into notification if MEMADDR falls in the range of
 	 sections contain code.  */
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index da8c81f..26ffeb07 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -746,7 +746,7 @@ list_available_thread_groups (const std::set<int> &ids, int recurse)
 
       ui_out_emit_tuple tuple_emitter (uiout, NULL);
 
-      uiout->field_fmt ("id", "%s", pid->c_str ());
+      uiout->field_string ("id", pid->c_str ());
       uiout->field_string ("type", "process");
       if (cmd)
 	uiout->field_string ("description", cmd->c_str ());
diff --git a/gdb/target.c b/gdb/target.c
index b3cfc53..a19a9bc 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3795,7 +3795,7 @@ flash_erase_command (const char *cmd, int from_tty)
           current_uiout->message (_("Erasing flash memory region at address "));
           current_uiout->field_core_addr ("address", gdbarch, m.lo);
           current_uiout->message (", size = ");
-          current_uiout->field_fmt ("size", "%s", hex_string (m.hi - m.lo));
+          current_uiout->field_string ("size", hex_string (m.hi - m.lo));
           current_uiout->message ("\n");
         }
     }


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

only message in thread, other threads:[~2019-07-15 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 15:36 [binutils-gdb] Use field_string in more places 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).