aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/break-catch-sig.c2
-rw-r--r--gdb/break-catch-throw.c2
-rw-r--r--gdb/cli/cli-setshow.c2
-rw-r--r--gdb/disasm.c2
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/inferior.c2
-rw-r--r--gdb/linux-thread-db.c2
-rw-r--r--gdb/mi/mi-cmd-var.c22
-rw-r--r--gdb/mi/mi-main.c14
-rw-r--r--gdb/osdata.c3
-rw-r--r--gdb/probe.c5
-rw-r--r--gdb/target-connection.c2
-rw-r--r--gdb/thread.c3
-rw-r--r--gdb/tracepoint.c4
-rw-r--r--gdb/ui-out.c5
-rw-r--r--gdb/ui-out.h3
16 files changed, 37 insertions, 38 deletions
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index 31a622c..9530dea 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -237,7 +237,7 @@ signal_catchpoint_print_one (struct breakpoint *b,
text += name;
}
- uiout->field_string ("what", text.c_str ());
+ uiout->field_string ("what", text);
}
else
uiout->field_string ("what",
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index c8d5ccd..7fc6953 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -300,7 +300,7 @@ print_one_detail_exception_catchpoint (const struct breakpoint *b,
if (!cp->exception_rx.empty ())
{
uiout->text (_("\tmatching: "));
- uiout->field_string ("regexp", cp->exception_rx.c_str ());
+ uiout->field_string ("regexp", cp->exception_rx);
uiout->text ("\n");
}
}
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index f6a594d..5fd5fd1 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -714,7 +714,7 @@ do_show_command (const char *arg, int from_tty, struct cmd_list_element *c)
versions of code to print the value out. */
if (uiout->is_mi_like_p ())
- uiout->field_string ("value", val.c_str ());
+ uiout->field_string ("value", val);
else
{
if (c->show_value_func != NULL)
diff --git a/gdb/disasm.c b/gdb/disasm.c
index eb69e89..70c5422 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -244,7 +244,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
the future. */
m_uiout->text (" <");
if (!omit_fname)
- m_uiout->field_string ("func-name", name.c_str (),
+ m_uiout->field_string ("func-name", name,
function_name_style.style ());
/* For negative offsets, avoid displaying them as +-N; the sign of
the offset takes the place of the "+" here. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index a22d815..4351409 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1539,7 +1539,7 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
{
std::string type_name = type_to_string (rv->type);
uiout->text ("Value returned has type: ");
- uiout->field_string ("return-type", type_name.c_str ());
+ uiout->field_string ("return-type", type_name);
uiout->text (".");
uiout->text (" Cannot determine contents\n");
}
diff --git a/gdb/inferior.c b/gdb/inferior.c
index a8779c3..059839e 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -529,7 +529,7 @@ print_inferior (struct ui_out *uiout, const char *requested_inferiors)
uiout->field_string ("target-id", inferior_pid_to_str (inf->pid));
std::string conn = uiout_field_connection (inf->process_target ());
- uiout->field_string ("connection-id", conn.c_str ());
+ uiout->field_string ("connection-id", conn);
if (inf->pspace->exec_filename != nullptr)
uiout->field_string ("exec", inf->pspace->exec_filename.get ());
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 2c75cd6..9925b02 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1935,7 +1935,7 @@ info_auto_load_libthread_db (const char *args, int from_tty)
i++;
}
- uiout->field_string ("pids", pids.c_str ());
+ uiout->field_string ("pids", pids);
uiout->text ("\n");
}
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index e54a5e0..61bc169 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -56,7 +56,7 @@ print_varobj (struct varobj *var, enum print_values print_values,
{
std::string exp = varobj_get_expression (var);
- uiout->field_string ("exp", exp.c_str ());
+ uiout->field_string ("exp", exp);
}
uiout->field_signed ("numchild", varobj_get_num_children (var));
@@ -64,12 +64,12 @@ print_varobj (struct varobj *var, enum print_values print_values,
{
std::string val = varobj_get_value (var);
- uiout->field_string ("value", val.c_str ());
+ uiout->field_string ("value", val);
}
std::string type = varobj_get_type (var);
if (!type.empty ())
- uiout->field_string ("type", type.c_str ());
+ uiout->field_string ("type", type);
thread_id = varobj_get_thread_id (var);
if (thread_id > 0)
@@ -236,7 +236,7 @@ mi_cmd_var_set_format (const char *command, char **argv, int argc)
/* Report the value in the new format. */
std::string val = varobj_get_value (var);
- uiout->field_string ("value", val.c_str ());
+ uiout->field_string ("value", val);
}
void
@@ -423,7 +423,7 @@ mi_cmd_var_info_type (const char *command, char **argv, int argc)
var = varobj_get_handle (argv[0]);
std::string type_name = varobj_get_type (var);
- uiout->field_string ("type", type_name.c_str ());
+ uiout->field_string ("type", type_name);
}
void
@@ -461,7 +461,7 @@ mi_cmd_var_info_expression (const char *command, char **argv, int argc)
uiout->field_string ("lang", lang->natural_name ());
std::string exp = varobj_get_expression (var);
- uiout->field_string ("exp", exp.c_str ());
+ uiout->field_string ("exp", exp);
}
void
@@ -545,13 +545,13 @@ mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
{
std::string val = varobj_get_formatted_value (var, format);
- uiout->field_string ("value", val.c_str ());
+ uiout->field_string ("value", val);
}
else
{
std::string val = varobj_get_value (var);
- uiout->field_string ("value", val.c_str ());
+ uiout->field_string ("value", val);
}
}
@@ -582,7 +582,7 @@ mi_cmd_var_assign (const char *command, char **argv, int argc)
"expression to variable object"));
std::string val = varobj_get_value (var);
- uiout->field_string ("value", val.c_str ());
+ uiout->field_string ("value", val);
}
/* Helper for mi_cmd_var_update - update each VAR. */
@@ -692,7 +692,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
{
std::string val = varobj_get_value (r.varobj);
- uiout->field_string ("value", val.c_str ());
+ uiout->field_string ("value", val);
}
uiout->field_string ("in_scope", "true");
break;
@@ -716,7 +716,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
{
std::string type_name = varobj_get_type (r.varobj);
- uiout->field_string ("new_type", type_name.c_str ());
+ uiout->field_string ("new_type", type_name);
}
if (r.type_changed || r.children_changed)
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 582a554..9d205f0 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -738,12 +738,12 @@ list_available_thread_groups (const std::set<int> &ids, int recurse)
ui_out_emit_tuple tuple_emitter (uiout, NULL);
- uiout->field_string ("id", pid->c_str ());
+ uiout->field_string ("id", *pid);
uiout->field_string ("type", "process");
if (cmd)
- uiout->field_string ("description", cmd->c_str ());
+ uiout->field_string ("description", *cmd);
if (user)
- uiout->field_string ("user", user->c_str ());
+ uiout->field_string ("user", *user);
if (cores)
output_cores (uiout, "cores", cores->c_str ());
@@ -762,9 +762,9 @@ list_available_thread_groups (const std::set<int> &ids, int recurse)
const std::string *tid = get_osdata_column (child, "tid");
const std::string *tcore = get_osdata_column (child, "core");
- uiout->field_string ("id", tid->c_str ());
+ uiout->field_string ("id", *tid);
if (tcore)
- uiout->field_string ("core", tcore->c_str ());
+ uiout->field_string ("core", *tcore);
}
}
}
@@ -1470,7 +1470,7 @@ mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc)
std::string data = bin2hex (read_result.data.get (),
(read_result.end - read_result.begin)
* unit_size);
- uiout->field_string ("contents", data.c_str ());
+ uiout->field_string ("contents", data);
}
}
@@ -2670,7 +2670,7 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
if (target_read_memory (r.start, data.data (), r.length) == 0)
{
std::string data_str = bin2hex (data.data (), r.length);
- uiout->field_string ("contents", data_str.c_str ());
+ uiout->field_string ("contents", data_str);
}
else
uiout->field_skip ("contents");
diff --git a/gdb/osdata.c b/gdb/osdata.c
index 2ff0f52..bc621cb 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -273,8 +273,7 @@ info_osdata (const char *type)
continue;
snprintf (col_name, 32, "col%d", ix_cols);
- uiout->field_string (col_name,
- item.columns[ix_cols].value.c_str ());
+ uiout->field_string (col_name, item.columns[ix_cols].value);
}
}
diff --git a/gdb/probe.c b/gdb/probe.c
index 9eccf82..d9a06e5 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -571,9 +571,8 @@ info_probes_for_spops (const char *arg, int from_tty,
ui_out_emit_tuple tuple_emitter (current_uiout, "probe");
current_uiout->field_string ("type", probe_type);
- current_uiout->field_string ("provider",
- probe.prob->get_provider ().c_str ());
- current_uiout->field_string ("name", probe.prob->get_name ().c_str ());
+ current_uiout->field_string ("provider", probe.prob->get_provider ());
+ current_uiout->field_string ("name", probe.prob->get_name ());
current_uiout->field_core_addr ("addr", probe.prob->get_gdbarch (),
probe.prob->get_relocated_address
(probe.objfile));
diff --git a/gdb/target-connection.c b/gdb/target-connection.c
index 2f8e01d..a649423 100644
--- a/gdb/target-connection.c
+++ b/gdb/target-connection.c
@@ -133,7 +133,7 @@ print_connection (struct ui_out *uiout, const char *requested_connections)
uiout->field_signed ("number", t->connection_number);
- uiout->field_string ("what", make_target_connection_string (t).c_str ());
+ uiout->field_string ("what", make_target_connection_string (t));
uiout->field_string ("description", t->longname ());
diff --git a/gdb/thread.c b/gdb/thread.c
index 87b6cbf..4005101 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1184,8 +1184,7 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
}
else
{
- uiout->field_string ("target-id",
- thread_target_id_str (tp).c_str ());
+ uiout->field_string ("target-id", thread_target_id_str (tp));
}
if (tp->state == THREAD_RUNNING)
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 7f6d3e4..da0e976 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3678,7 +3678,7 @@ print_one_static_tracepoint_marker (int count,
identifier! */
uiout->field_signed ("count", count);
- uiout->field_string ("marker-id", marker.str_id.c_str ());
+ uiout->field_string ("marker-id", marker.str_id);
uiout->field_fmt ("enabled", "%c",
!tracepoints.empty () ? 'y' : 'n');
@@ -3735,7 +3735,7 @@ print_one_static_tracepoint_marker (int count,
uiout->text ("\n");
uiout->text (extra_field_indent);
uiout->text (_("Data: \""));
- uiout->field_string ("extra-data", marker.extra.c_str ());
+ uiout->field_string ("extra-data", marker.extra);
uiout->text ("\"\n");
if (!tracepoints.empty ())
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 56251c9..c091af6 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -528,9 +528,10 @@ ui_out::field_string (const char *fldname, const char *string,
}
void
-ui_out::field_string (const char *fldname, const std::string &string)
+ui_out::field_string (const char *fldname, const std::string &string,
+ const ui_file_style &style)
{
- field_string (fldname, string.c_str ());
+ field_string (fldname, string.c_str (), style);
}
/* VARARGS */
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index a06477d..46dfe28 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -191,7 +191,8 @@ class ui_out
CORE_ADDR address);
void field_string (const char *fldname, const char *string,
const ui_file_style &style = ui_file_style ());
- void field_string (const char *fldname, const std::string &string);
+ void field_string (const char *fldname, const std::string &string,
+ const ui_file_style &style = ui_file_style ());
void field_stream (const char *fldname, string_file &stream,
const ui_file_style &style = ui_file_style ());
void field_skip (const char *fldname);