* [PATCH] gdb: Only paginate for filtered output in fputs_maybe_filtered
@ 2022-02-17 11:19 Lancelot SIX
2022-02-17 23:59 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Lancelot SIX @ 2022-02-17 11:19 UTC (permalink / raw)
To: gdb-patches; +Cc: lsix, Lancelot SIX
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
---
gdb/utils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/utils.c b/gdb/utils.c
index dcb42138d39..505a88aa1cd 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 ();
base-commit: fb583cfc0936554a1f8d86ef2b6649bf511d6df8
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: Only paginate for filtered output in fputs_maybe_filtered
2022-02-17 11:19 [PATCH] gdb: Only paginate for filtered output in fputs_maybe_filtered Lancelot SIX
@ 2022-02-17 23:59 ` Tom Tromey
2022-02-18 9:18 ` Lancelot SIX
2022-02-20 18:34 ` Lancelot SIX
0 siblings, 2 replies; 4+ messages in thread
From: Tom Tromey @ 2022-02-17 23:59 UTC (permalink / raw)
To: Lancelot SIX via Gdb-patches; +Cc: Lancelot SIX, lsix
>>>>> ">" == Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org> writes:
>> 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.
Thanks, this is ok.
It's perhaps worth noting that I believe this is also fixed by my series
to change the filter to be a more ordinary ui_file.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: Only paginate for filtered output in fputs_maybe_filtered
2022-02-17 23:59 ` Tom Tromey
@ 2022-02-18 9:18 ` Lancelot SIX
2022-02-20 18:34 ` Lancelot SIX
1 sibling, 0 replies; 4+ messages in thread
From: Lancelot SIX @ 2022-02-18 9:18 UTC (permalink / raw)
To: Tom Tromey, Lancelot SIX via Gdb-patches; +Cc: lsix
On 17/02/2022 23:59, Tom Tromey wrote:
> [CAUTION: External Email]
>
>>>>>> ">" == Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>>> 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.
>
> Thanks, this is ok.
>
> It's perhaps worth noting that I believe this is also fixed by my series
> to change the filter to be a more ordinary ui_file.
>
Hi,
Thanks. I have to admit that when I hit into that that ringed a bell
about this series I did see. I did not really got back to it (shame on
me). I'll have a look to see if your series fixes that as well, and I
am happy not getting this in and wait for your series if you prefer / it
simplifies your life when rebasing.
Lancelot.
> Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: Only paginate for filtered output in fputs_maybe_filtered
2022-02-17 23:59 ` Tom Tromey
2022-02-18 9:18 ` Lancelot SIX
@ 2022-02-20 18:34 ` Lancelot SIX
1 sibling, 0 replies; 4+ messages in thread
From: Lancelot SIX @ 2022-02-20 18:34 UTC (permalink / raw)
To: Tom Tromey, Lancelot SIX via Gdb-patches; +Cc: lsix
> Thanks, this is ok.
>
> Tom
Thanks,
I just pushed this.
Best,
Lancelot.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-20 18:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 11:19 [PATCH] gdb: Only paginate for filtered output in fputs_maybe_filtered Lancelot SIX
2022-02-17 23:59 ` Tom Tromey
2022-02-18 9:18 ` Lancelot SIX
2022-02-20 18:34 ` Lancelot SIX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).