From 6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 2 Jan 2022 11:46:15 -0700 Subject: 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. --- gdb/guile/guile.c | 6 +++--- gdb/guile/scm-auto-load.c | 2 +- gdb/guile/scm-objfile.c | 4 ++-- gdb/guile/scm-param.c | 4 ++-- gdb/guile/scm-pretty-print.c | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'gdb/guile') diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index c040be5..c7be48f 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -273,7 +273,7 @@ gdbscm_source_script (const struct extension_language_defn *extlang, gdb::unique_xmalloc_ptr msg = gdbscm_safe_source_script (filename); if (msg != NULL) - fprintf_filtered (gdb_stderr, "%s\n", msg.get ()); + gdb_printf (gdb_stderr, "%s\n", msg.get ()); } /* (execute string [#:from-tty boolean] [#:to-string boolean]) @@ -528,11 +528,11 @@ print_throw_error (SCM key, SCM args) static SCM handle_boot_error (void *boot_scm_file, SCM key, SCM args) { - fprintf_unfiltered (gdb_stderr, ("Exception caught while booting Guile.\n")); + gdb_printf (gdb_stderr, ("Exception caught while booting Guile.\n")); print_throw_error (key, args); - fprintf_unfiltered (gdb_stderr, "\n"); + gdb_printf (gdb_stderr, "\n"); warning (_("Could not complete Guile gdb module initialization from:\n" "%s.\n" "Limited Guile support is available.\n" diff --git a/gdb/guile/scm-auto-load.c b/gdb/guile/scm-auto-load.c index 8ced220..6aa0a5d 100644 --- a/gdb/guile/scm-auto-load.c +++ b/gdb/guile/scm-auto-load.c @@ -38,7 +38,7 @@ static void show_auto_load_guile_scripts (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, _("Auto-loading of Guile scripts is %s.\n"), value); + gdb_printf (file, _("Auto-loading of Guile scripts is %s.\n"), value); } /* See guile-internal.h. */ diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c index bdd61ae..760d5aa 100644 --- a/gdb/guile/scm-objfile.c +++ b/gdb/guile/scm-objfile.c @@ -314,7 +314,7 @@ gdbscm_source_objfile_script (const struct extension_language_defn *extlang, gdb::unique_xmalloc_ptr msg = gdbscm_safe_source_script (filename); if (msg != NULL) - fprintf_filtered (gdb_stderr, "%s", msg.get ()); + gdb_printf (gdb_stderr, "%s", msg.get ()); ofscm_current_objfile = NULL; } @@ -335,7 +335,7 @@ gdbscm_execute_objfile_script (const struct extension_language_defn *extlang, gdb::unique_xmalloc_ptr msg = gdbscm_safe_eval_string (script, 0 /* display_result */); if (msg != NULL) - fprintf_filtered (gdb_stderr, "%s", msg.get ()); + gdb_printf (gdb_stderr, "%s", msg.get ()); ofscm_current_objfile = NULL; } diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c index 42727bb..54c8c27 100644 --- a/gdb/guile/scm-param.c +++ b/gdb/guile/scm-param.c @@ -320,7 +320,7 @@ pascm_set_func (const char *args, int from_tty, struct cmd_list_element *c) /* GDB is usually silent when a parameter is set. */ if (*msg.get () != '\0') - printf_filtered ("%s\n", msg.get ()); + gdb_printf ("%s\n", msg.get ()); } /* A callback function that is registered against the respective @@ -362,7 +362,7 @@ pascm_show_func (struct ui_file *file, int from_tty, error (_("Error converting show text to host string.")); } - fprintf_filtered (file, "%s\n", msg.get ()); + gdb_printf (file, "%s\n", msg.get ()); } /* A helper function that dispatches to the appropriate add_setshow diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index 707ef4b..a99ab13 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -617,7 +617,7 @@ ppscm_print_exception_unless_memory_error (SCM exception, /* This "shouldn't happen", but play it safe. */ if (msg == NULL || msg.get ()[0] == '\0') - fprintf_filtered (stream, _("")); + gdb_printf (stream, _("")); else { /* Remove the trailing newline. We could instead call a special @@ -628,7 +628,7 @@ ppscm_print_exception_unless_memory_error (SCM exception, if (msg_text[len - 1] == '\n') msg_text[len - 1] = '\0'; - fprintf_filtered (stream, _(""), msg_text); + gdb_printf (stream, _(""), msg_text); } } else @@ -871,7 +871,7 @@ ppscm_print_children (SCM printer, enum display_hint hint, /* We print the index, not whatever the child method returned as the name. */ if (options->print_array_indexes) - fprintf_filtered (stream, "[%d] = ", i); + gdb_printf (stream, "[%d] = ", i); } else if (! is_map) { -- cgit v1.1