public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <kseitz@firetalk.com>
To: Nicholas_Karagas@cirilium.com
Cc: insight@sourceware.cygnus.com
Subject: Re: prompt in console window
Date: Thu, 15 Jun 2000 06:11:00 -0000	[thread overview]
Message-ID: <3948D5E8.E74F21FE@firetalk.com> (raw)
In-Reply-To: <OF14E7EA77.DC16752A-ON072568FE.006D40EF@cirilium.com>

Nicholas_Karagas@cirilium.com wrote:
> 
> Hello, Insight gurus...
> 
> I've recently come across a problem using the console window in Insight.
> In ordinary GDB, if the number of lines printed exceeds the 'height'
> parameter, then the debugger will issue the prompt '---Type <return> to
> continue, or q <return> to quit---'.  However, this apparently doesn't work
> in the Insight console, as the call to readline (readline.c:337) from
> prompt_for_continue (utils.c:1619) always returns 0x0, and never shows the
> prompt in the console window.  I imagine that this is because readline
> expects everything to be going to and from stdout (since it doesn't require
> a stream as a parameter).  Is there a quick fix for this that doesn't
> involve fiddling with readline, and therefore binutils (I think that's
> where it lives)?  Thanks in advance.

Ugh. Don't even ask. This is very nasty, and not particularly useful in
a GUI, anyway (IMO). That's why man invented scrollbars. O:-)

The trick that Insight uses to turn this off is "set height 0", which
tells gdb that the window height is zero lines high. This can be
overridden by setting it to some number, but I just tried it in a recent
snapshot, and it did exactly what I thought it would: it works as
expected, but the message "---Type <return>..." appears in the
controlling terminal, not in the console window. (Which reminds me, why
haven't we closed stdout???) This happens because this message is passed
to readline to handle, and readline doesn't understand how to use the
GUI's printing streams. In order for anything to show up in the GUI, all
output MUST pass through fputs_unfiltered, which is hooked. This
function is called by all of gdb's printf_unfiltered/filtered commands.
(So if anyone happens to see a "printf" or "fprintf" or "putc" or "puts"
or anything like them without "_unfiltered" or "_filtered" in gdb, it's
a bug.)

We could hack readline to take an input/output hook, but when we
upgraded to the lastest version of readline, we really wanted to avoid
any hacking. I suspect this could be done, but I've not taken a good,
serious look at readline.

Of course, the console window could be modified to do this, too. It
probably wouldn't be too difficult, either, but it would not qualify as
"quick". Use ConsoleWin::insert to count the number of lines inserted,
when it hits some maximum, output the prompt, wait for the keypress,
etc. The trick, though, is that many internal messages/errors are sent
to the console. One must be certain that we are processing user input
when we do this (so set some flag saying it's okay to do this in
ConsoleWin::invoke). That part would be quick, but hooking it all up to
the preferences dialog and all the little nitpicks (adding online
documentation for it) can be too easily overlooked.

Keith
-- 
Why chat when you can Firetalk?
Firetalk ID: Keith (10320)
www.firetalk.com

  reply	other threads:[~2000-06-15  6:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-14 13:02 Nicholas_Karagas
2000-06-15  6:11 ` Keith Seitz [this message]
2000-06-15 10:29   ` Jim Ingham
2000-06-15 10:42     ` Keith Seitz
2000-06-15 10:11 Nicholas_Karagas
2000-06-15 10:35 ` Jim 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=3948D5E8.E74F21FE@firetalk.com \
    --to=kseitz@firetalk.com \
    --cc=Nicholas_Karagas@cirilium.com \
    --cc=insight@sourceware.cygnus.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).