diff options
author | Muhammad Bilal <mbilal@sourceware.org> | 2013-07-30 12:06:04 +0000 |
---|---|---|
committer | Muhammad Bilal <mbilal@sourceware.org> | 2013-07-30 12:06:04 +0000 |
commit | 97c85fc673064bcd05bbdf1dd7a76eb7a9e6a1d2 (patch) | |
tree | 1739be27b5a132b494b7299dfe177b8c07569dc7 | |
parent | ff39bb5eb2356c364713b103399fec9fb07efbeb (diff) | |
download | gdb-97c85fc673064bcd05bbdf1dd7a76eb7a9e6a1d2.zip gdb-97c85fc673064bcd05bbdf1dd7a76eb7a9e6a1d2.tar.gz gdb-97c85fc673064bcd05bbdf1dd7a76eb7a9e6a1d2.tar.bz2 |
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.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/setshow.exp | 31 | ||||
-rw-r--r-- | gdb/top.c | 14 |
4 files changed, 56 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 43c2783..825599d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +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 Sanimir Agovic <sanimir.agovic@intel.com> * dwarf2read.c (dwarf2_get_ref_die_offset): Constify struct diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4f51d8e..b90def4 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +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. + 2013-07-26 Keith Seitz <keiths@redhat.com> * gdb.mi/mi-var-child-f.exp: Pass f90 to gdb_compile instead diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 661431c..d9e71d3 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -165,11 +165,38 @@ gdb_test_no_output "set height unlimited" gdb_test_no_output "set history expansion on" "set history expansion on" #test show history expansion on gdb_test "show history expansion on" "History expansion on command input is on.*" "show history expansion" +#get home directory path +set HOME "" +set test "show environment HOME" +gdb_test_multiple $test $test { + -re "\nHOME = (.*).\n.*" { + set HOME $expect_out(1,string) + pass $test + } +} +#test set history filename ~/foobar.baz +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 \"$HOME/foobar.baz\"..*" \ + "show history filename (~/foobar.baz)" +#get current working directory +set PWD "" +set test "show working directory" +gdb_test_multiple "pwd" $test { + -re "\nWorking directory (.*)..\n.*" { + set PWD $expect_out(1,string) + pass $test + } +} #test set history filename foobar.baz gdb_test_no_output "set history filename foobar.baz" \ - "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 \"$PWD/foobar.baz\"..*" \ + "show history filename (current_directory/foobar.baz)" #test set history save on gdb_test_no_output "set history save on" "set history save on" #test show history save on @@ -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); |