Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ksh history file is distinct from bash history. Set HISTSIZE in testi…

…ng for more predictable results.
  • Loading branch information...
commit 9a2d5076e538278ea9631455b1f2f4b2a30f39da 1 parent 4943ba0
@rocky authored
View
22 command/eval.sh
@@ -45,24 +45,24 @@ See also "print" and "set autoeval".' 1
typeset -i _Dbg_show_eval_rc; _Dbg_show_eval_rc=1
_Dbg_do_eval() {
-
+
typeset -i old_level=.sh.level
typeset -i new_level
((new_level=${#_Dbg_frame_stack[@]} - 1 - _Dbg_stack_pos))
-
- # FIXME: is this needed. Is it effective?
- # Should it be moved after setting .sh?
+
+ # FIXME: is this needed. Is it effective?
+ # Should it be moved after setting .sh?
print ". ${_Dbg_libdir}/lib/set-d-vars.sh" > $_Dbg_evalfile
-
+
print "(( .sh.level = $new_level ))" >> $_Dbg_evalfile
print "typeset -i _Dbg_rc" >> $_Dbg_evalfile
if (( $# == 0 )) ; then
- # FIXME: add parameter to get unhighlighted line, or
+ # FIXME: add parameter to get unhighlighted line, or
# always save a copy of that in _Dbg_sget_source_line
typeset source_line
- source_line=${.sh.command}
+ source_line=${.sh.command}
- # Were we called via ? as the suffix?
+ # Were we called via ? as the suffix?
typeset suffix
suffix=${_Dbg_orig_cmd:${#_Dbg_orig_cmd}-1:1}
if [[ '?' == "$suffix" ]] ; then
@@ -70,7 +70,7 @@ _Dbg_do_eval() {
_Dbg_eval_extract_condition "$source_line"
source_line="$extracted"
fi
-
+
print "$source_line" >> $_Dbg_evalfile
_Dbg_msg "eval: ${source_line}"
else
@@ -78,13 +78,13 @@ _Dbg_do_eval() {
fi
print '_Dbg_rc=$?' >> $_Dbg_evalfile
print "(( .sh.level = $old_level ))" >> $_Dbg_evalfile
-
+
if [[ -n $_Dbg_tty ]] ; then
_Dbg_set_dol_q $_Dbg_debugged_exit_code
. $_Dbg_evalfile >>$_Dbg_tty
else
_Dbg_set_dol_q $_Dbg_debugged_exit_code
- . $_Dbg_evalfile
+ # . $_Dbg_evalfile
fi
(( _Dbg_show_eval_rc )) && _Dbg_msg "\$? is $_Dbg_rc"
# We've reset some variables like IFS and PS4 to make eval look
View
2  command/source.sh
@@ -33,7 +33,7 @@ _Dbg_do_source() {
_Dbg_errmsg 'Need to give a filename for the "source" command.'
return 1
fi
-
+
typeset filename
_Dbg_glob_filename "$1"
if [[ -r $filename ]] || [[ "$filename" == '/dev/stdin' ]] ; then
View
28 lib/hist.sh
@@ -1,7 +1,7 @@
# -*- shell-script -*-
# hist.sh - Bourne Again Shell Debugger history routines
#
-# Copyright (C) 2002, 2003, 2006, 2007, 2008, 2011 Rocky Bernstein
+# Copyright (C) 2002-003, 2006-2008, 2011, 2014 Rocky Bernstein
# <rocky@gnu.org>
#
# This program is free software; you can redistribute it and/or
@@ -25,25 +25,25 @@ typeset -a _Dbg_history=()
typeset -i _Dbg_set_history=1
typeset -i _Dbg_history_length=${HISTSIZE:-256} # gdb's default value
-typeset _Dbg_histfile=${HOME:-.}/.bashdb_hist
+typeset _Dbg_histfile=${HOME:-.}/.kshdb_hist
# Set to rerun history item, or print history if command is of the form
-# !n:p. If command is "history" then $1 is number of history item.
-# the history command index to run is returned or $_Dbg_hi if
+# !n:p. If command is "history" then $1 is number of history item.
+# the history command index to run is returned or $_Dbg_hi if
# there's nothing to run.
# Return value in $history_num
_Dbg_history_parse() {
history_num=$1
((history_num < 0)) && ((history_num=${#_Dbg_history[@]}-1+$1))
-
+
_Dbg_hi=${#_Dbg_history[@]}
[[ -z $history_num ]] && let history_num=$_Dbg_hi-1
eval "$_seteglob"
if [[ $_Dbg_cmd == h* ]] ; then
- if [[ $history_num != $int_pat ]] ; then
- if [[ $history_num == -$int_pat ]] ; then
+ if [[ $history_num != $int_pat ]] ; then
+ if [[ $history_num == -$int_pat ]] ; then
history_num=$_Dbg_hi+$history_num
else
_Dbg_msg "Invalid history number skipped: $history_num"
@@ -52,7 +52,7 @@ _Dbg_history_parse() {
fi
else
# Handle ! form. May need to parse number out number and modifier
- case $_Dbg_cmd in
+ case $_Dbg_cmd in
\!\-${int_pat}:p )
local -a word1
word1=($(_Dbg_split '!' $_Dbg_cmd))
@@ -70,19 +70,19 @@ _Dbg_history_parse() {
_Dbg_do_history_list ${word2[0]} ${word2[0]}
history_num=-1
;;
- \!\-$int_pat )
+ \!\-$int_pat )
local -a word
word=($(_Dbg_split '!' $_Dbg_cmd))
history_num=$_Dbg_hi+${word[0]}
;;
- \!$int_pat )
+ \!$int_pat )
local -a word
word=($(_Dbg_split '!' $_Dbg_cmd))
history_num=${word[0]}
;;
- '!' )
- if [[ $history_num != $int_pat ]] ; then
- if [[ $history_num == -$int_pat ]] ; then
+ '!' )
+ if [[ $history_num != $int_pat ]] ; then
+ if [[ $history_num == -$int_pat ]] ; then
history_num=$_Dbg_hi+$history_num
else
_Dbg_msg "Invalid history number skipped: $history_num"
@@ -99,7 +99,7 @@ _Dbg_history_parse() {
}
_Dbg_history_read() {
- if [[ -r $_Dbg_histfile ]] ; then
+ if [[ -r $_Dbg_histfile ]] ; then
history -r $_Dbg_histfile
typeset -a last_history=($(history 1))
typeset -i max_history=${last_history[0]}
View
12 lib/setshow.sh
@@ -1,6 +1,6 @@
# setshow.sh - Helper routines for help/set/show
#
-# Copyright (C) 2010, 2011 Rocky Bernstein <rocky@gnu.org>
+# Copyright (C) 2010-2011, 2014 Rocky Bernstein <rocky@gnu.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
@@ -11,7 +11,7 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place, Suite 330, Boston,
@@ -21,8 +21,8 @@
_Dbg_set_onoff() {
typeset -l onoff=${1:-'off'}
typeset cmdname=$2
- case $onoff in
- on | 1 )
+ case $onoff in
+ on | 1 )
_Dbg_write_journal_eval "_Dbg_set_${cmdname}=1"
;;
off | 0 )
@@ -71,9 +71,9 @@ if [[ $0 == ${.sh.file##*/} ]] ; then
_Dbg_msg() {
print $*
}
-
+
typeset -i _Dbg_foo
- for i in 0 1 ; do
+ for i in 0 1 ; do
_Dbg_set_foo=$i
_Dbg_help_set_onoff "foo" "foo" "Set short xx"
typeset -p _Dbg_set_foo
View
18 test/data/setshow.right
@@ -8,9 +8,9 @@ set -xv
** Unknown show subcommand: badcommand
** Show subcommands are:
alias autoeval commands different highlight prompt width
- annotate autolist copying directories history version
+ annotate autolist copying directories history version
args basename debug editing listsize warranty
-+another-bad-command
++another-bad-command
** Undefined command "another-bad-command". Try "help".
+#### *** GNU things...
+# show warranty
@@ -273,7 +273,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
-+show
++show
annotate : Annotation_level is 0.
args : Argument list to give script when debugged program starts is:
testarg1 testarg2".
@@ -284,10 +284,10 @@ debug : Allow debugging the debugger is off.
different : Show stepping forces a new line is off.
editing : Editing of command lines as they are typed is off.
highlight : Syntax highlight in source listings is off.
-history --
- filename: The filename in which to record the command history is
+history --
+ filename: The filename in which to record the command history is
save: Saving of history save is on.
- size: Debugger history size is 256
+ size: Debugger history size is 999
listsize : Number of source lines kshdb will list by default is 10.
prompt : kshdb's prompt is:
"$_Dbg_debugger_name<${_Dbg_less}1${_Dbg_greater}> ".
@@ -325,13 +325,13 @@ Annotation_level is 1.
+# show history
+# set history save on
+# show history
-+#########################
++#########################
+#### Test 'show commands'...
+# show commands
+# show commands +
+# show commands -5
+# show commands 12
-+#########################
++#########################
+#### Test 'autoeval'...
+set autoeval on
Evaluate unrecognized commands is on.
@@ -342,5 +342,5 @@ $? is 0
Evaluate unrecognized commands is off.
+xx=1 ; typeset -p xx
** Undefined command "xx=1". Try "help".
-+quit
++quit
kshdb: That's all, folks...
View
1  test/integration/test-setshow.in
@@ -4,6 +4,7 @@ t=${0##*/}; TEST_NAME=${t:5} # basename $0 with 'test-' stripped off
[ -z "$builddir" ] && export builddir=$PWD
+export HISTSIZE=999
. ${builddir}/check-common.sh
ARGS='testarg1 testarg2'
debugged_script="${top_srcdir}/test/example/dbg-test2.sh"
Please sign in to comment.
Something went wrong with that request. Please try again.