Remove some ui_file_* functions
This removes ui_file_isatty, ui_file_read, ui_file_write, ui_file_write_async_safe, ui_file_flush, and ui_file_puts, replacing them with calls to the appropriate method instead. gdb/ChangeLog 2020-02-11 Tom Tromey <tromey@adacore.com> * remote.c (remote_console_output): Update. * printcmd.c (printf_command): Update. * event-loop.c (gdb_wait_for_event): Update. * linux-nat.c (sigchld_handler): Update. * remote-sim.c (gdb_os_write_stdout): Update. (gdb_os_flush_stdout): Update. (gdb_os_flush_stderr): Update. (gdb_os_write_stderr): Update. * exceptions.c (print_exception): Update. * remote-fileio.c (remote_fileio_func_read): Update. (remote_fileio_func_write): Update. * tui/tui.c (tui_enable): Update. * tui/tui-interp.c (tui_interp::init): Update. * utils.c (init_page_info): Update. (putchar_unfiltered, fputc_unfiltered): Update. (gdb_flush): Update. (emit_style_escape): Update. (flush_wrap_buffer, fputs_maybe_filtered): Update. * ui-file.c (ui_file_isatty, ui_file_read, ui_file_write) (ui_file_write_async_safe, ui_file_flush, ui_file_puts): Remove. (stderr_file::write): Update. (stderr_file::puts): Update. * ui-file.h (ui_file_isatty, ui_file_write) (ui_file_write_async_safe, ui_file_read, ui_file_flush) (ui_file_puts): Don't declare. Change-Id: I3ca9b36e9107f6adbc41e014f5078b41d6bcec4d
This commit is contained in:
parent
c675ec1e76
commit
da5bd37ebc
@ -1,3 +1,31 @@
|
||||
2020-02-11 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
* remote.c (remote_console_output): Update.
|
||||
* printcmd.c (printf_command): Update.
|
||||
* event-loop.c (gdb_wait_for_event): Update.
|
||||
* linux-nat.c (sigchld_handler): Update.
|
||||
* remote-sim.c (gdb_os_write_stdout): Update.
|
||||
(gdb_os_flush_stdout): Update.
|
||||
(gdb_os_flush_stderr): Update.
|
||||
(gdb_os_write_stderr): Update.
|
||||
* exceptions.c (print_exception): Update.
|
||||
* remote-fileio.c (remote_fileio_func_read): Update.
|
||||
(remote_fileio_func_write): Update.
|
||||
* tui/tui.c (tui_enable): Update.
|
||||
* tui/tui-interp.c (tui_interp::init): Update.
|
||||
* utils.c (init_page_info): Update.
|
||||
(putchar_unfiltered, fputc_unfiltered): Update.
|
||||
(gdb_flush): Update.
|
||||
(emit_style_escape): Update.
|
||||
(flush_wrap_buffer, fputs_maybe_filtered): Update.
|
||||
* ui-file.c (ui_file_isatty, ui_file_read, ui_file_write)
|
||||
(ui_file_write_async_safe, ui_file_flush, ui_file_puts): Remove.
|
||||
(stderr_file::write): Update.
|
||||
(stderr_file::puts): Update.
|
||||
* ui-file.h (ui_file_isatty, ui_file_write)
|
||||
(ui_file_write_async_safe, ui_file_read, ui_file_flush)
|
||||
(ui_file_puts): Don't declare.
|
||||
|
||||
2020-02-10 Tom de Vries <tdevries@suse.de>
|
||||
|
||||
* dwarf2/read.c (process_psymtab_comp_unit_reader): Cast concat NULL
|
||||
|
@ -750,8 +750,8 @@ gdb_wait_for_event (int block)
|
||||
int num_found = 0;
|
||||
|
||||
/* Make sure all output is done before getting another event. */
|
||||
ui_file_flush (gdb_stdout);
|
||||
ui_file_flush (gdb_stderr);
|
||||
gdb_stdout->flush ();
|
||||
gdb_stderr->flush ();
|
||||
|
||||
if (gdb_notifier.num_fds == 0)
|
||||
return -1;
|
||||
|
@ -85,7 +85,7 @@ print_exception (struct ui_file *file, const struct gdb_exception &e)
|
||||
else
|
||||
{
|
||||
end++;
|
||||
ui_file_write (file, start, end - start);
|
||||
file->write (start, end - start);
|
||||
}
|
||||
}
|
||||
fprintf_filtered (file, "\n");
|
||||
|
@ -234,7 +234,7 @@ ioscm_fill_input (SCM port)
|
||||
gdb_flush (gdb_stdout);
|
||||
gdb_flush (gdb_stderr);
|
||||
|
||||
count = ui_file_read (gdb_stdin, (char *) pt->read_buf, pt->read_buf_size);
|
||||
count = gdb_stdin->read ((char *) pt->read_buf, pt->read_buf_size);
|
||||
if (count == -1)
|
||||
scm_syserror (FUNC_NAME);
|
||||
if (count == 0)
|
||||
|
@ -4213,8 +4213,7 @@ sigchld_handler (int signo)
|
||||
int old_errno = errno;
|
||||
|
||||
if (debug_linux_nat)
|
||||
ui_file_write_async_safe (gdb_stdlog,
|
||||
"sigchld\n", sizeof ("sigchld\n") - 1);
|
||||
gdb_stdlog->write_async_safe ("sigchld\n", sizeof ("sigchld\n") - 1);
|
||||
|
||||
if (signo == SIGCHLD
|
||||
&& linux_nat_event_pipe[0] != -1)
|
||||
|
@ -2720,7 +2720,7 @@ printf_command (const char *arg, int from_tty)
|
||||
ui_printf (arg, gdb_stdout);
|
||||
reset_terminal_style (gdb_stdout);
|
||||
wrap_here ("");
|
||||
ui_file_flush (gdb_stdout);
|
||||
gdb_stdout->flush ();
|
||||
}
|
||||
|
||||
/* Implement the "eval" command. */
|
||||
|
@ -541,7 +541,7 @@ remote_fileio_func_read (remote_target *remote, char *buf)
|
||||
limit this read to something smaller than that - by a
|
||||
safe margin, in case the limit depends on system
|
||||
resources or version. */
|
||||
ret = ui_file_read (gdb_stdtargin, (char *) buffer, 16383);
|
||||
ret = gdb_stdtargin->read ((char *) buffer, 16383);
|
||||
if (ret > 0 && (size_t)ret > length)
|
||||
{
|
||||
remaining_buf = (char *) xmalloc (ret - length);
|
||||
@ -639,10 +639,12 @@ remote_fileio_func_write (remote_target *remote, char *buf)
|
||||
xfree (buffer);
|
||||
return;
|
||||
case FIO_FD_CONSOLE_OUT:
|
||||
ui_file_write (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr,
|
||||
(char *) buffer, length);
|
||||
ui_file_flush (target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr);
|
||||
{
|
||||
ui_file *file = target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr;
|
||||
file->write ((char *) buffer, length);
|
||||
file->flush ();
|
||||
ret = length;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = write (fd, buffer, length);
|
||||
|
@ -351,7 +351,7 @@ end_callbacks (void)
|
||||
static int
|
||||
gdb_os_write_stdout (host_callback *p, const char *buf, int len)
|
||||
{
|
||||
ui_file_write (gdb_stdtarg, buf, len);
|
||||
gdb_stdtarg->write (buf, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ gdb_os_write_stdout (host_callback *p, const char *buf, int len)
|
||||
static void
|
||||
gdb_os_flush_stdout (host_callback *p)
|
||||
{
|
||||
ui_file_flush (gdb_stdtarg);
|
||||
gdb_stdtarg->flush ();
|
||||
}
|
||||
|
||||
/* GDB version of os_write_stderr callback. */
|
||||
@ -375,7 +375,7 @@ gdb_os_write_stderr (host_callback *p, const char *buf, int len)
|
||||
{
|
||||
b[0] = buf[i];
|
||||
b[1] = 0;
|
||||
ui_file_puts (gdb_stdtargerr, b);
|
||||
gdb_stdtargerr->puts (b);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@ -385,7 +385,7 @@ gdb_os_write_stderr (host_callback *p, const char *buf, int len)
|
||||
static void
|
||||
gdb_os_flush_stderr (host_callback *p)
|
||||
{
|
||||
ui_file_flush (gdb_stdtargerr);
|
||||
gdb_stdtargerr->flush ();
|
||||
}
|
||||
|
||||
/* GDB version of printf_filtered callback. */
|
||||
|
@ -6845,9 +6845,9 @@ remote_console_output (const char *msg)
|
||||
|
||||
tb[0] = c;
|
||||
tb[1] = 0;
|
||||
ui_file_puts (gdb_stdtarg, tb);
|
||||
gdb_stdtarg->puts (tb);
|
||||
}
|
||||
ui_file_flush (gdb_stdtarg);
|
||||
gdb_stdtarg->flush ();
|
||||
}
|
||||
|
||||
struct stop_reply : public notif_event
|
||||
|
@ -243,7 +243,7 @@ tui_interp::init (bool top_level)
|
||||
|
||||
tui_initialize_io ();
|
||||
tui_initialize_win ();
|
||||
if (ui_file_isatty (gdb_stdout))
|
||||
if (gdb_stdout->isatty ())
|
||||
tui_initialize_readline ();
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ tui_enable (void)
|
||||
|
||||
/* Don't try to setup curses (and print funny control
|
||||
characters) if we're not outputting to a terminal. */
|
||||
if (!ui_file_isatty (gdb_stdout))
|
||||
if (!gdb_stderr->isatty ())
|
||||
error (_("Cannot enable the TUI when output is not a terminal"));
|
||||
|
||||
s = newterm (NULL, stdout, stdin);
|
||||
|
@ -90,18 +90,6 @@ null_file::write_async_safe (const char *buf, long sizeof_buf)
|
||||
|
||||
|
||||
|
||||
void
|
||||
ui_file_flush (struct ui_file *file)
|
||||
{
|
||||
file->flush ();
|
||||
}
|
||||
|
||||
int
|
||||
ui_file_isatty (struct ui_file *file)
|
||||
{
|
||||
return file->isatty ();
|
||||
}
|
||||
|
||||
/* true if the gdb terminal supports styling, and styling is enabled. */
|
||||
|
||||
static bool
|
||||
@ -126,35 +114,6 @@ term_cli_styling ()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ui_file_write (struct ui_file *file,
|
||||
const char *buf,
|
||||
long length_buf)
|
||||
{
|
||||
file->write (buf, length_buf);
|
||||
}
|
||||
|
||||
void
|
||||
ui_file_write_async_safe (struct ui_file *file,
|
||||
const char *buf,
|
||||
long length_buf)
|
||||
{
|
||||
file->write_async_safe (buf, length_buf);
|
||||
}
|
||||
|
||||
long
|
||||
ui_file_read (struct ui_file *file, char *buf, long length_buf)
|
||||
{
|
||||
return file->read (buf, length_buf);
|
||||
}
|
||||
|
||||
void
|
||||
ui_file_puts (struct ui_file *file, const char *buf)
|
||||
{
|
||||
file->puts (buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
string_file::~string_file ()
|
||||
@ -315,7 +274,7 @@ stdio_file::can_emit_style_escape ()
|
||||
void
|
||||
stderr_file::write (const char *buf, long length_buf)
|
||||
{
|
||||
ui_file_flush (gdb_stdout);
|
||||
gdb_stdout->flush ();
|
||||
stdio_file::write (buf, length_buf);
|
||||
}
|
||||
|
||||
@ -325,7 +284,7 @@ stderr_file::write (const char *buf, long length_buf)
|
||||
void
|
||||
stderr_file::puts (const char *linebuffer)
|
||||
{
|
||||
ui_file_flush (gdb_stdout);
|
||||
gdb_stdout->flush ();
|
||||
stdio_file::puts (linebuffer);
|
||||
}
|
||||
|
||||
|
@ -100,20 +100,6 @@ public:
|
||||
/* A preallocated null_file stream. */
|
||||
extern null_file null_stream;
|
||||
|
||||
extern void ui_file_flush (ui_file *);
|
||||
|
||||
extern int ui_file_isatty (struct ui_file *);
|
||||
|
||||
extern void ui_file_write (struct ui_file *file, const char *buf,
|
||||
long length_buf);
|
||||
|
||||
extern void ui_file_write_async_safe (struct ui_file *file, const char *buf,
|
||||
long length_buf);
|
||||
|
||||
extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
|
||||
|
||||
extern void ui_file_puts (struct ui_file *file, const char *buf);
|
||||
|
||||
extern int gdb_console_fputs (const char *, FILE *);
|
||||
|
||||
/* A std::string-based ui_file. Can be used as a scratch buffer for
|
||||
|
16
gdb/utils.c
16
gdb/utils.c
@ -1277,7 +1277,7 @@ init_page_info (void)
|
||||
}
|
||||
|
||||
/* If the output is not a terminal, don't paginate it. */
|
||||
if (!ui_file_isatty (gdb_stdout))
|
||||
if (!gdb_stdout->isatty ())
|
||||
lines_per_page = UINT_MAX;
|
||||
#endif
|
||||
}
|
||||
@ -1405,7 +1405,7 @@ emit_style_escape (const ui_file_style &style,
|
||||
if (stream == nullptr)
|
||||
wrap_buffer.append (style.to_ansi ());
|
||||
else
|
||||
ui_file_puts (stream, style.to_ansi ().c_str ());
|
||||
stream->puts (style.to_ansi ().c_str ());
|
||||
}
|
||||
|
||||
/* Set the current output style. This will affect future uses of the
|
||||
@ -1539,7 +1539,7 @@ flush_wrap_buffer (struct ui_file *stream)
|
||||
{
|
||||
if (stream == gdb_stdout && !wrap_buffer.empty ())
|
||||
{
|
||||
ui_file_puts (stream, wrap_buffer.c_str ());
|
||||
stream->puts (wrap_buffer.c_str ());
|
||||
wrap_buffer.clear ();
|
||||
}
|
||||
}
|
||||
@ -1550,7 +1550,7 @@ void
|
||||
gdb_flush (struct ui_file *stream)
|
||||
{
|
||||
flush_wrap_buffer (stream);
|
||||
ui_file_flush (stream);
|
||||
stream->flush ();
|
||||
}
|
||||
|
||||
/* Indicate that if the next sequence of characters overflows the line,
|
||||
@ -1697,7 +1697,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
|
||||
|| top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
|
||||
{
|
||||
flush_wrap_buffer (stream);
|
||||
ui_file_puts (stream, linebuffer);
|
||||
stream->puts (linebuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1797,7 +1797,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
|
||||
/* Now output indentation and wrapped string. */
|
||||
if (wrap_column)
|
||||
{
|
||||
ui_file_puts (stream, wrap_indent);
|
||||
stream->puts (wrap_indent);
|
||||
if (stream->can_emit_style_escape ())
|
||||
emit_style_escape (save_style, stream);
|
||||
/* FIXME, this strlen is what prevents wrap_indent from
|
||||
@ -1918,7 +1918,7 @@ putchar_unfiltered (int c)
|
||||
{
|
||||
char buf = c;
|
||||
|
||||
ui_file_write (gdb_stdout, &buf, 1);
|
||||
gdb_stdout->write (&buf, 1);
|
||||
return c;
|
||||
}
|
||||
|
||||
@ -1936,7 +1936,7 @@ fputc_unfiltered (int c, struct ui_file *stream)
|
||||
{
|
||||
char buf = c;
|
||||
|
||||
ui_file_write (stream, &buf, 1);
|
||||
stream->write (&buf, 1);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user