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

#include "gdbtypes.h"

Public Attributes

struct typepointer_type
 
struct typereference_type
 
struct typechain
 
int instance_flags
 
unsigned length
 
struct main_typemain_type
 

Detailed Description

A ``struct type'' describes a particular instance of a type, with some particular qualification.

Definition at line 749 of file gdbtypes.h.

Member Data Documentation

struct type* type::chain

Variant chain. This points to a type that differs from this one only in qualifiers and length. Currently, the possible qualifiers are const, volatile, code-space, data-space, and address class. The length may differ only when one of the address class flags are set. The variants are linked in a circular ring and share MAIN_TYPE.

Definition at line 769 of file gdbtypes.h.

int type::instance_flags

Flags specific to this instance of the type, indicating where on the ring we are.

For TYPE_CODE_TYPEDEF the flags of the typedef type should be binary or-ed with the target type, with a special case for address class and space class. For example if this typedef does not specify any new qualifiers, TYPE_INSTANCE_FLAGS is 0 and the instance flags are completely inherited from the target type. No qualifiers can be cleared by the typedef. See also check_typedef.

Definition at line 781 of file gdbtypes.h.

unsigned type::length

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.

Definition at line 807 of file gdbtypes.h.

struct main_type* type::main_type

Core type, shared by a group of qualified types.

Definition at line 811 of file gdbtypes.h.

struct type* type::pointer_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.

Definition at line 756 of file gdbtypes.h.

struct type* type::reference_type

C++: also need a reference type.

Definition at line 760 of file gdbtypes.h.


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