bashdb  4.4-1.0.1
About: BASHDB is a source-code debugger for the bash shell that follows the gdb command syntax (for bash 4.4 or higher).
  Fossies Dox: bashdb-4.4-1.0.1.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

bashdb Documentation

Some Fossies usage hints in advance:

  1. To see the Doxygen generated documentation please click on one of the items in the steelblue colored "quick index" bar above or use the side panel at the left which displays a hierarchical tree-like index structure and is adjustable in width.
  2. If you want to search for something by keyword rather than browse for it you can use the client side search facility (using Javascript and DHTML) that provides live searching, i.e. the search results are presented and adapted as you type in the Search input field at the top right.
  3. Doxygen doesn't incorporate all member files but just a definable subset (basically the main project source code files that are written in a supported language). So to search and browse all member files you may visit the Fossies bashdb-4.4-1.0.1.tar.bz2 contents page and use the Fossies standard member browsing features (also with source code highlighting and additionally with optional code folding).

Here we have a debugger (the debugger?) for Bash 3.0 and higher.

The command syntax generally follows that of the zsh debugger trepanning debuggers and, more generally, GNU debugger gdb.

There are 3 ways to get into the debugger. If bash (with debugger support enabled which is the default) is installed and the debugger are both installed properly. Then:

   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
  source <bashdb-installation>/bashdb-trace -L <bashdb-installation>
  # work, work, work or not...
  _Dbg_debugger; :   # Calls the debugger at the line below

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

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:

  source <bashdb-installation>/bashdb-trace -L <bashdb-installation> -x /tmp/bashdb-configure

See INSTALL for generic GNU configure installation instructions.