ucsim-0.2.37-pre3 into cvs
[fw/sdcc] / sim / ucsim / doc / cmd_bp.html
1 <html>
2 <head>
3 <title>Breakpoints commands of uCsim</title>
4 </head>
5
6 <body bgcolor="white">
7
8                                                           <!-- BREAKPOINTS -->
9
10 <h2>Commands of uCsim to manage breakpoints</h2>
11
12 Two kind of breakpoints can be used: fetch and event
13 breakpoint. <B>Fetch</b> breakpoints are classical breakpoints. They
14 can be placed at any instruction in the code memory. Breakpoint will
15 be hit if CPU fetches instruction code from the memory location
16 specified by the breakpoint. Only fetching of first byte of the
17 instruction hits the breakpoint. If the execution reaches a breakpoint
18 it stops <i>before</i> the instruction at location specified by the
19 breakpoint would be executed.
20
21 <p><b>Event</b> breakpoints are special onces. They cause stop of
22 execution if event specified by the breakpoint occures. Events are:
23
24 <dl><dt><b>wi</b> <dd>writing into internal RAM at specified location;
25
26 <dt><b>ri</b> <dd>reading from internal RAM at specified address;
27
28 <dt><b>wx</b> <dd>writing into external RAM at specified location
29 (MOVX instruction);
30
31 <dt><b>rx</b> <dd>reading from external RAM at specified address (MOVX
32 instruction);
33
34 <dt><b>ws</b> <dd>writing into SFR area at specified location;
35
36 <dt><b>rs</b> <dd>reading from SFR area at specified address;
37
38 <dt><b>rc</b> <dd>reading from code memory at specified location (MOVC
39 instruction).</dl>
40
41 Event breakpoint stops execution <i>after</i> specified event occured.
42
43 <p>Every breakpoint can be <b>fix</b> (permanent) or <b>dynamic</b>
44 (temporary). Dynamic breakpoints are automatically removed when they
45 reached. Some commands place dynamic fetch breakpoints into the code,
46 for example <a href="#g"><b>go</b></a> or <a
47 href="#n"><b>next</b></a>.
48
49 <p>A <b>hit number</b> can be associated to any breakpoint. This hit
50 number specifies how many times the breakpoint must be hit before it
51 causes the execution to stop. This hit number is 1 by default.
52
53
54 <a name="break"><h3>break addr [hit]</h3></a>
55 <a name="tbreak"><h3>tbreak addr [hit]</h3></a>
56
57 Set fetch breakpoint. The command specifies if the breakpoint will be
58 fix (<b>break</b>) or dynamic (temporary) (<b>tbreak</b>). First
59 parameter specifies address where the breakpoint must be placed to. It
60 should be address of an instruction.
61
62 <p>Second parameter is optional and it specifies the hit number. It is
63 1 by default.
64
65 <pre>
66 $ <font color="#118811">s51 remoansi.hex</font>
67 ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt.
68 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
69 This is free software, and you are welcome to redistribute it
70 under certain conditions; type `show c' for details.
71 58659 bytes read from remoansi.hex
72 > <font color="#118811">dc 0 0x10</font>
73    000000 02 01 60 LJMP  0160
74  * 000003 02 00 3c LJMP  003c
75  * 000006 ff       MOV   R7,A
76  * 000007 ff       MOV   R7,A
77  * 000008 ff       MOV   R7,A
78  * 000009 ff       MOV   R7,A
79  * 00000a ff       MOV   R7,A
80  * 00000b 02 3b e0 LJMP  3be0
81  * 00000e ff       MOV   R7,A
82  * 00000f ff       MOV   R7,A
83  * 000010 ff       MOV   R7,A
84 > <font color="#118811">break 0x160</font>
85 Breakpoint 1 at 0x000160: CLR   P1.0
86 > <font color="#118811">tbreak 8 2</font>
87 Breakpoint 2 at 0x000008: MOV   R7,A
88 > <font color="#118811">g</font>
89 Simulation started, PC=0x000000
90 Stop at 000160: (4) Breakpoint
91 F 000160
92 > </pre>
93
94
95 <a name="bse"><h3>bse wi|ri|wx|rx|ws|rs|rc f|d addr [hit]</h3></a>
96
97 Set event breakpoint. First parameter specifies type of event. See <a
98 href="#breakpoints">general description of event breakpoints</a> above
99 about meaning of event identifiers. Second parameter specify if the
100 breakpoint will be fix (<b>f</b>) or dynamic (<b>d</b>). Third
101 parameter specifies address. Remember that this is not an instruction
102 address, it is address of the memory cell where specified event should
103 occur.
104
105 <p>Forth parameter is optional and it specifies the hit number. It is
106 1 by default.
107
108 <pre>
109 $ <font color="#118811">s51 remoansi.hex</font>
110 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt.
111 ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
112 This is free software, and you are welcome to redistribute it
113 under certain conditions; type `show c' for details.
114 58659 bytes read from remoansi.hex
115 > <font color="#118811">dis</font>
116    00d47e 22       RET
117    000000 02 01 60 LJMP  0160
118    000160 c2 90    CLR   P1.0
119    000162 c2 97    CLR   P1.7
120    000164 d2 b5    SETB  P3.5
121    000166 d2 b4    SETB  P3.4
122    000168 75 81 22 MOV   SP,#22
123    00016b 75 d0 00 MOV   PSW,#00
124    00016e 7e 00    MOV   R6,#00
125    000170 7f 00    MOV   R7,#00
126    000172 79 04    MOV   R1,#04
127    000174 12 0d b8 LCALL 0db8
128    000177 0f       INC   R7
129    000178 d9 fa    DJNZ  R1,0174
130    00017a 75 0b 00 MOV   0b,#00
131    00017d 75 0c 00 MOV   0c,#00
132    000180 02 02 2a LJMP  022a
133    000183 78 22    MOV   R0,#22
134    000185 76 00    MOV   @R0,#00
135    000187 d8 fc    DJNZ  R0,0185
136 > <font color="#118811">bse wi f 6</font>
137 > <font color="#118811">g</font>
138 4
139    000170 7f 00    MOV   R7,#00
140 > </pre>
141
142
143 <a name="clear"><h3>clear [addr...]</h3></a>
144
145 Delete fetch breakpoint. Parameter specifies address of breakpoint. If
146 there is no breakpoint specified at given address this command prints
147 out a warning message.
148
149 <p>If parameter is not given then breakpoint at current PC will be
150 deleted if it exists. If more than one address is specified then all
151 breakpoints at specified addresses will be deleted.
152
153 <pre>
154 > <font color="#118811">i b</font>
155 Num Type       Disp Hit   Cnt   Address  What
156 1   fetch      keep 1     1     0x000160 CLR   P1.0
157 2   fetch      del  1     1     0x000180 LJMP  022a
158 1   event      keep 1     1     0x000006 wi
159 > <font color="#118811">clear 160</font>
160 No breakpoint at 0000a0
161 > <font color="#118811">clear 0x160</font>
162 > <font color="#118811">i b</font>
163 Num Type       Disp Hit   Cnt   Address  What
164 2   fetch      del  1     1     0x000180 LJMP  022a
165 1   event      keep 1     1     0x000006 wi
166 > </pre>
167
168
169 <a name="bde"><h3>bde wi|ri|wx|rx|ws|rs|rc addr</h3></a>
170
171 Delete event breakpoint. First parameter must be given to specify type
172 of event. Second parameter is address of memory cell which the
173 breakpoint is associated to. Continuing example given above:
174
175 <pre>
176 > <font color="#118811">bl</font>
177 D 2(2) 000180 02 LJMP  022a
178 F 1(1) 000006 wi
179 > <font color="#118811">bde ri 6</font>
180 No ri breakpoint at 000006
181 > <font color="#118811">bde wi 6</font>
182 > <font color="#118811">bl</font>
183 D 2(2) 000180 02 LJMP  022a
184 > </pre>
185
186
187 <a name="ba"><h3>ba</h3></a>
188
189 Delete all breakpoints. This command deletes all fetch as well as
190 event breakpoints. Be carefull because it does not ask you to confirm
191 your intention.
192
193 <pre>
194 > <font color="#118811">bl</font>
195 F 1(1) 000160 c2 CLR   P1.0
196 D 2(2) 000180 02 LJMP  022a
197 F 1(1) 000006 wi
198 > <font color="#118811">ba</font>
199 > <font color="#118811">bl</font>
200 > </pre>
201
202
203 <hr>
204
205 </body>
206 </html>