]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use field_string in more places
authorTom Tromey <tromey@adacore.com>
Mon, 1 Jul 2019 18:08:15 +0000 (12:08 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 15 Jul 2019 15:31:18 +0000 (09:31 -0600)
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.

gdb/ChangeLog
gdb/ada-tasks.c
gdb/breakpoint.c
gdb/i386-tdep.c
gdb/infrun.c
gdb/mi/mi-interp.c
gdb/mi/mi-main.c
gdb/target.c

index c8d0c6acea8e7628a66f7b1302fe1f7cd9cc2cde..ae3303986814674ad84e6de1efe134fc7e3e1cf9 100644 (file)
@@ -1,3 +1,14 @@
+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.
index 9c07f0ca226fc8924677dc5db77b7fc13af0a804..71800d1167b9004ff27088efca47ddd29a4c49e1 100644 (file)
@@ -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");
     }
index 87ec7b81e329fcffef87d49b64a53421a7a905fa..b345379d9a745a8086089f4c1dd92a8c29888af7 100644 (file)
@@ -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 ("\"");
        }
 
index 3b8dac73c6e87df5f3d81e0e341beeac81fcf989..aac9baa0aacebc95925b99eab932a1ddc873df7b 100644 (file)
@@ -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]);
index c60ed306bd1dab7f3a16b76d5ce50be0b77fca8e..2dc418923655dd3fd8a1e3b9f5a86189038bc5d6 100644 (file)
@@ -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 ("\"");
        }
     }
index ab1f9138876ad00a1d487ea7f4d486e7543c9a91..03ab169fdf51283e4b54fa3d3df2b56ea0be4af0 100644 (file)
@@ -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.  */
index da8c81f9e2265a4c1edc56c32d14e8bad5199d60..26ffeb0751cf3b48d7d751fe3e450ac7472702d3 100644 (file)
@@ -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 ());
index b3cfc53cca1a90d01a07f212985eed9787f3274e..a19a9bce133a3e28f2689146f86e7354fa7d95a4 100644 (file)
@@ -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");
         }
     }