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

mbilal
2013-05-07T07:19:28Z

Here is a updated patch for Fix relative "set history filename" to by
immediately converted to absolute
On Monday, May 06, 2013 4:26 PM Pedro Alves wrote:

>Please do this in the command's set handler rather than
>hacking in the the set/show machinery.

Yes,
Here I am printing the absolute path in show_history_filename ,
I think it is more appropriate than using the internal set/show machinery .

diff --git a/gdb/top.c b/gdb/top.c
index 480b67e..ae93e21 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -729,6 +729,9 @@ static void
show_history_filename (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
+ if (!IS_ABSOLUTE_PATH (value))
+ value = concat (current_directory, "/", value,
+ (char *)NULL);
fprintf_filtered (file, _("The filename in which to record "
"the command history is \"%s\".\n"),
value);
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