mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 13:23:00 +08:00
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.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user