This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Read $GDBHISTSIZE instead of $HISTSIZE


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b58c513b7932cfb9852d66e07282b9c2379197ed

commit b58c513b7932cfb9852d66e07282b9c2379197ed
Author: Patrick Palka <patrick@parcs.ath.cx>
Date:   Wed Jun 17 13:31:56 2015 -0400

    Read $GDBHISTSIZE instead of $HISTSIZE
    
    The HISTSIZE environment variable is generally expected to be read by
    shells, not by applications.  Some distros for example globally export
    HISTSIZE in /etc/profile -- with the intention that it only affects
    shells -- and by doing so it renders useless GDB's own mechanism for
    setting the history size via .gdbinit.  Also, annoyances may arise when
    HISTSIZE is not interpreted the same way by the shell and by GDB, e.g.
    PR gdb/16999.  That can always be fixed on a shell-by-shell basis but it
    may be impossible to be consistent with the behavior of all shells at
    once.  Finally it just makes sense to not confound shell environment
    variables with application environment variables.
    
    gdb/ChangeLog:
    
    	* NEWS: Mention that GDBHISTSIZE is read instead of HISTSIZE.
    	* top.c (init_history): Read from GDBHISTSIZE instead of
    	HISTSIZE.
    	(init_main): Refer to GDBHISTSIZE instead of HISTSIZE.
    
    gdb/doc/ChangeLog:
    
    	* gdb.texinfo (Command History): Replace occurrences of HISTSIZE
    	with GDBHISTSIZE.
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.base/gdbinit-history.exp: Replace occurrences of HISTSIZE
    	with GDBHISTSIZE.
    	* gdb.base/readline.exp: Likewise.

Diff:
---
 gdb/ChangeLog                              |  7 +++++++
 gdb/NEWS                                   |  4 ++++
 gdb/doc/ChangeLog                          |  5 +++++
 gdb/doc/gdb.texinfo                        |  4 ++--
 gdb/testsuite/ChangeLog                    |  6 ++++++
 gdb/testsuite/gdb.base/gdbinit-history.exp |  8 ++++----
 gdb/testsuite/gdb.base/readline.exp        | 12 ++++++------
 gdb/top.c                                  |  4 ++--
 8 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e84bd28..7d63185 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2015-06-17  Patrick Palka  <patrick@parcs.ath.cx>
 
+	* NEWS: Mention that GDBHISTSIZE is read instead of HISTSIZE.
+	* top.c (init_history): Read from GDBHISTSIZE instead of
+	HISTSIZE.
+	(init_main): Refer to GDBHISTSIZE instead of HISTSIZE.
+
+2015-06-17  Patrick Palka  <patrick@parcs.ath.cx>
+
 	* top.c (gdb_safe_append_history): Do not call
 	history_truncate_file if the history is not stifled.
 
diff --git a/gdb/NEWS b/gdb/NEWS
index 85688c7..8b813af 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -62,6 +62,10 @@
 * The "tui reg" command now provides completion for all of the
   available register groups, including target specific groups.
 
+* The HISTSIZE environment variable is no longer read when determining
+  the size of GDB's command history.  GDB now instead reads the dedicated
+  GDBHISTSIZE environment variable.
+
 * Guile Scripting
 
   ** Memory ports can now be unbuffered.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index b970b62..ed51387 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-17  Patrick Palka  <patrick@parcs.ath.cx>
+
+	* gdb.texinfo (Command History): Replace occurrences of HISTSIZE
+	with GDBHISTSIZE.
+
 2015-06-15  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* gdb.texinfo (GDB/MI Data Manipulation): Clarify usage of
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 952844e..e02f92e 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22635,12 +22635,12 @@ Stop recording command history in a file.
 
 @cindex history size
 @kindex set history size
-@cindex @env{HISTSIZE}, environment variable
+@cindex @env{GDBHISTSIZE}, environment variable
 @item set history size @var{size}
 @itemx set history size unlimited
 Set the number of commands which @value{GDBN} keeps in its history list.
 This defaults to the value of the environment variable
