Imported from ../bash-2.01.tar.gz.
[platform/upstream/bash.git] / examples / bashdb / bashdb.pre
1 # bashdb.pre - Bourne-Again Shell Debugger preamble file
2 # prepended to script being ddebugged
3 #arguments:
4 # $1 = name of original guineapig script
5 # $2 = dir where temp files are stored
6 # $3 = dir where bashdb.pre and bashdb.fns are stored
7
8 # separate history file for bashdb
9 HISTFILE=~/.bashdb_history
10 set -o history
11 set +H
12
13 # prompt for trace line
14 PS4="${1}"
15
16 _dbgfile=$0
17 _guineapig=$1
18 _tmpdir=$2
19 _libdir=$3
20 shift 3                         #move user's args into place
21
22 . $_libdir/bashdb.fns           #read in the debugger functions
23
24 _linebp=
25 _stringbp=
26 let _trace=1                    #init execution trace flag to on
27
28 #read guineapig file into _lines array
29 _readin 1
30
31 trap _cleanup EXIT              #erase files before exiting
32
33 let _steps=1                    #no. of statements to run after setting trap
34 #set LINENO, gets incremented to 1
35 LINENO=0
36 trap '_steptrap $LINENO' DEBUG
37 :