<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14"> <TITLE> The WAM debugger </TITLE> </HEAD> <BODY TEXT=black BGCOLOR=white> <A HREF="manual014.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual009.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> <HR> <TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%"> <TR><TD BGCOLOR="#66dbff"><DIV ALIGN=center><TABLE> <TR><TD><FONT SIZE=4><B><A NAME="htoc28">4.6</A></B></FONT></TD> <TD WIDTH="100%" ALIGN=center><FONT SIZE=4><B>The WAM debugger</B></FONT></TD> </TR></TABLE></DIV></TD> </TR></TABLE> <A NAME="The-WAM-debugger"></A> In some cases it is interesting to have access to the WAM data structures. This sub-debugger allows the user to inspect/modify the contents of any stack or register of the WAM. The WAM debugger is invoked using the built-in predicate <TT>wam_debug/0</TT> (section <A HREF="manual012.html#Running-and-stopping-the-debugger">4.3.1</A>) or the <TT>W</TT> debugger command (section <A HREF="manual014.html#Debugger-commands">4.5</A>). The following table presents the specific commands of the WAM debugger:<BR> <TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1> <TR><TD ALIGN=left NOWRAP>Command</TD> <TD ALIGN=left NOWRAP>Description</TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>write</TT> <I><TT>A</TT></I> [<I><TT>N</TT></I>]</TD> <TD ALIGN=left NOWRAP>write <I><TT>N</TT></I> terms starting at the address <I><TT>A</TT></I> using <TT>write/1</TT> (section <A HREF="manual037.html#write-term/3">7.14.6</A>)</TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>data</TT> <I><TT>A</TT></I> [<I><TT>N</TT></I>]</TD> <TD ALIGN=left NOWRAP>display <I><TT>N</TT></I> words starting at the address <I><TT>A</TT></I></TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>modify</TT> <I><TT>A</TT></I> [<I><TT>N</TT></I>]</TD> <TD ALIGN=left NOWRAP>display and modify <I><TT>N</TT></I> words starting at the address <I><TT>A</TT></I></TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>where</TT> <I><TT>A</TT></I></TD> <TD ALIGN=left NOWRAP>display the real address corresponding to <I><TT>A</TT></I></TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>what</TT> <I><TT>RA</TT></I></TD> <TD ALIGN=left NOWRAP>display what corresponds to the real address <I><TT>RA</TT></I></TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>deref</TT> <I><TT>A</TT></I></TD> <TD ALIGN=left NOWRAP>display the dereferenced word starting at the address <I><TT>A</TT></I></TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>envir</TT> [<I><TT>SA</TT></I>]</TD> <TD ALIGN=left NOWRAP>display the contents of the environment located at <I><TT>SA</TT></I> (or the current one)</TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>backtrack</TT> [<I><TT>SA</TT></I>]</TD> <TD ALIGN=left NOWRAP>display the contents of the choice-point located at <I><TT>SA</TT></I> (or the current one)</TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>backtrack all</TT></TD> <TD ALIGN=left NOWRAP>display all choice-points</TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>quit</TT></TD> <TD ALIGN=left NOWRAP>quit the WAM debugger</TD> </TR> <TR><TD ALIGN=left NOWRAP><TT>help</TT></TD> <TD ALIGN=left NOWRAP>display a summary of available commands</TD> </TR></TABLE><BR> In the above table the following conventions apply: <UL><LI>elements between [ and ] are optional.<BR> <BR> <LI><I><TT>N</TT></I> is an optional integer (defaults to 1).<BR> <BR> <LI><I><TT>A</TT></I> is a WAM address, its syntax is: <I><TT>BANK_NAME</TT></I> [ <TT>[ <I>N</I> ]</TT> ], i.e. a bank name possibly followed by an index (defaults to 0). <I><TT>BANK_NAME</TT></I> is either: <UL><LI><TT>reg</TT>: WAM general register (stack pointers, continuation, ...). <BR> <BR> <LI><TT>x</TT>: WAM X register (temporary variables, i.e. arguments).<BR> <BR> <LI><TT>y</TT>: WAM Y register (permanent variables).<BR> <BR> <LI><TT>ab</TT>: WAM X register saved in the current choice-point.<BR> <BR> <LI><I><TT>STACK_NAME</TT></I>: WAM stack (<I><TT>STACK_NAME</TT></I> in <TT>local</TT>, <TT>global</TT>, <TT>trail</TT>, <TT>cstr</TT>).</UL><BR> <BR> <LI><I><TT>SA</TT></I> is a WAM stack address, i.e. <I><TT>STACK_NAME</TT></I> [ <TT>[ <I>N</I> ]</TT> ] (special case of WAM addresses).<BR> <BR> <LI><I><TT>RA</TT></I> is a real address, its syntax is the syntax of C integers (in particular the notation <TT>0x...</TT> is recognized).</UL> It is possible to only use the first letters of a commands and bank names when there is no ambiguity. Also the square brackets <TT>[</TT> <TT>]</TT> enclosing the index of a bank name can be omitted. For instance the following command (showing the contents of 25 consecutive words of the global stack from the index 3): <TT>data global[3] 25</TT> can be abbreviated as: <TT>d g 3 25</TT>.<BR> <BR> <HR SIZE=2> Copyright (C) 1999-2002 Daniel Diaz <BR> <BR> Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. <BR> <BR> <A HREF="index.html#copyright">More about the copyright</A> <HR> <A HREF="manual014.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A> <A HREF="manual009.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A> </BODY> </HTML>