Bug 15328 - more powerful history manipulation
Summary: more powerful history manipulation
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-01 14:31 UTC by Pedro Alves
Modified: 2013-04-01 14:31 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Alves 2013-04-01 14:31:09 UTC
I noticed there's no way to save the current GDB command history to some specified file.  Bash can do that with "history -w ~/foohistory".  Maybe
gdb could have a "save history", as we already have the "save" prefix.

We have "set history xxx", and "show commands".  I bet the latter would be more discoverable if called "show history" or plain "history", as in bash.

Speaking of which, bash's "history" command allows several other manipulations of history files:

$ help history 
history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
    Display or manipulate the history list.
    
    Display the history list with line numbers, prefixing each modified
    entry with a `*'.  An argument of N lists only the last N entries.
    
    Options:
      -c        clear the history list by deleting all of the entries
      -d offset delete the history entry at offset OFFSET.
    
      -a        append history lines from this session to the history file
      -n        read all history lines not already read from the history file
      -r        read the history file and append the contents to the history
        list
      -w        write the current history to the history file
        and append them to the history list
    
      -p        perform history expansion on each ARG and display the result
        without storing it in the history list
      -s        append the ARGs to the history list as a single entry
    
    If FILENAME is given, it is used as the history file.  Otherwise,
    if $HISTFILE has a value, that is used, else ~/.bash_history.
    
    If the $HISTTIMEFORMAT variable is set and not null, its value is used
    as a format string for strftime(3) to print the time stamp associated
    with each displayed history entry.  No time stamps are printed otherwise.
    
    Exit Status:
    Returns success unless an invalid option is given or an error occurs.

An idea would be to add a similar "history" command that models closely from bash's.