-@code{HISTSIZE}, or to 256 if this variable is not set.  If @var{size}
+@code{GDBHISTSIZE}, or to 256 if this variable is not set.  If @var{size}
 is @code{unlimited}, the number of commands @value{GDBN} keeps in the
 history list is unlimited.
 @end table
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 65c5579..abb0677 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-17  Patrick Palka  <patrick@parcs.ath.cx>
+
+	* gdb.base/gdbinit-history.exp: Replace occurrences of HISTSIZE
+	with GDBHISTSIZE.
+	* gdb.base/readline.exp: Likewise.
+
 2015-06-17  Yao Qi  <yao.qi@linaro.org>
 
 	* lib/gdb.exp (get_build_id): Move braces and "else" to the same
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
index 8c4f4ca..7bdce5f 100644
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -31,10 +31,10 @@ proc test_gdbinit_history_setting { home size } {
 
     set env(HOME) "$srcdir/$subdir/$home"
 
-    # The HISTSIZE environment variable takes precedence over whatever
+    # The GDBHISTSIZE environment variable takes precedence over whatever
     # history size is set in .gdbinit.  Make sure the former is not
     # set.
-    unset -nocomplain env(HISTSIZE)
+    unset -nocomplain env(GDBHISTSIZE)
 
     set saved_internal_gdbflags $INTERNAL_GDBFLAGS
     set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS]
@@ -66,10 +66,10 @@ proc test_no_truncation_of_unlimited_history_file { } {
 
     array set old_env [array get env]
 
-    # The HISTSIZE environment variable takes precedence over whatever
+    # The GDBHISTSIZE environment variable takes precedence over whatever
     # history size is set in .gdbinit.  Make sure the former is not
     # set.
-    unset -nocomplain env(HISTSIZE)
+    unset -nocomplain env(GDBHISTSIZE)
 
     set saved_internal_gdbflags $INTERNAL_GDBFLAGS
 
diff --git a/gdb/testsuite/gdb.base/readline.exp b/gdb/testsuite/gdb.base/readline.exp
index c444285..f0490a2 100644
--- a/gdb/testsuite/gdb.base/readline.exp
+++ b/gdb/testsuite/gdb.base/readline.exp
@@ -185,11 +185,11 @@ gdb_test_multiple "if 1 > 0\n\033\[A\033\[A\nend" $msg {
 if [info exists env(GDBHISTFILE)] {
     set old_gdbhistfile $env(GDBHISTFILE)
 }
-if [info exists env(HISTSIZE)] {
-    set old_histsize $env(HISTSIZE)
+if [info exists env(GDBHISTSIZE)] {
+    set old_gdbhistsize $env(GDBHISTSIZE)
 }
 set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
-set env(HISTSIZE) "10"
+set env(GDBHISTSIZE) "10"
 
 gdb_exit
 gdb_start
@@ -207,10 +207,10 @@ if [info exists old_gdbhistfile] {
 } else {
     unset env(GDBHISTFILE)
 }
-if [info exists old_histsize] {
-    set env(HISTSIZE) $old_histsize
+if [info exists old_gdbhistsize] {
+    set env(GDBHISTSIZE) $old_gdbhistsize
 } else {
-    unset env(HISTSIZE)
+    unset env(GDBHISTSIZE)
 }
 set timeout $oldtimeout1
 
diff --git a/gdb/top.c b/gdb/top.c
index f8f926b..8ff2039 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1681,7 +1681,7 @@ init_history (void)
 {
   char *tmpenv;
 
-  tmpenv = getenv ("HISTSIZE");
+  tmpenv = getenv ("GDBHISTSIZE");
   if (tmpenv)
     {
       int var;
@@ -1857,7 +1857,7 @@ Show the size of the command history,"), _("\
 ie. the number of previous commands to keep a record of.\n\
 If set to \"unlimited\", the number of commands kept in the history\n\
 list is unlimited.  This defaults to the value of the environment\n\
-variable \"HISTSIZE\", or to 256 if this variable is not set."),
+variable \"GDBHISTSIZE\", or to 256 if this variable is not set."),
 			    set_history_size_command,
 			    show_history_size,
 			    &sethistlist, &showhistlist);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]