1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
0. INTRODUCTION
This is a port and cleanup of my bash debugger bashdb
(http://bashdb.sf.net).
The command syntax generally follows that of the GNU debugger gdb.
However this debugger depends on a number bug fixes and of debugging
support features that are neither part of the POSIX 1003.1 standard
and are not in current "stable" zsh releases. In particular, the
"functrace" function should always report filenames and absolute line
numbers. Also both "functrace" and "funcstack" should include
source'd files in their arrays.
1. SETUP
To get the code, install git and run in a zsh shell:
git-clone git://github.com/rocky/zshdb.git
cd zshdb
./autogen.sh # Add configure options. See ./configure --help
If you've got a suitable zsh installed, then
make && make test
To try on a real program such as perhaps /etc/zsh/zshrc:
./zshdb /etc/zsh/zshrc # substitute .../zshrc with your favorite zsh script
To modify source code to call the debugger inside the program:
source path-to-zshdb/zshdb/dbg-trace.sh
# work, work, work.
_Dbg_debugger
# start debugging here
Above, the directory _path-to_zshdb_ should be replaced with the
directory that dbg-trace.sh is located in. This can also be from the
source code directory zshdb or from the directory dbg-trac.sh gets
installed directory. The "souce" command needs to be done only once
somewhere in the code prior to using _Dbg_debugger.
If you are happy and "make test" above worked, install via:
sudo make install
and uninstall with
sudo make uninstall # ;-)
See INSTALL for generic configure installation instructions.
2. WHAT'S HERE, WHAT'S NOT and WHY NOT
What's missing falls into a two categories:
* Stuff that can be ported in a straightforward way from bashdb
* Stuff that needs additional zsh support
Of the things which can be ported in a straight-forward way, however
some of them I want to revise and simplify. In some cases, the fact
that zsh has associative arrays simplifies code. On other cases, the
code I wrote needs refactoring and better modularization.
Writing documentation is important, but an extensive guide will have
to wait. For now one can consult the reference guide that comes with
bashdb: http://bashdb.sf.net/bashdb.html There is some minimal help to
get a list of commands and some help for each.
3. WHAT'S NOT HERE YET IN DETAIL
3.a) Showing frame arguments
This can done with or without support from zsh, albeit faster with
help from zsh. Changing scope when changing frames however has to be
done with zsh support.
3.b) Setting $0
3.c) other stuff including...
signal handling,
debugger commands:
debug
file
handle
history
pwd
signal
tty
watch
None of this is rocket science. Should be pretty straight-forward to
add.
4. WHAT MAY NEED MORE WORK AND SUPPORT FROM ZSH
4.a) stopping points that can be used for breakpoint
|