File | Date | Author | Commit |
---|---|---|---|
.cvsignore | 2007-01-20 |
![]() |
[5e2eb5] Get ready for 3.1-0.08 release |
.gitignore | 2011-03-05 |
![]() |
[f5aa61] Save and restore variables in debug command. |
Makefile.am | 2017-04-30 |
![]() |
[b490e9] Backport from current bash part 2 |
README.md | 2017-04-30 |
![]() |
[b490e9] Backport from current bash part 2 |
bashdb-man.pod | 2017-04-30 |
![]() |
[b490e9] Backport from current bash part 2 |
bashdb.texi | 2017-04-30 |
![]() |
[b490e9] Backport from current bash part 2 |
copyright.texi | 2006-11-02 |
![]() |
[e46d0d] Address Debian legal concerns, yet again. Actu... |
fdl.texi | 2006-01-02 |
![]() |
[59451c] Initial revision |
gpl.texi | 2017-04-30 |
![]() |
[b490e9] Backport from current bash part 2 |
macros.texi.in | 2006-01-02 |
![]() |
[59451c] Initial revision |
notecase-HTML.sh | 2017-04-30 |
![]() |
[d55cb3] Script from Rod Smith |
Here we have a gdb-like debugger for Bash.
The version of bashdb to use has to be compatible with the version
of bash used. Run bash --version
to see what version of bash you
are using.
As seen from the above, the first part of the version in the bashdb version name matches the major version number of bash. This is intentional.
See file file INSTALL in the distribution for detailed installation
instructions.
There are 3 ways to get into the debugger. If
Then run:
bash --debugger -- bash-script-name script-arg1 script-arg2...
If bash isn't installed in a way that will find bashdb, then:
bashdb [bashdb-opts] -- bash-script-name script-arg1 script-arg2...
The downside here is that $0 will be "bashdb" not
bash-script-name. Also call stack will show the invocation to bashdb.
Finally, to invoke the debugger from the script
# my script
# work, work, work, ...
# Load debugger support
BASHDB_INSTALL=/usr/share/bashdb # ADJUST THIS!
source ${BASHDB_INSTALL}/bashdb-trace -L $BASHDB_INSTALL
# work, work, work or not...
_Dbg_debugger; : # Calls the debugger at the line below
stop_before_running_this_statement
An advantage of the above is that there is no overhead up until you
invoke the debugger. Typically for large bash programs like
configuration scripts, this is a big win.
stdin is closed by configure early on. This causes the debugger to quit.
You can get around this invoking a command script that sets debugger
up input and output. Run tty to figure out what the terminal tty is set to.
$ tty
/dev/pts/3
$
Above it came out to /dev/pts/3. Let's go with that. Put the folliwng
in a file say /tmp/bashdb-configure:
source /dev/pts/3
tty /dev/pts/3
Now arrange to read that configuration file using the -x (or --eval-command)
switch:
BASHDB_INSTALLATION=/usr/share/bashdb # ADJUST THIS!
source ${BASHDB_INSTALL}/bashdb-trace -L $BASHDB_INSTALL -x /tmp/bashdb-configure