This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: fix in features/Makefile
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 06 Oct 2008 14:36:39 -0600
- Subject: Re: RFA: fix in features/Makefile
- References: <m3prnycmh4.fsf@fleche.redhat.com> <20080824223751.GB7324@caradoc.them.org> <m3sksuarmn.fsf@fleche.redhat.com> <20080825023538.GA20039@caradoc.them.org> <m3myj1bv28.fsf@fleche.redhat.com> <20080825121201.GA17122@caradoc.them.org>
- Reply-to: tromey at redhat dot com
>>>>> "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);