From 06ddd042f20a0fe095f54452ca15692a56b22a6d Mon Sep 17 00:00:00 2001 From: empathicqubit Date: Sun, 20 Feb 2022 11:44:08 +0100 Subject: [PATCH] Documentation --- doc/cc65.sgml | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index df58a0a95..67323931c 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -198,6 +198,189 @@ Here is a description of all the command line options: Enables debug mode, for debugging the behavior of cc65. + --debug-tables name + + Writes symbol table information to a file, which includes details on structs, unions + functions, and global variables. For example, given the following code: + + + struct l { + unsigned char m; + unsigned char n; + }; + + struct hello { + unsigned char j; + unsigned char k; + struct l l; + }; + + struct sub { + unsigned char x; + unsigned char y; + }; + + union xy { + struct sub xy; + unsigned int mem; + }; + + typedef struct hello thingy; + + unsigned char single; + + unsigned char test_local_vars_main(void) { + static unsigned char wahoo; + static unsigned char bonanza = 0x42; + unsigned char i; + unsigned int j; + unsigned int *random; + unsigned char *lol; + signed char whoa; + struct hello wow; + thingy *cool; + union xy xy; + + return 0; + } + + + The following output would be produced: + + + SC_FUNC: _test_local_vars_main: Symbol table + ============================================ + __fixargs__: + Flags: SC_CONST SC_DEF + Type: unsigned int + __argsize__: + Flags: SC_CONST SC_DEF + Type: unsigned char + wahoo: + AsmName: M0001 + Flags: SC_STATIC SC_DEF SC_REF + Type: unsigned char + bonanza: + AsmName: M0002 + Flags: SC_STATIC SC_DEF SC_REF + Type: unsigned char + i: + Flags: SC_AUTO SC_DEF SC_REF + Type: unsigned char + j: + Flags: SC_AUTO SC_DEF SC_REF + Type: unsigned int + random: + Flags: SC_AUTO SC_DEF SC_REF + Type: unsigned int * + lol: + Flags: SC_AUTO SC_DEF SC_REF + Type: unsigned char * + whoa: + Flags: SC_AUTO SC_DEF SC_REF + Type: signed char + wow: + Flags: SC_AUTO SC_DEF SC_REF + Type: struct hello + cool: + Flags: SC_AUTO SC_DEF SC_REF + Type: struct hello * + xy: + Flags: SC_AUTO SC_DEF SC_REF + Type: union xy + + + + + Global symbol table + =================== + thingy: + AsmName: _thingy + Flags: SC_TYPEDEF 0x100000 + Type: struct hello + single: + AsmName: _single + Flags: SC_STATIC SC_EXTERN SC_STORAGE SC_DEF SC_REF 0x100000 + Type: unsigned char + test_local_vars_main: + AsmName: _test_local_vars_main + Flags: SC_FUNC SC_STATIC SC_EXTERN SC_DEF 0x100000 + Type: unsigned char (void) + + + + + Global tag table + ================ + l: + Flags: SC_STRUCT SC_DEF + Type: (none) + hello: + Flags: SC_STRUCT SC_DEF + Type: (none) + sub: + Flags: SC_STRUCT SC_DEF + Type: (none) + xy: + Flags: SC_UNION SC_DEF + Type: (none) + + + + + Global struct and union definitions + ========================= + + SC_STRUCT: l + ============ + m: + Flags: SC_STRUCTFIELD + Type: unsigned char + n: + Flags: SC_STRUCTFIELD + Type: unsigned char + + + + + SC_STRUCT: hello + ================ + j: + Flags: SC_STRUCTFIELD + Type: unsigned char + k: + Flags: SC_STRUCTFIELD + Type: unsigned char + l: + Flags: SC_STRUCTFIELD + Type: struct l + + + + + SC_STRUCT: sub + ============== + x: + Flags: SC_STRUCTFIELD + Type: unsigned char + y: + Flags: SC_STRUCTFIELD + Type: unsigned char + + + + + SC_UNION: xy + ============ + xy: + Flags: SC_STRUCTFIELD + Type: struct sub + mem: + Flags: SC_STRUCTFIELD + Type: unsigned int + + + --debug-opt name The named file contains a list of specific optimization steps to enable or disable.