aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-02 11:36:44 -0700
committerTom Tromey <tom@tromey.com>2022-03-29 12:46:24 -0600
commit0426ad513f93bb1c5805988e60d6f87fbe738860 (patch)
tree6ad0f94f9b2a907623df38db9dd7727fe80f5d51 /gdb/mi
parent19a7b8ab871b92dee32a0ebffe274388d3426564 (diff)
downloadgdb-0426ad513f93bb1c5805988e60d6f87fbe738860.zip
gdb-0426ad513f93bb1c5805988e60d6f87fbe738860.tar.gz
gdb-0426ad513f93bb1c5805988e60d6f87fbe738860.tar.bz2
Unify gdb puts functions
Now that filtered and unfiltered output can be treated identically, we can unify the puts family of functions. This is done under the name "gdb_puts". Most of this patch was written by script.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-console.c2
-rw-r--r--gdb/mi/mi-interp.c8
-rw-r--r--gdb/mi/mi-main.c42
-rw-r--r--gdb/mi/mi-out.c4
4 files changed, 28 insertions, 28 deletions
diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c
index 9db87fe..5043e9b 100644
--- a/gdb/mi/mi-console.c
+++ b/gdb/mi/mi-console.c
@@ -76,7 +76,7 @@ mi_console_file::flush ()
size_t length_buf = str.size ();
const char *buf = str.data ();
- fputs_unfiltered (m_prefix, m_raw);
+ gdb_puts (m_prefix, m_raw);
if (m_quote)
{
fputc_unfiltered (m_quote, m_raw);
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 2c47024..4da4518 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -98,7 +98,7 @@ display_mi_prompt (struct mi_interp *mi)
{
struct ui *ui = current_ui;
- fputs_unfiltered ("(gdb) \n", mi->raw_stdout);
+ gdb_puts ("(gdb) \n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
ui->prompt_state = PROMPTED;
}
@@ -674,11 +674,11 @@ mi_on_normal_stop_1 (struct bpstat *bs, int print_frame)
mi_uiout->field_signed ("core", core);
}
- fputs_unfiltered ("*stopped", mi->raw_stdout);
+ gdb_puts ("*stopped", mi->raw_stdout);
mi_out_put (mi_uiout, mi->raw_stdout);
mi_out_rewind (mi_uiout);
mi_print_timing_maybe (mi->raw_stdout);
- fputs_unfiltered ("\n", mi->raw_stdout);
+ gdb_puts ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
@@ -1018,7 +1018,7 @@ mi_on_resume_1 (struct mi_interp *mi,
even if it cannot actually accept any input. This will be
surely removed for MI3, and may be removed even earlier. */
if (current_ui->prompt_state == PROMPT_BLOCKED)
- fputs_unfiltered ("(gdb) \n", mi->raw_stdout);
+ gdb_puts ("(gdb) \n", mi->raw_stdout);
}
gdb_flush (mi->raw_stdout);
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 91eb8d1..ff46af5 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -153,8 +153,8 @@ mi_cmd_gdb_exit (const char *command, char **argv, int argc)
/* We have to print everything right here because we never return. */
if (current_token)
- fputs_unfiltered (current_token, mi->raw_stdout);
- fputs_unfiltered ("^exit\n", mi->raw_stdout);
+ gdb_puts (current_token, mi->raw_stdout);
+ gdb_puts ("^exit\n", mi->raw_stdout);
mi_out_put (current_uiout, mi->raw_stdout);
gdb_flush (mi->raw_stdout);
/* FIXME: The function called is not yet a formal libgdb function. */
@@ -1830,15 +1830,15 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
uiout will most likely crash in the mi_out_* routines. */
if (!running_result_record_printed)
{
- fputs_unfiltered (context->token, mi->raw_stdout);
+ gdb_puts (context->token, mi->raw_stdout);
/* There's no particularly good reason why target-connect results
in not ^done. Should kill ^connected for MI3. */
- fputs_unfiltered (strcmp (context->command, "target-select") == 0
- ? "^connected" : "^done", mi->raw_stdout);
+ gdb_puts (strcmp (context->command, "target-select") == 0
+ ? "^connected" : "^done", mi->raw_stdout);
mi_out_put (uiout, mi->raw_stdout);
mi_out_rewind (uiout);
mi_print_timing_maybe (mi->raw_stdout);
- fputs_unfiltered ("\n", mi->raw_stdout);
+ gdb_puts ("\n", mi->raw_stdout);
}
else
/* The command does not want anything to be printed. In that
@@ -1869,12 +1869,12 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
{
if (!running_result_record_printed)
{
- fputs_unfiltered (context->token, mi->raw_stdout);
- fputs_unfiltered ("^done", mi->raw_stdout);
+ gdb_puts (context->token, mi->raw_stdout);
+ gdb_puts ("^done", mi->raw_stdout);
mi_out_put (uiout, mi->raw_stdout);
mi_out_rewind (uiout);
mi_print_timing_maybe (mi->raw_stdout);
- fputs_unfiltered ("\n", mi->raw_stdout);
+ gdb_puts ("\n", mi->raw_stdout);
}
else
mi_out_rewind (uiout);
@@ -1891,22 +1891,22 @@ mi_print_exception (const char *token, const struct gdb_exception &exception)
{
struct mi_interp *mi = (struct mi_interp *) current_interpreter ();
- fputs_unfiltered (token, mi->raw_stdout);
- fputs_unfiltered ("^error,msg=\"", mi->raw_stdout);
+ gdb_puts (token, mi->raw_stdout);
+ gdb_puts ("^error,msg=\"", mi->raw_stdout);
if (exception.message == NULL)
- fputs_unfiltered ("unknown error", mi->raw_stdout);
+ gdb_puts ("unknown error", mi->raw_stdout);
else
mi->raw_stdout->putstr (exception.what (), '"');
- fputs_unfiltered ("\"", mi->raw_stdout);
+ gdb_puts ("\"", mi->raw_stdout);
switch (exception.error)
{
case UNDEFINED_COMMAND_ERROR:
- fputs_unfiltered (",code=\"undefined-command\"", mi->raw_stdout);
+ gdb_puts (",code=\"undefined-command\"", mi->raw_stdout);
break;
}
- fputs_unfiltered ("\n", mi->raw_stdout);
+ gdb_puts ("\n", mi->raw_stdout);
}
void
@@ -2187,8 +2187,8 @@ mi_load_progress (const char *section_name,
previous_sect_name = xstrdup (section_name);
if (current_token)
- fputs_unfiltered (current_token, mi->raw_stdout);
- fputs_unfiltered ("+download", mi->raw_stdout);
+ gdb_puts (current_token, mi->raw_stdout);
+ gdb_puts ("+download", mi->raw_stdout);
{
ui_out_emit_tuple tuple_emitter (uiout.get (), NULL);
uiout->field_string ("section", section_name);
@@ -2196,7 +2196,7 @@ mi_load_progress (const char *section_name,
uiout->field_signed ("total-size", grand_total);
}
mi_out_put (uiout.get (), mi->raw_stdout);
- fputs_unfiltered ("\n", mi->raw_stdout);
+ gdb_puts ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
@@ -2205,8 +2205,8 @@ mi_load_progress (const char *section_name,
{
last_update = time_now;
if (current_token)
- fputs_unfiltered (current_token, mi->raw_stdout);
- fputs_unfiltered ("+download", mi->raw_stdout);
+ gdb_puts (current_token, mi->raw_stdout);
+ gdb_puts ("+download", mi->raw_stdout);
{
ui_out_emit_tuple tuple_emitter (uiout.get (), NULL);
uiout->field_string ("section", section_name);
@@ -2216,7 +2216,7 @@ mi_load_progress (const char *section_name,
uiout->field_signed ("total-size", grand_total);
}
mi_out_put (uiout.get (), mi->raw_stdout);
- fputs_unfiltered ("\n", mi->raw_stdout);
+ gdb_puts ("\n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
}
}
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 5145bea..ff93cb3 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -150,9 +150,9 @@ mi_ui_out::do_field_fmt (int fldno, int width, ui_align align,
if (fldname)
fprintf_unfiltered (stream, "%s=\"", fldname);
else
- fputs_unfiltered ("\"", stream);
+ gdb_puts ("\"", stream);
gdb_vprintf (stream, format, args);
- fputs_unfiltered ("\"", stream);
+ gdb_puts ("\"", stream);
}
void