|
|
1.1 ! root 1: /* Symbol table definitions for GDB. ! 2: Copyright (C) 1986 Free Software Foundation, Inc. ! 3: ! 4: GDB is distributed in the hope that it will be useful, but WITHOUT ANY ! 5: WARRANTY. No author or distributor accepts responsibility to anyone ! 6: for the consequences of using it or for whether it serves any ! 7: particular purpose or works at all, unless he says so in writing. ! 8: Refer to the GDB General Public License for full details. ! 9: ! 10: Everyone is granted permission to copy, modify and redistribute GDB, ! 11: but only under the conditions described in the GDB General Public ! 12: License. A copy of this license is supposed to have been given to you ! 13: along with GDB so you can know your rights and responsibilities. It ! 14: should be in a file named COPYING. Among other things, the copyright ! 15: notice and this notice must be preserved on all copies. ! 16: ! 17: In other words, go ahead and share GDB, but don't try to stop ! 18: anyone else from sharing it farther. Help stamp out software hoarding! ! 19: */ ! 20: ! 21: /* An obstack to hold objects that should be freed ! 22: when we load a new symbol table. ! 23: This includes the symbols made by dbxread ! 24: and the types that are not permanent. */ ! 25: ! 26: extern struct obstack *symbol_obstack; ! 27: ! 28: /* Some definitions and declarations to go with use of obstacks. */ ! 29: #define obstack_chunk_alloc xmalloc ! 30: #define obstack_chunk_free free ! 31: extern char *xmalloc (); ! 32: extern void free (); ! 33: ! 34: /* gdb can know one or several symbol tables at the same time; ! 35: the ultimate intent is to have one for each separately-compiled module. ! 36: Each such symbol table is recorded by a struct symtab, and they ! 37: are all chained together. */ ! 38: ! 39: /* In addition, gdb can record any number of miscellaneous undebuggable ! 40: functions' addresses. In a system that appends _ to function names, ! 41: the _'s are removed from the names stored in this table. */ ! 42: ! 43: struct misc_function ! 44: { ! 45: char *name; ! 46: CORE_ADDR address; ! 47: }; ! 48: ! 49: /* Address and length of the vector recording all misc function names/addresses. */ ! 50: ! 51: struct misc_function *misc_function_vector; ! 52: int misc_function_count; ! 53: ! 54: #include "symseg.h" ! 55: ! 56: /* Each source file is represented by a struct symtab. ! 57: These objects are chained through the `next' field. */ ! 58: ! 59: struct symtab ! 60: { ! 61: /* Chain of all existing symtabs. */ ! 62: struct symtab *next; ! 63: /* List of all symbol scope blocks for this symtab. */ ! 64: struct blockvector *blockvector; ! 65: /* Table mapping core addresses to line numbers for this file. */ ! 66: struct linetable *linetable; ! 67: /* Vector containing all types defined for this symtab. */ ! 68: struct typevector *typevector; ! 69: /* Name of this source file. */ ! 70: char *filename; ! 71: /* This component says how to free the data we point to: ! 72: free_contents => do a tree walk and free each object. ! 73: free_nothing => do nothing; some other symtab will free ! 74: the data this one uses. ! 75: free_linetable => free just the linetable. */ ! 76: enum free_code {free_nothing, free_contents, free_linetable} ! 77: free_code; ! 78: /* Pointer to one block storage to be freed, if nonzero. */ ! 79: char *free_ptr; ! 80: /* Total number of lines found in source file. */ ! 81: int nlines; ! 82: /* Array mapping line number to character position. */ ! 83: int *line_charpos; ! 84: /* Language of this source file. */ ! 85: enum language language; ! 86: /* String of version information. May be zero. */ ! 87: char *version; ! 88: /* String of compilation information. May be zero. */ ! 89: char *compilation; ! 90: /* Offset within loader symbol table ! 91: of first local symbol for this file. */ ! 92: int ldsymoff; ! 93: /* Full name of file as found by searching the source path. ! 94: 0 if not yet known. */ ! 95: char *fullname; ! 96: }; ! 97: ! 98: /* This is the list of struct symtab's that gdb considers current. */ ! 99: ! 100: struct symtab *symtab_list; ! 101: ! 102: /* This symtab variable specifies the current file for printing source lines */ ! 103: ! 104: struct symtab *current_source_symtab; ! 105: ! 106: /* This is the next line to print for listing source lines. */ ! 107: ! 108: int current_source_line; ! 109: ! 110: #define BLOCKLIST(symtab) (symtab)->blockvector ! 111: #define BLOCKVECTOR(symtab) (symtab)->blockvector ! 112: ! 113: #define TYPEVECTOR(symtab) (symtab)->typevector ! 114: ! 115: #define LINELIST(symtab) (symtab)->linetable ! 116: #define LINETABLE(symtab) (symtab)->linetable ! 117: ! 118: /* Macros normally used to access components of symbol table structures. */ ! 119: ! 120: #define BLOCKLIST_NBLOCKS(blocklist) (blocklist)->nblocks ! 121: #define BLOCKLIST_BLOCK(blocklist,n) (blocklist)->block[n] ! 122: #define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks ! 123: #define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n] ! 124: ! 125: #define TYPEVECTOR_NTYPES(typelist) (typelist)->length ! 126: #define TYPEVECTOR_TYPE(typelist,n) (typelist)->type[n] ! 127: ! 128: #define BLOCK_START(bl) (bl)->startaddr ! 129: #define BLOCK_END(bl) (bl)->endaddr ! 130: #define BLOCK_NSYMS(bl) (bl)->nsyms ! 131: #define BLOCK_SYM(bl, n) (bl)->sym[n] ! 132: #define BLOCK_FUNCTION(bl) (bl)->function ! 133: #define BLOCK_SUPERBLOCK(bl) (bl)->superblock ! 134: ! 135: /* Nonzero if symbols of block BL should be sorted alphabetically. */ ! 136: #define BLOCK_SHOULD_SORT(bl) ((bl)->nsyms >= 40) ! 137: ! 138: #define SYMBOL_NAME(symbol) (symbol)->name ! 139: #define SYMBOL_NAMESPACE(symbol) (symbol)->namespace ! 140: #define SYMBOL_CLASS(symbol) (symbol)->class ! 141: #define SYMBOL_VALUE(symbol) (symbol)->value.value ! 142: #define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes ! 143: #define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block ! 144: #define SYMBOL_TYPE(symbol) (symbol)->type ! 145: ! 146: /* This appears in a type's flags word ! 147: if it is a (pointer to a|function returning a)* built in scalar type. ! 148: These types are never freed. */ ! 149: #define TYPE_FLAG_PERM 4 ! 150: ! 151: #define TYPE_NAME(thistype) (thistype)->name ! 152: #define TYPE_TARGET_TYPE(thistype) (thistype)->target_type ! 153: #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type ! 154: #define TYPE_FUNCTION_TYPE(thistype) (thistype)->function_type ! 155: #define TYPE_LENGTH(thistype) (thistype)->length ! 156: #define TYPE_FLAGS(thistype) (thistype)->flags ! 157: #define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED) ! 158: #define TYPE_CODE(thistype) (thistype)->code ! 159: #define TYPE_NFIELDS(thistype) (thistype)->nfields ! 160: #define TYPE_FIELDS(thistype) (thistype)->fields ! 161: ! 162: #define TYPE_FIELD(thistype, n) (thistype)->fields[n] ! 163: #define TYPE_FIELD_TYPE(thistype, n) (thistype)->fields[n].type ! 164: #define TYPE_FIELD_NAME(thistype, n) (thistype)->fields[n].name ! 165: #define TYPE_FIELD_VALUE(thistype, n) (* (int*) &(thistype)->fields[n].type) ! 166: #define TYPE_FIELD_BITPOS(thistype, n) (thistype)->fields[n].bitpos ! 167: #define TYPE_FIELD_BITSIZE(thistype, n) (thistype)->fields[n].bitsize ! 168: #define TYPE_FIELD_PACKED(thistype, n) (thistype)->fields[n].bitsize ! 169: ! 170: /* Functions that work on the objects described above */ ! 171: ! 172: extern struct symtab *lookup_symtab (); ! 173: extern struct symbol *lookup_symbol (); ! 174: extern struct type *lookup_typename (); ! 175: extern struct type *lookup_unsigned_typename (); ! 176: extern struct type *lookup_struct (); ! 177: extern struct type *lookup_union (); ! 178: extern struct type *lookup_enum (); ! 179: extern struct type *lookup_pointer_type (); ! 180: extern struct type *lookup_function_type (); ! 181: extern struct symbol *block_function (); ! 182: extern struct symbol *find_pc_function (); ! 183: extern int find_pc_misc_function (); ! 184: ! 185: extern struct type *builtin_type_void; ! 186: extern struct type *builtin_type_char; ! 187: extern struct type *builtin_type_short; ! 188: extern struct type *builtin_type_int; ! 189: extern struct type *builtin_type_long; ! 190: extern struct type *builtin_type_unsigned_char; ! 191: extern struct type *builtin_type_unsigned_short; ! 192: extern struct type *builtin_type_unsigned_int; ! 193: extern struct type *builtin_type_unsigned_long; ! 194: extern struct type *builtin_type_float; ! 195: extern struct type *builtin_type_double; ! 196: ! 197: struct symtab_and_line ! 198: { ! 199: struct symtab *symtab; ! 200: int line; ! 201: CORE_ADDR pc; ! 202: CORE_ADDR end; ! 203: }; ! 204: ! 205: /* Given a pc value, return line number it is in. ! 206: Second arg nonzero means if pc is on the boundary ! 207: use the previous statement's line number. */ ! 208: ! 209: struct symtab_and_line find_pc_line (); ! 210: ! 211: /* Given a string, return the line specified by it. ! 212: For commands like "list" and "breakpoint". */ ! 213: ! 214: struct symtab_and_line decode_line_spec (); ! 215: struct symtab_and_line decode_line_1 ();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.