diff options
author | Patrick Palka <patrick@parcs.ath.cx> | 2015-06-04 10:12:27 -0400 |
---|---|---|
committer | Patrick Palka <patrick@parcs.ath.cx> | 2015-06-17 09:41:58 -0400 |
commit | 2093d2d31460dc351145c4c295ea4a101e0c5aed (patch) | |
tree | ff662aecdbaeaec4f35f60a3805ab72a339ca912 /gdb/top.c | |
parent | 1256987795a7f61826c0e5cc2ee023a579bb0a80 (diff) | |
download | gdb-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |