File: gprolog015.html

package info (click to toggle)
gprolog 1.3.0-6.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 13,512 kB
  • ctags: 8,954
  • sloc: ansic: 57,431; perl: 16,620; sh: 5,900; makefile: 1,284
file content (121 lines) | stat: -rw-r--r-- 5,367 bytes parent folder | download | duplicates (2)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!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.08">
<LINK rel="stylesheet" type="text/css" href="gprolog.css">
<TITLE>
The WAM debugger
</TITLE>
</HEAD>
<BODY TEXT=black BGCOLOR=white>
<A HREF="gprolog014.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="gprolog009.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<HR>

<H3 CLASS="subsection"><A NAME="htoc28">4.6</A>&nbsp;&nbsp;The WAM debugger</H3>
<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&nbsp;<A HREF="gprolog012.html#Running-and-stopping-the-debugger">4.3.1</A>) or the <TT>W</TT> debugger command (section&nbsp;<A HREF="gprolog014.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&nbsp;<A HREF="gprolog037.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 CLASS="itemize"><LI CLASS="li-itemize">elements between [ and ] are optional.<BR>
<BR>
<LI CLASS="li-itemize"><I><TT>N</TT></I> is an optional integer (defaults to 1).<BR>
<BR>
<LI CLASS="li-itemize"><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 CLASS="itemize"><LI CLASS="li-itemize"><TT>reg</TT>: WAM general register (stack pointers, continuation,
...). <BR>
<BR>
<LI CLASS="li-itemize"><TT>x</TT>: WAM X register (temporary variables, i.e. arguments).<BR>
<BR>
<LI CLASS="li-itemize"><TT>y</TT>: WAM Y register (permanent variables).<BR>
<BR>
<LI CLASS="li-itemize"><TT>ab</TT>: WAM X register saved in the current choice-point.<BR>
<BR>
<LI CLASS="li-itemize"><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 CLASS="li-itemize"><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 CLASS="li-itemize"><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-2007 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="gprolog014.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="gprolog009.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
</BODY>
</HTML>