From b0715493df19e5223251c5be0efc7f180aa0a5ff Mon Sep 17 00:00:00 2001 From: Tom Tromey <tom@tromey.com> Date: Mon, 20 Dec 2021 09:40:14 -0700 Subject: Remove puts_debug I noticed that puts_debug isn't used in the tree. git log tells me that the last use was removed in 2015: commit 40e0b27177e747600d3ec186458fe0e482a1cf77 Author: Pedro Alves <palves@redhat.com> Date: Mon Aug 24 15:40:26 2015 +0100 Delete the remaining ROM monitor targets ... and this commit mentions that the code being removed here probably hadn't worked for 6 years prior to that. Based on this, I'm removing puts_debug. I don't think it's useful. Tested by rebuilding. --- gdb/utils.c | 85 ------------------------------------------------------------- gdb/utils.h | 2 -- 2 files changed, 87 deletions(-) diff --git a/gdb/utils.c b/gdb/utils.c index ea0f65c..7d27f9b 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2041,91 +2041,6 @@ fputc_filtered (int c, struct ui_file *stream) return c; } -/* puts_debug is like fputs_unfiltered, except it prints special - characters in printable fashion. */ - -void -puts_debug (char *prefix, char *string, char *suffix) -{ - int ch; - - /* Print prefix and suffix after each line. */ - static int new_line = 1; - static int return_p = 0; - static const char *prev_prefix = ""; - static const char *prev_suffix = ""; - - if (*string == '\n') - return_p = 0; - - /* If the prefix is changing, print the previous suffix, a new line, - and the new prefix. */ - if ((return_p || (strcmp (prev_prefix, prefix) != 0)) && !new_line) - { - fputs_unfiltered (prev_suffix, gdb_stdlog); - fputs_unfiltered ("\n", gdb_stdlog); - fputs_unfiltered (prefix, gdb_stdlog); - } - - /* Print prefix if we printed a newline during the previous call. */ - if (new_line) - { - new_line = 0; - fputs_unfiltered (prefix, gdb_stdlog); - } - - prev_prefix = prefix; - prev_suffix = suffix; - - /* Output characters in a printable format. */ - while ((ch = *string++) != '\0') - { - switch (ch) - { - default: - if (gdb_isprint (ch)) - fputc_unfiltered (ch, gdb_stdlog); - - else - fprintf_unfiltered (gdb_stdlog, "\\x%02x", ch & 0xff); - break; - - case '\\': - fputs_unfiltered ("\\\\", gdb_stdlog); - break; - case '\b': - fputs_unfiltered ("\\b", gdb_stdlog); - break; - case '\f': - fputs_unfiltered ("\\f", gdb_stdlog); - break; - case '\n': - new_line = 1; - fputs_unfiltered ("\\n", gdb_stdlog); - break; - case '\r': - fputs_unfiltered ("\\r", gdb_stdlog); - break; - case '\t': - fputs_unfiltered ("\\t", gdb_stdlog); - break; - case '\v': - fputs_unfiltered ("\\v", gdb_stdlog); - break; - } - - return_p = ch == '\r'; - } - - /* Print suffix if we printed a newline. */ - if (new_line) - { - fputs_unfiltered (suffix, gdb_stdlog); - fputs_unfiltered ("\n", gdb_stdlog); - } -} - - /* Print a variable number of ARGS using format FORMAT. If this information is going to put the amount written (since the last call to REINITIALIZE_MORE_FILTER or the last page break) over the page size, diff --git a/gdb/utils.h b/gdb/utils.h index f6fd32f..4d20ebd 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -447,8 +447,6 @@ extern void puts_unfiltered (const char *); extern void puts_filtered_tabular (char *string, int width, int right); -extern void puts_debug (char *prefix, char *string, char *suffix); - extern void vprintf_filtered (const char *, va_list) ATTRIBUTE_PRINTF (1, 0); extern void vfprintf_filtered (struct ui_file *, const char *, va_list) -- cgit v1.1