public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdb/testsuite: capture GDB tty name in default_gdb_spawn
Date: Wed, 09 Jun 2021 09:09:08 -0600	[thread overview]
Message-ID: <874ke7jcrv.fsf@tromey.com> (raw)
In-Reply-To: <20210608212126.1673188-1-simon.marchi@polymtl.ca> (Simon Marchi via Gdb-patches's message of "Tue, 8 Jun 2021 17:21:26 -0400")

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> gdb/ChangeLog:

Simon> 	* lib/gdb.exp (default_gdb_exit): Unset gdb_tty_name.
Simon> 	(spawn_capture_tty_name): New.
Simon> 	(default_gdb_spawn): Capture GDB's TTY name.
Simon> 	* lib/tuiterm.exp (tuiterm_spawn): Remove.
Simon> 	(tuiterm_env_init, tuiterm_env_finish): Remove spawn override.
Simon> 	(Term) <resize>: Use new variable name.
Simon> 	(tuiterm_env_init, tuiterm_env_finish): Remove.
Simon> 	(tuiterm_env): Don't call tuiterm_env_init and register
Simon> 	tuiterm_env_finish in gdb_finish_hooks.
Simon> 	(gdb_finish_hooks): Remove.
Simon> 	(gdb_finish): Don't call finish hooks.

This looks good to me.

Simon> +    # Capture GDB's TTY name, so we can save it below.
Simon> +    rename spawn builtin_spawn
Simon> +    rename spawn_capture_tty_name spawn
Simon> +    set code [catch {uplevel 1 {
Simon> +        remote_spawn host "$::GDB $::INTERNAL_GDBFLAGS $::GDBFLAGS [host_info gdb_opts]"
Simon> +    }} res]
Simon> +    rename spawn spawn_capture_tty_name
Simon> +    rename builtin_spawn spawn
Simon> +
Simon> +    # If remote_spawn threw an error, propagate it.
Simon> +    if { $code == 1 } {
Simon> +	return -code $code -errorinfo $::errorInfo -errorcode $::errorCode $res
Simon> +    }

It would be simpler to just always rename+wrap spawn, and then only
stash the result in this particular case.  However, it's also fine this
way.

Tom

  reply	other threads:[~2021-06-09 15:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 21:21 Simon Marchi
2021-06-09 15:09 ` Tom Tromey [this message]
2021-06-09 15:15   ` Simon Marchi
2021-06-09 15:42     ` Simon Marchi
2021-06-10 18:26       ` Tom Tromey
2021-06-10 18:32         ` Simon Marchi
2021-07-19 18:36           ` Bernd Edlinger
2021-07-19 18:53             ` Simon Marchi
2021-07-19 19:05               ` Bernd Edlinger
2021-07-20  5:14                 ` Simon Marchi
2021-07-20 20:28                   ` Bernd Edlinger
2021-07-21 19:54                     ` Bernd Edlinger

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=874ke7jcrv.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /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).