public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Jonathan Larmour <jlarmour@redhat.co.uk>
Cc: insight@sourceware.cygnus.com, gdb@sourceware.cygnus.com
Subject: Re: Insight remote output doesn't output to console window immediately
Date: Thu, 13 Apr 2000 16:53:00 -0000	[thread overview]
Message-ID: <38F65D4D.8B390EFA@cygnus.com> (raw)
In-Reply-To: <38F6404E.5959A4E0@redhat.co.uk>

Jonathan Larmour wrote:
> 
> [ Sent to gdb and insight lists since ]
> 
> I've found a problem in insight that is surprisingly old - I can't imagine
> how it's lived so long actually: output from a remote target doesn't get
> sent to the console window as it arrives. Instead it is buffered up.
> 
> I believe the problem is because of Cagney's change to remote.c on July 2nd
> 1999 which changed remote_console_output to operate on the gdb_stdtarg
> stream rather than gdb_stdout. But, in main.c, gdb_stdtarg is #defined to
> gdb_stderr. Which means that it matches the following code in
> gdbtk/generic/gdbtk-hooks.c in gdbtk_fputs():

Yes, most likely :-(

>   if (result_ptr != NULL)
>     {
>       if (result_ptr->flags & GDBTK_TO_RESULT)
> ...
>       else if (stream == gdb_stderr || result_ptr->flags &
> GDBTK_ERROR_ONLY)
>         {
>           if (result_ptr->flags & GDBTK_ERROR_STARTED)
>             Tcl_AppendToObj (result_ptr->obj_ptr, (char *) ptr, -1);
>           else
>             {
>               Tcl_SetStringObj (result_ptr->obj_ptr, (char *) ptr, -1);
>               result_ptr->flags |= GDBTK_ERROR_STARTED;
>             }
> 
> i.e. it is appended to result_ptr, rather than calling gdbtk_tcl_fputs to
> display it in the console window.
> 
> The only thing I'm wondering about is the fix. We could #define gdb_stdtarg
> to gdb_stdout instead. Or we could add a hook with set_ui_file_flush() so
> that the "gdb_flush (gdb_stdtarg);" at the end of remote_console_output()
> would do the right thing. I simply don't know which is the more correct fix
> before I implement it, although I suspect the latter.

There is no need for another hook.  Even the existing hooks
(gdbtk_fputs() and gdbtk_flush()) can, in theory, deleted.  To see how
it should work, check the MI (mi/mi-main.c) - it maintains a separate
stream.

(BTW, sending the output gdb_stdout is wrong in CLI mode. gdb_stdout is
paged.  Having ``more ....'' appear part way through target output in
CLI mode is only a little less frustrating than delayed output in GUI
mode :-)


As for a quick hack?

My first guess is to, when the GUI is enabled (ie not CLI mode),
re-route gdb_stdtarg to gdb_stdout.  That might be suitable for the
branch.  However, the trunk, needs to start taking advantage of ``struct
ui_out''.

	Andrew

  reply	other threads:[~2000-04-13 16:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-13 14:46 Jonathan Larmour
2000-04-13 16:53 ` Andrew Cagney [this message]
2000-04-13 16:56   ` James Ingham
2000-04-13 18:36   ` Jonathan Larmour
2000-04-13 18:54     ` James Ingham
2000-04-13 19:49       ` Jonathan Larmour
2000-04-14  8:53         ` James Ingham
2000-04-17 13:07           ` Jonathan Larmour
2000-04-17 13:15             ` James Ingham

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=38F65D4D.8B390EFA@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb@sourceware.cygnus.com \
    --cc=insight@sourceware.cygnus.com \
    --cc=jlarmour@redhat.co.uk \
    /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).