dwarf2.h

来自「主要用于在线分析dsp目标代码的调试信息。DSP平台下用CCS调试源代码时」· C头文件 代码 · 共 1,613 行 · 第 1/4 页

H
1,613
字号
#define TYPE_FLAG_VECTOR    (1 << 12) /* comment */
#define TYPE_VECTOR(t)      (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR)

struct fn_field
{
    /* If is_stub is clear, this is the mangled name which we can
    look up to find the address of the method (FIXME: it would
    be cleaner to have a pointer to the struct symbol here
    instead).  */

    /* If is_stub is set, this is the portion of the mangled
    name which specifies the arguments.  For example, "ii",
    if there are two int arguments, or "" if there are no
    arguments.  See gdb_mangle_name for the conversion from this
    format to the one used if is_stub is clear.  */

    char * physname;

    /* The function type for the method.
    (This comment used to say "The return value of the method",
    but that's wrong. The function type
    is expected here, i.e. something with TYPE_CODE_FUNC,
    and *not* the return-value type). */

    struct type * type;

    /* For virtual functions.
    First baseclass that defines this virtual function.   */

    struct type * fcontext;

    /* Attributes. */

    unsigned int is_const:1;
    unsigned int is_volatile:1;
    unsigned int is_private:1;
    unsigned int is_protected:1;
    unsigned int is_public:1;
    unsigned int is_abstract:1;
    unsigned int is_static:1;
    unsigned int is_final:1;
    unsigned int is_synchronized:1;
    unsigned int is_native:1;
    unsigned int is_artificial:1;

    /* A stub method only has some fields valid (but they are enough
    to reconstruct the rest of the fields).  */
    unsigned int is_stub:1;

    /* C++ method that is inlined */
    unsigned int is_inlined:1;

    /* Unused.  */
    unsigned int dummy:3; /* comment */

    /* Index into that baseclass's virtual function table,
    minus 2; else if static: VOFFSET_STATIC; else: 0.  */

    unsigned int voffset:16; /* comment */

#define VOFFSET_STATIC 1 /* comment */
};

struct fn_fieldlist
{
    /* The overloaded name.  */

    char * name;

    /* The number of methods with this name.  */

    int length;

    /* The list of methods.  */

    struct fn_field * fn_fields;
};

/* C++ language-specific information for TYPE_CODE_STRUCT and TYPE_CODE_UNION
   nodes.  */

struct cplus_struct_type
{
    /* Number of base classes this type derives from.  The baseclasses are
    stored in the first N_BASECLASSES fields (i.e. the `fields' field of
    the struct type).  I think only the `type' field of such a field has
    any meaning.  */

    short n_baseclasses;

    /* Number of methods with unique names.  All overloaded methods with
    the same name count only once. */

    short nfn_fields;

    /* Number of methods described for this type, not including the
    methods that it derives from.  */

    short nfn_fields_total;

    /* The "declared_type" field contains a code saying how the
    user really declared this type, e.g., "class s", "union s",
    "struct s".
    The 3 above things come out from the C++ compiler looking like classes,
    but we keep track of the real declaration so we can give
    the correct information on "ptype". (Note: TEMPLATE may not
    belong in this list...)  */

#define DECLARED_TYPE_CLASS 0 /* comment */
#define DECLARED_TYPE_UNION 1 /* comment */
#define DECLARED_TYPE_STRUCT 2 /* comment */
#define DECLARED_TYPE_TEMPLATE 3 /* comment */
    short declared_type;    /* One of the above codes */

    /* For derived classes, the number of base classes is given by n_baseclasses
    and virtual_field_bits is a bit vector containing one bit per base class.
    If the base class is virtual, the corresponding bit will be set.
    I.E, given:

    class A{};
    class B{};
    class C : public B, public virtual A {};

    B is a baseclass of C; A is a virtual baseclass for C.
    This is a C++ 2.0 language feature. */

    unsigned char * virtual_field_bits;

    /* For classes with private fields, the number of fields is given by
    nfields and private_field_bits is a bit vector containing one bit
    per field.
    If the field is private, the corresponding bit will be set. */

    unsigned char * private_field_bits;

    /* For classes with protected fields, the number of fields is given by
    nfields and protected_field_bits is a bit vector containing one bit
    per field.
    If the field is private, the corresponding bit will be set. */

    unsigned char * protected_field_bits;

    /* for classes with fields to be ignored, either this is optimized out
    or this field has length 0 */

    unsigned char * ignore_field_bits;

    /* For classes, structures, and unions, a description of each field,
    which consists of an overloaded name, followed by the types of
    arguments that the method expects, and then the name after it
    has been renamed to make it distinct.

    fn_fieldlists points to an array of nfn_fields of these. */

    struct fn_fieldlist * fn_fieldlists;

    /* If this "struct type" describes a template, then it
    * has arguments. "template_args" points to an array of
    * template arg descriptors, of length "ntemplate_args".
    * The only real information in each of these template arg descriptors
    * is a name. "type" will typically just point to a "struct type" with
    * the placeholder TYPE_CODE_TEMPLATE_ARG type.
    */
    short ntemplate_args;
    struct template_arg
    {
        char * name;
        struct type * type;
    } * template_args;

    /* If this "struct type" describes a template, it has a list
    * of instantiations. "instantiations" is a pointer to an array
    * of type's, one representing each instantiation. There
    * are "ninstantiations" elements in this array.
    */
    short ninstantiations;
    struct type ** instantiations;

