aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorLancelot SIX <lancelot.six@amd.com>2022-02-17 09:25:59 +0000
committerLancelot SIX <lancelot.six@amd.com>2022-02-20 17:21:30 +0000
commit32d8e07ea75c20bafe760215f4866bc4381da78c (patch)
treeed2b25de8b214e46e693dbeb5750160ec7f8338b /gdb/utils.c
parentd65aab93df9fa9010d2f7a2cd3f9ab07e0ac5f19 (diff)
downloadgdb-32d8e07ea75c20bafe760215f4866bc4381da78c.zip
gdb-32d8e07ea75c20bafe760215f4866bc4381da78c.tar.gz
gdb-32d8e07ea75c20bafe760215f4866bc4381da78c.tar.bz2
gdb: Only paginate for filtered output in fputs_maybe_filtered
A have had situation where a unfiltered output (done using fputs_unfiltered) ended up triggering pagination. The backtrace for this was: ... #24 0x000055839377ee4e in check_async_event_handlers () at ../../gdb/async-event.c:335 #25 0x0000558394b67b57 in gdb_do_one_event () at ../../gdbsupport/event-loop.cc:216 #26 0x0000558394587454 in gdb_readline_wrapper (prompt=0x7ffd907712d0 "--Type <RET> for more, q to quit, c to continue without paging--") at ../../gdb/top.c:1148 #27 0x0000558394707270 in prompt_for_continue () at ../../gdb/utils.c:1438 #28 0x00005583947088b3 in fputs_maybe_filtered (linebuffer=0x60c0000f4000 " [...quite big message...]", stream=0x60300028e9d0, filter=0) at ../../gdb/utils.c:1752 #29 0x0000558394708e57 in fputs_unfiltered (linebuffer=0x60c0000f4000 " [...quite big message...]", stream=0x60300028e9d0) at ../../gdb/utils.c:1811 ... This comes from what appears to be a oversight in fputs_maybe_filtered. This function has a FILTER parameter which if true makes the function pause after every screenful (i.e. triggers pagination). The filter parameter is correctly used to guard the first place where prompt_for_continue. There is a second place in the function which can call prompt_for_continue, but is currently unguarded. I believe that this is an oversight, this patch fixes that. Tested on Linux-x86_64, no regression observed. Change-Id: Iad8ffd50a87cf20077500878e2564b5a7dc81ece
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index dcb4213..505a88a 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1744,7 +1744,8 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
/* Possible new page. Note that
PAGINATION_DISABLED_FOR_COMMAND might be set during
this loop, so we must continue to check it here. */
- if (lines_printed >= lines_per_page - 1
+ if (filter
+ && lines_printed >= lines_per_page - 1
&& !pagination_disabled_for_command)
{
prompt_for_continue ();