This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: fix in features/Makefile


>>>>> "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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]