aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2015-06-17 15:41:07 -0400
committerPatrick Palka <patrick@parcs.ath.cx>2015-06-18 11:51:19 -0400
commit74bd41ce65c6c2c30ff67519bfc1d00b61826d96 (patch)
treeb89352306f7a50aa4cb8a623e1a04d3c65ed33b8 /gdb
parentAdd support for using the ADR alias in Thumb mode against nearby symbols. (diff)
downloadbinutils-gdb-74bd41ce65c6c2c30ff67519bfc1d00b61826d96.tar.gz
binutils-gdb-74bd41ce65c6c2c30ff67519bfc1d00b61826d96.tar.bz2
binutils-gdb-74bd41ce65c6c2c30ff67519bfc1d00b61826d96.zip
Test the interaction between GDBHISTSIZE and .gdbinit
The value inside the GDBHISTSIZE environment variable, only if valid, should override setting the history size through one's .gdbinit file. gdb/testsuite/ChangeLog: * gdb.base/gdbinit-history.exp: Test the interaction between setting GDBHISTSIZE and setting the history size via .gdbinit.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/gdbinit-history.exp23
2 files changed, 25 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 0f3749e8350..5a9a7eb74d3 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-18 Patrick Palka <patrick@parcs.ath.cx>
+
+ * gdb.base/gdbinit-history.exp: Test the interaction between
+ setting GDBHISTSIZE and setting the history size via .gdbinit.
+
2015-06-17 Patrick Palka <patrick@parcs.ath.cx>
PR gdb/16999
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
index 7bdce5ff132..85177f32e16 100644
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -19,9 +19,10 @@
# Check that the history size is properly set to SIZE when reading the .gdbinit
-# file located in HOME.
+# file located in HOME with the environment variable GDBHISTSIZE optionally
+# set to GDBHISTSIZE_VAL.
-proc test_gdbinit_history_setting { home size } {
+proc test_gdbinit_history_setting { home size { gdbhistsize_val "-" } } {
global env
global INTERNAL_GDBFLAGS
global srcdir
@@ -36,10 +37,19 @@ proc test_gdbinit_history_setting { home size } {
# set.
unset -nocomplain env(GDBHISTSIZE)
+ if { $gdbhistsize_val != "-" } {
+ set env(GDBHISTSIZE) $gdbhistsize_val
+ }
+
set saved_internal_gdbflags $INTERNAL_GDBFLAGS
set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS]
- with_test_prefix "home=$home" {
+ set prefix "home=$home"
+ if { $gdbhistsize_val != "-" } {
+ append prefix " gdbhistsize=$gdbhistsize_val"
+ }
+
+ with_test_prefix $prefix {
gdb_exit
gdb_start
@@ -54,6 +64,7 @@ proc test_gdbinit_history_setting { home size } {
set INTERNAL_GDBFLAGS $saved_internal_gdbflags
+ unset -nocomplain env(GDBHISTSIZE)
array set env [array get old_env]
}
@@ -117,3 +128,9 @@ test_gdbinit_history_setting "gdbinit-history/unlimited" "unlimited"
test_gdbinit_history_setting "gdbinit-history/zero" "0"
test_no_truncation_of_unlimited_history_file
+
+# A valid GDBHISTSIZE value overrides the setting inside the .gdbinit file; an
+# invalid GDBHISTSIZE value is ignored, falling back on the setting inside the
+# .gdbinit file.
+test_gdbinit_history_setting "gdbinit-history/unlimited" "1000" "1000"
+test_gdbinit_history_setting "gdbinit-history/unlimited" "unlimited" "foo"