diff options
author | Patrick Palka <patrick@parcs.ath.cx> | 2015-01-12 17:51:33 -0500 |
---|---|---|
committer | Patrick Palka <patrick@parcs.ath.cx> | 2015-01-12 17:51:33 -0500 |
commit | 08b13bdd82996fbd321111191d33233073584b98 (patch) | |
tree | f5d833239d3eb966967eefcf86d36f1322f18348 /gdb/top.h | |
parent | a0a3b04c61d7aa79e265224540930cf4057acfb3 (diff) | |
download | gdb-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/top.h')
-rw-r--r-- | gdb/top.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -79,6 +79,8 @@ extern int history_expansion_p; extern int server_command; extern char *lim_at_start; +extern void gdb_add_history (const char *); + extern void show_commands (char *args, int from_tty); extern void set_history (char *, int); |