From: Doug Evans <dje@google.com>
To: Pedro Alves <palves@redhat.com>
Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Speed up "gdb -tui" output
Date: Wed, 07 Jan 2015 18:00:00 -0000 [thread overview]
Message-ID: <CADPb22RjhBGkbSjuFgGDy4qhRiXAcyaw_-DHdz4pY_-t42FJFQ@mail.gmail.com> (raw)
In-Reply-To: <54AD4E22.1010106@redhat.com>
On Wed, Jan 7, 2015 at 7:17 AM, Pedro Alves <palves@redhat.com> wrote:
> On 01/06/2015 06:37 PM, Doug Evans wrote:
>
>> Having written all that, asking the caller to know to do
>> wrefresh at the needed times could be onerous.
>> One thing that occurs to me is that gdb does do things like:
>>
>> Reading symbols from foo ... (work work work) done.
>> And if I do that on my standard monster benchmark (fortunately
>> I keep a ready-to-use copy lying around for experiments like this :-))
>> I see a long pause before "done." is printed.
>>
>> And lo and behold, if I apply your patch I see this:
>>
>> bash$ gdb -tui
>> (gdb) file foo<ret>
>>
>> At this point I've hit return but I don't see anything printed.
>>
>> pause pause pause
>>
>> and then finally I see all the output:
>>
>> Reading symbols from foo...done.
>> mumble ...
>> (gdb)
>
> Since stdout is line buffered by default (on Unix), if this is
> working when the TUI is disabled, then it must be because there's
> explicit gdb_flush(gdb_stdout) after "Reading symbols from foo..."
> is printed, right?
>
> Isn't the issue then that the TUI's implementation of
> gdb_flush (tui/tui-file.c) should be doing whatever it
> needs to flush the output? Should it be calling wrefresh
> if the file is gdb_stdout? If we do that, and change tui_puts like:
>
> - /* We could defer the following. */
> - wrefresh (w);
> - fflush (stdout);
> + if (c == '\n')
> + gdb_flush (gdb_stdout);
>
> would it work?
TBH I'm not entirely sure why the fflush (stdout) is there.
[There's another one in the file as well.]
There's a comment at the top of tui-io.c mentioning readline
needs some work w.r.t. stdout.
I don't know off hand if removing the fflush (stdout) will break anything,
but obviously in an ideal world it shouldn't be there.
So, yeah, it seems like gdb_flush for tui needs to do a wrefresh
(for gdb_stdout/stderr (/stdlog?))
I did some experimentation with pagination and "set height".
pagination does work, at least a little.
[The more I look into tui sources, and the more I play with tui,
the lower the bar I have for what I expect to work ...]
Do we need to do gdb_flush (gdb_stdout) if c == '\n'?
Normally in curses line buffering doesn't make any sense.
One paints the window and then does a refresh.
We want to add scrolling of the command line window on
top of that, but if the intent is for that to be handled by
gdb's standard set height mechanism (which could use
some TLC w.r.t. TUI), then the screen will be refreshed
at the "Type <return> to continue, ..." prompt.
I don't off hand know if TUI tries to give the user the
impression of scrolling if the user sets the height
to be larger than the physical command line window.
My impression is it doesn't.
And therefore, I think we don't need to do any call to
gdb_flush here. Could be missing something though.
next prev parent reply other threads:[~2015-01-07 18:00 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
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 [this message]
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=CADPb22RjhBGkbSjuFgGDy4qhRiXAcyaw_-DHdz4pY_-t42FJFQ@mail.gmail.com \
--to=dje@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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