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
9HISTFILE=~/.bashdb_history
10set -o history
11set +H
12
13# prompt for trace line
14PS4="${1}"
15
16_dbgfile=$0
17_guineapig=$1
18_tmpdir=$2
19_libdir=$3
20shift 3				#move user's args into place
21
22. $_libdir/bashdb.fns		#read in the debugger functions
23
24_linebp=
25_stringbp=
26let _trace=1			#init execution trace flag to on
27
28#read guineapig file into _lines array
29_readin 1
30
31trap _cleanup EXIT		#erase files before exiting
32
33let _steps=1			#no. of statements to run after setting trap
34#set LINENO, gets incremented to 1
35LINENO=0
36trap '_steptrap $LINENO' DEBUG
37:
38