Append to input history file instead of overwriting it
authorPatrick Palka <patrick@parcs.ath.cx>
Mon, 12 Jan 2015 22:51:33 +0000 (17:51 -0500)
committerPatrick Palka <patrick@parcs.ath.cx>
Mon, 12 Jan 2015 22:51:33 +0000 (17:51 -0500)
commit08b13bdd82996fbd321111191d33233073584b98
treef5d833239d3eb966967eefcf86d36f1322f18348
parenta0a3b04c61d7aa79e265224540930cf4057acfb3
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.
gdb/ChangeLog
gdb/event-top.c
gdb/top.c
gdb/top.h
This page took 0.039185 seconds and 4 git commands to generate.