diff options
author | Tom Tromey <tom@tromey.com> | 2022-01-02 11:46:15 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-03-29 12:46:24 -0600 |
commit | 6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch) | |
tree | 641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/mi | |
parent | a11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff) | |
download | gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.zip gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.gz gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.bz2 |
Unify gdb printf functions
Now that filtered and unfiltered output can be treated identically, we
can unify the printf family of functions. This is done under the name
"gdb_printf". Most of this patch was written by script.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-var.c | 6 | ||||
-rw-r--r-- | gdb/mi/mi-interp.c | 130 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 20 | ||||
-rw-r--r-- | gdb/mi/mi-out.c | 10 |
4 files changed, 83 insertions, 83 deletions
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index c660fd5..3db09cf 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -125,9 +125,9 @@ mi_cmd_var_create (const char *command, char **argv, int argc) } if (varobjdebug) - fprintf_unfiltered (gdb_stdlog, - "Name=\"%s\", Frame=\"%s\" (%s), Expression=\"%s\"\n", - name, frame, hex_string (frameaddr), expr); + gdb_printf (gdb_stdlog, + "Name=\"%s\", Frame=\"%s\" (%s), Expression=\"%s\"\n", + name, frame, hex_string (frameaddr), expr); var = varobj_create (name, expr, frameaddr, var_type); diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 4da4518..8d6e033 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -159,9 +159,9 @@ mi_interp::init (bool top_level) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "thread-group-added,id=\"i%d\"", - inf->num); + gdb_printf (mi->event_channel, + "thread-group-added,id=\"i%d\"", + inf->num); gdb_flush (mi->event_channel); } @@ -348,9 +348,9 @@ mi_new_thread (struct thread_info *t) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "thread-created,id=\"%d\",group-id=\"i%d\"", - t->global_num, t->inf->num); + gdb_printf (mi->event_channel, + "thread-created,id=\"%d\",group-id=\"i%d\"", + t->global_num, t->inf->num); gdb_flush (mi->event_channel); } } @@ -370,9 +370,9 @@ mi_thread_exit (struct thread_info *t, int silent) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "thread-exited,id=\"%d\",group-id=\"i%d\"", - t->global_num, t->inf->num); + gdb_printf (mi->event_channel, + "thread-exited,id=\"%d\",group-id=\"i%d\"", + t->global_num, t->inf->num); gdb_flush (mi->event_channel); } } @@ -397,24 +397,24 @@ mi_record_changed (struct inferior *inferior, int started, const char *method, { if (format != NULL) { - fprintf_unfiltered (mi->event_channel, - "record-started,thread-group=\"i%d\"," - "method=\"%s\",format=\"%s\"", - inferior->num, method, format); + gdb_printf (mi->event_channel, + "record-started,thread-group=\"i%d\"," + "method=\"%s\",format=\"%s\"", + inferior->num, method, format); } else { - fprintf_unfiltered (mi->event_channel, - "record-started,thread-group=\"i%d\"," - "method=\"%s\"", - inferior->num, method); + gdb_printf (mi->event_channel, + "record-started,thread-group=\"i%d\"," + "method=\"%s\"", + inferior->num, method); } } else { - fprintf_unfiltered (mi->event_channel, - "record-stopped,thread-group=\"i%d\"", - inferior->num); + gdb_printf (mi->event_channel, + "record-stopped,thread-group=\"i%d\"", + inferior->num); } gdb_flush (mi->event_channel); @@ -442,9 +442,9 @@ mi_inferior_added (struct inferior *inf) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "thread-group-added,id=\"i%d\"", - inf->num); + gdb_printf (mi->event_channel, + "thread-group-added,id=\"i%d\"", + inf->num); gdb_flush (mi->event_channel); } } @@ -462,9 +462,9 @@ mi_inferior_appeared (struct inferior *inf) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "thread-group-started,id=\"i%d\",pid=\"%d\"", - inf->num, inf->pid); + gdb_printf (mi->event_channel, + "thread-group-started,id=\"i%d\",pid=\"%d\"", + inf->num, inf->pid); gdb_flush (mi->event_channel); } } @@ -483,12 +483,12 @@ mi_inferior_exit (struct inferior *inf) target_terminal::ours_for_output (); if (inf->has_exit_code) - fprintf_unfiltered (mi->event_channel, - "thread-group-exited,id=\"i%d\",exit-code=\"%s\"", - inf->num, int_string (inf->exit_code, 8, 0, 0, 1)); + gdb_printf (mi->event_channel, + "thread-group-exited,id=\"i%d\",exit-code=\"%s\"", + inf->num, int_string (inf->exit_code, 8, 0, 0, 1)); else - fprintf_unfiltered (mi->event_channel, - "thread-group-exited,id=\"i%d\"", inf->num); + gdb_printf (mi->event_channel, + "thread-group-exited,id=\"i%d\"", inf->num); gdb_flush (mi->event_channel); } @@ -507,9 +507,9 @@ mi_inferior_removed (struct inferior *inf) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "thread-group-removed,id=\"i%d\"", - inf->num); + gdb_printf (mi->event_channel, + "thread-group-removed,id=\"i%d\"", + inf->num); gdb_flush (mi->event_channel); } } @@ -740,11 +740,11 @@ mi_traceframe_changed (int tfnum, int tpnum) target_terminal::ours_for_output (); if (tfnum >= 0) - fprintf_unfiltered (mi->event_channel, "traceframe-changed," - "num=\"%d\",tracepoint=\"%d\"", - tfnum, tpnum); + gdb_printf (mi->event_channel, "traceframe-changed," + "num=\"%d\",tracepoint=\"%d\"", + tfnum, tpnum); else - fprintf_unfiltered (mi->event_channel, "traceframe-changed,end"); + gdb_printf (mi->event_channel, "traceframe-changed,end"); gdb_flush (mi->event_channel); } @@ -765,9 +765,9 @@ mi_tsv_created (const struct trace_state_variable *tsv) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, "tsv-created," - "name=\"%s\",initial=\"%s\"", - tsv->name.c_str (), plongest (tsv->initial_value)); + gdb_printf (mi->event_channel, "tsv-created," + "name=\"%s\",initial=\"%s\"", + tsv->name.c_str (), plongest (tsv->initial_value)); gdb_flush (mi->event_channel); } @@ -789,10 +789,10 @@ mi_tsv_deleted (const struct trace_state_variable *tsv) target_terminal::ours_for_output (); if (tsv != NULL) - fprintf_unfiltered (mi->event_channel, "tsv-deleted," - "name=\"%s\"", tsv->name.c_str ()); + gdb_printf (mi->event_channel, "tsv-deleted," + "name=\"%s\"", tsv->name.c_str ()); else - fprintf_unfiltered (mi->event_channel, "tsv-deleted"); + gdb_printf (mi->event_channel, "tsv-deleted"); gdb_flush (mi->event_channel); } @@ -816,8 +816,8 @@ mi_tsv_modified (const struct trace_state_variable *tsv) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "tsv-modified"); + gdb_printf (mi->event_channel, + "tsv-modified"); mi_uiout->redirect (mi->event_channel); @@ -885,8 +885,8 @@ mi_breakpoint_created (struct breakpoint *b) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "breakpoint-created"); + gdb_printf (mi->event_channel, + "breakpoint-created"); mi_print_breakpoint_for_event (mi, b); gdb_flush (mi->event_channel); @@ -914,8 +914,8 @@ mi_breakpoint_deleted (struct breakpoint *b) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, "breakpoint-deleted,id=\"%d\"", - b->number); + gdb_printf (mi->event_channel, "breakpoint-deleted,id=\"%d\"", + b->number); gdb_flush (mi->event_channel); } @@ -941,8 +941,8 @@ mi_breakpoint_modified (struct breakpoint *b) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, - "breakpoint-modified"); + gdb_printf (mi->event_channel, + "breakpoint-modified"); mi_print_breakpoint_for_event (mi, b); gdb_flush (mi->event_channel); @@ -959,9 +959,9 @@ mi_output_running (struct thread_info *thread) if (mi == NULL) continue; - fprintf_unfiltered (mi->raw_stdout, - "*running,thread-id=\"%d\"\n", - thread->global_num); + gdb_printf (mi->raw_stdout, + "*running,thread-id=\"%d\"\n", + thread->global_num); } } @@ -997,8 +997,8 @@ mi_on_resume_1 (struct mi_interp *mi, In future (MI3), we'll be outputting "^done" here. */ if (!running_result_record_printed && mi_proceeded) { - fprintf_unfiltered (mi->raw_stdout, "%s^running\n", - current_token ? current_token : ""); + gdb_printf (mi->raw_stdout, "%s^running\n", + current_token ? current_token : ""); } /* Backwards compatibility. If doing a wildcard resume and there's @@ -1006,7 +1006,7 @@ mi_on_resume_1 (struct mi_interp *mi, thread individually. */ if ((ptid == minus_one_ptid || ptid.is_pid ()) && !multiple_inferiors_p ()) - fprintf_unfiltered (mi->raw_stdout, "*running,thread-id=\"all\"\n"); + gdb_printf (mi->raw_stdout, "*running,thread-id=\"all\"\n"); else for (thread_info *tp : all_non_exited_threads (targ, ptid)) mi_output_running (tp); @@ -1091,7 +1091,7 @@ mi_solib_loaded (struct so_list *solib) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, "library-loaded"); + gdb_printf (mi->event_channel, "library-loaded"); uiout->redirect (mi->event_channel); @@ -1119,7 +1119,7 @@ mi_solib_unloaded (struct so_list *solib) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, "library-unloaded"); + gdb_printf (mi->event_channel, "library-unloaded"); uiout->redirect (mi->event_channel); @@ -1158,7 +1158,7 @@ mi_command_param_changed (const char *param, const char *value) target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, "cmd-param-changed"); + gdb_printf (mi->event_channel, "cmd-param-changed"); mi_uiout->redirect (mi->event_channel); @@ -1194,7 +1194,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr, target_terminal::scoped_restore_terminal_state term_state; target_terminal::ours_for_output (); - fprintf_unfiltered (mi->event_channel, "memory-changed"); + gdb_printf (mi->event_channel, "memory-changed"); mi_uiout->redirect (mi->event_channel); @@ -1260,9 +1260,9 @@ mi_user_selected_context_changed (user_selected_what selection) { print_selected_thread_frame (mi->cli_uiout, selection); - fprintf_unfiltered (mi->event_channel, - "thread-selected,id=\"%d\"", - tp->global_num); + gdb_printf (mi->event_channel, + "thread-selected,id=\"%d\"", + tp->global_num); if (tp->state != THREAD_RUNNING) { diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index ff46af5..18707bf 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -123,9 +123,9 @@ show_mi_async_command (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, - _("Whether MI is in asynchronous mode is %s.\n"), - value); + gdb_printf (file, + _("Whether MI is in asynchronous mode is %s.\n"), + value); } /* A wrapper for target_can_async_p that takes the MI setting into @@ -1816,9 +1816,9 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context) case MI_COMMAND: /* A MI command was read from the input stream. */ if (mi_debug_p) - fprintf_unfiltered (gdb_stdlog, - " token=`%s' command=`%s' args=`%s'\n", - context->token, context->command, context->args); + gdb_printf (gdb_stdlog, + " token=`%s' command=`%s' args=`%s'\n", + context->token, context->command, context->args); mi_cmd_execute (context); @@ -1855,7 +1855,7 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context) /* This "feature" will be removed as soon as we have a complete set of mi commands. */ /* Echo the command on the console. */ - fprintf_unfiltered (gdb_stdlog, "%s\n", context->command); + gdb_printf (gdb_stdlog, "%s\n", context->command); /* Call the "console" interpreter. */ argv[0] = (char *) INTERP_CONSOLE; argv[1] = context->command; @@ -2135,8 +2135,8 @@ mi_execute_cli_command (const char *cmd, bool args_p, const char *args) gdb_assert (args == nullptr); if (mi_debug_p) - fprintf_unfiltered (gdb_stdlog, "cli=%s run=%s\n", - cmd, run.c_str ()); + gdb_printf (gdb_stdlog, "cli=%s run=%s\n", + cmd, run.c_str ()); execute_command (run.c_str (), 0 /* from_tty */ ); } @@ -2258,7 +2258,7 @@ print_diff (struct ui_file *file, struct mi_timestamp *start, duration<double> utime = end->utime - start->utime; duration<double> stime = end->stime - start->stime; - fprintf_unfiltered + gdb_printf (file, ",time={wallclock=\"%0.5f\",user=\"%0.5f\",system=\"%0.5f\"}", wallclock.count (), utime.count (), stime.count ()); diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index c84cc55..567ef83 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -132,11 +132,11 @@ mi_ui_out::do_field_string (int fldno, int width, ui_align align, field_separator (); if (fldname) - fprintf_unfiltered (stream, "%s=", fldname); - fprintf_unfiltered (stream, "\""); + gdb_printf (stream, "%s=", fldname); + gdb_printf (stream, "\""); if (string) stream->putstr (string, '"'); - fprintf_unfiltered (stream, "\""); + gdb_printf (stream, "\""); } void @@ -148,7 +148,7 @@ mi_ui_out::do_field_fmt (int fldno, int width, ui_align align, field_separator (); if (fldname) - fprintf_unfiltered (stream, "%s=\"", fldname); + gdb_printf (stream, "%s=\"", fldname); else gdb_puts ("\"", stream); gdb_vprintf (stream, format, args); @@ -211,7 +211,7 @@ mi_ui_out::open (const char *name, ui_out_type type) m_suppress_field_separator = true; if (name) - fprintf_unfiltered (stream, "%s=", name); + gdb_printf (stream, "%s=", name); switch (type) { |