From: Patrick Palka <patrick@parcs.ath.cx>
To: gdb-patches@sourceware.org
Cc: Patrick Palka <patrick@parcs.ath.cx>
Subject: [PATCH] Test the interaction between GDBHISTSIZE and .gdbinit
Date: Wed, 17 Jun 2015 20:17:00 -0000 [thread overview]
Message-ID: <1434572241-16019-1-git-send-email-patrick@parcs.ath.cx> (raw)
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.
---
gdb/testsuite/gdb.base/gdbinit-history.exp | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
index 7bdce5f..85177f3 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"
--
2.4.4.410.g43ed522.dirty
next reply other threads:[~2015-06-17 20:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-17 20:17 Patrick Palka [this message]
2015-06-18 9:06 ` Pedro Alves
2015-06-18 12:45 ` Patrick Palka
2015-06-18 14:47 ` Patrick Palka
2015-06-18 15:29 ` Pedro Alves
2015-08-11 22:11 ` Pedro Alves
2015-08-12 12:44 ` Patrick Palka
2015-06-23 16:48 ` Doug Evans
2015-06-22 13:21 ` Doug Evans
2015-06-22 13:46 ` Patrick Palka
2015-06-22 13:59 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434572241-16019-1-git-send-email-patrick@parcs.ath.cx \
--to=patrick@parcs.ath.cx \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox