public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Pedro Alves <palves@redhat.com>,
	gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Speed up "gdb -tui" output
Date: Wed, 07 Jan 2015 18:09:00 -0000	[thread overview]
Message-ID: <CADPb22QqTE+yq9RSRmvBiu0tdy++8S40D8xzKi6k8nLYmiN48g@mail.gmail.com> (raw)
In-Reply-To: <83mw5u79t7.fsf@gnu.org>

On Wed, Jan 7, 2015 at 9:57 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 07 Jan 2015 15:17:54 +0000
>> From: Pedro Alves <palves@redhat.com>
>> CC: gdb-patches <gdb-patches@sourceware.org>
>>
>> > 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?
>
> Yes.
>
>> 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?
>
> Maybe.  I already made that change in my sandbox.  Alas, that's just
> the tip of the iceberg.  We call single-character output functions,
> like putchar and fputc all over the place, implicitly assuming that in
> certain cases (e.g., when the stream is stderr), things are unbuffered
> and the output appears immediately.  On top of that, functions that
> output strings go through single-character output versions, so there's
> no easy way of saying on, say, utils.c level whether the character
> should or shouldn't appear immediately. It's a terrible mess.
>
>> Should it be calling wrefresh if the file is gdb_stdout?
>
> Only if that stream is a real file, not a string or whatever else we
> support in ui-file.

tui_file_flush only gets called for tui files, so no worries there.

Though I see tui also has its own ui file strings (tui_sfileopen).
That can go I think.

>
>> 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?
>
> No, it's not enough.  There's also gdb_stderr and gdb_stdlog, at
> least. (tui_puts doesn't get the stream as its argument, so it
> doesn't really know which stream it is serving.)  I'm trying to make
> heads or tails out of this, but I'm not there yet.

Sure, but it does suggest tui_puts is the wrong place to do
any kind of flushing/refreshing.
Fortunately, tui_puts is internal to tui.

  reply	other threads:[~2015-01-07 18:09 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 [this message]
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=CADPb22QqTE+yq9RSRmvBiu0tdy++8S40D8xzKi6k8nLYmiN48g@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).