Re: [PATCH 5/7] PR gdb/15224 , Change the default set history filename to ~/.gdb_history.

mbilal
2013-05-15T11:08:38Z

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

Hi
Please find attached updated patch.

In This patch Default location of History file has been changed to user
home directory (~/.gdb_history).

2013-05-15 Muhammad Bilal <mbilal@codesourcery.com>

PR gdb/15224
* top.c (init_history): Change the default history filename
to ~/.gdb_history.

* NEWS: Updated.

2013-05-15 Muhammad Bilal <mbilal@codesourcery.com>

PR gdb/15224
* gdb.base/default.exp: Test default history filename
Path.

2013-05-15 Muhammad Bilal <mbilal@codesourcery.com>

PR gdb/15224
* gdb.texinfo (Command History): Change the default history filename
to ~/.gdb_history.

Thanks,
-Bilal

[-- Attachment #2: 6 --]
[-- Type: text/plain, Size: 2387 bytes --]

diff --git a/gdb/top.c b/gdb/top.c
index 480b67e..83a5fee 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1651,11 +1651,9 @@ init_history (void)
that was read. */
#ifdef __MSDOS__
/* No leading dots in file names are allowed on MSDOS. */
- history_filename = concat (current_directory, "/_gdb_history",
- (char *)NULL);
+ history_filename = tilde_expand ("~/_gdb_history");
#else
- history_filename = concat (current_directory, "/.gdb_history",
- (char *)NULL);
+ history_filename = tilde_expand ("~/.gdb_history");
#endif
}
read_history (history_filename);
diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
index 9230ee8..9d2e9ce 100644
--- a/gdb/testsuite/gdb.base/default.exp
+++ b/gdb/testsuite/gdb.base/default.exp
@@ -800,6 +800,15 @@ if ![istarget "*-*-udi*"] then {
timeout { fail "(timeout) target remote" }
}
}
+#get home directory path
+gdb_test_multiple "show environment HOME" "show home directory" {
+ -re "\nHOME = (.*).\n.*" {
+ set HOME $expect_out(1,string)
+ }
+}
+#test show history filename
+gdb_test "show history filename" "The filename in which to record the command history is \"[file join $HOME .gdb_history]\"..*" \
+ "show history filename ([file join $HOME foobar.baz])"

#test target
gdb_test "target" "Argument required .target name.*" "target"
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1869d74..a9a1f89 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21455,7 +21455,7 @@ list, and where it writes the command history from this session when it
exits. You can access this list through history expansion or through
the history command editing characters listed below. This file defaults
to the value of the environment variable @code{GDBHISTFILE}, or to
-@file{./.gdb_history} (@file{./_gdb_history} on MS-DOS) if this variable
+@file{~/.gdb_history} (@file{~/_gdb_history} on MS-DOS) if this variable
is not set.
diff --git a/gdb/NEWS b/gdb/NEWS
index 7cd1646..04b929f 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,9 @@

*** Changes since GDB 7.6

+* Default location of History file has been changed to user
+home directory (~/.gdb_history).
+
* Python scripting

** Frame filters and frame decorators have been added.