public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH] [gdb/testsuite] Remove Term::command_no_prompt_prefix
Date: Wed, 21 Jun 2023 15:35:30 +0200	[thread overview]
Message-ID: <8efaccce-ef77-125f-d52b-2ec0146fc427@suse.de> (raw)
In-Reply-To: <20230609072605.2327-1-tdevries@suse.de>

On 6/9/23 09:26, Tom de Vries via Gdb-patches wrote:
> Say we run test-case gdb.tui/basic.exp.  It calls Term::enter_tui, which does:
> ...
> 	command_no_prompt_prefix "tui enable"
> ...
> 
> The proc command_no_prompt_prefix is documented as:
> ...
>      # As proc command, but don't wait for an initial prompt.  This is used for
>      # initial terminal commands, where there's no prompt yet.
> ...
> 
> Indeed, before the "tui enable" command, the tuiterm is empty, so there is no
> prompt.
> 
> The reason that there is no prompt, is that:
> - in order for tuiterm to show something, its input processing procs need to
>    be called, and
> - the initial gdb prompt, and subsequent prompts generated by gdb_test-style
>    procs, are all consumed by those procs instead.
> 
> This is in principle not a problem, but the absence of a prompt makes a
> tuiterm session look less like a session on an actual xterm.
> 
> Fix this by using a new proc gen_prompt, that:
> - generates a prompt using ^C (though also something like echo \n would work)
> - consumes the response before the prompt using gdb_expect
> - consumes the prompt using Term::wait_for "".
> 
> A fix was necessary to Term::wait_for, to make sure that Term::wait_for ""
> consumes just one prompt.
> 
> This allows us to use the regular proc command instead:
> ...
>          gen_prompt
> 	command "tui enable"
> ...
> such that we have in tuiterm:
> ...
> (gdb) tui enable
> ...
> instead of:
> ...
> tui enable
> ...
> 
> Fix all uses of command_no_prompt_prefix, and remove it.
> 

I split up the patch in two parts (one separate patch for the change in 
Term::wait_for), and rather than removing command_no_prompt_prefix, 
reimplemented it.  Committed, and posted here:
- https://sourceware.org/pipermail/gdb-patches/2023-June/200422.html
- https://sourceware.org/pipermail/gdb-patches/2023-June/200423.html

Thanks,
- Tom





      reply	other threads:[~2023-06-21 13:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09  7:26 Tom de Vries
2023-06-21 13:35 ` Tom de Vries [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=8efaccce-ef77-125f-d52b-2ec0146fc427@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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).