Permalink
Switch branches/tags
version-14_01_1 version-14_01 version-13_05_2 version-13_05_1 version-13_05 version-12_08-branchpoint version-12_08-GIT version-11_07_2 version-11_07_1 version-11_07 version-11_07-branchpoint version-11_01 version-11_01-branchpoint version-10_04_2 version-10_04_1 version-10_04 version-10_04-branchpoint version-0_13_1 version-0_13-branchpoint version-0_12_2 version-0_12_1 version-0_12-branchpoint version-0_11_0 version-0_11-branchpoint version-0_10 version-0_9_1 version-0_9 version-0_9_x-snapshot version-0_9_x-snapshot-19991220 unstable-version-0_13_1-x86_64-unknown-linux-gnu-libc2_3 unstable-version-0_13_1-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_13-branch-x86_64-unknown-linux-gnu-libc2_3 unstable-version-0_13-branch-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_12_2-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12_2-i386-pc-solaris2_8 unstable-version-0_12_1-i686-pc-linux-libc2_3-gnu-O4-intermod unstable-version-0_12_1-i686-pc-linux-libc2_3-gnu-O2 unstable-version-0_12_1-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12_1-i386-pc-solaris2_8 unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O5 unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O4-intermod unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O4-hlc unstable-version-0_12-branch-i686-pc-linux-libc2_3-gnu-O2 unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O5 unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_12-branch-i686-pc-linux-libc2_2-gnu-O3 unstable-version-0_12-branch-i386-pc-solaris2_8 unstable-version-0_11_0-sparc-sun-solaris2_7 unstable-version-0_11_0-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5 unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-lcc unstable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-hlc unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4-asm unstable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_11_0-i386-pc-solaris2_8 unstable-version-0_11-branch-i686-pc-linux-libc2_3-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-hlc unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-intermod unstable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-hlc unstable-version-0_11-branch-alpha-dec-osf5_1 unstable-version-0_10_y-sparc-sun-solaris2_7 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-intermod unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O5-hlc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O4-hlc unstable-version-0_10_y-i686-pc-linux-libc2_1-gnu-O2 unstable-version-0_10_y-i586-pc-linux-libc2_1-gnu-O0 unstable-version-0_10_y-alpha-dec-osf5_1 unstable-version-0_10_y-alpha-dec-osf3_2 unstable-version-0_10_x-sparc-sun-solaris2_7 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5-lcc unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4-hlc unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O2 unstable-version-0_10_x-i586-pc-linux-libc2_1-gnu-O0 unstable-version-0_10_x-alpha-dec-osf3_2 termination2_trunk stable-version-0_11_0-i686-pc-linux-libc2_3-gnu-O5-intermod stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5 stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-lcc stable-version-0_11_0-i686-pc-linux-libc2_2-gnu-O5-hlc stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4 stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O4-asm stable-version-0_11_0-i686-pc-linux-libc2_1-gnu-O3 stable-version-0_11-branch-i686-pc-linux-libc2_3-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-lcc stable-version-0_11-branch-i686-pc-linux-libc2_2-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5 stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-lcc stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-intermod stable-version-0_11-branch-i686-pc-linux-libc2_1-gnu-O5-hlc stable-version-0_11-branch-alpha-dec-osf5_1
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
137 lines (94 sloc) 5.4 KB
-----------------------------------------------------------------------------
SOURCE-TO-SOURCE DEBUGGER
The source-to-source debugger (ssdebug, ssdb) operates by performing a
high-level transformation of Mercury source code to provide a rudimentary
debugger interface. As such, it has numerous limitations (see below), but
can potentially work with all backends. It is mainly intended for when you
cannot use the Mercury debugger `mdb', such as with the Java or high-level C
backends.
ssdebug is still an experimental feature.
-----------------------------------------------------------------------------
INSTALLATION
To use the source-to-source debugger you can install the grades containing the
".ssdebug" grade component. One way to do this is to invoke configure
with the option `--enable-ssdebug-grades'. This will add the grades
hlc.gc.ssdebug, csharp.ssdebug and java.ssdebug to the set of library grades
to install.
-----------------------------------------------------------------------------
COMPILATION
Compile your program in a grade with the ".ssdebug" grade component, e.g.
java.ssdebug or hlc.gc.ssdebug. Your entire program will be then compiled
with --ssdb-trace level of deep.
An alternative way is to use `mmc --make --link-ssdb-libs' to compile your
program in any grade. You then just need to set --ssdb-trace shallow or deep
on the modules you wish to debug.
-----------------------------------------------------------------------------
TRACING LEVELS
--ssdb-trace none
None of the procedures in the module will generate trace events.
--ssdb-trace shallow
All the procedures in the interface of the module will generate events
of trace level shallow. Events of trace level shallow are only
displayed if the parent procedure in the call stack is compiled in
trace level deep.
--ssdb-trace deep
All procedures in the module will generate events of trace level deep..
-----------------------------------------------------------------------------
USING THE SOURCE TO SOURCE DEBUGGER
You may run the program as usual. To bring up the debugger prompt, set
the environment variable SSDB beforehand.
% SSDB=1 ./calculator
1: 1 1 CALL calculator.main
ssdb>
If you set SSDB=0 then you will need to explicitly enable the debugger later in
your code by calling ssdb.enable_debugging/2.
As in mdb, the three numbers are the event number, call sequence number (CSN)
and the stack depth. Type "help" to show a list of commands. All commands act
like their mdb counterparts (with reduced functionality), except for `list'
which prints the source code at the call site, not of the called procedure.
The debugger will execute commands from `$HOME/.ssdbrc' and `.ssdbrc' in
the current working directory, in order, at startup. You can put your
aliases and settings in those files. Lines starting with the # character
will be ignored.
For Java grades, JDK 7 improves performance considerably.
Early access releases are available from
<http://java.sun.com/javase/downloads/ea.jsp>
Programs built in .ssdebug grades use much more stack space (tail call
optimisation is destroyed by the transformation). You will likely need to
increase the stack size, e.g.
JAVA='java -Xss10m' SSDB=1 ./calculator
-----------------------------------------------------------------------------
LIMITATIONS
- There are no internal events. The only events are CALL, EXIT, REDO, FAIL,
and, for Java and C# grades, EXCP.
- Standard library procedures are treated specially. Events will only be
generated at the boundaries at which a user procedure calls and returns
from a standard library procedure. No events will be generated when a
standard library procedure calls another standard library procedure.
- The "retry" command works by executing forwards until reaching the end of
the call to retry, then recursively calling that procedure. Any side
effects of continuing execution will be visible. If it is not possible to
reach the end of the procedure to retry, the program will simply keep
executing. Press ^C to get back the debugger prompt.
- When running on Mono 2.8 and earlier, ^C can cause the program to hang.
This is fixed in later versions.
- Exceptions are only handled in Java and C# grades. Only a single EXCP event
is generated when an exception is thrown, instead of propagating EXCP events
up the call stack to the nearest exception handler.
- In grades which don't handle exceptions, the debugger's internal state will
be inconsistent with the program's execution after an exception, so you had
better quit the program and restart.
- Breakpoints currently match procedures by module and name only. Predicates
or functions with the same name but different arities will still match.
The debugger will not warn you if you set a breakpoint on a non-existent
procedure.
- We provide the filename and line number of call sites, but not the location
of the source code for the called procedure itself. Use mtags.
- The print goal command does not distinguish predicates and functions.
- Procedures with arguments which are neither `in' nor `out' will not be
transformed, hence will not generate events when called.
- Many commands available in mdb are not yet implemented for ssdebug.
- There is no tab completion.
- There is no I/O tabling.
- Debugging of multi-threaded programs is not supported.
-----------------------------------------------------------------------------