The BASH Debugger Project contains the most comprehensive source-code debugger for bash that has been written. It has a similar command interface as gdb. Read the INSTALL file in the source directory for instructions if you wish to enable readarray support. readarray speeds up initial loading of large scripts.