summaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authormbilal <mbilal>2013-07-30 12:06:04 +0000
committermbilal <mbilal>2013-07-30 12:06:04 +0000
commit19dbd794eaea44916da1de106ae42a5d1e4523e0 (patch)
treedec33fc4095f60fcf29ca2bc14f47ef5a71958ec /gdb/top.c
parent52f87c6e3e23b032c4c50f251e5347089164f438 (diff)
downloadgdb-19dbd794eaea44916da1de106ae42a5d1e4523e0.tar.gz
2013-07-30 Muhammad Bilal <mbilal@codesorcery.com>
PR gdb/15715 * top.c: Include "filenames.h". (set_history_filename): New function. (init_main): Install it as set hook of the "set history filename" command. 2013-07-30 Muhammad Bilal <mbilal@codesourcery.com> PR gdb/15715 * gdb.base/setshow.exp: Test that relative paths passed to 'set history filename' are converted to absolute paths.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 467e6a297db..33a78da84c5 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -48,6 +48,7 @@
#include "interps.h"
#include "observer.h"
#include "maint.h"
+#include "filenames.h"
/* readline include files. */
#include "readline/readline.h"
@@ -1704,6 +1705,17 @@ set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
}
static void
+set_history_filename (char *args, int from_tty, struct cmd_list_element *c)
+{
+ /* We include the current directory so that if the user changes
+ directories the file written will be the same as the one
+ that was read. */
+ if (!IS_ABSOLUTE_PATH (history_filename))
+ history_filename = reconcat (history_filename, current_directory, "/",
+ history_filename, (char *) NULL);
+}
+
+static void
init_main (void)
{
/* Initialize the prompt to a simple "(gdb) " prompt or to whatever
@@ -1779,7 +1791,7 @@ variable \"HISTSIZE\", or to 256 if this variable is not set."),
Set the filename in which to record the command history"), _("\
Show the filename in which to record the command history"), _("\
(the list of previous commands of which a record is kept)."),
- NULL,
+ set_history_filename,
show_history_filename,
&sethistlist, &showhistlist);