| 1 | /* GDB symbol table format definitions.
|
|---|
| 2 | Copyright (C) 1986, 1989 Free Software Foundation, Inc.
|
|---|
| 3 | Hacked by Michael Tiemann (tiemann@mcc.com)
|
|---|
| 4 |
|
|---|
| 5 | This file is part of GDB.
|
|---|
| 6 |
|
|---|
| 7 | GDB is free software; you can redistribute it and/or modify
|
|---|
| 8 | it under the terms of the GNU General Public License as published by
|
|---|
| 9 | the Free Software Foundation; either version 1, or (at your option)
|
|---|
| 10 | any later version.
|
|---|
| 11 |
|
|---|
| 12 | GDB is distributed in the hope that it will be useful,
|
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 15 | GNU General Public License for more details.
|
|---|
| 16 |
|
|---|
| 17 | You should have received a copy of the GNU General Public License
|
|---|
| 18 | along with GDB; see the file COPYING. If not, write to
|
|---|
| 19 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|---|
| 20 |
|
|---|
| 21 | /* Format of GDB symbol table data.
|
|---|
| 22 | There is one symbol segment for each source file or
|
|---|
| 23 | independant compilation. These segments are simply concatenated
|
|---|
| 24 | to form the GDB symbol table. A zero word where the beginning
|
|---|
| 25 | of a segment is expected indicates there are no more segments.
|
|---|
| 26 |
|
|---|
| 27 | Format of a symbol segment:
|
|---|
| 28 |
|
|---|
| 29 | The symbol segment begins with a word containing 1
|
|---|
| 30 | if it is in the format described here. Other formats may
|
|---|
| 31 | be designed, with other code numbers.
|
|---|
| 32 |
|
|---|
| 33 | The segment contains many objects which point at each other.
|
|---|
| 34 | The pointers are offsets in bytes from the beginning of the segment.
|
|---|
| 35 | Thus, each segment can be loaded into core and its pointers relocated
|
|---|
| 36 | to make valid in-core pointers.
|
|---|
| 37 |
|
|---|
| 38 | All the data objects in the segment can be found indirectly from
|
|---|
| 39 | one of them, the root object, of type `struct symbol_root'.
|
|---|
| 40 | It appears at the beginning of the segment.
|
|---|
| 41 |
|
|---|
| 42 | The total size of the segment, in bytes, appears as the `length'
|
|---|
| 43 | field of this object. This size includes the size of the
|
|---|
| 44 | root object.
|
|---|
| 45 |
|
|---|
| 46 | All the object data types are defined here to contain pointer types
|
|---|
| 47 | appropriate for in-core use on a relocated symbol segment.
|
|---|
| 48 | Casts to and from type int are required for working with
|
|---|
| 49 | unrelocated symbol segments such as are found in the file.
|
|---|
| 50 |
|
|---|
| 51 | The ldsymaddr word is filled in by the loader to contain
|
|---|
| 52 | the offset (in bytes) within the ld symbol table
|
|---|
| 53 | of the first nonglobal symbol from this compilation.
|
|---|
| 54 | This makes it possible to match those symbols
|
|---|
| 55 | (which contain line number information) reliably with
|
|---|
| 56 | the segment they go with.
|
|---|
| 57 |
|
|---|
| 58 | Core addresses within the program that appear in the symbol segment
|
|---|
| 59 | are not relocated by the loader. They are inserted by the assembler
|
|---|
| 60 | and apply to addresses as output by the assembler, so GDB must
|
|---|
| 61 | relocate them when it loads the symbol segment. It gets the information
|
|---|
| 62 | on how to relocate from the textrel, datarel, bssrel, databeg and bssbeg
|
|---|
| 63 | words of the root object.
|
|---|
| 64 |
|
|---|
| 65 | The words textrel, datarel and bssrel
|
|---|
| 66 | are filled in by ld with the amounts to relocate within-the-file
|
|---|
| 67 | text, data and bss addresses by; databeg and bssbeg can be
|
|---|
| 68 | used to tell which kind of relocation an address needs. */
|
|---|
| 69 |
|
|---|
| 70 | enum language {language_c};
|
|---|
| 71 |
|
|---|
| 72 | struct symbol_root
|
|---|
| 73 | {
|
|---|
| 74 | int format; /* Data format version */
|
|---|
| 75 | int length; /* # bytes in this symbol segment */
|
|---|
| 76 | int ldsymoff; /* Offset in ld symtab of this file's syms */
|
|---|
| 77 | int textrel; /* Relocation for text addresses */
|
|---|
| 78 | int datarel; /* Relocation for data addresses */
|
|---|
| 79 | int bssrel; /* Relocation for bss addresses */
|
|---|
| 80 | char *filename; /* Name of main source file compiled */
|
|---|
| 81 | char *filedir; /* Name of directory it was reached from */
|
|---|
| 82 | struct blockvector *blockvector; /* Vector of all symbol-naming blocks */
|
|---|
| 83 | struct typevector *typevector; /* Vector of all data types */
|
|---|
| 84 | enum language language; /* Code identifying the language used */
|
|---|
| 85 | char *version; /* Version info. Not fully specified */
|
|---|
| 86 | char *compilation; /* Compilation info. Not fully specified */
|
|---|
| 87 | int databeg; /* Address within the file of data start */
|
|---|
| 88 | int bssbeg; /* Address within the file of bss start */
|
|---|
| 89 | struct sourcevector *sourcevector; /* Vector of line-number info */
|
|---|
| 90 | };
|
|---|
| 91 | |
|---|
| 92 |
|
|---|
| 93 | /* All data types of symbols in the compiled program
|
|---|
| 94 | are represented by `struct type' objects.
|
|---|
| 95 | All of these objects are pointed to by the typevector.
|
|---|
| 96 | The type vector may have empty slots that contain zero. */
|
|---|
| 97 |
|
|---|
| 98 | struct typevector
|
|---|
| 99 | {
|
|---|
| 100 | int length; /* Number of types described */
|
|---|
| 101 | struct type *type[1];
|
|---|
| 102 | };
|
|---|
| 103 |
|
|---|
| 104 | /* Different kinds of data types are distinguished by the `code' field. */
|
|---|
| 105 |
|
|---|
| 106 | enum type_code
|
|---|
| 107 | {
|
|---|
| 108 | TYPE_CODE_UNDEF, /* Not used; catches errors */
|
|---|
| 109 | TYPE_CODE_PTR, /* Pointer type */
|
|---|
| 110 | TYPE_CODE_ARRAY, /* Array type, lower bound zero */
|
|---|
| 111 | TYPE_CODE_STRUCT, /* C struct or Pascal record */
|
|---|
| 112 | TYPE_CODE_UNION, /* C union or Pascal variant part */
|
|---|
| 113 | TYPE_CODE_ENUM, /* Enumeration type */
|
|---|
| 114 | TYPE_CODE_FUNC, /* Function type */
|
|---|
| 115 | TYPE_CODE_INT, /* Integer type */
|
|---|
| 116 | TYPE_CODE_FLT, /* Floating type */
|
|---|
| 117 | TYPE_CODE_VOID, /* Void type (values zero length) */
|
|---|
| 118 | TYPE_CODE_SET, /* Pascal sets */
|
|---|
| 119 | TYPE_CODE_RANGE, /* Range (integers within spec'd bounds) */
|
|---|
| 120 | TYPE_CODE_PASCAL_ARRAY, /* Array with explicit type of index */
|
|---|
| 121 |
|
|---|
| 122 | /* C++ */
|
|---|
| 123 | TYPE_CODE_MEMBER, /* Member type */
|
|---|
| 124 | TYPE_CODE_METHOD, /* Method type */
|
|---|
| 125 | TYPE_CODE_REF /* C++ Reference types */
|
|---|
| 126 | };
|
|---|
| 127 |
|
|---|
| 128 | /* This appears in a type's flags word for an unsigned integer type. */
|
|---|
| 129 | #define TYPE_FLAG_UNSIGNED 1
|
|---|
| 130 | /* This appears in a type's flags word
|
|---|
| 131 | if it is a (pointer to a|function returning a)* built in scalar type.
|
|---|
| 132 | These types are never freed. */
|
|---|
| 133 | #define TYPE_FLAG_PERM 4
|
|---|
| 134 | /* This appears in a type's flags word if it is a stub type (eg. if
|
|---|
| 135 | someone referenced a type that wasn't definined in a source file
|
|---|
| 136 | via (struct sir_not_appearing_in_this_film *)). */
|
|---|
| 137 | #define TYPE_FLAG_STUB 8
|
|---|
| 138 | /* Set when a class has a constructor defined */
|
|---|
| 139 | #define TYPE_FLAG_HAS_CONSTRUCTOR 256
|
|---|
| 140 | /* Set when a class has a destructor defined */
|
|---|
| 141 | #define TYPE_FLAG_HAS_DESTRUCTOR 512
|
|---|
| 142 | /* Indicates that this type is a public baseclass of another class,
|
|---|
| 143 | i.e. that all its public methods are available in the derived
|
|---|
| 144 | class. */
|
|---|
| 145 | #define TYPE_FLAG_VIA_PUBLIC 1024
|
|---|
| 146 | /* Indicates that this type is a virtual baseclass of another class,
|
|---|
| 147 | i.e. that if this class is inherited more than once by another
|
|---|
| 148 | class, only one set of member variables will be included. */
|
|---|
| 149 | #define TYPE_FLAG_VIA_VIRTUAL 2048
|
|---|
| 150 |
|
|---|
| 151 | struct type
|
|---|
| 152 | {
|
|---|
| 153 | /* Code for kind of type */
|
|---|
| 154 | enum type_code code;
|
|---|
| 155 | /* Name of this type, or zero if none.
|
|---|
| 156 | This is used for printing only.
|
|---|
| 157 | Type names specified as input are defined by symbols. */
|
|---|
| 158 | char *name;
|
|---|
| 159 | /* Length in bytes of storage for a value of this type */
|
|---|
| 160 | int length;
|
|---|
| 161 | /* For a pointer type, describes the type of object pointed to.
|
|---|
| 162 | For an array type, describes the type of the elements.
|
|---|
| 163 | For a function or method type, describes the type of the value.
|
|---|
| 164 | For a range type, describes the type of the full range.
|
|---|
| 165 | Unused otherwise. */
|
|---|
| 166 | struct type *target_type;
|
|---|
| 167 | /* Type that is a pointer to this type.
|
|---|
| 168 | Zero if no such pointer-to type is known yet.
|
|---|
| 169 | The debugger may add the address of such a type
|
|---|
| 170 | if it has to construct one later. */
|
|---|
| 171 | struct type *pointer_type;
|
|---|
| 172 | /* C++: also need a reference type. */
|
|---|
| 173 | struct type *reference_type;
|
|---|
| 174 | struct type **arg_types;
|
|---|
| 175 |
|
|---|
| 176 | /* Type that is a function returning this type.
|
|---|
| 177 | Zero if no such function type is known here.
|
|---|
| 178 | The debugger may add the address of such a type
|
|---|
| 179 | if it has to construct one later. */
|
|---|
| 180 | struct type *function_type;
|
|---|
| 181 |
|
|---|
| 182 | /* Handling of pointers to members:
|
|---|
| 183 | TYPE_MAIN_VARIANT is used for pointer and pointer
|
|---|
| 184 | to member types. Normally it the value of the address of its
|
|---|
| 185 | containing type. However, for pointers to members, we must be
|
|---|
| 186 | able to allocate pointer to member types and look them up
|
|---|
| 187 | from some place of reference.
|
|---|
| 188 | NEXT_VARIANT is the next element in the chain. */
|
|---|
| 189 | struct type *main_variant, *next_variant;
|
|---|
| 190 |
|
|---|
| 191 | /* Flags about this type. */
|
|---|
| 192 | short flags;
|
|---|
| 193 | /* Number of fields described for this type */
|
|---|
| 194 | short nfields;
|
|---|
| 195 | /* For structure and union types, a description of each field.
|
|---|
| 196 | For set and pascal array types, there is one "field",
|
|---|
| 197 | whose type is the domain type of the set or array.
|
|---|
| 198 | For range types, there are two "fields",
|
|---|
| 199 | the minimum and maximum values (both inclusive).
|
|---|
| 200 | For enum types, each possible value is described by one "field".
|
|---|
| 201 |
|
|---|
| 202 | Using a pointer to a separate array of fields
|
|---|
| 203 | allows all types to have the same size, which is useful
|
|---|
| 204 | because we can allocate the space for a type before
|
|---|
| 205 | we know what to put in it. */
|
|---|
| 206 | struct field
|
|---|
| 207 | {
|
|---|
| 208 | /* Position of this field, counting in bits from start of
|
|---|
| 209 | containing structure. For a function type, this is the
|
|---|
| 210 | position in the argument list of this argument.
|
|---|
| 211 | For a range bound or enum value, this is the value itself. */
|
|---|
| 212 | int bitpos;
|
|---|
| 213 | /* Size of this field, in bits, or zero if not packed.
|
|---|
| 214 | For an unpacked field, the field's type's length
|
|---|
| 215 | says how many bytes the field occupies. */
|
|---|
| 216 | int bitsize;
|
|---|
| 217 | /* In a struct or enum type, type of this field.
|
|---|
| 218 | In a function type, type of this argument.
|
|---|
| 219 | In an array type, the domain-type of the array. */
|
|---|
| 220 | struct type *type;
|
|---|
| 221 | /* Name of field, value or argument.
|
|---|
| 222 | Zero for range bounds and array domains. */
|
|---|
| 223 | char *name;
|
|---|
| 224 | } *fields;
|
|---|
| 225 |
|
|---|
| 226 | /* C++ */
|
|---|
| 227 | int *private_field_bits;
|
|---|
| 228 | int *protected_field_bits;
|
|---|
| 229 |
|
|---|
| 230 | /* Number of methods described for this type */
|
|---|
| 231 | short nfn_fields;
|
|---|
| 232 | /* Number of base classes this type derives from. */
|
|---|
| 233 | short n_baseclasses;
|
|---|
| 234 |
|
|---|
| 235 | /* Number of methods described for this type plus all the
|
|---|
| 236 | methods that it derives from. */
|
|---|
| 237 | int nfn_fields_total;
|
|---|
| 238 |
|
|---|
| 239 | /* For classes, structures, and unions, a description of each field,
|
|---|
| 240 | which consists of an overloaded name, followed by the types of
|
|---|
| 241 | arguments that the method expects, and then the name after it
|
|---|
| 242 | has been renamed to make it distinct. */
|
|---|
| 243 | struct fn_fieldlist
|
|---|
| 244 | {
|
|---|
| 245 | /* The overloaded name. */
|
|---|
| 246 | char *name;
|
|---|
| 247 | /* The number of methods with this name. */
|
|---|
| 248 | int length;
|
|---|
| 249 | /* The list of methods. */
|
|---|
| 250 | struct fn_field
|
|---|
| 251 | {
|
|---|
| 252 | #if 0
|
|---|
| 253 | /* The overloaded name */
|
|---|
| 254 | char *name;
|
|---|
| 255 | #endif
|
|---|
| 256 | /* The return value of the method */
|
|---|
| 257 | struct type *type;
|
|---|
| 258 | /* The argument list */
|
|---|
| 259 | struct type **args;
|
|---|
| 260 | /* The name after it has been processed */
|
|---|
| 261 | char *physname;
|
|---|
| 262 | /* If this is a virtual function, the offset into the vtbl-1,
|
|---|
| 263 | else 0. */
|
|---|
| 264 | int voffset;
|
|---|
| 265 | } *fn_fields;
|
|---|
| 266 |
|
|---|
| 267 | int *private_fn_field_bits;
|
|---|
| 268 | int *protected_fn_field_bits;
|
|---|
| 269 |
|
|---|
| 270 | } *fn_fieldlists;
|
|---|
| 271 |
|
|---|
| 272 | unsigned char via_protected;
|
|---|
| 273 | unsigned char via_public;
|
|---|
| 274 |
|
|---|
| 275 | /* For types with virtual functions, VPTR_BASETYPE is the base class which
|
|---|
| 276 | defined the virtual function table pointer. VPTR_FIELDNO is
|
|---|
| 277 | the field number of that pointer in the structure.
|
|---|
| 278 |
|
|---|
| 279 | For types that are pointer to member types, VPTR_BASETYPE
|
|---|
| 280 | ifs the type that this pointer is a member of.
|
|---|
| 281 |
|
|---|
| 282 | Unused otherwise. */
|
|---|
| 283 | struct type *vptr_basetype;
|
|---|
| 284 |
|
|---|
| 285 | int vptr_fieldno;
|
|---|
| 286 |
|
|---|
| 287 | /* If this type has a base class, put it here.
|
|---|
| 288 | If this type is a pointer type, the chain of member pointer
|
|---|
| 289 | types goes here.
|
|---|
| 290 | Unused otherwise.
|
|---|
| 291 |
|
|---|
| 292 | Contrary to all maxims of C style and common sense, the baseclasses
|
|---|
| 293 | are indexed from 1 to N_BASECLASSES rather than 0 to N_BASECLASSES-1
|
|---|
| 294 | (i.e. BASECLASSES points to one *before* the first element of
|
|---|
| 295 | the array). */
|
|---|
| 296 | struct type **baseclasses;
|
|---|
| 297 | };
|
|---|
| 298 | |
|---|
| 299 |
|
|---|
| 300 | /* All of the name-scope contours of the program
|
|---|
| 301 | are represented by `struct block' objects.
|
|---|
| 302 | All of these objects are pointed to by the blockvector.
|
|---|
| 303 |
|
|---|
| 304 | Each block represents one name scope.
|
|---|
| 305 | Each lexical context has its own block.
|
|---|
| 306 |
|
|---|
| 307 | The first two blocks in the blockvector are special.
|
|---|
| 308 | The first one contains all the symbols defined in this compilation
|
|---|
| 309 | whose scope is the entire program linked together.
|
|---|
| 310 | The second one contains all the symbols whose scope is the
|
|---|
| 311 | entire compilation excluding other separate compilations.
|
|---|
| 312 | In C, these correspond to global symbols and static symbols.
|
|---|
| 313 |
|
|---|
| 314 | Each block records a range of core addresses for the code that
|
|---|
| 315 | is in the scope of the block. The first two special blocks
|
|---|
| 316 | give, for the range of code, the entire range of code produced
|
|---|
| 317 | by the compilation that the symbol segment belongs to.
|
|---|
| 318 |
|
|---|
| 319 | The blocks appear in the blockvector
|
|---|
| 320 | in order of increasing starting-address,
|
|---|
| 321 | and, within that, in order of decreasing ending-address.
|
|---|
| 322 |
|
|---|
| 323 | This implies that within the body of one function
|
|---|
| 324 | the blocks appear in the order of a depth-first tree walk. */
|
|---|
| 325 |
|
|---|
| 326 | struct blockvector
|
|---|
| 327 | {
|
|---|
| 328 | /* Number of blocks in the list. */
|
|---|
| 329 | int nblocks;
|
|---|
| 330 | /* The blocks themselves. */
|
|---|
| 331 | struct block *block[1];
|
|---|
| 332 | };
|
|---|
| 333 |
|
|---|
| 334 | struct block
|
|---|
| 335 | {
|
|---|
| 336 | /* Addresses in the executable code that are in this block.
|
|---|
| 337 | Note: in an unrelocated symbol segment in a file,
|
|---|
| 338 | these are always zero. They can be filled in from the
|
|---|
| 339 | N_LBRAC and N_RBRAC symbols in the loader symbol table. */
|
|---|
| 340 | int startaddr, endaddr;
|
|---|
| 341 | /* The symbol that names this block,
|
|---|
| 342 | if the block is the body of a function;
|
|---|
| 343 | otherwise, zero.
|
|---|
| 344 | Note: In an unrelocated symbol segment in an object file,
|
|---|
| 345 | this field may be zero even when the block has a name.
|
|---|
| 346 | That is because the block is output before the name
|
|---|
| 347 | (since the name resides in a higher block).
|
|---|
| 348 | Since the symbol does point to the block (as its value),
|
|---|
| 349 | it is possible to find the block and set its name properly. */
|
|---|
| 350 | struct symbol *function;
|
|---|
| 351 | /* The `struct block' for the containing block, or 0 if none. */
|
|---|
| 352 | /* Note that in an unrelocated symbol segment in an object file
|
|---|
| 353 | this pointer may be zero when the correct value should be
|
|---|
| 354 | the second special block (for symbols whose scope is one compilation).
|
|---|
| 355 | This is because the compiler ouptuts the special blocks at the
|
|---|
| 356 | very end, after the other blocks. */
|
|---|
| 357 | struct block *superblock;
|
|---|
| 358 | /* A flag indicating whether or not the fucntion corresponding
|
|---|
| 359 | to this block was compiled with gcc or not. If there is no
|
|---|
| 360 | function corresponding to this block, this meaning of this flag
|
|---|
| 361 | is undefined. (In practice it will be 1 if the block was created
|
|---|
| 362 | while processing a file compiled with gcc and 0 when not). */
|
|---|
| 363 | unsigned char gcc_compile_flag;
|
|---|
| 364 | /* Number of local symbols. */
|
|---|
| 365 | int nsyms;
|
|---|
| 366 | /* The symbols. */
|
|---|
| 367 | struct symbol *sym[1];
|
|---|
| 368 | };
|
|---|
| 369 | |
|---|
| 370 |
|
|---|
| 371 | /* Represent one symbol name; a variable, constant, function or typedef. */
|
|---|
| 372 |
|
|---|
| 373 | /* Different name spaces for symbols. Looking up a symbol specifies
|
|---|
| 374 | a namespace and ignores symbol definitions in other name spaces.
|
|---|
| 375 |
|
|---|
| 376 | VAR_NAMESPACE is the usual namespace.
|
|---|
| 377 | In C, this contains variables, function names, typedef names
|
|---|
| 378 | and enum type values.
|
|---|
| 379 |
|
|---|
| 380 | STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
|
|---|
| 381 | Thus, if `struct foo' is used in a C program,
|
|---|
| 382 | it produces a symbol named `foo' in the STRUCT_NAMESPACE.
|
|---|
| 383 |
|
|---|
| 384 | LABEL_NAMESPACE may be used for names of labels (for gotos);
|
|---|
| 385 | currently it is not used and labels are not recorded at all. */
|
|---|
| 386 |
|
|---|
| 387 | /* For a non-global symbol allocated statically,
|
|---|
| 388 | the correct core address cannot be determined by the compiler.
|
|---|
| 389 | The compiler puts an index number into the symbol's value field.
|
|---|
| 390 | This index number can be matched with the "desc" field of
|
|---|
| 391 | an entry in the loader symbol table. */
|
|---|
| 392 |
|
|---|
| 393 | enum namespace
|
|---|
| 394 | {
|
|---|
| 395 | UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE, LABEL_NAMESPACE
|
|---|
| 396 | };
|
|---|
| 397 |
|
|---|
| 398 | /* An address-class says where to find the value of the symbol in core. */
|
|---|
| 399 |
|
|---|
| 400 | enum address_class
|
|---|
| 401 | {
|
|---|
| 402 | LOC_UNDEF, /* Not used; catches errors */
|
|---|
| 403 | LOC_CONST, /* Value is constant int */
|
|---|
| 404 | LOC_STATIC, /* Value is at fixed address */
|
|---|
| 405 | LOC_REGISTER, /* Value is in register */
|
|---|
| 406 | LOC_ARG, /* Value is at spec'd position in arglist */
|
|---|
| 407 | LOC_REF_ARG, /* Value address is at spec'd position in */
|
|---|
| 408 | /* arglist. */
|
|---|
| 409 | LOC_REGPARM, /* Value is at spec'd position in register window */
|
|---|
| 410 | LOC_LOCAL, /* Value is at spec'd pos in stack frame */
|
|---|
| 411 | LOC_TYPEDEF, /* Value not used; definition in SYMBOL_TYPE
|
|---|
| 412 | Symbols in the namespace STRUCT_NAMESPACE
|
|---|
| 413 | all have this class. */
|
|---|
| 414 | LOC_LABEL, /* Value is address in the code */
|
|---|
| 415 | LOC_BLOCK, /* Value is address of a `struct block'.
|
|---|
| 416 | Function names have this class. */
|
|---|
| 417 | LOC_EXTERNAL, /* Value is at address not in this compilation.
|
|---|
| 418 | This is used for .comm symbols
|
|---|
| 419 | and for extern symbols within functions.
|
|---|
| 420 | Inside GDB, this is changed to LOC_STATIC once the
|
|---|
| 421 | real address is obtained from a loader symbol. */
|
|---|
| 422 | LOC_CONST_BYTES /* Value is a constant byte-sequence. */
|
|---|
| 423 | };
|
|---|
| 424 |
|
|---|
| 425 | struct symbol
|
|---|
| 426 | {
|
|---|
| 427 | /* Symbol name */
|
|---|
| 428 | char *name;
|
|---|
| 429 | /* Name space code. */
|
|---|
| 430 | enum namespace namespace;
|
|---|
| 431 | /* Address class */
|
|---|
| 432 | enum address_class class;
|
|---|
| 433 | /* Data type of value */
|
|---|
| 434 | struct type *type;
|
|---|
| 435 | /* constant value, or address if static, or register number,
|
|---|
| 436 | or offset in arguments, or offset in stack frame. */
|
|---|
| 437 | union
|
|---|
| 438 | {
|
|---|
| 439 | long value;
|
|---|
| 440 | struct block *block; /* for LOC_BLOCK */
|
|---|
| 441 | char *bytes; /* for LOC_CONST_BYTES */
|
|---|
| 442 | }
|
|---|
| 443 | value;
|
|---|
| 444 | };
|
|---|
| 445 |
|
|---|
| 446 | struct partial_symbol
|
|---|
| 447 | {
|
|---|
| 448 | /* Symbol name */
|
|---|
| 449 | char *name;
|
|---|
| 450 | /* Name space code. */
|
|---|
| 451 | enum namespace namespace;
|
|---|
| 452 | /* Address class (for info_symbols) */
|
|---|
| 453 | enum address_class class;
|
|---|
| 454 | /* Value (only used for static functions currently). Done this
|
|---|
| 455 | way so that we can use the struct symbol macros.
|
|---|
| 456 | Note that the address of a function is SYMBOL_VALUE (pst)
|
|---|
| 457 | in a partial symbol table, but BLOCK_START (SYMBOL_BLOCK_VALUE (st))
|
|---|
| 458 | in a symbol table. */
|
|---|
| 459 | union
|
|---|
| 460 | {
|
|---|
| 461 | long value;
|
|---|
| 462 | }
|
|---|
| 463 | value;
|
|---|
| 464 | };
|
|---|
| 465 |
|
|---|
| 466 | /*
|
|---|
| 467 | * Vectors of all partial symbols read in from file; actually declared
|
|---|
| 468 | * and used in dbxread.c.
|
|---|
| 469 | */
|
|---|
| 470 | extern struct psymbol_allocation_list {
|
|---|
| 471 | struct partial_symbol *list, *next;
|
|---|
| 472 | int size;
|
|---|
| 473 | } global_psymbols, static_psymbols;
|
|---|
| 474 |
|
|---|
| 475 | |
|---|
| 476 |
|
|---|
| 477 | /* Source-file information.
|
|---|
| 478 | This describes the relation between source files and line numbers
|
|---|
| 479 | and addresses in the program text. */
|
|---|
| 480 |
|
|---|
| 481 | struct sourcevector
|
|---|
| 482 | {
|
|---|
| 483 | int length; /* Number of source files described */
|
|---|
| 484 | struct source *source[1]; /* Descriptions of the files */
|
|---|
| 485 | };
|
|---|
| 486 |
|
|---|
| 487 | /* Each item represents a line-->pc (or the reverse) mapping. This is
|
|---|
| 488 | somewhat more wasteful of space than one might wish, but since only
|
|---|
| 489 | the files which are actually debugged are read in to core, we don't
|
|---|
| 490 | waste much space.
|
|---|
| 491 |
|
|---|
| 492 | Each item used to be an int; either minus a line number, or a
|
|---|
| 493 | program counter. If it represents a line number, that is the line
|
|---|
| 494 | described by the next program counter value. If it is positive, it
|
|---|
| 495 | is the program counter at which the code for the next line starts. */
|
|---|
| 496 |
|
|---|
| 497 | struct linetable_entry
|
|---|
| 498 | {
|
|---|
| 499 | int line;
|
|---|
| 500 | CORE_ADDR pc;
|
|---|
| 501 | };
|
|---|
| 502 |
|
|---|
| 503 | struct linetable
|
|---|
| 504 | {
|
|---|
| 505 | int nitems;
|
|---|
| 506 | struct linetable_entry item[1];
|
|---|
| 507 | };
|
|---|
| 508 |
|
|---|
| 509 | /* All the information on one source file. */
|
|---|
| 510 |
|
|---|
| 511 | struct source
|
|---|
| 512 | {
|
|---|
| 513 | char *name; /* Name of file */
|
|---|
| 514 | struct linetable contents;
|
|---|
| 515 | };
|
|---|