pragma noinduction broke memcpy on mcs51 large model. Moved it into z80 code.
[fw/sdcc] / doc / cdbfile.html
1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
2 <html>
3 <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5    <meta name="GENERATOR" content="Mozilla/4.51 [en] (X11; I; Linux 2.2.5-15 i686) [Netscape]">
6 </head>
7 <body>
8
9 <h1>
10 <u>CDB File format Description</u></h1>
11 The .cdb file created when the --debug option is used contains&nbsp; the
12 following types of records. The records are stored one per&nbsp; line,
13 and the first character determines the record type.
14 <br>&nbsp;
15 <h4>
16 <u>Type Description Generated by</u></h4>
17
18 <ul>
19 <li>
20 'S'&nbsp;&nbsp;&nbsp; Symbol Record Compiler</li>
21
22 <li>
23 'T'&nbsp;&nbsp;&nbsp; Structure description record Compiler</li>
24
25 <li>
26 'L'&nbsp;&nbsp;&nbsp; Linker record assembler/linker</li>
27
28 <li>
29 'F'&nbsp;&nbsp;&nbsp; Function record Compiler</li>
30
31 <li>
32 'M'&nbsp;&nbsp; Module record Compiler</li>
33 </ul>
34
35 <h4>
36 <u>Details of 'S'-Type (Symbol Record)</u></h4>
37 A symbol record is generated for each named symbol in the source file (local,
38 global &amp; parameter). The format of the symbol record is as follows.
39 <p><i>S:{G|F&lt;filename>|L&lt;functionName>}$&lt;name>$&lt;level>$&lt;block>
40 (&lt;type info>),&lt;Address Space>,&lt;on Stack?>,&lt;stack offset></i>
41 <p>Following the record type is the scope information for the symbol.&nbsp;
42 'G' indicates Global . F&lt;filename> indicates the symbol is active for
43 a given file only (e.g. global variables declared as 'static') L&lt;functionName>
44 indicates that the symbol is local to the function with the given name.
45 The follows the name of the variable (this is&nbsp; the unmangled/user
46 given name of the variable). The level &amp; block are used to further
47 scope local variables since C allows the&nbsp; definitions like ...
48 <p>foo()
49 <br>{
50 <br>&nbsp;&nbsp;&nbsp; int c; /* block #1 , level #1 */
51 <br>&nbsp;&nbsp;&nbsp; {
52 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int c; /* block #2, level
53 #2 */
54 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...
55 <br>&nbsp;&nbsp;&nbsp; }
56 <p>&nbsp;&nbsp;&nbsp; {
57 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int c; /* block #3 , level
58 #2 */
59 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...
60 <br>&nbsp;&nbsp;&nbsp; }
61 <br>}
62 <p>The type info is a chain of type (since C allows declarations of arbitrary
63 complexity. The type info has the following format .
64 <p><i>({size}&lt;type info chain>)</i>
65 <p><i>size </i>- size in bytes of the symbol.
66 <p><i>&lt;type info chain></i> - should be parsed into a linked list of
67 type, the elements of the list are described below.
68 <br>&nbsp;
69 <br>&nbsp;
70 <center><table BORDER=3 CELLSPACING=3 WIDTH="500" BGCOLOR="#CCCCCC" NOSAVE >
71 <tr NOSAVE>
72 <td NOSAVE><b>Type Code</b></td>
73
74 <td NOSAVE><b>Description</b></td>
75 </tr>
76
77 <tr NOSAVE>
78 <td NOSAVE>DA&lt;n></td>
79
80 <td NOSAVE>Array of n elements</td>
81 </tr>
82
83 <tr>
84 <td>DF</td>
85
86 <td>Function</td>
87 </tr>
88
89 <tr>
90 <td>DG</td>
91
92 <td>Generic pointer</td>
93 </tr>
94
95 <tr>
96 <td>DC</td>
97
98 <td>Code pointer</td>
99 </tr>
100
101 <tr>
102 <td>DX</td>
103
104 <td>Xternal Ram pointer</td>
105 </tr>
106
107 <tr>
108 <td>DD</td>
109
110 <td>Internal ram pointer</td>
111 </tr>
112
113 <tr>
114 <td>DP</td>
115
116 <td>Paged pointer</td>
117 </tr>
118
119 <tr NOSAVE>
120 <td>DI</td>
121
122 <td NOSAVE>Upper 128 byte pointer</td>
123 </tr>
124
125 <tr>
126 <td>SL</td>
127
128 <td>long</td>
129 </tr>
130
131 <tr>
132 <td>SI</td>
133
134 <td>int</td>
135 </tr>
136
137 <tr>
138 <td>SC</td>
139
140 <td>char</td>
141 </tr>
142
143 <tr>
144 <td>SS</td>
145
146 <td>short</td>
147 </tr>
148
149 <tr>
150 <td>SV</td>
151
152 <td>void</td>
153 </tr>
154
155 <tr>
156 <td>SF</td>
157
158 <td>float</td>
159 </tr>
160
161 <tr>
162 <td>ST&lt;name></td>
163
164 <td>structure of name &lt;name></td>
165 </tr>
166
167 <tr>
168 <td>SX&nbsp;</td>
169
170 <td>sbit</td>
171 </tr>
172
173 <tr>
174 <td>SB&lt;n></td>
175
176 <td>bit field of &lt;n> bits.</td>
177 </tr>
178 </table></center>
179
180 <p>Address Space
181 <br>Code Description
182 <br>---- -----------
183 <br>&nbsp;
184 <center><table BORDER WIDTH="500" NOSAVE >
185 <tr NOSAVE>
186 <td NOSAVE><b>Address Space</b>
187 <br><b>Code&nbsp;</b></td>
188
189 <td><b>Description of address space</b></td>
190 </tr>
191
192 <tr>
193 <td>A</td>
194
195 <td>External stack</td>
196 </tr>
197
198 <tr>
199 <td>B</td>
200
201 <td>Internal stack</td>
202 </tr>
203
204 <tr>
205 <td>C</td>
206
207 <td>Code</td>
208 </tr>
209
210 <tr>
211 <td>D</td>
212
213 <td>Code/static segment</td>
214 </tr>
215
216 <tr>
217 <td>E</td>
218
219 <td>Internal ram (lower 128) bytes</td>
220 </tr>
221
222 <tr>
223 <td>F</td>
224
225 <td>External ram</td>
226 </tr>
227
228 <tr>
229 <td>G</td>
230
231 <td>Internal ram</td>
232 </tr>
233
234 <tr>
235 <td>H</td>
236
237 <td>Bit addressable</td>
238 </tr>
239
240 <tr>
241 <td>I</td>
242
243 <td>SFR space</td>
244 </tr>
245
246 <tr>
247 <td>J</td>
248
249 <td>SBIT space</td>
250 </tr>
251 </table></center>
252
253 <br>&nbsp;
254 <p>Sign Information
255 <br>Code Description
256 <br>---- -----------
257 <br>S Signed
258 <br>U Unsigned
259 <p>Examples
260 <br>--------
261 <br>This is best illustrated with a few examples.
262 <p>Declaration.
263 <p>idata char BCD_Cell[5];
264 <p>Generates the following debug info.
265 <p>S:G$BCD_cell$0$0({5}DA5,SC:S),G,0,0
266 <br>&nbsp;
267 <p>The following function declaration along with local variables and parameters.
268 <p>void uitoa(unsigned int value, char* string, int radix)
269 <br>{
270 <br>char buffer[NUMBER_OF_DIGITS];
271 <p>..
272 <br>}
273 <p>Will generate the following debug information.
274 <p>/* function "uitoa" */
275 <br>F:G$uitoa$0$0({2}DF,SV:S),C,0,0
276 <p>/* parameter "value" */
277 <br>S:Luitoa$value$1$1({2}SI:S),E,0,0
278 <p>/* parameter "string" */
279 <br>S:Luitoa$string$1$1({3}DG,SC:S),E,0,0
280 <p>/* parameter "radix" */
281 <br>S:Luitoa$radix$1$1({2}SI:S),E,0,0
282 <p>/* local variable "buffer" */
283 <br>S:Luitoa$buffer$1$1({16}DA16,SC:S),E,0,0
284 <br>&nbsp;
285 <p>Details of 'T'-Type (Structure Record)
286 <br>--------------------------------------
287 <br>Structure definitions ALWAYS have file scope. Currently structure definitions
288 <br>within functions or blocks are not handled in the debug information.
289 Structure
290 <br>and unions are represented using the same debug format. The format
291 of the
292 <br>Structure record is as follows .
293 <p>T:F&lt;filename>$tag[({offset}&lt;Symbol Record 'S' type for 1st field>)
294 <br>({offset}&lt;Symbol Record 'S' type for 2nd field>)
295 <br>...
296 <br>...
297 <br>]
298 <p>Example 1.
299 <br>----------
300 <p>Definition
301 <p>struct some_struct {
302 <br>int a;
303 <br>char b;
304 <br>long c;
305 <br>};
306 <p>Generates the following 'T' - type record.
307 <p>T:Fprob38$some_struct[
308 <br>/* field 'a' offset = 0 */
309 <br>({0}S:S$a$1$0({2}SI:S),Z,0,0)
310 <br>/* field 'b' offset = 2 */
311 <br>({2}S:S$b$1$0({1}SC:S),Z,0,0)
312 <br>/* field 'c' offset = 3 */
313 <br>({3}S:S$c$1$0({4}SL:S),Z,0,0)]
314 <p>The 'S' - type (symbol rescord for each of the fields is embedded inside
315 <br>the structure definition record.
316 <p>Example 2.
317 <br>----------
318 <p>Structure declarations with embeded structures.
319 <p>union bil {
320 <br>struct {
321 <br>volatile unsigned char b0,
322 <br>b1,
323 <br>b2,
324 <br>b3 ;
325 <br>} b;
326 <br>struct {
327 <br>volatile unsigned int lo,hi ;
328 <br>} i;
329 <br>unsigned volatile long l;
330 <br>struct {
331 <br>volatile unsigned char b0;
332 <br>unsigned int i12;
333 <br>unsigned char b3;}
334 <br>bi;
335 <br>} ;
336 <br>&nbsp;
337 <p>Generates the following debug information. NOTE: the embedded anonymous
338 <br>structures generates separate T - type records.
339 <p>T:Fprob38$bil[
340 <br>/* field 'b' is of type Structure __00020000 , offset = 0 */
341 <br>({0}S:S$b$1$0({4}ST__00020000:S),Z,0,0)
342 <p>/* field 'i' is of type structre __00020001 , offset = 0 (union) */
343 <br>({0}S:S$i$1$0({4}ST__00020001:S),Z,0,0)
344 <p>/* field 'l' is of type unsigned long */
345 <br>({0}S:S$l$1$0({4}SL:U),Z,0,0)
346 <p>/* field 'bi' is of type structure __00020002 offset = 0 */
347 <br>({0}S:S$bi$1$0({4}ST__00020002:S),Z,0,0)]
348 <p>/* compiler generates these 'T'-type records for the
349 <br>anonymous structures */
350 <p>/* T record for structure __00020000 (field 'b' in the above structure)
351 */
352 <p>T:Fprob38$__00020000[
353 <br>/* field 'b0' type unsigned char , offset = 0 */
354 <br>({0}S:S$b0$2$0({1}SC:U),Z,0,0)
355 <p>/* field 'b1' type unsigned char , offset = 1 */
356 <br>({1}S:S$b1$2$0({1}SC:U),Z,0,0)
357 <p>/* field 'b2' type unsigned char, offset = 2 */
358 <br>({2}S:S$b2$2$0({1}SC:U),Z,0,0)
359 <p>/* field 'b3' type unsigned char , offset = 3 */
360 <br>({3}S:S$b3$2$0({1}SC:U),Z,0,0)]
361 <p>/* T record for structure __00020001 (field 'i' in union 'bil' ) */
362 <p>T:Fprob38$__00020001[
363 <br>/* field 'lo' type unsigned int offset 0 */
364 <br>({0}S:S$lo$2$0({2}SI:U),Z,0,0)
365 <p>/* field 'hi' type unsigned int offset 2 */
366 <br>({2}S:S$hi$2$0({2}SI:U),Z,0,0)]
367 <p>/* T record for structure __00020002 (field 'bi' in union 'bil' )*/
368 <p>T:Fprob38$__00020002[
369 <br>/* field 'b0' type unsigned char , offset 0 */
370 <br>({0}S:S$b0$2$0({1}SC:U),Z,0,0)
371 <p>/* field 'i1' type unsigned int , offset 1 */
372 <br>({1}S:S$i12$2$0({2}SI:U),Z,0,0)
373 <p>/* field 'b3' type unsigned char offset 3 */
374 <br>({3}S:S$b3$2$0({1}SC:U),Z,0,0)]
375 <p>Details of 'F'-Type (FUNCTION Record)
376 <br>--------------------------------------
377 <br>A Function record is created for each function defined in the C Source
378 <br>file. The format of a function record is identical to that of the Symbol
379 <br>record. The function record contains information about the return value
380 <br>of a function, in addition it contains information about the register
381 bank
382 <br>the function uses and if the function is an interrupt service routine
383 the
384 <br>interrupt number of the function.
385 <p>Example 1.
386 <br>----------
387 </body>
388 </html>