aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2015-01-12 17:51:33 -0500
committerPatrick Palka <patrick@parcs.ath.cx>2015-01-12 17:51:33 -0500
commit08b13bdd82996fbd321111191d33233073584b98 (patch)
treef5d833239d3eb966967eefcf86d36f1322f18348 /gdb/event-top.c
parenta0a3b04c61d7aa79e265224540930cf4057acfb3 (diff)
downloadgdb-08b13bdd82996fbd321111191d33233073584b98.zip
gdb-08b13bdd82996fbd321111191d33233073584b98.tar.gz
gdb-08b13bdd82996fbd321111191d33233073584b98.tar.bz2
Append to input history file instead of overwriting it
This patch makes readline append new history lines to the GDB history file on exit instead of overwriting the entire history file on exit. This change allows us to run multiple simultaneous GDB sessions without having each session overwrite the added history of each other session on exit. Care must be taken to ensure that the history file doesn't get corrupted when multiple GDB processes are trying to simultaneously append to and then truncate it. Safety is achieved in such a situation by using an intermediate local history file to mutually exclude multiple processes from simultaneously performing write operations on the global history file. gdb/ChangeLog: * top.h (gdb_add_history): Declare. * top.c (command_count): New variable. (gdb_add_history): New function. (gdb_safe_append_history): New static function. (quit_force): Call it. (command_line_input): Use gdb_add_history instead of add_history. * event-top.c (command_line_handler): Likewise.
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 13ddee2..bbda5dc 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -667,7 +667,7 @@ command_line_handler (char *rl)
/* Add line to history if appropriate. */
if (*linebuffer && input_from_terminal_p ())
- add_history (linebuffer);
+ gdb_add_history (linebuffer);
/* Note: lines consisting solely of comments are added to the command
history. This is useful when you type a command, and then