Re: [PATCH 1/7] PR gdb/15224 "set history filename" to by immediately converted to absolute path

mbilal
2013-05-07T12:44:01Z

please find updated patch .

I made new 'set_history_filename' function to solve this problem

and thanks Pedro for review this patch.

diff --git a/gdb/top.c b/gdb/top.c
index 480b67e..20aecc9 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"
@@ -1607,6 +1608,14 @@ set_verbose (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)
+{
+ if (!IS_ABSOLUTE_PATH (*(char **) c->var))
+ *(char **) c->var = concat (current_directory, "/", *(char **) c->var,
+ (char *)NULL);
+}
+
/* Init the history buffer. Note that we are called after the init
file(s)
have been read so that the user can change the history file via his
.gdbinit file (for instance). The GDBHISTFILE environment variable
@@ -1777,7 +1786,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);

Thanks,
-Bilal