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.
This commit is contained in:
parent
a11ac3b3e8
commit
6cb06a8cda
249 changed files with 8449 additions and 8463 deletions
|
@ -37,7 +37,7 @@ static void
|
|||
show_auto_load_python_scripts (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
{
|
||||
fprintf_filtered (file, _("Auto-loading of Python scripts is %s.\n"), value);
|
||||
gdb_printf (file, _("Auto-loading of Python scripts is %s.\n"), value);
|
||||
}
|
||||
|
||||
/* See python-internal.h. */
|
||||
|
|
|
@ -44,7 +44,7 @@ static void
|
|||
show_pybp_debug (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
{
|
||||
fprintf_filtered (file, _("Python breakpoint debugging is %s.\n"), value);
|
||||
gdb_printf (file, _("Python breakpoint debugging is %s.\n"), value);
|
||||
}
|
||||
|
||||
/* Print a "py-breakpoint" debug statement. */
|
||||
|
|
|
@ -1222,7 +1222,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
|||
{
|
||||
/* We've printed all the frames we were asked to
|
||||
print, but more frames existed. */
|
||||
printf_filtered (_("(More stack frames follow...)\n"));
|
||||
gdb_printf (_("(More stack frames follow...)\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ static void
|
|||
show_pymicmd_debug (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
{
|
||||
fprintf_filtered (file, _("Python MI command debugging is %s.\n"), value);
|
||||
gdb_printf (file, _("Python MI command debugging is %s.\n"), value);
|
||||
}
|
||||
|
||||
/* Print a "py-micmd" debug statement. */
|
||||
|
|
|
@ -464,7 +464,7 @@ get_set_value (const char *args, int from_tty,
|
|||
|
||||
const char *str = set_doc_string.get ();
|
||||
if (str != nullptr && str[0] != '\0')
|
||||
printf_filtered ("%s\n", str);
|
||||
gdb_printf ("%s\n", str);
|
||||
}
|
||||
|
||||
/* A callback function that is registered against the respective
|
||||
|
@ -508,7 +508,7 @@ get_show_value (struct ui_file *file, int from_tty,
|
|||
return;
|
||||
}
|
||||
|
||||
fprintf_filtered (file, "%s\n", show_doc_string.get ());
|
||||
gdb_printf (file, "%s\n", show_doc_string.get ());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -519,8 +519,8 @@ get_show_value (struct ui_file *file, int from_tty,
|
|||
show_doc adjustment is not i18n friendly, so, instead, we just
|
||||
print this generic string. */
|
||||
std::string cmd_path = full_cmd_name_without_first_prefix (c);
|
||||
fprintf_filtered (file, _("The current value of '%s' is \"%s\".\n"),
|
||||
cmd_path.c_str (), value);
|
||||
gdb_printf (file, _("The current value of '%s' is \"%s\".\n"),
|
||||
cmd_path.c_str (), value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -425,8 +425,8 @@ print_children (PyObject *printer, const char *hint,
|
|||
/* The user won't necessarily get a stack trace here, so provide
|
||||
more context. */
|
||||
if (gdbpy_print_python_errors_p ())
|
||||
fprintf_unfiltered (gdb_stderr,
|
||||
_("Bad result from children iterator.\n"));
|
||||
gdb_printf (gdb_stderr,
|
||||
_("Bad result from children iterator.\n"));
|
||||
gdbpy_print_stack ();
|
||||
continue;
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ print_children (PyObject *printer, const char *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)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ static void
|
|||
show_pyuw_debug (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
{
|
||||
fprintf_filtered (file, _("Python unwinder debugging is %s.\n"), value);
|
||||
gdb_printf (file, _("Python unwinder debugging is %s.\n"), value);
|
||||
}
|
||||
|
||||
/* Print a "py-unwind" debug statement. */
|
||||
|
|
|
@ -372,9 +372,9 @@ gdbpy_handle_exception ()
|
|||
{
|
||||
/* An error occurred computing the string representation of the
|
||||
error message. This is rare, but we should inform the user. */
|
||||
printf_filtered (_("An error occurred in Python "
|
||||
"and then another occurred computing the "
|
||||
"error message.\n"));
|
||||
gdb_printf (_("An error occurred in Python "
|
||||
"and then another occurred computing the "
|
||||
"error message.\n"));
|
||||
gdbpy_print_stack ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1413,16 +1413,16 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
fprintf_filtered (gdb_stderr, "%s", arg);
|
||||
gdb_printf (gdb_stderr, "%s", arg);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
fprintf_filtered (gdb_stdlog, "%s", arg);
|
||||
gdb_printf (gdb_stdlog, "%s", arg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf_filtered (gdb_stdout, "%s", arg);
|
||||
gdb_printf (gdb_stdout, "%s", arg);
|
||||
}
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
|
@ -1493,7 +1493,7 @@ gdbpy_print_stack (void)
|
|||
PyErr_Print ();
|
||||
/* PyErr_Print doesn't necessarily end output with a newline.
|
||||
This works because Python's stdout/stderr is fed through
|
||||
printf_filtered. */
|
||||
gdb_printf. */
|
||||
try
|
||||
{
|
||||
begin_line ();
|
||||
|
@ -1520,14 +1520,14 @@ gdbpy_print_stack (void)
|
|||
{
|
||||
/* An error occurred computing the string representation of the
|
||||
error message. */
|
||||
fprintf_filtered (gdb_stderr,
|
||||
_("Error occurred computing Python error" \
|
||||
"message.\n"));
|
||||
gdb_printf (gdb_stderr,
|
||||
_("Error occurred computing Python error" \
|
||||
"message.\n"));
|
||||
PyErr_Clear ();
|
||||
}
|
||||
else
|
||||
fprintf_filtered (gdb_stderr, "Python Exception %s: %s\n",
|
||||
type.get (), msg.get ());
|
||||
gdb_printf (gdb_stderr, "Python Exception %s: %s\n",
|
||||
type.get (), msg.get ());
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
|
@ -1796,8 +1796,8 @@ static void
|
|||
show_python_ignore_environment (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
{
|
||||
fprintf_filtered (file, _("Python's ignore-environment setting is %s.\n"),
|
||||
value);
|
||||
gdb_printf (file, _("Python's ignore-environment setting is %s.\n"),
|
||||
value);
|
||||
}
|
||||
|
||||
/* Implement 'set python ignore-environment'. This sets Python's internal
|
||||
|
@ -1830,13 +1830,13 @@ show_python_dont_write_bytecode (struct ui_file *file, int from_tty,
|
|||
= (python_ignore_environment
|
||||
|| getenv ("PYTHONDONTWRITEBYTECODE") == nullptr) ? "off" : "on";
|
||||
|
||||
fprintf_filtered (file,
|
||||
_("Python's dont-write-bytecode setting is %s (currently %s).\n"),
|
||||
value, auto_string);
|
||||
gdb_printf (file,
|
||||
_("Python's dont-write-bytecode setting is %s (currently %s).\n"),
|
||||
value, auto_string);
|
||||
}
|
||||
else
|
||||
fprintf_filtered (file, _("Python's dont-write-bytecode setting is %s.\n"),
|
||||
value);
|
||||
gdb_printf (file, _("Python's dont-write-bytecode setting is %s.\n"),
|
||||
value);
|
||||
}
|
||||
|
||||
/* Implement 'set python dont-write-bytecode'. This sets Python's internal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue