Re: [PATCH 2/7] PR gdb/15224 fix for Unify interactivity tests to use input_from_terminal_p

mbilal
2013-05-09T11:08:32Z

On Wednesday, May 08, 2013 9:22 PM Pedro Alves wrote:

>I'd guess that input_from_terminal_p already does some of the
>checks this is also making, so that this could be simplified.

I don't think that because input_from_terminal_p
checks the condition instream==stdin that
is equal in both sanario , but input_from_terminal_p
also return 1 when instream==NULL.
So I think that there is no any condition that is overlapping with
input_from_terminal_p.

>Missing space before parens.

fixed.

>A ChangeLog entry is missing.

fixed.

Please find updated patch.

Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.94
diff -u -p -r1.94 event-top.c
--- event-top.c 21 Mar 2013 17:37:29 -0000 1.94
+++ event-top.c 9 May 2013 10:23:21 -0000
@@ -604,7 +604,8 @@ command_line_handler (char *rl)

/* Add line to history if appropriate. */
if (instream == stdin
- && ISATTY (stdin) && *linebuffer)
+ && ISATTY (stdin) && *linebuffer
+ && input_from_terminal_p ())
add_history (linebuffer);
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.15497
diff -u -p -r1.15497 ChangeLog
--- ChangeLog 1 May 2013 14:54:18 -0000 1.15497
+++ ChangeLog 9 May 2013 10:28:41 -0000
@@ -1,3 +1,9 @@
+2013-05-09 Muhammad Bilal <mbilal@codesourcery.com>
+
+ PR gdb/15224
+ * event-top.c (command_line_handler): Use input_from_terminal_p
condition
+ for add line to history.
+
2013-05-01 Joel Brobecker <brobecker@adacore.com>

* darwin-nat.c (darwin_read_write_inferior): Change types