    /* The following points to information relevant to the runtime model
    * of the compiler.
    * Currently being used only for HP's ANSI C++ compiler.
    * (This type may have to be changed/enhanced for other compilers.)
    *
    * RUNTIME_PTR is NULL if there is no runtime information (currently
    * this means the type was not compiled by HP aCC).
    *
    * Fields in structure pointed to:
    * ->HAS_VTABLE : 0 => no virtual table, 1 => vtable present
    *
    * ->PRIMARY_BASE points to the first non-virtual base class that has
    * a virtual table.
    *
    * ->VIRTUAL_BASE_LIST points to a list of struct type * pointers that
    * point to the type information for all virtual bases among this type's
    * ancestors.
    */
    struct runtime_info
    {
        short has_vtable;
        struct type * primary_base;
        struct type ** virtual_base_list;
    } * runtime_ptr;

    /* Pointer to information about enclosing scope, if this is a
    * local type.  If it is not a local type, this is NULL
    */
    struct local_type_info
    {
        char * file;
        int line;
    } * localtype_ptr;
};

struct main_type
{
    /* Code for kind of type */

    enum type_code code;

    /* 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_NAMESPACE.  */

    char * 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_NAMESPACE.
    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.  */

    char * tag_name;

    /* Length of storage for a value of this type.  This is what
    sizeof(type) would return; use it for address arithmetic,
    memory reads and writes, etc.  This size includes padding.  For
    example, an i386 extended-precision floating point value really
    only occupies ten bytes, but most ABI's declare its size to be
    12 bytes, to preserve alignment.  A `struct type' representing
    such a floating-point type would have a `length' value of 12,
    even though the last two bytes are unused.

    There's a bit of a host/target mess here, if you're concerned
    about machines whose bytes aren't eight bits long, or who don't
    have byte-addressed memory.  Various places pass this to memcpy
    and such, meaning it must be in units of host bytes.  Various
    other places expect they can calculate addresses by adding it
    and such, meaning it must be in units of target bytes.  For
    some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8
    and TARGET_CHAR_BIT will be (say) 32, this is a problem.

    One fix would be to make this field in bits (requiring that it
    always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) ---
    the other choice would be to make it consistently in units of
    HOST_CHAR_BIT.  However, this would still fail to address
    machines based on a ternary or decimal representation.  */

    unsigned length;

    /* FIXME, these should probably be restricted to a Fortran-specific
    field in some fashion.  */
#define BOUND_CANNOT_BE_DETERMINED   5 /* comment */
#define BOUND_BY_REF_ON_STACK        4 /* comment */
#define BOUND_BY_VALUE_ON_STACK      3 /* comment */
#define BOUND_BY_REF_IN_REG          2 /* comment */
#define BOUND_BY_VALUE_IN_REG        1 /* comment */
#define BOUND_SIMPLE                 0 /* comment */
    int upper_bound_type;
    int lower_bound_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.
    Unused otherwise.  */

    struct type * target_type;

    /* Flags about this type.  */

    int flags;

    /* Number of fields described for this type */

    short nfields;

    /* 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.  */

    struct field * fields;

    /* For types with virtual functions (TYPE_CODE_STRUCT), VPTR_BASETYPE
    is the base class which defined the virtual function table pointer.

    For types that are pointer to member types (TYPE_CODE_MEMBER),
    VPTR_BASETYPE is the type that this pointer is a member of.

    For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate
    type that contains the method.

    Unused otherwise.  */

    struct type * vptr_basetype;

    /* Field number of the virtual function table pointer in
    VPTR_BASETYPE.  If -1, we were unable to find the virtual
    function table pointer in initial symbol reading, and
    fill_in_vptr_fieldno should be called to find it if possible.

    Unused if this type does not have virtual functions.  */

    int vptr_fieldno;

    /* Slot to point to additional language-specific fields of this type.  */
    union type_specific
    {
        struct cplus_struct_type * cplus_stuff;
        /* FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to the
        floatformat object that describes the floating-point value
        that resides within the type.  */

        const struct floatformat * floatformat;
    } type_specific;
};

/* A ``struct type'' describes a particular instance of a type, with
   some particular qualification.  */
struct type
{
    /* Type that is a pointer to this type.
     NULL if no such pointer-to type is known yet.
     The debugger may add the address of such a type
     if it has to construct one later.  */

    struct type * pointer_type;

    /* C++: also need a reference type.  */

    struct type * reference_type;

    /* Variant chain.  This points to a type that differs from this one only
     in qualifiers.  Currently, the possible qualifiers are const, volatile,
     code-space, and data-space.  The variants are linked in a circular
     ring and share MAIN_TYPE.  */
    struct type * chain;

    /* Flags specific to this instance of the type, indicating where
     on the ring we are.  */
    int instance_flags;

    /* Core type, shared by a group of qualified types.  */
    struct main_type * pmain_type;
};

union field_location
{
    /* Position of this field, counting in bits from start of
    containing structure.
    For BITS_BIG_ENDIAN=1 targets, it is the bit offset to the MSB.
    For BITS_BIG_ENDIAN=0 targets, it is the bit offset to the LSB.
    For a range bound or enum value, this is the value itself. */

    int bitpos;

    /* For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then physaddr
    is the location (in the target) of the static field.
    Otherwise, physname is the mangled label of the static field. */

    CORE_ADDR physaddr;
    char * physname;

    /* For a function or member type, this is 1 if the argument is marked
    artificial.  Artificial arguments should not be shown to the
    user.  */
    int artificial;
};

struct field
{
    union field_location loc;

    /* Size of this field, in bits, or zero if not packed.
    For an unpacked field, the field's type's length
    says how many bytes the field occupies.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?