aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2015-06-04 10:12:27 -0400
committerPatrick Palka <patrick@parcs.ath.cx>2015-06-17 09:41:58 -0400
commit2093d2d31460dc351145c4c295ea4a101e0c5aed (patch)
treeff662aecdbaeaec4f35f60a3805ab72a339ca912 /gdb/top.c
parent1256987795a7f61826c0e5cc2ee023a579bb0a80 (diff)
downloadgdb-2093d2d31460dc351145c4c295ea4a101e0c5aed.zip
gdb-2093d2d31460dc351145c4c295ea4a101e0c5aed.tar.gz
gdb-2093d2d31460dc351145c4c295ea4a101e0c5aed.tar.bz2
Don't truncate the history file when history size is unlimited
We still do not handle "set history size unlimited" correctly. In particular, after writing to the history file, we truncate the history even if it is unlimited. This patch makes sure that we do not call history_truncate_file() if the history is not stifled (i.e. if it's unlimited). This bug causes the history file to be truncated to zero on exit when one has "set history size unlimited" in their gdbinit file. Although this code exists in GDB 7.8, the bug is masked by a pre-existing bug that's been only fixed in GDB 7.9 (PR gdb/17820). gdb/ChangeLog: * top.c (gdb_safe_append_history): Do not call history_truncate_file if the history is not stifled. gdb/testsuite/ChangeLog: * gdb.base/gdbinit-history.exp: Add test case to check that an unlimited history file does not get truncated on exit.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 74e1e07..f8f926b 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -941,7 +941,8 @@ gdb_safe_append_history (void)
else
{
append_history (command_count, local_history_filename);
- history_truncate_file (local_history_filename, history_max_entries);
+ if (history_is_stifled ())
+ history_truncate_file (local_history_filename, history_max_entries);
}
ret = rename (local_history_filename, history_filename);