gdb: Add an overloaded ui_out::text accepting a const std::string &
authorMarco Barisione <mbarisione@undo.io>
Wed, 19 May 2021 12:58:40 +0000 (13:58 +0100)
committerMarco Barisione <mbarisione@undo.io>
Wed, 19 May 2021 12:58:40 +0000 (13:58 +0100)
gdb/ChangeLog:

* ui-out.h (class ui_out): Add ui_out::text accepting a constant
reference to a std::string.  Fix all callers using
std::string::c_str.
* ui-out.c (ui_out::text): Ditto.

gdb/ada-lang.c
gdb/cli/cli-setshow.c
gdb/source.c
gdb/thread.c
gdb/ui-out.c
gdb/ui-out.h

index 2a257c2fd6dbed74aeeb53b7220048851ef7be91..1b5067662593504940a369a0127a177d50adf190 100644 (file)
@@ -11865,7 +11865,7 @@ print_mention_exception (struct breakpoint *b)
          {
            std::string info = string_printf (_("`%s' Ada exception"),
                                              c->excep_string.c_str ());
-           uiout->text (info.c_str ());
+           uiout->text (info);
          }
        else
          uiout->text (_("all Ada exceptions"));
@@ -11881,7 +11881,7 @@ print_mention_exception (struct breakpoint *b)
            std::string info
              = string_printf (_("`%s' Ada exception handlers"),
                               c->excep_string.c_str ());
-           uiout->text (info.c_str ());
+           uiout->text (info);
          }
        else
          uiout->text (_("all Ada exceptions handlers"));
index 82008ca8eed6923bae3abb34cb4d469c38045bdf..f6a594d69a2b3a23eeb10f3ba45c08cd544454b3 100644 (file)
@@ -760,7 +760,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
              std::string prefixname = list->prefix->prefixname ();
              prefixname = (!list->prefix->is_prefix () ? ""
                            : strstr (prefixname.c_str (), "show ") + 5);
-             uiout->text (prefixname.c_str ());
+             uiout->text (prefixname);
            }
          uiout->field_string ("name", list->name);
          uiout->text (":  ");
index b6dab6eb236a3db4ff181e1446597edce17526e5..54cb45f4e9d4b8321d359444e331142ea881efcb 100644 (file)
@@ -1394,7 +1394,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
          if (iter > start)
            {
              std::string text (start, iter);
-             uiout->text (text.c_str ());
+             uiout->text (text);
            }
          if (*iter == '\r')
            {
index 3cd588e0b121b68ee166990283ffcfe201a397f0..87b6cbf74fd76bfc73d1dde9b8fdcc304441566f 100644 (file)
@@ -1977,7 +1977,7 @@ print_selected_thread_frame (struct ui_out *uiout,
          uiout->text ("[Switching to thread ");
          uiout->field_string ("new-thread-id", print_thread_id (tp));
          uiout->text (" (");
-         uiout->text (target_pid_to_str (inferior_ptid).c_str ());
+         uiout->text (target_pid_to_str (inferior_ptid));
          uiout->text (")]");
        }
     }
index d67dae4f5069bf56aeafa7ed1640fdb7e8226d54..56251c9445a98fd07c92b41c34b4a5c8a13b64d1 100644 (file)
@@ -581,6 +581,12 @@ ui_out::text (const char *string)
   do_text (string);
 }
 
+void
+ui_out::text (const std::string &string)
+{
+  text (string.c_str ());
+}
+
 void
 ui_out::call_do_message (const ui_file_style &style, const char *format,
                         ...)
index f14be479fa15bfbb275d7f57d9d505b082d1a605..a06477df533051562ce588ca4a5d25216b699c98 100644 (file)
@@ -203,6 +203,7 @@ class ui_out
 
   void spaces (int numspaces);
   void text (const char *string);
+  void text (const std::string &string);
 
   /* Output a printf-style formatted string.  In addition to the usual
      printf format specs, this supports a few GDB-specific
This page took 0.040213 seconds and 4 git commands to generate.