public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: Re: [PATCH] Pass stream to remote_console_output
Date: Fri, 10 May 2024 12:01:11 +0100	[thread overview]
Message-ID: <87zfsyq6bs.fsf@redhat.com> (raw)
In-Reply-To: <20240506211035.1751940-1-tromey@adacore.com>

Tom Tromey <tromey@adacore.com> writes:

> I noticed that remote_target::rcmd did not pass its ui_file argument
> down to remote_console_output.  This patch fixes this oversight.

LGTM.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

> ---
>  gdb/remote.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 55069559a60..6e568eb47b2 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -1521,7 +1521,7 @@ static ptid_t read_ptid (const char *buf, const char **obuf);
>  
>  static bool remote_read_description_p (struct target_ops *target);
>  
> -static void remote_console_output (const char *msg);
> +static void remote_console_output (const char *msg, ui_file *stream);
>  
>  static void remote_btrace_reset (remote_state *rs);
>  
> @@ -1750,7 +1750,10 @@ remote_target::remote_get_noisy_reply ()
>  	    }
>  	}
>        else if (buf[0] == 'O' && buf[1] != 'K')
> -	remote_console_output (buf + 1);	/* 'O' message from stub */
> +	{
> +	  /* 'O' message from stub */
> +	  remote_console_output (buf + 1, gdb_stdtarg);
> +	}
>        else
>  	return buf;		/* Here's the actual reply.  */
>      }
> @@ -7642,7 +7645,7 @@ remote_target::terminal_ours ()
>  }
>  
>  static void
> -remote_console_output (const char *msg)
> +remote_console_output (const char *msg, ui_file *stream)
>  {
>    const char *p;
>  
> @@ -7653,9 +7656,9 @@ remote_console_output (const char *msg)
>  
>        tb[0] = c;
>        tb[1] = 0;
> -      gdb_stdtarg->puts (tb);
> +      stream->puts (tb);
>      }
> -  gdb_stdtarg->flush ();
> +  stream->flush ();
>  }
>  
>  /* Return the length of the stop reply queue.  */
> @@ -8583,7 +8586,7 @@ remote_target::wait_ns (ptid_t ptid, struct target_waitstatus *status,
>  	    warning (_("Remote failure reply: %s"), rs->buf.data ());
>  	    break;
>  	  case 'O':		/* Console output.  */
> -	    remote_console_output (&rs->buf[1]);
> +	    remote_console_output (&rs->buf[1], gdb_stdtarg);
>  	    break;
>  	  default:
>  	    warning (_("Invalid remote reply: %s"), rs->buf.data ());
> @@ -8717,7 +8720,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
>  	    break;
>  	  }
>  	case 'O':		/* Console output.  */
> -	  remote_console_output (buf + 1);
> +	  remote_console_output (buf + 1, gdb_stdtarg);
>  	  break;
>  	case '\0':
>  	  if (rs->last_sent_signal != GDB_SIGNAL_0)
> @@ -11993,7 +11996,8 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf)
>        buf = rs->buf.data ();
>        if (buf[0] == 'O' && buf[1] != 'K')
>  	{
> -	  remote_console_output (buf + 1); /* 'O' message from stub.  */
> +	  /* 'O' message from stub.  */
> +	  remote_console_output (buf + 1, outbuf);
>  	  continue;
>  	}
>        packet_result result = packet_check_result (buf, false);
> -- 
> 2.44.0


      parent reply	other threads:[~2024-05-10 11:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 21:10 Tom Tromey
2024-05-08 15:21 ` Ciaran Woodward
2024-05-10 11:01 ` Andrew Burgess [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=87zfsyq6bs.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.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).