Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Pedro Alves <palves@redhat.com>
Cc: Marc Khouzam <marc.khouzam@ericsson.com>, gdb@sourceware.org
Subject: Re: Is there a way to unset inferior-tty?
Date: Sat, 02 Jul 2016 01:29:00 -0000	[thread overview]
Message-ID: <9560791fd070c79f7ab54e5e7b63d433@simark.ca> (raw)
In-Reply-To: <302246af-a394-4a76-5223-5cac924bda9a@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

On 2016-07-01 14:51, Pedro Alves wrote:
> I think this should just be fixed to work.
> 
> The fix should be very similar to this:
> 
> 
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=811a659a779fdf93293fe1105d99e9db171a8b68
> 
> Thanks,
> Pedro Alves

Hi Marc,

Here's a patch.  If you like it I'll submit it to gdb-patches with 
ChangeLog and all.

That made me realize there is an alias for this, you can use "tty 
/dev/pts/X", which is equivalent to "set inferior-tty /dev/pts/X".  
There, I just saved you about 1 hour of typing per day :).

Simon

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-resetting-an-empty-inferior-tty.patch --]
[-- Type: text/x-diff; name=0001-Allow-resetting-an-empty-inferior-tty.patch, Size: 1786 bytes --]

From 139d8e7ccc24e0efaa84ad9424f318d55dfe9eea Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Fri, 1 Jul 2016 21:23:28 -0400
Subject: [PATCH] Allow resetting an empty inferior-tty

This patch allows the user to set the inferior-tty to "empty", in order
to come back to the default behaviour of using the same tty as gdb is
using.
---
 gdb/infcmd.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 58ba1cb..97a1e35 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -151,7 +151,11 @@ void
 set_inferior_io_terminal (const char *terminal_name)
 {
   xfree (current_inferior ()->terminal);
-  current_inferior ()->terminal = terminal_name ? xstrdup (terminal_name) : 0;
+
+  if (terminal_name != NULL && strlen (terminal_name) > 0)
+    current_inferior ()->terminal = xstrdup (terminal_name);
+  else
+    current_inferior ()->terminal = NULL;
 }
 
 const char *
@@ -3224,14 +3228,14 @@ _initialize_infcmd (void)
   const char *cmd_name;
 
   /* Add the filename of the terminal connected to inferior I/O.  */
-  add_setshow_filename_cmd ("inferior-tty", class_run,
-			    &inferior_io_terminal_scratch, _("\
+  add_setshow_optional_filename_cmd ("inferior-tty", class_run,
+				     &inferior_io_terminal_scratch, _("\
 Set terminal for future runs of program being debugged."), _("\
 Show terminal for future runs of program being debugged."), _("\
 Usage: set inferior-tty /dev/pts/1"),
-			    set_inferior_tty_command,
-			    show_inferior_tty_command,
-			    &setlist, &showlist);
+				     set_inferior_tty_command,
+				     show_inferior_tty_command,
+				     &setlist, &showlist);
   add_com_alias ("tty", "set inferior-tty", class_alias, 0);
 
   cmd_name = "args";
-- 
2.9.0


  reply	other threads:[~2016-07-02  1:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01 18:32 Marc Khouzam
2016-07-01 18:51 ` Pedro Alves
2016-07-02  1:29   ` Simon Marchi [this message]
2016-07-02 14:04     ` Marc Khouzam
2016-07-26 18:43       ` Bob Rossi
2016-07-26 19:22         ` Marc Khouzam
2016-07-26 19:32           ` Bob Rossi
2016-08-11 14:22             ` Bob Rossi
2016-08-11 17:41               ` Pedro Alves
     [not found]       ` <875b0391-3b94-c3d7-c829-a8c3abb00770@redhat.com>
2016-08-15 19:49         ` Marc Khouzam
2016-08-17 12:14           ` Pedro Alves
2016-08-17 14:07             ` Marc Khouzam
2016-08-11 17:00     ` Pedro Alves

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=9560791fd070c79f7ab54e5e7b63d433@simark.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    --cc=palves@redhat.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