1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
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]">
10 <u>CDB File format Description</u></h1>
11 The .cdb file created when the --debug option is used contains the
12 following types of records. The records are stored one per line,
13 and the first character determines the record type.
16 <u>Type Description Generated by</u></h4>
20 'S' Symbol Record Compiler</li>
23 'T' Structure description record Compiler</li>
26 'L' Linker record assembler/linker</li>
29 'F' Function record Compiler</li>
32 'M' Module record Compiler</li>
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 & parameter). The format of the symbol record is as follows.
39 <p><i>S:{G|F<filename>|L<functionName>}$<name>$<level>$<block>
40 (<type info>),<Address Space>,<on Stack?>,<stack offset></i>
41 <p>Following the record type is the scope information for the symbol.
42 'G' indicates Global . F<filename> indicates the symbol is active for
43 a given file only (e.g. global variables declared as 'static') L<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 the unmangled/user
46 given name of the variable). The level & block are used to further
47 scope local variables since C allows the definitions like ...
50 <br> int c; /* block #1 , level #1 */
51 <br> {
52 <br> int c; /* block #2, level
54 <br> ...
55 <br> }
56 <p> {
57 <br> int c; /* block #3 , level
59 <br> ...
60 <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}<type info chain>)</i>
65 <p><i>size </i>- size in bytes of the symbol.
66 <p><i><type info chain></i> - should be parsed into a linked list of
67 type, the elements of the list are described below.
70 <center><table BORDER=3 CELLSPACING=3 WIDTH="500" BGCOLOR="#CCCCCC" NOSAVE >
72 <td NOSAVE><b>Type Code</b></td>
74 <td NOSAVE><b>Description</b></td>
78 <td NOSAVE>DA<n></td>
80 <td NOSAVE>Array of n elements</td>
92 <td>Generic pointer</td>
104 <td>Xternal Ram pointer</td>
110 <td>Internal ram pointer</td>
116 <td>Paged pointer</td>
122 <td NOSAVE>Upper 128 byte pointer</td>
164 <td>structure of name <name></td>
176 <td>bit field of <n> bits.</td>
184 <center><table BORDER WIDTH="500" NOSAVE >
186 <td NOSAVE><b>Address Space</b>
187 <br><b>Code </b></td>
189 <td><b>Description of address space</b></td>
195 <td>External stack</td>
201 <td>Internal stack</td>
213 <td>Code/static segment</td>
219 <td>Internal ram (lower 128) bytes</td>
225 <td>External ram</td>
231 <td>Internal ram</td>
237 <td>Bit addressable</td>
261 <br>This is best illustrated with a few examples.
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
267 <p>The following function declaration along with local variables and parameters.
268 <p>void uitoa(unsigned int value, char* string, int radix)
270 <br>char buffer[NUMBER_OF_DIGITS];
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
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.
290 <br>and unions are represented using the same debug format. The format
292 <br>Structure record is as follows .
293 <p>T:F<filename>$tag[({offset}<Symbol Record 'S' type for 1st field>)
294 <br>({offset}<Symbol Record 'S' type for 2nd field>)
301 <p>struct some_struct {
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.
318 <p>Structure declarations with embeded structures.
321 <br>volatile unsigned char b0,
327 <br>volatile unsigned int lo,hi ;
329 <br>unsigned volatile long l;
331 <br>volatile unsigned char b0;
332 <br>unsigned int i12;
333 <br>unsigned char b3;}
337 <p>Generates the following debug information. NOTE: the embedded anonymous
338 <br>structures generates separate T - type records.
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)
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
382 <br>the function uses and if the function is an interrupt service routine
384 <br>interrupt number of the function.