summaryrefslogtreecommitdiffstats
path: root/gdb/top.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2011-01-13 23:01:10 +0000
committerJoel Brobecker <brobecker@gnat.com>2011-01-13 23:01:10 +0000
commitde8fa76c44b010437d7ceafd20e2b0fb0d47e961 (patch)
tree6914ffbd14469b1b7550eac0e9628080370bddb5 /gdb/top.c
parent7f71cd9831d9f2272b67a259ddc9293d637cf15c (diff)
downloadppe42-binutils-de8fa76c44b010437d7ceafd20e2b0fb0d47e961.tar.gz
ppe42-binutils-de8fa76c44b010437d7ceafd20e2b0fb0d47e961.zip
problem sourcing GDB script in interactive-mode on
When interactive-mode is not auto, GDB always uses that setting to determine whether to act as if the input stream is a terminal or not. However, this setting should only be honored if the input stream is the standard input stream. Otherwise, we run into trouble while source-ing a GDB script, as shown below (on x86_64-linux): % cat script print 1 print 2 % gdb -q (gdb) set interactive-mode on (gdb) source script (gdb) print 3 $1 = 3 The lack of output and the fact that the "print 3" command returned a value saved in $1 (as opposed to $3) indicates that the script was not even evaluated at all. gdb/ChangeLog: * top.c (input_from_terminal_p): Restrict the use of interactive_mode to the case where instream is stdin. gdb/testsuite/ChangeLog: * gdb.base/interact.exp: New testcase.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/top.c b/gdb/top.c
index d974897ec9..bba1a2ddf5 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1292,7 +1292,7 @@ show_interactive_mode (struct ui_file *file, int from_tty,
int
input_from_terminal_p (void)
{
- if (interactive_mode != AUTO_BOOLEAN_AUTO)
+ if (interactive_mode != AUTO_BOOLEAN_AUTO && instream == stdin)
return interactive_mode == AUTO_BOOLEAN_TRUE;
if (batch_flag)
OpenPOWER on IntegriCloud