Next: , Previous: , Up: The type section   [Contents][Index]


2.3.10 Enums

Enumerated types are represented as types of kind CTF_K_ENUM in a ctf_stype_t. The ctt_size is always the size of an int from the data model (enum bitfields are implemented via slices). The vlen is a count of enumerations, each of which is represented by a ctf_enum_t in the vlen:

typedef struct ctf_enum
{
  uint32_t cte_name;
  int32_t cte_value;
} ctf_enum_t;
OffsetNameDescription
0x0uint32_t cte_name Strtab offset of the enumeration name. Must not be 0.
0x4int32_t cte_value The enumeration value.

Enumeration values larger than 2^32 are not yet supported and are omitted from the enumeration. (v4 will lift this restriction by encoding the value differently.)

Forward declarations of enums are not implemented with this kind: see section Forward declarations.

Enumerated type names, as usual in C, go into their own namespace, and do not conflict with non-enums, structs, or unions with the same name.