I usually debug in console
gdb and now I'm trying to move to Emacs. In my
~/.gdbinit I have the following lines setting up history:
# save history of unlimited size, write always to ~/.gdb_history set history save on set history size unlimited set history filename ~/.gdb_history
And in console
gdb history works perfectly.
show history result there:
(gdb) show history +show history expansion: History expansion on command input is off. filename: The filename in which to record the command history is "/home/ars/. gdb_history". save: Saving of the history record on exit is on. size: The size of the command history is 10000000.
If you wonder, history size is 10000000 instead of
unlimited because I have $HISTSIZE=10000000.
In Emacs, I successfully search for old commands from
comint-history-isearch-backward-regexp. However, the problem is that commands entered while debugging from Emacs are not appended to
~/.gdb_history. I can still search through them in the current session, i.e. they are saved somewhere in memory, but they will not be written to the file and as a consequence I don't see them in the following sessions.
While GDB starts inside Emacs, I see that the config is read:
... +set history save on +set history size unlimited +set history filename ~/.gdb_history ...
show history output there is exactly the same like in console GDB:
show history +show history expansion: History expansion on command input is off. filename: The filename in which to record the command history is "/home/ars/.gdb_history". save: Saving of the history record on exit is on. size: The size of the command history is 10000000. (gdb) +info break
gdb with command like
(gdb "gdb -i=mi $PROGTODEBUG") and finish debugging with
quit, typed manually or via
C-d. Then I kill the buffer with
kill-this-buffer and exit Emacs. GNU Emacs version is 25.1.