From: Doug Evans <dje@google.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Speed up "gdb -tui" output
Date: Wed, 07 Jan 2015 20:45:00 -0000 [thread overview]
Message-ID: <CADPb22QZ8qgfYfsT=wxQg8yKRE3EzPTc8QHcHpk8oXpA6DsA2A@mail.gmail.com> (raw)
In-Reply-To: <837fwy74ny.fsf@gnu.org>
On Wed, Jan 7, 2015 at 11:48 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 7 Jan 2015 11:30:37 -0800
>> From: Doug Evans <dje@google.com>
>> Cc: gdb-patches <gdb-patches@sourceware.org>
>>
>> I can't promise to have a patch ready before 7.9, but I'll put it
>> on my todo list.
>
> Thanks.
>
>> >> Note that while we do explicitly call *_unfiltered with single characters,
>> >> unfiltered output is not in itself broken up into single characters.
>> >
>> > Not sure what you mean by that. fputs_maybe_filtered, which is the
>> > workhorse of most of the output functions, explicitly writes out the
>> > stuff it gets one character at a time, by calling fputc_unfiltered.
>> > How's that not breaking output?
>>
>> fputs_maybe_filtered is the workhorse for filtered output, and
>> it early exists for a number of things, like stream != gdb_stdout.
>
> It is used both for gdb_stdout and for other streams.
static void
fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
int filter)
{
const char *lineptr;
if (linebuffer == 0)
return;
/* Don't do any filtering if it is disabled. */
if (stream != gdb_stdout
|| !pagination_enabled
|| batch_flag
|| (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)
|| top_level_interpreter () == NULL
|| ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ())))
{
fputs_unfiltered (linebuffer, stream);
return;
}
...
}
It may be called for other streams, but it early exits
with a direct call to fputs_unfiltered if stream != gdb_stdout.
I don't know how to say it any plainer than that.
>
>> Most unfiltered output goes straight to fputs_unfiltered (which is the
>> wrapper around the ui-file to_fputs method).
>
> Once again, I fail to see how this fact, which I certainly noticed
> already, helps to solve the problem. When fputs_maybe_filtered is
> called, we have no idea whether the text it gets is complete enough to
> flush the stream after we are done with it. That information is at
> higher levels. So we don't know whether to flush the stream after the
> direct call to fputs_unfiltered.
My theory is we can punt for streams != gdb_stdout,
and for them just always refresh inside calls to tui_file_fputs.
And for gdb_stdout rely on calls to gdb_flush to do
the refresh.
Seems like not that many lines of code to give it a try.
>
>> I see there is fputstr{,n}_unfiltered which does things a character
>> at a time but it looks like it is only used by MI.
>
> Grep for fputs_unfiltered callers, and you will see that there are
> much more calls with only 1 or 2 characters.
I already did, and pointed that out.
We don't know yet if they're a problem.
Seems like the main source of the problem would be gdb_stdout,
so let's try to fix that first and go from there.
next prev parent reply other threads:[~2015-01-07 20:45 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 16:12 Eli Zaretskii
2015-01-06 18:37 ` Doug Evans
2015-01-06 19:06 ` Eli Zaretskii
2015-01-06 20:54 ` Doug Evans
2015-01-07 18:30 ` Eli Zaretskii
2015-01-07 19:08 ` Doug Evans
2015-01-07 19:20 ` Eli Zaretskii
2015-01-07 19:30 ` Doug Evans
2015-01-07 19:48 ` Eli Zaretskii
2015-01-07 20:45 ` Doug Evans [this message]
2015-01-07 21:59 ` Doug Evans
2015-01-19 17:55 ` Eli Zaretskii
2015-01-19 18:32 ` Doug Evans
2015-01-31 21:37 ` Eli Zaretskii
2015-02-03 17:52 ` Pedro Alves
2015-02-03 18:47 ` Eli Zaretskii
2015-02-04 11:55 ` Pedro Alves
2015-02-04 12:27 ` Pedro Alves
2015-02-04 15:39 ` Eli Zaretskii
2015-02-04 15:38 ` Eli Zaretskii
2015-01-07 15:18 ` Pedro Alves
2015-01-07 17:57 ` Eli Zaretskii
2015-01-07 18:09 ` Doug Evans
2015-01-07 18:34 ` Eli Zaretskii
2015-01-07 19:16 ` Doug Evans
2015-01-07 19:32 ` Eli Zaretskii
2015-01-07 22:30 ` Pedro Alves
2015-01-19 17:52 ` Eli Zaretskii
2015-01-07 18:00 ` Doug Evans
2015-01-07 18:12 ` Doug Evans
2015-01-07 18:34 ` Eli Zaretskii
2015-01-07 18:21 ` Eli Zaretskii
2015-01-07 18:56 ` Doug Evans
2015-01-07 19:11 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADPb22QZ8qgfYfsT=wxQg8yKRE3EzPTc8QHcHpk8oXpA6DsA2A@mail.gmail.com' \
--to=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).