[PATCH 1/7] PR gdb/15224 should "set history save on" by default

mbilal
2013-05-06T09:40:48Z

On Wednesday, April 03, 2013 7:30 PM Jan Kratochvil wrote:

> (1) Fix relative "set history filename" to by immediately converted
to absolute
form

Here is a proposed patch with testcase.

Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.61
diff -u -p -r1.61 cli-setshow.c
--- cli/cli-setshow.c 10 Apr 2013 15:11:12 -0000 1.61
+++ cli/cli-setshow.c 6 May 2013 05:23:46 -0000
@@ -22,6 +22,7 @@
#include "gdb_string.h"
#include "arch-utils.h"
#include "observer.h"
+#include "filenames.h"

#include "ui-out.h"

@@ -247,6 +248,13 @@ do_set_command (char *arg, int from_tty,
if (*(char **) c->var == NULL
|| strcmp (*(char **) c->var, val) != 0)
{
+ if (strcmp (c->name, "filename") == 0)
+ {
+ if (!IS_ABSOLUTE_PATH (val))
+ val = concat (current_directory, "/", val,
+ (char *)NULL);
+ }
+
xfree (*(char **) c->var);
*(char **) c->var = val;
Index: gdb.base/setshow.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/setshow.exp,v
retrieving revision 1.30
diff -u -p -r1.30 setshow.exp
--- gdb.base/setshow.exp 24 Apr 2013 14:29:17 -0000 1.30
+++ gdb.base/setshow.exp 6 May 2013 06:01:05 -0000
@@ -173,7 +173,8 @@ gdb_test "show history expansion on" "Hi
gdb_test_no_output "set history filename foobar.baz" \
"set history filename foobar.baz"
#test show history filename foobar.baz
-gdb_test "show history filename" "The filename in which to record the
command history is \"foobar.baz\"..*" "show history filename (foobar.baz)"
+gdb_test "show history filename" "The filename in which to record the
command history is \"[file join [pwd] foobar.baz]\"..*" \
+ "show history filename \"[file join [pwd] foobar.baz]\"."
#test set history save on
gdb_test_no_output "set history save on" "set history save on"
#test show history save on

thanks,
-Bilal