public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gdcproject.org>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Pedro Alves <palves@redhat.com>
Subject: Re: [PATCH v2 1/3] gdb: Rename gdb_flush to ui_file_flush.
Date: Fri, 07 Aug 2020 23:01:37 +0200	[thread overview]
Message-ID: <1596833341.t1ehhpwvpi.astroid@galago.none> (raw)
In-Reply-To: <20191129005420.GF3410@embecosm.com>

Excerpts from Andrew Burgess's message of November 29, 2019 1:54 am:
> * Iain Buclaw <ibuclaw@gdcproject.org> [2019-11-28 23:53:48 +0000]:
> 
>> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>> On Wednesday, 27 November 2019 00:00, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>>
>> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>> > On Tuesday, 26 November 2019 21:24, Pedro Alves palves@redhat.com wrote:
>> >
>> > > On 11/26/19 12:49 PM, Iain Buclaw wrote:
>> > >
>> > > > The significance of this is that printf_unfiltered writes messages to wrap_buffer, whereas puts_unfiltered pushes them immediately to stdout, resulting in "post-" messages being printed out of order.
>> > >
>> > > It sounds quite surprising that two _unfiltered functions could behave differently
>> > > like that. That sounds like a bug that should be fixed, instead of worked around
>> > > by having to recall to use printf vs puts.
>> > > Thanks,
>> > > Pedro Alves
>> >
>> > I think the best way to avoid the discrepancy is to treat both fputs_filtered and fputs_unfiltered equally by forwarding both calls to fputs_maybe_filtered.
>> >
>> > To avoid recursion, flush_wrap_buffer and fputs_maybe_filtered have had calls to fputs_unfiltered replaced with stream->puts().
>> >
>> > While attempting to grok my head around fputs_maybe_filtered, I also noticed that buffer_clearer is being removed by the compiler as dead code.
>> >
>>
>> Except that doesn't work as some parts of gdb require that direct
>> writing/flushing stdout is kept in place, so what I ultimately ended
>> up doing is defining two new functions for this, then repurposing
>> fputs_unfiltered and gdb_flush to interact with
>> fputs_maybe_unfiltered.
>>
>> I've split the patch into two logical parts, each dealing with one function at a time.  Running the testsuitelocally, I can see no new regressions as a result of applying this.
>>
>> This first patch renames gdb_flush to ui_file_flush.  Redefining gdb_flush in utils.c, with a new behaviour to flush the wrap_buffer if necessary before flushing the stream.
>>
>> --
>> Iain
>>
>> ---
>> gdb/ChangeLog:
>>
>> 2019-11-28  Iain Buclaw  <ibuclaw@gdcproject.org>
>>
>>         * gdb/event-loop.c (gdb_wait_for_event): Update.
>>         * gdb/printcmd.c (printf_command): Update.
>>         * gdb/remote-fileio.c (remote_fileio_func_write): Update.
>>         * gdb/remote-sim.c (gdb_os_flush_stdout): Update.
>>         (gdb_os_flush_stderr): Update.
>>         * gdb/remote.c (remote_console_output): Update.
>>         * gdb/ui-file.c (gdb_flush): Rename to...
>>         (ui_file_flush): ...this.
>>         (stderr_file::write): Update.
>>         (stderr_file::puts): Update.
>>         * gdb/ui-file.h (gdb_flush): Rename to...
>>         (ui_file_flush): ...this.
>>         * gdb/utils.c (gdb_flush): Add function.
>>         * gdb/utils.h (gdb_flush): Add declaration.
> 
> Iain,  thanks for looking at this issue.
> 
> When posting patches for review you should include the commit message
> for review too.  This should consist of a concise but informative
> title, a description of the problem, maybe how you discovered it, or
> what problems it was causing, and then an overview of the solution.
> 

Hi Andrew,

Sorry, I've been awfully held up with matters out of my own hands, and
eventually enough time passed that this message fell through the cracks.

Refamiliarizing myself with what I wrote, I've noticed that its already
been committed.  Though I don't think it was I who pushed it.

http://sourceware.org/git/?p=binutils-gdb.git;a=log;h=899016d49d289757372459f72d642a4c6b3b7732

Is there anything left for me to address here?

Iain.

      reply	other threads:[~2020-08-07 21:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 23:53 Iain Buclaw
     [not found] ` <K0ZQfQbER-xf_F_fvM9b0dOB8zR9XB2iEJys8P5WafAOB79fr4BK7Uv8mi0vFrcncFRQg2gtqQOjIZadT-LYTQ==@protonmail.internalid>
2019-11-29  0:54 ` Andrew Burgess
2020-08-07 21:01   ` Iain Buclaw [this message]

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=1596833341.t1ehhpwvpi.astroid@galago.none \
    --to=ibuclaw@gdcproject.org \
    --cc=andrew.burgess@embecosm.com \
    --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).