[PATCH 3/7] PR gdb/15224 should "set history save on" by default

mbilal
2013-05-06T09:43:37Z

On Wednesday, April 03, 2013 7:30 PM Jan Kratochvil wrote:

> (3) Fix currently incorrectly touched history file even if no
commands get

here is patch

Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.235
diff -u -p -r1.235 top.c
--- top.c 17 Apr 2013 01:02:02 -0000 1.235
+++ top.c 6 May 2013 06:16:04 -0000
@@ -1430,7 +1430,8 @@ quit_force (char *args, int from_tty)
/* Save the history information if it is appropriate to do so. */
DO_TRY
{
- if (write_history_p && history_filename)
+ if (write_history_p && history_filename
+ && input_from_terminal_p())
write_history (history_filename);
}
DO_PRINT_EX;

I have tested

$ ls -als ~/gdb_history
0 -rw-rw-r-- 1 mbilal mbilal 0 May 6 13:12 /home/mbilal/gdb_history
$ date
Mon May 6 13:16:09 PKT 2013
$ ./gdb-cvs/src/gdb/gdb gdb -ex "set history filename ~/gdb_history" <
/dev/null
GNU gdb (GDB) 7.6.50.20130503-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/bin/gdb...done.
(gdb) quit
$ ls -als ~/gdb_history
0 -rw-rw-r-- 1 mbilal mbilal 0 May 6 13:12 /home/mbilal/gdb_history

Thanks,
-Bilal