This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] [commit PR cli/16122] Unify interactivity tests to use input_from_terminal_p
- From: Muhammad Bilal <mbilal at codesourcery dot com>
- To: <palves at redhat dot com>, <gdb-patches at sourceware dot org>
- Cc: Muhammad Bilal <mbilal at codesourcery dot com>
- Date: Wed, 6 Nov 2013 12:55:41 +0500
- Subject: [PATCH] [commit PR cli/16122] Unify interactivity tests to use input_from_terminal_p
- Authentication-results: sourceware.org; auth=none
Hi Pedro,
On 08/13/2013 10:53 PM, Pedro Alves wrote:
> On 08/08/2013 06:17 AM, Muhammad Bilal wrote:
>>
>> Currently commands are added to gdb history with out checking the
>> interactive debugging
>> In this patch we are performing the interactivity tests to use
>> input_from_terminal_p.
>
> Previous I had said:
>
>> It'd be great to try that on
>> GNU/Linux, mingw32 gdb running under cmd.exe, and mingw32 gdb under
>> Cygwin bash, the latter with and without "set interactive-mode on".
>> I suspect this change would fix history for the forced
>> "set interactive-mode on" case too.
>
> Did you try any of that?
>
>
> This is OK if it doesn't regress the modes mentioned above.
>
Sorry, for late reply. I had busy on other projects.
I have tested above mentioned cases in GNU/Linux, gdb under Cygwin and cmd.exe
Please find Below some test casees.
* Below case touches the history file in Cygwin, cmd.exe and Linux/gnu.
./gdb -ex "set interactive-mode on" < NUL or /dev/null/ (linux)
* Below case does not touch the history file
./gdb -ex "show history filename" < NUL or /dev/null
Below is what I committed with new PR cli/16122 instead of PR gdb/15224.
---
gdb/ChangeLog | 7 +++++++
gdb/event-top.c | 3 +--
gdb/top.c | 3 +--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c252138..e721f02 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2013-11-06 Muhammad Bilal <mbilal@codesourcery.com>
+
+ PR cli/16122
+ * top.c (command_line_input): Unify interactivity tests to use
+ input_from_terminal_p.
+ * event-top.c (command_line_handler): Likewise.
+
2013-11-06 Yao Qi <yao@codesourcery.com>
* Makefile.in (check-perf): New target.
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 1f2e6fb..1290dd0 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -606,8 +606,7 @@ command_line_handler (char *rl)
*p = 0;
/* Add line to history if appropriate. */
- if (instream == stdin
- && ISATTY (stdin) && *linebuffer)
+ if (*linebuffer && input_from_terminal_p ())
add_history (linebuffer);
/* Note: lines consisting solely of comments are added to the command
diff --git a/gdb/top.c b/gdb/top.c
index c473d8c..7d928e1 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1061,8 +1061,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
*p = 0;
/* Add line to history if appropriate. */
- if (instream == stdin
- && ISATTY (stdin) && *linebuffer)
+ if (*linebuffer && input_from_terminal_p ())
add_history (linebuffer);
/* Note: lines consisting solely of comments are added to the command
--
1.7.9.5