GDB (API)
Public Attributes | List of all members
main_type Struct Reference

#include "gdbtypes.h"

Public Attributes

__extension__ enum type_code code: 8
 
unsigned int flag_unsigned: 1
 
unsigned int flag_nosign: 1
 
unsigned int flag_stub: 1
 
unsigned int flag_target_stub: 1
 
unsigned int flag_static: 1
 
unsigned int flag_prototyped: 1
 
unsigned int flag_incomplete: 1
 
unsigned int flag_varargs: 1
 
unsigned int flag_vector: 1
 
unsigned int flag_stub_supported: 1
 
unsigned int flag_gnu_ifunc: 1
 
unsigned int flag_fixed_instance: 1
 
unsigned int flag_objfile_owned: 1
 
unsigned int flag_declared_class: 1
 
unsigned int flag_flag_enum: 1
 
__extension__ enum type_specific_kind type_specific_field: 3
 
short nfields
 
const char * name
 
const char * tag_name
 
union type_owner owner
 
struct typetarget_type
 
union {
   struct field *   fields
 
   struct range_bounds *   bounds
 
flds_bnds
 
union type_specific type_specific
 
struct dynamic_prop_listdyn_prop_list
 

Detailed Description

Main structure representing a type in GDB.

This structure is space-critical. Its layout has been tweaked to reduce the space used.

Definition at line 619 of file gdbtypes.h.

Member Data Documentation

struct range_bounds* main_type::bounds

Union member used for range types.

Definition at line 733 of file gdbtypes.h.

__extension__ enum type_code main_type::code

Code for kind of type.

Definition at line 623 of file gdbtypes.h.

struct dynamic_prop_list* main_type::dyn_prop_list

Contains all dynamic type properties.

Definition at line 743 of file gdbtypes.h.

struct field* main_type::fields

Definition at line 729 of file gdbtypes.h.

unsigned int main_type::flag_declared_class

True if this type was declared with "class" rather than "struct".

Definition at line 646 of file gdbtypes.h.

unsigned int main_type::flag_fixed_instance

Definition at line 640 of file gdbtypes.h.

unsigned int main_type::flag_flag_enum

True if this is an enum type with disjoint values. This affects how the enum is printed.

Definition at line 651 of file gdbtypes.h.

unsigned int main_type::flag_gnu_ifunc

Definition at line 639 of file gdbtypes.h.

unsigned int main_type::flag_incomplete

Definition at line 635 of file gdbtypes.h.

unsigned int main_type::flag_nosign

Definition at line 630 of file gdbtypes.h.

unsigned int main_type::flag_objfile_owned

Definition at line 641 of file gdbtypes.h.

unsigned int main_type::flag_prototyped

Definition at line 634 of file gdbtypes.h.

unsigned int main_type::flag_static

Definition at line 633 of file gdbtypes.h.

unsigned int main_type::flag_stub

Definition at line 631 of file gdbtypes.h.

unsigned int main_type::flag_stub_supported

Definition at line 638 of file gdbtypes.h.

unsigned int main_type::flag_target_stub

Definition at line 632 of file gdbtypes.h.

unsigned int main_type::flag_unsigned

Flags about this type. These fields appear at this location because they packs nicely here. See the TYPE_* macros for documentation about these fields.

Definition at line 629 of file gdbtypes.h.

unsigned int main_type::flag_varargs

Definition at line 636 of file gdbtypes.h.

unsigned int main_type::flag_vector

Definition at line 637 of file gdbtypes.h.

union { ... } main_type::flds_bnds

For structure and union types, a description of each field. For set and pascal array types, there is one "field", whose type is the domain type of the set or array. For range types, there are two "fields", the minimum and maximum values (both inclusive). For enum types, each possible value is described by one "field". For a function or method type, a "field" for each parameter. For C++ classes, there is one field for each base class (if it is a derived class) plus one field for each class data member. Member functions are recorded elsewhere.

Using a pointer to a separate array of fields allows all types to have the same size, which is useful because we can allocate the space for a type before we know what to put in it.

const char* main_type::name

Name of this type, or NULL if none.

This is used for printing only, except by poorly designed C++ code. For looking up a name, look for a symbol in the VAR_DOMAIN. This is generally allocated in the objfile's obstack. However coffread.c uses malloc.

Definition at line 670 of file gdbtypes.h.

short main_type::nfields

Number of fields described for this type. This field appears at this location because it packs nicely here.

Definition at line 661 of file gdbtypes.h.

union type_owner main_type::owner

Every type is now associated with a particular objfile, and the type is allocated on the objfile_obstack for that objfile. One problem however, is that there are times when gdb allocates new types while it is not in the process of reading symbols from a particular objfile. Fortunately, these happen when the type being created is a derived type of an existing type, such as in lookup_pointer_type(). So we can just allocate the new type using the same objfile as the existing type, but to do this we need a backpointer to the objfile from the existing type. Yes this is somewhat ugly, but without major overhaul of the internal type system, it can't be avoided for now.

Definition at line 697 of file gdbtypes.h.

const char* main_type::tag_name

Tag name for this type, or NULL if none. This means that the name of the type consists of a keyword followed by the tag name. Which keyword is determined by the type code ("struct" for TYPE_CODE_STRUCT, etc.). As far as I know C/C++ are the only languages with this feature.

This is used for printing only, except by poorly designed C++ code. For looking up a name, look for a symbol in the STRUCT_DOMAIN. One more legitimate use is that if TYPE_FLAG_STUB is set, this is the name to use to look for definitions in other files.

Definition at line 683 of file gdbtypes.h.

struct type* main_type::target_type

For a pointer type, describes the type of object pointed to.

  • For an array type, describes the type of the elements.
  • For a function or method type, describes the type of the return value.
  • For a range type, describes the type of the full range.
  • For a complex type, describes the type of each coordinate.
  • For a special record or union type encoding a dynamic-sized type in GNAT, a memoized pointer to a corresponding static version of the type.
  • Unused otherwise.

Definition at line 709 of file gdbtypes.h.

union type_specific main_type::type_specific

Slot to point to additional language-specific fields of this type.

Definition at line 740 of file gdbtypes.h.

__extension__ enum type_specific_kind main_type::type_specific_field

A discriminant telling us which field of the type_specific union is being used for this type, if any.

Definition at line 656 of file gdbtypes.h.


The documentation for this struct was generated from the following file: