GDB (API)
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
type Struct Reference

#include "gdbtypes.h"

Public Member Functions

type_code code () const
 
void set_code (type_code code)
 
const charname () const
 
void set_name (const char *name)
 
ULONGEST length () const
 
void set_length (ULONGEST length)
 
unsigned int num_fields () const
 
void set_num_fields (unsigned int num_fields)
 
struct fieldfields () const
 
struct fieldfield (int idx) const
 
void set_fields (struct field *fields)
 
void alloc_fields (unsigned int nfields, bool init=true)
 
void copy_fields (struct type *src)
 
void copy_fields (std::vector< struct field > &src)
 
typeindex_type () const
 
struct typetarget_type () const
 
void set_target_type (struct type *target_type)
 
void set_index_type (type *index_type)
 
const type_instance_flags instance_flags () const
 
void set_instance_flags (type_instance_flags flags)
 
range_boundsbounds () const
 
void set_bounds (range_bounds *bounds)
 
ULONGEST bit_stride () const
 
bool is_unsigned () const
 
void set_is_unsigned (bool is_unsigned)
 
bool has_no_signedness () const
 
void set_has_no_signedness (bool has_no_signedness)
 
bool is_stub () const
 
void set_is_stub (bool is_stub)
 
bool target_is_stub () const
 
void set_target_is_stub (bool target_is_stub)
 
bool is_prototyped () const
 
void set_is_prototyped (bool is_prototyped)
 
bool has_varargs () const
 
void set_has_varargs (bool has_varargs)
 
bool is_vector () const
 
void set_is_vector (bool is_vector)
 
bool stub_is_supported () const
 
void set_stub_is_supported (bool stub_is_supported)
 
bool is_gnu_ifunc () const
 
void set_is_gnu_ifunc (bool is_gnu_ifunc)
 
bool is_fixed_instance () const
 
void set_is_fixed_instance (bool is_fixed_instance)
 
bool endianity_is_not_default () const
 
void set_endianity_is_not_default (bool endianity_is_not_default)
 
bool is_declared_class () const
 
void set_is_declared_class (bool is_declared_class) const
 
bool is_flag_enum () const
 
void set_is_flag_enum (bool is_flag_enum)
 
bool is_multi_dimensional () const
 
void set_is_multi_dimensional (bool value)
 
struct fixed_point_type_infofixed_point_info () const
 
void set_fixed_point_info (struct fixed_point_type_info *info) const
 
struct typefixed_point_type_base_type ()
 
const gdb_mpqfixed_point_scaling_factor ()
 
dynamic_propdyn_prop (dynamic_prop_node_kind kind) const
 
void add_dyn_prop (dynamic_prop_node_kind kind, dynamic_prop prop)
 
void remove_dyn_prop (dynamic_prop_node_kind kind)
 
bool is_objfile_owned () const
 
void set_owner (objfile *objfile)
 
void set_owner (gdbarch *arch)
 
struct objfile * objfile_owner () const
 
gdbarch * arch_owner () const
 
gdbarch * arch () const
 
bool bit_size_differs_p () const
 
unsigned short bit_size () const
 
unsigned short bit_offset () const
 
bool is_pointer_or_reference () const
 
bool is_string_like ()
 
bool is_array_like ()
 
enum language language () const
 

Public Attributes

struct typepointer_type
 
struct typereference_type
 
struct typervalue_reference_type
 
struct typechain
 
unsigned align_log2: TYPE_ALIGN_BITS
 
unsigned m_instance_flags: 9
 
ULONGEST m_length
 
struct main_typemain_type
 

Detailed Description

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

Definition at line 950 of file gdbtypes.h.

Member Function Documentation

◆ add_dyn_prop()

void type::add_dyn_prop ( dynamic_prop_node_kind kind,
dynamic_prop prop )

Given a dynamic property PROP of a given KIND, add this dynamic property to this type.

This function assumes that this type is objfile-owned.

◆ alloc_fields()

void type::alloc_fields ( unsigned int nfields,
bool init = true )

◆ arch()

gdbarch * type::arch ( ) const

◆ arch_owner()

gdbarch * type::arch_owner ( ) const
inline

Definition at line 1390 of file gdbtypes.h.

◆ bit_offset()

unsigned short type::bit_offset ( ) const
inline

Return the bit offset for this integer type. Only valid for integer (TYPE_SPECIFIC_INT) types.

Definition at line 1424 of file gdbtypes.h.

◆ bit_size()

unsigned short type::bit_size ( ) const
inline

Return the logical (bit) size for this integer type. Only valid for integer (TYPE_SPECIFIC_INT) types.

Definition at line 1416 of file gdbtypes.h.

◆ bit_size_differs_p()

bool type::bit_size_differs_p ( ) const
inline

Return true if this is an integer type whose logical (bit) size differs from its storage size; false otherwise. Always return false for non-integer (i.e., non-TYPE_SPECIFIC_INT) types.

Definition at line 1408 of file gdbtypes.h.

◆ bit_stride()

ULONGEST type::bit_stride ( ) const
inline

Definition at line 1090 of file gdbtypes.h.

◆ bounds()

range_bounds * type::bounds ( ) const
inline

Definition at line 1065 of file gdbtypes.h.

◆ code()

type_code type::code ( ) const
inline

Definition at line 956 of file gdbtypes.h.

◆ copy_fields() [1/2]

void type::copy_fields ( std::vector< struct field > & src)

◆ copy_fields() [2/2]

void type::copy_fields ( struct type * src)

◆ dyn_prop()

dynamic_prop * type::dyn_prop ( dynamic_prop_node_kind kind) const

Return the dynamic property of the requested KIND from this type's list of dynamic properties.

◆ endianity_is_not_default()

bool type::endianity_is_not_default ( ) const
inline

Definition at line 1250 of file gdbtypes.h.

◆ field()

struct field & type::field ( int idx) const
inline

Definition at line 1012 of file gdbtypes.h.

◆ fields()

struct field * type::fields ( ) const
inline

Definition at line 1006 of file gdbtypes.h.

◆ fixed_point_info()

struct fixed_point_type_info & type::fixed_point_info ( ) const
inline

Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference to this type's fixed_point_info.

Definition at line 1306 of file gdbtypes.h.

◆ fixed_point_scaling_factor()

const gdb_mpq & type::fixed_point_scaling_factor ( )

Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its scaling factor.

◆ fixed_point_type_base_type()

struct type * type::fixed_point_type_base_type ( )

Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its base type.

In other words, this returns the type after having peeled all intermediate type layers (such as TYPE_CODE_RANGE, for instance). The TYPE_CODE of the type returned is guaranteed to be a TYPE_CODE_FIXED_POINT.

◆ has_no_signedness()

bool type::has_no_signedness ( ) const
inline

Definition at line 1114 of file gdbtypes.h.

◆ has_varargs()

bool type::has_varargs ( ) const
inline

Definition at line 1172 of file gdbtypes.h.

◆ index_type()

type * type::index_type ( ) const
inline

Definition at line 1032 of file gdbtypes.h.

◆ instance_flags()

const type_instance_flags type::instance_flags ( ) const
inline

Definition at line 1053 of file gdbtypes.h.

◆ is_array_like()

bool type::is_array_like ( )

◆ is_declared_class()

bool type::is_declared_class ( ) const
inline

Definition at line 1267 of file gdbtypes.h.

◆ is_fixed_instance()

bool type::is_fixed_instance ( ) const
inline

Definition at line 1236 of file gdbtypes.h.

◆ is_flag_enum()

bool type::is_flag_enum ( ) const
inline

Definition at line 1281 of file gdbtypes.h.

◆ is_gnu_ifunc()

bool type::is_gnu_ifunc ( ) const
inline

Definition at line 1216 of file gdbtypes.h.

◆ is_multi_dimensional()

bool type::is_multi_dimensional ( ) const
inline

Definition at line 1293 of file gdbtypes.h.

◆ is_objfile_owned()

bool type::is_objfile_owned ( ) const
inline

Definition at line 1353 of file gdbtypes.h.

◆ is_pointer_or_reference()

bool type::is_pointer_or_reference ( ) const
inline

Definition at line 1431 of file gdbtypes.h.

◆ is_prototyped()

bool type::is_prototyped ( ) const
inline

Definition at line 1159 of file gdbtypes.h.

◆ is_string_like()

bool type::is_string_like ( )

◆ is_stub()

bool type::is_stub ( ) const
inline

Definition at line 1128 of file gdbtypes.h.

◆ is_unsigned()

bool type::is_unsigned ( ) const
inline

Definition at line 1100 of file gdbtypes.h.

◆ is_vector()

bool type::is_vector ( ) const
inline

Definition at line 1186 of file gdbtypes.h.

◆ language()

enum language type::language ( ) const
inline

Definition at line 1446 of file gdbtypes.h.

◆ length()

ULONGEST type::length ( ) const
inline

Definition at line 983 of file gdbtypes.h.

◆ name()

const char * type::name ( ) const
inline

Definition at line 968 of file gdbtypes.h.

◆ num_fields()

unsigned int type::num_fields ( ) const
inline

Definition at line 994 of file gdbtypes.h.

◆ objfile_owner()

struct objfile * type::objfile_owner ( ) const
inline

Definition at line 1379 of file gdbtypes.h.

◆ remove_dyn_prop()

void type::remove_dyn_prop ( dynamic_prop_node_kind kind)

Remove dynamic property of kind KIND from this type, if it exists.

◆ set_bounds()

void type::set_bounds ( range_bounds * bounds)
inline

Definition at line 1083 of file gdbtypes.h.

◆ set_code()

void type::set_code ( type_code code)
inline

Definition at line 962 of file gdbtypes.h.

◆ set_endianity_is_not_default()

void type::set_endianity_is_not_default ( bool endianity_is_not_default)
inline

Definition at line 1255 of file gdbtypes.h.

◆ set_fields()

void type::set_fields ( struct field * fields)
inline

Definition at line 1019 of file gdbtypes.h.

◆ set_fixed_point_info()

void type::set_fixed_point_info ( struct fixed_point_type_info * info) const
inline

Assuming that THIS is a TYPE_CODE_FIXED_POINT, set this type's fixed_point_info to INFO.

Definition at line 1317 of file gdbtypes.h.

◆ set_has_no_signedness()

void type::set_has_no_signedness ( bool has_no_signedness)
inline

Definition at line 1119 of file gdbtypes.h.

◆ set_has_varargs()

void type::set_has_varargs ( bool has_varargs)
inline

Definition at line 1177 of file gdbtypes.h.

◆ set_index_type()

void type::set_index_type ( type * index_type)
inline

Definition at line 1047 of file gdbtypes.h.

◆ set_instance_flags()

void type::set_instance_flags ( type_instance_flags flags)
inline

Definition at line 1059 of file gdbtypes.h.

◆ set_is_declared_class()

void type::set_is_declared_class ( bool is_declared_class) const
inline

Definition at line 1272 of file gdbtypes.h.

◆ set_is_fixed_instance()

void type::set_is_fixed_instance ( bool is_fixed_instance)
inline

Definition at line 1241 of file gdbtypes.h.

◆ set_is_flag_enum()

void type::set_is_flag_enum ( bool is_flag_enum)
inline

Definition at line 1286 of file gdbtypes.h.

◆ set_is_gnu_ifunc()

void type::set_is_gnu_ifunc ( bool is_gnu_ifunc)
inline

Definition at line 1221 of file gdbtypes.h.

◆ set_is_multi_dimensional()

void type::set_is_multi_dimensional ( bool value)
inline

Definition at line 1298 of file gdbtypes.h.

◆ set_is_prototyped()

void type::set_is_prototyped ( bool is_prototyped)
inline

Definition at line 1164 of file gdbtypes.h.

◆ set_is_stub()

void type::set_is_stub ( bool is_stub)
inline

Definition at line 1133 of file gdbtypes.h.

◆ set_is_unsigned()

void type::set_is_unsigned ( bool is_unsigned)
inline

Definition at line 1105 of file gdbtypes.h.

◆ set_is_vector()

void type::set_is_vector ( bool is_vector)
inline

Definition at line 1191 of file gdbtypes.h.

◆ set_length()

void type::set_length ( ULONGEST length)
inline

Definition at line 988 of file gdbtypes.h.

◆ set_name()

void type::set_name ( const char * name)
inline

Definition at line 974 of file gdbtypes.h.

◆ set_num_fields()

void type::set_num_fields ( unsigned int num_fields)
inline

Definition at line 1000 of file gdbtypes.h.

◆ set_owner() [1/2]

void type::set_owner ( gdbarch * arch)
inline

Definition at line 1368 of file gdbtypes.h.

◆ set_owner() [2/2]

void type::set_owner ( objfile * objfile)
inline

Definition at line 1359 of file gdbtypes.h.

◆ set_stub_is_supported()

void type::set_stub_is_supported ( bool stub_is_supported)
inline

Definition at line 1206 of file gdbtypes.h.

◆ set_target_is_stub()

void type::set_target_is_stub ( bool target_is_stub)
inline

Definition at line 1149 of file gdbtypes.h.

◆ set_target_type()

void type::set_target_type ( struct type * target_type)
inline

Definition at line 1042 of file gdbtypes.h.

◆ stub_is_supported()

bool type::stub_is_supported ( ) const
inline

Definition at line 1201 of file gdbtypes.h.

◆ target_is_stub()

bool type::target_is_stub ( ) const
inline

Definition at line 1144 of file gdbtypes.h.

◆ target_type()

struct type * type::target_type ( ) const
inline

Definition at line 1037 of file gdbtypes.h.

Member Data Documentation

◆ align_log2

unsigned type::align_log2

The alignment for this type. Zero means that the alignment was not specified in the debug info. Note that this is stored in a funny way: as the log base 2 (plus 1) of the alignment; so a value of 1 means the alignment is 1, and a value of 9 means the alignment is 256.

Definition at line 1479 of file gdbtypes.h.

◆ chain

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 1471 of file gdbtypes.h.

◆ m_instance_flags

unsigned type::m_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 1491 of file gdbtypes.h.

◆ m_length

ULONGEST type::m_length

Length of storage for a value of this type. The value is the expression in host bytes of what sizeof(type) would return. 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.

Since this field is expressed in host bytes, its value is appropriate to pass to memcpy and such (it is assumed that GDB itself always runs on an 8-bits addressable architecture). However, when using it for target address arithmetic (e.g. adding it to a target address), the type_length_units function should be used in order to get the length expressed in target addressable memory units.

Definition at line 1509 of file gdbtypes.h.

◆ main_type

struct main_type* type::main_type

Core type, shared by a group of qualified types.

Definition at line 1513 of file gdbtypes.h.

◆ pointer_type

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 1454 of file gdbtypes.h.

◆ reference_type

struct type* type::reference_type

C++: also need a reference type.

Definition at line 1458 of file gdbtypes.h.

◆ rvalue_reference_type

struct type* type::rvalue_reference_type

A C++ rvalue reference type added in C++11.

Definition at line 1462 of file gdbtypes.h.


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