Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: RFA: fix in features/Makefile
Date: Mon, 06 Oct 2008 20:39:00 -0000	[thread overview]
Message-ID: <m3d4ida2aw.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20080825121201.GA17122@caradoc.them.org> (Daniel Jacobowitz's message of "Mon\, 25 Aug 2008 08\:12\:01 -0400")

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

Daniel> Guess we shouldn't be initializing readline when stdout / stderr are
Daniel> not a terminal...

Here's one stab at a fix.

I built and regtested this on x86-64 (compile farm).  I also tried
rebuilding rs6000/rs6000.c before and after; this verified that before
the patch I get weird junk in the output, and after it works fine.

I wonder if this should be conditional on -batch, though, and not just
input_from_terminal_p.

Tom


2008-10-06  Tom Tromey  <tromey@redhat.com>

	* features/Makefile (%.c): Redirect gdb's stdin.
	* tui/tui.c (tui_initialize_readline): Return early if input is
	not from terminal.

diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index 9241e2a..aecf280 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -72,7 +72,8 @@ $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
 cfiles: $(CFILES)
 %.c: %.xml
 	$(GDB) -nx -q -batch \
-	  -ex "set tdesc filename $<" -ex 'maint print c-tdesc' > $@.tmp
+	  -ex "set tdesc filename $<" -ex 'maint print c-tdesc' \
+	  < /dev/null > $@.tmp
 	sh ../../move-if-change $@.tmp $@
 
 # Other dependencies.
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 9710141..e0e9760 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -309,6 +309,9 @@ tui_initialize_readline (void)
   int i;
   Keymap tui_ctlx_keymap;
 
+  if (!input_from_terminal_p ())
+    return;
+
   rl_initialize ();
 
   rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1);


      reply	other threads:[~2008-10-06 20:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-24 18:12 Tom Tromey
2008-08-24 22:38 ` Daniel Jacobowitz
2008-08-25  0:03   ` Tom Tromey
2008-08-25  2:36     ` Daniel Jacobowitz
2008-08-25  4:04       ` Tom Tromey
2008-08-25 12:12         ` Daniel Jacobowitz
2008-10-06 20:39           ` Tom Tromey [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=m3d4ida2aw.fsf@fleche.redhat.com \
    --to=tromey@redhat.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