aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2025-03-05 11:28:15 -0500
committerSimon Marchi <simon.marchi@efficios.com>2025-03-05 12:19:13 -0500
commit6594ca4a99dabbebd70c0748dee61d8b3a373336 (patch)
tree21869730a37ba9b1899486120b60b74f1edb8cd3 /gdb/utils.c
parent6a739b5551261f53774c2773a912668c14d991f9 (diff)
downloadbinutils-6594ca4a99dabbebd70c0748dee61d8b3a373336.zip
binutils-6594ca4a99dabbebd70c0748dee61d8b3a373336.tar.gz
binutils-6594ca4a99dabbebd70c0748dee61d8b3a373336.tar.bz2
gdb: do not handle a NULL linebuffer in pager_file::puts
This patch [1] has shown that different implementations of ui_file::puts handle a NULL line differently. pager_file::puts handles a NULL argument gracefully, as a no-op, while other implementations don't and likely crash. This causes subtle bugs: things will be working until the current ui_file is suddenly not a pager_file anymore. I think it would be better to be consistent here, so change pager_file::puts to not accept a NULL line. A regular test run on Linux shows no regression. [1] https://inbox.sourceware.org/gdb-patches/edfe6e17-1c20-4a4c-944f-247ff71b6c10@simark.ca/T/#m864aea10de8ca6fa84757971fcbaf3180e2eaefa Change-Id: Ieb465c86cd2c42a248cf481cd174c8622ef6724b Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 4027d4f..9842bfc 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1638,8 +1638,7 @@ pager_file::puts (const char *linebuffer)
{
const char *lineptr;
- if (linebuffer == 0)
- return;
+ gdb_assert (linebuffer != nullptr);
/* Don't do any filtering or wrapping if both are disabled. */
if (batch_flag