Change wrap buffering to use a std::string
authorTom Tromey <tom@tromey.com>
Wed, 5 Sep 2018 17:25:28 +0000 (11:25 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 28 Dec 2018 19:49:47 +0000 (12:49 -0700)
commitc5603d506350cca3b1af7ba3a97bf05adeea0508
treec1c6e7d759ac207404e1735a14ee0290e9358b9b
parent94f2c73066597f33933bef2d20bdbfbf6fcd8b69
Change wrap buffering to use a std::string

Currently wrap buffering is implemented by allocating a string that is
the same width as the window, and then writing characters into it.
However, if gdb emits terminal escapes, then these could possibly
overflow the buffer.

To prevent this, change the wrap buffer to be a std::string and update
the various uses.

This also changes utils.c to always emit characters to the wrap
buffer.  This simplifies future patches which emit terminal escape
sequences, and also makes it possible for the "echo" and "printf"
commands to be used to emit terminal escapes and have these work in
the TUI.

gdb/ChangeLog
2018-12-28  Tom Tromey  <tom@tromey.com>

* utils.c (filter_initialized): New global.
(wrap_buffer): Now a std::string.
(wrap_pointer): Remove.
(flush_wrap_buffer): New function.
(filtered_printing_initialized, set_width, wrap_here)
(fputs_maybe_filtered): Update.
gdb/ChangeLog
gdb/utils.c