Home | History | Annotate | Line # | Download | only in doc
      1      1.1  christos This is ctf-spec.info, produced by makeinfo version 6.8 from
      2      1.1  christos ctf-spec.texi.
      3      1.1  christos 
      4  1.1.1.2  christos Copyright (C) 2021-2024 Free Software Foundation, Inc.
      5      1.1  christos 
      6      1.1  christos    Permission is granted to copy, distribute and/or modify this document
      7      1.1  christos under the terms of the GNU General Public License, Version 3 or any
      8      1.1  christos later version published by the Free Software Foundation.  A copy of the
      9      1.1  christos license is included in the section entitled "GNU General Public
     10      1.1  christos License".
     11      1.1  christos 
     12      1.1  christos INFO-DIR-SECTION Software development
     13      1.1  christos START-INFO-DIR-ENTRY
     14      1.1  christos * CTF: (ctf-spec).         The CTF file format.
     15      1.1  christos END-INFO-DIR-ENTRY
     16      1.1  christos 
     17      1.1  christos 
     18      1.1  christos File: ctf-spec.info,  Node: Top,  Next: Overview,  Up: (dir)
     19      1.1  christos 
     20      1.1  christos The CTF file format
     21      1.1  christos *******************
     22      1.1  christos 
     23      1.1  christos This manual describes version 3 of the CTF file format, which is
     24      1.1  christos intended to model the C type system in a fashion that C programs can
     25      1.1  christos consume at runtime.
     26      1.1  christos 
     27      1.1  christos * Menu:
     28      1.1  christos 
     29      1.1  christos * Overview::
     30      1.1  christos * CTF archive::
     31      1.1  christos * CTF dictionaries::
     32      1.1  christos * Index::
     33      1.1  christos 
     34      1.1  christos 
     35      1.1  christos File: ctf-spec.info,  Node: Overview,  Next: CTF archive,  Prev: Top,  Up: Top
     36      1.1  christos 
     37      1.1  christos Overview
     38      1.1  christos ********
     39      1.1  christos 
     40      1.1  christos The CTF file format compactly describes C types and the association
     41      1.1  christos between function and data symbols and types: if embedded in ELF objects,
     42      1.1  christos it can exploit the ELF string table to reduce duplication further.
     43      1.1  christos There is no real concept of namespacing: only top-level types are
     44      1.1  christos described, not types scoped to within single functions.
     45      1.1  christos 
     46      1.1  christos    CTF dictionaries can be "children" of other dictionaries, in a
     47      1.1  christos one-level hierarchy: child dictionaries can refer to types in the
     48      1.1  christos parent, but the opposite is not sensible (since if you refer to a child
     49      1.1  christos type in the parent, the actual type you cited would vary depending on
     50      1.1  christos what child was attached).  This parent/child definition is recorded in
     51      1.1  christos the child, but only as a recommendation: users of the API have to attach
     52      1.1  christos parents to children explicitly, and can choose to attach a child to any
     53      1.1  christos parent they like, or to none, though doing so might lead to unpleasant
     54      1.1  christos consequences like dangling references to types.  *Note Type indexes and
     55      1.1  christos type IDs::.  Type lookups in child dicts that are not associated with a
     56      1.1  christos parent at all will fail with 'ECTF_NOPARENT' if a parent type was
     57      1.1  christos needed.
     58      1.1  christos 
     59      1.1  christos    The associated API to generate, merge together, and query this file
     60      1.1  christos format will be described in the accompanying 'libctf' manual once it is
     61      1.1  christos written.  There is no API to modify dictionaries once they've been
     62      1.1  christos written out: CTF is a write-once file format.  (However, it is always
     63      1.1  christos possible to dynamically create a new child dictionary on the fly and
     64      1.1  christos attach it to a pre-existing, read-only parent.)
     65      1.1  christos 
     66      1.1  christos    There are two major pieces to CTF: the "archive" and the
     67      1.1  christos "dictionary".  Some relatives and ancestors of CTF call dictionaries
     68      1.1  christos "containers": the archive format is unique to this variant of CTF. (Much
     69      1.1  christos of the source code still uses the old term.)
     70      1.1  christos 
     71      1.1  christos    The archive file format is a very simple mmappable archive used to
     72      1.1  christos group multiple dictionaries together into groups: it is expected to
     73      1.1  christos slowly go away and be replaced by other mechanisms, but right now it is
     74      1.1  christos an important part of the file format, used to group dictionaries
     75      1.1  christos containing types with conflicting definitions in different TUs with the
     76      1.1  christos overarching dictionary used to store all other types.  (Even when
     77      1.1  christos archives go away, the 'libctf' API used to access them will remain, and
     78      1.1  christos access the other mechanisms that replace it instead.)
     79      1.1  christos 
     80      1.1  christos    The CTF dictionary consists of a "preamble", which does not vary
     81      1.1  christos between versions of the CTF file format, and a "header" and some number
     82      1.1  christos of "sections", which can vary between versions.
     83      1.1  christos 
     84      1.1  christos    The rest of this specification describes the format of these
     85      1.1  christos sections, first for the latest version of CTF, then for all earlier
     86      1.1  christos versions supported by 'libctf': the earlier versions are defined in
     87      1.1  christos terms of their differences from the next later one.  We describe each
     88      1.1  christos part of the format first by reproducing the C structure which defines
     89      1.1  christos that part, then describing it at greater length in terms of file
     90      1.1  christos offsets.
     91      1.1  christos 
     92      1.1  christos    The description of the file format ends with a description of
     93      1.1  christos relevant limits that apply to it.  These limits can vary between file
     94      1.1  christos format versions.
     95      1.1  christos 
     96      1.1  christos    This document is quite young, so for now the C code in 'ctf.h' should
     97      1.1  christos be presumed correct when this document conflicts with it.
     98      1.1  christos 
     99      1.1  christos 
    100      1.1  christos File: ctf-spec.info,  Node: CTF archive,  Next: CTF dictionaries,  Prev: Overview,  Up: Top
    101      1.1  christos 
    102      1.1  christos 1 CTF archives
    103      1.1  christos **************
    104      1.1  christos 
    105      1.1  christos The CTF archive format maps names to CTF dictionaries.  The names may
    106      1.1  christos contain any character other than \0, but for now archives containing
    107      1.1  christos slashes in the names may not extract correctly.  It is possible to
    108      1.1  christos insert multiple members with the same name, but these are quite hard to
    109      1.1  christos access reliably (you have to iterate through all the members rather than
    110      1.1  christos opening by name) so this is not recommended.
    111      1.1  christos 
    112      1.1  christos    CTF archives are not themselves compressed: the constituent
    113      1.1  christos components, CTF dictionaries, can be compressed.  (*Note CTF header::).
    114      1.1  christos 
    115      1.1  christos    CTF archives usually contain a collection of related dictionaries,
    116      1.1  christos one parent and many children of that parent.  CTF archives can have a
    117      1.1  christos member with a "default name", '.ctf' (which can be represented as 'NULL'
    118      1.1  christos in the API). If present, this member is usually the parent of all the
    119      1.1  christos children, but it is possible for CTF producers to emit parents with
    120      1.1  christos different names if they wish (usually for backward- compatibility
    121      1.1  christos purposes).
    122      1.1  christos 
    123      1.1  christos    '.ctf' sections in ELF objects consist of a single CTF dictionary
    124      1.1  christos rather than an archive of dictionaries if and only if the section
    125      1.1  christos contains no types with identical names but conflicting definitions: if
    126      1.1  christos two conflicting definitions exist, the deduplicator will place the type
    127      1.1  christos most commonly referred to by other types in the parent and will place
    128      1.1  christos the other type in a child named after the translation unit it is found
    129      1.1  christos in, and will emit a CTF archive containing both dictionaries instead of
    130      1.1  christos a raw dictionary.  All types that refer to such conflicting types are
    131      1.1  christos also placed in the per-translation-unit child.
    132      1.1  christos 
    133      1.1  christos    The definition of an archive in 'ctf.h' is as follows:
    134      1.1  christos 
    135      1.1  christos struct ctf_archive
    136      1.1  christos {
    137      1.1  christos   uint64_t ctfa_magic;
    138      1.1  christos   uint64_t ctfa_model;
    139      1.1  christos   uint64_t ctfa_nfiles;
    140      1.1  christos   uint64_t ctfa_names;
    141      1.1  christos   uint64_t ctfa_ctfs;
    142      1.1  christos };
    143      1.1  christos 
    144      1.1  christos typedef struct ctf_archive_modent
    145      1.1  christos {
    146      1.1  christos   uint64_t name_offset;
    147      1.1  christos   uint64_t ctf_offset;
    148      1.1  christos } ctf_archive_modent_t;
    149      1.1  christos 
    150      1.1  christos    (Note one irregularity here: the 'ctf_archive_t' is not a typedef to
    151      1.1  christos 'struct ctf_archive', but a different typedef, private to 'libctf', so
    152      1.1  christos that things that are not really archives can be made to appear as if
    153      1.1  christos they were.)
    154      1.1  christos 
    155      1.1  christos    All the above items are always in little-endian byte order,
    156      1.1  christos regardless of the machine endianness.
    157      1.1  christos 
    158      1.1  christos    The archive header has the following fields:
    159      1.1  christos 
    160      1.1  christos Offset   Name                     Description
    161      1.1  christos ------------------------------------------------------------------------------------------
    162      1.1  christos 0x00     'uint64_t ctfa_magic'    The magic number for archives, 'CTFA_MAGIC':
    163      1.1  christos                                   0x8b47f2a4d7623eeb.
    164      1.1  christos                                   
    165      1.1  christos 0x08     'uint64_t ctfa_model'    The data model for this archive: an arbitrary integer
    166      1.1  christos                                   that serves no purpose but to be handed back by the
    167      1.1  christos                                   libctf API. *Note Data models::.
    168      1.1  christos                                   
    169      1.1  christos 0x10     'uint64_t ctfa_nfiles'   The number of CTF dictionaries in this archive.
    170      1.1  christos                                   
    171      1.1  christos 0x18     'uint64_t ctfa_names'    Offset of the name table, in bytes from the start of
    172      1.1  christos                                   the archive.  The name table is an array of 'struct
    173      1.1  christos                                   ctf_archive_modent_t[ctfa_nfiles]'.
    174      1.1  christos                                   
    175      1.1  christos 0x20     'uint64_t ctfa_ctfs'     Offset of the CTF table.  Each element starts with a
    176      1.1  christos                                   'uint64_t' size, followed by a CTF dictionary.
    177      1.1  christos                                   
    178      1.1  christos 
    179      1.1  christos    The array pointed to by 'ctfa_names' is an array of entries of
    180      1.1  christos 'ctf_archive_modent':
    181      1.1  christos 
    182      1.1  christos Offset   Name                     Description
    183      1.1  christos ---------------------------------------------------------------------------------
    184      1.1  christos 0x00     'uint64_t name_offset'   Offset of this name, in bytes from the start
    185      1.1  christos                                   of the archive.
    186      1.1  christos                                   
    187      1.1  christos 0x08     'uint64_t ctf_offset'    Offset of this CTF dictionary, in bytes from
    188      1.1  christos                                   the start of the archive.
    189      1.1  christos                                   
    190      1.1  christos 
    191      1.1  christos    The 'ctfa_names' array is sorted into ASCIIbetical order by name
    192      1.1  christos (i.e.  by the result of dereferencing the 'name_offset').
    193      1.1  christos 
    194      1.1  christos    The archive file also contains a name table and a table of CTF
    195      1.1  christos dictionaries: these are pointed to by the structures above.  The name
    196      1.1  christos table is a simple strtab which is not required to be sorted; the
    197      1.1  christos dictionary array is described above in the entry for 'ctfa_ctfs'.
    198      1.1  christos 
    199      1.1  christos    The relative order of these various parts is not defined, except that
    200      1.1  christos the header naturally always comes first.
    201      1.1  christos 
    202      1.1  christos 
    203      1.1  christos File: ctf-spec.info,  Node: CTF dictionaries,  Next: Index,  Prev: CTF archive,  Up: Top
    204      1.1  christos 
    205      1.1  christos 2 CTF dictionaries
    206      1.1  christos ******************
    207      1.1  christos 
    208      1.1  christos CTF dictionaries consist of a header, starting with a premable, and a
    209      1.1  christos number of sections.
    210      1.1  christos 
    211      1.1  christos * Menu:
    212      1.1  christos 
    213      1.1  christos * CTF Preamble::
    214      1.1  christos * CTF header::
    215      1.1  christos * The type section::
    216      1.1  christos * The symtypetab sections::
    217      1.1  christos * The variable section::
    218      1.1  christos * The label section::
    219      1.1  christos * The string section::
    220      1.1  christos * Data models::
    221      1.1  christos * Limits of CTF::
    222      1.1  christos 
    223      1.1  christos 
    224      1.1  christos File: ctf-spec.info,  Node: CTF Preamble,  Next: CTF header,  Up: CTF dictionaries
    225      1.1  christos 
    226      1.1  christos 2.1 CTF Preamble
    227      1.1  christos ================
    228      1.1  christos 
    229      1.1  christos The preamble is the only part of the CTF dictionary whose format cannot
    230      1.1  christos vary between versions.  It is never compressed.  It is correspondingly
    231      1.1  christos simple:
    232      1.1  christos 
    233      1.1  christos typedef struct ctf_preamble
    234      1.1  christos {
    235      1.1  christos   unsigned short ctp_magic;
    236      1.1  christos   unsigned char ctp_version;
    237      1.1  christos   unsigned char ctp_flags;
    238      1.1  christos } ctf_preamble_t;
    239      1.1  christos 
    240      1.1  christos    '#define's are provided under the names 'cth_magic', 'cth_version'
    241      1.1  christos and 'cth_flags' to make the fields of the 'ctf_preamble_t' appear to be
    242      1.1  christos part of the 'ctf_header_t', so consuming programs rarely need to
    243      1.1  christos consider the existence of the preamble as a separate structure.
    244      1.1  christos 
    245      1.1  christos Offset   Name                          Description
    246      1.1  christos -------------------------------------------------------------------------------
    247      1.1  christos 0x00     'unsigned short ctp_magic'    The magic number for CTF
    248      1.1  christos                                        dictionaries, 'CTF_MAGIC': 0xdff2.
    249      1.1  christos                                        
    250      1.1  christos 0x02     'unsigned char ctp_version'   The version number of this CTF
    251      1.1  christos                                        dictionary.
    252      1.1  christos                                        
    253      1.1  christos 0x03     'ctp_flags'                   Flags for this CTF file.
    254      1.1  christos                                        *Note CTF file-wide flags::.
    255      1.1  christos 
    256      1.1  christos    Every element of a dictionary must be naturally aligned unless
    257      1.1  christos otherwise specified.  (This restriction will be lifted in later
    258      1.1  christos versions.)
    259      1.1  christos 
    260      1.1  christos    CTF dictionaries are stored in the native endianness of the system
    261      1.1  christos that generates them: the consumer (e.g., 'libctf') can detect whether to
    262      1.1  christos endian-flip a CTF dictionary by inspecting the 'ctp_magic'.  (If it
    263      1.1  christos appears as 0xf2df, endian-flipping is needed.)
    264      1.1  christos 
    265      1.1  christos    The version of the CTF dictionary can be determined by inspecting
    266      1.1  christos 'ctp_version'.  The following versions are currently valid, and 'libctf'
    267      1.1  christos can read all of them:
    268      1.1  christos 
    269      1.1  christos Version                      Number   Description
    270      1.1  christos -------------------------------------------------------------------------------------------
    271      1.1  christos 'CTF_VERSION_1'              1        First version, rare.  Very similar to Solaris CTF.
    272      1.1  christos                                       
    273      1.1  christos 'CTF_VERSION_1_UPGRADED_3'   2        First version, upgraded to v3 or higher and
    274      1.1  christos                                       written out again.  Name may change.  Very rare.
    275      1.1  christos                                       
    276      1.1  christos 'CTF_VERSION_2'              3        Second version, with many range limits lifted.
    277      1.1  christos                                       
    278      1.1  christos 'CTF_VERSION_3'              4        Third and current version, documented here.
    279      1.1  christos 
    280      1.1  christos    This section documents 'CTF_VERSION_3'.
    281      1.1  christos 
    282      1.1  christos * Menu:
    283      1.1  christos 
    284      1.1  christos * CTF file-wide flags::
    285      1.1  christos 
    286      1.1  christos 
    287      1.1  christos File: ctf-spec.info,  Node: CTF file-wide flags,  Up: CTF Preamble
    288      1.1  christos 
    289      1.1  christos 2.1.1 CTF file-wide flags
    290      1.1  christos -------------------------
    291      1.1  christos 
    292      1.1  christos The preamble contains bitflags in its 'ctp_flags' field that describe
    293      1.1  christos various file-wide properties.  Some of the flags are valid only for
    294      1.1  christos particular file-format versions, which means the flags can be used to
    295      1.1  christos fix file-format bugs.  Consumers that see unknown flags should
    296      1.1  christos accordingly assume that the dictionary is not comprehensible, and refuse
    297      1.1  christos to open them.
    298      1.1  christos 
    299      1.1  christos    The following flags are currently defined.  Many are bug workarounds,
    300      1.1  christos valid only in CTFv3, and will not be valid in any future versions: the
    301      1.1  christos same values may be reused for other flags in v4+.
    302      1.1  christos 
    303      1.1  christos Flag                  Versions   Value   Meaning
    304      1.1  christos ---------------------------------------------------------------------------------------
    305      1.1  christos 'CTF_F_COMPRESS'      All        0x1     Compressed with zlib
    306      1.1  christos 'CTF_F_NEWFUNCINFO'   3 only     0x2     "New-format" func info section.
    307      1.1  christos 'CTF_F_IDXSORTED'     3+         0x4     The index section is in sorted order
    308      1.1  christos 'CTF_F_DYNSTR'        3 only     0x8     The external strtab is in '.dynstr' and the
    309      1.1  christos                                          symtab used is '.dynsym'.
    310      1.1  christos                                          *Note The string section::
    311      1.1  christos 
    312      1.1  christos    'CTF_F_NEWFUNCINFO' and 'CTF_F_IDXSORTED' relate to the function info
    313      1.1  christos and data object sections.  *Note The symtypetab sections::.
    314      1.1  christos 
    315      1.1  christos    Further flags (and further compression methods) wil be added in
    316      1.1  christos future.
    317      1.1  christos 
    318      1.1  christos 
    319      1.1  christos File: ctf-spec.info,  Node: CTF header,  Next: The type section,  Prev: CTF Preamble,  Up: CTF dictionaries
    320      1.1  christos 
    321      1.1  christos 2.2 CTF header
    322      1.1  christos ==============
    323      1.1  christos 
    324      1.1  christos The CTF header is the first part of a CTF dictionary, including the
    325      1.1  christos preamble.  All parts of it other than the preamble (*note CTF
    326      1.1  christos Preamble::) can vary between CTF file versions and are never compressed.
    327      1.1  christos It contains things that apply to the dictionary as a whole, and a table
    328      1.1  christos of the sections into which the rest of the dictionary is divided.  The
    329      1.1  christos sections tile the file: each section runs from the offset given until
    330      1.1  christos the start of the next section.  Only the last section cannot follow this
    331      1.1  christos rule, so the header has a length for it instead.
    332      1.1  christos 
    333      1.1  christos    All section offsets, here and in the rest of the CTF file, are
    334      1.1  christos relative to the _end_ of the header.  (This is annoyingly different to
    335      1.1  christos how offsets in CTF archives are handled.)
    336      1.1  christos 
    337      1.1  christos    This is the first structure to include offsets into the string table,
    338      1.1  christos which are not straight references because CTF dictionaries can include
    339      1.1  christos references into the ELF string table to save space, as well as into the
    340      1.1  christos string table internal to the CTF dictionary.  *Note The string section::
    341      1.1  christos for more on these.  Offset 0 is always the null string.
    342      1.1  christos 
    343      1.1  christos typedef struct ctf_header
    344      1.1  christos {
    345      1.1  christos   ctf_preamble_t cth_preamble;
    346      1.1  christos   uint32_t cth_parlabel;
    347      1.1  christos   uint32_t cth_parname;
    348      1.1  christos   uint32_t cth_cuname;
    349      1.1  christos   uint32_t cth_lbloff;
    350      1.1  christos   uint32_t cth_objtoff;
    351      1.1  christos   uint32_t cth_funcoff;
    352      1.1  christos   uint32_t cth_objtidxoff;
    353      1.1  christos   uint32_t cth_funcidxoff;
    354      1.1  christos   uint32_t cth_varoff;
    355      1.1  christos   uint32_t cth_typeoff;
    356      1.1  christos   uint32_t cth_stroff;
    357      1.1  christos   uint32_t cth_strlen;
    358      1.1  christos } ctf_header_t;
    359      1.1  christos 
    360      1.1  christos    In detail:
    361      1.1  christos 
    362      1.1  christos Offset   Name                            Description
    363      1.1  christos -----------------------------------------------------------------------------------------------
    364      1.1  christos 0x00     'ctf_preamble_t cth_preamble'   The preamble (conceptually embedded in the header).
    365      1.1  christos                                          *Note CTF Preamble::
    366      1.1  christos                                          
    367      1.1  christos 0x04     'uint32_t cth_parlabel'         The parent label, if deduplication happened against
    368      1.1  christos                                          a specific label: a strtab offset.
    369      1.1  christos                                          *Note The label section::.  Currently unused and
    370      1.1  christos                                          always 0, but may be used in future when semantics
    371      1.1  christos                                          are attached to the label section.
    372      1.1  christos                                          
    373      1.1  christos 0x08     'uint32_t cth_parname'          The name of the parent dictionary deduplicated
    374      1.1  christos                                          against: a strtab offset.  Interpretation is up to
    375      1.1  christos                                          the consumer (usually a CTF archive member name).
    376      1.1  christos                                          0 (the null string) if this is not a child
    377      1.1  christos                                          dictionary.
    378      1.1  christos                                          
    379      1.1  christos 0x1c     'uint32_t cth_cuname'           The name of the compilation unit, for consumers
    380      1.1  christos                                          like GDB that want to know the name of CUs
    381      1.1  christos                                          associated with single CUs: a strtab offset.  0 if
    382      1.1  christos                                          this dictionary describes types from many CUs.
    383      1.1  christos                                          
    384      1.1  christos 0x10     'uint32_t cth_lbloff'           The offset of the label section, which tiles the
    385      1.1  christos                                          type space into named regions.
    386      1.1  christos                                          *Note The label section::.
    387      1.1  christos                                          
    388      1.1  christos 0x14     'uint32_t cth_objtoff'          The offset of the data object symtypetab section,
    389      1.1  christos                                          which maps ELF data symbols to types.
    390      1.1  christos                                          *Note The symtypetab sections::.
    391      1.1  christos                                          
    392      1.1  christos 0x18     'uint32_t cth_funcoff'          The offset of the function info symtypetab section,
    393      1.1  christos                                          which maps ELF function symbols to a return type
    394      1.1  christos                                          and arg types.  *Note The symtypetab sections::.
    395      1.1  christos                                          
    396      1.1  christos 0x1c     'uint32_t cth_objtidxoff'       The offset of the object index section, which maps
    397      1.1  christos                                          ELF object symbols to entries in the data object
    398      1.1  christos                                          section.  *Note The symtypetab sections::.
    399      1.1  christos                                          
    400      1.1  christos 0x20     'uint32_t cth_funcidxoff'       The offset of the function info index section,
    401      1.1  christos                                          which maps ELF function symbols to entries in the
    402      1.1  christos                                          function info section.
    403      1.1  christos                                          *Note The symtypetab sections::.
    404      1.1  christos                                          
    405      1.1  christos 0x24     'uint32_t cth_varoff'           The offset of the variable section, which maps
    406      1.1  christos                                          string names to types.
    407      1.1  christos                                          *Note The variable section::.
    408      1.1  christos                                          
    409      1.1  christos 0x28     'uint32_t cth_typeoff'          The offset of the type section, the core of CTF,
    410      1.1  christos                                          which describes types using variable-length array
    411      1.1  christos                                          elements.  *Note The type section::.
    412      1.1  christos                                          
    413      1.1  christos 0x2c     'uint32_t cth_stroff'           The offset of the string section.
    414      1.1  christos                                          *Note The string section::.
    415      1.1  christos                                          
    416      1.1  christos 0x30     'uint32_t cth_strlen'           The length of the string section (not an offset!).
    417      1.1  christos                                          The CTF file ends at this point.
    418      1.1  christos                                          
    419      1.1  christos 
    420      1.1  christos    Everything from this point on (until the end of the file at
    421      1.1  christos 'cth_stroff' + 'cth_strlen') is compressed with zlib if 'CTF_F_COMPRESS'
    422      1.1  christos is set in the preamble's 'ctp_flags'.
    423      1.1  christos 
    424      1.1  christos 
    425      1.1  christos File: ctf-spec.info,  Node: The type section,  Next: The symtypetab sections,  Prev: CTF header,  Up: CTF dictionaries
    426      1.1  christos 
    427      1.1  christos 2.3 The type section
    428      1.1  christos ====================
    429      1.1  christos 
    430      1.1  christos This section is the most important section in CTF, describing all the
    431      1.1  christos top-level types in the program.  It consists of an array of type
    432      1.1  christos structures, each of which describes a type of some "kind": each kind of
    433      1.1  christos type has some amount of variable-length data associated with it (some
    434      1.1  christos kinds have none).  The amount of variable-length data associated with a
    435      1.1  christos given type can be determined by inspecting the type, so the reading code
    436      1.1  christos can walk through the types in sequence at opening time.
    437      1.1  christos 
    438      1.1  christos    Each type structure is one of a set of overlapping structures in a
    439      1.1  christos discriminated union of sorts: the variable-length data for each type
    440      1.1  christos immediately follows the type's type structure.  Here's the largest of
    441      1.1  christos the overlapping structures, which is only needed for huge types and so
    442      1.1  christos is very rarely seen:
    443      1.1  christos 
    444      1.1  christos typedef struct ctf_type
    445      1.1  christos {
    446      1.1  christos   uint32_t ctt_name;
    447      1.1  christos   uint32_t ctt_info;
    448      1.1  christos   __extension__
    449      1.1  christos   union
    450      1.1  christos   {
    451      1.1  christos     uint32_t ctt_size;
    452      1.1  christos     uint32_t ctt_type;
    453      1.1  christos   };
    454      1.1  christos   uint32_t ctt_lsizehi;
    455      1.1  christos   uint32_t ctt_lsizelo;
    456      1.1  christos } ctf_type_t;
    457      1.1  christos 
    458      1.1  christos    Here's the much more common smaller form:
    459      1.1  christos 
    460      1.1  christos typedef struct ctf_stype
    461      1.1  christos {
    462      1.1  christos   uint32_t ctt_name;
    463      1.1  christos   uint32_t ctt_info;
    464      1.1  christos   __extension__
    465      1.1  christos   union
    466      1.1  christos   {
    467      1.1  christos     uint32_t ctt_size;
    468      1.1  christos     uint32_t ctt_type;
    469      1.1  christos   };
    470  1.1.1.3  christos } ctf_stype_t;
    471      1.1  christos 
    472      1.1  christos    If 'ctt_size' is the #define 'CTF_LSIZE_SENT', 0xffffffff, this type
    473      1.1  christos is described by a 'ctf_type_t': otherwise, a 'ctf_stype_t'.
    474      1.1  christos 
    475      1.1  christos    Here's what the fields mean:
    476      1.1  christos 
    477      1.1  christos Offset               Name                     Description
    478      1.1  christos -----------------------------------------------------------------------------------------------------
    479      1.1  christos 0x00                 'uint32_t ctt_name'      Strtab offset of the type name, if any (0 if none).
    480      1.1  christos                                               
    481      1.1  christos 0x04                 'uint32_t ctt_info'      The "info word", containing information on the kind
    482      1.1  christos                                               of this type, its variable-length data and whether
    483      1.1  christos                                               it is visible to name lookup.  See
    484      1.1  christos                                               *Note The info word::.
    485      1.1  christos                                               
    486      1.1  christos 0x08                 'uint32_t ctt_size'      The size of this type, if this type is of a kind for
    487      1.1  christos                                               which a size needs to be recorded (constant-size
    488      1.1  christos                                               types don't need one).  If this is 'CTF_LSIZE_SENT',
    489      1.1  christos                                               this type is a huge type described by 'ctf_type_t'.
    490      1.1  christos                                               
    491      1.1  christos 0x08                 'uint32_t ctt_type'      The type this type refers to, if this type is of a
    492      1.1  christos                                               kind which refers to other types (like a pointer).
    493      1.1  christos                                               All such types are fixed-size, and no types that are
    494      1.1  christos                                               variable-size refer to other types, so 'ctt_size'
    495      1.1  christos                                               and 'ctt_type' overlap.  All type kinds that use
    496      1.1  christos                                               'ctt_type' are described by 'ctf_stype_t', not
    497      1.1  christos                                               'ctf_type_t'.  *Note Type indexes and type IDs::.
    498      1.1  christos                                               
    499      1.1  christos 0x0c ('ctf_type_t'   'uint32_t ctt_lsizehi'   The high 32 bits of the size of a very large type.
    500      1.1  christos only)                                         The 'CTF_TYPE_LSIZE' macro can be used to get a
    501      1.1  christos                                               64-bit size out of this field and the next one.
    502      1.1  christos                                               'CTF_SIZE_TO_LSIZE_HI' splits the 'ctt_lsizehi' out
    503      1.1  christos                                               of it again.
    504      1.1  christos                                               
    505      1.1  christos 0x10 ('ctf_type_t'   'uint32_t ctt_lsizelo'   The low 32 bits of the size of a very large type.
    506      1.1  christos only)                                         'CTF_SIZE_TO_LSIZE_LO' splits the 'ctt_lsizelo' out
    507      1.1  christos                                               of a 64-bit size.
    508      1.1  christos 
    509      1.1  christos    Two aspects of this need further explanation: the info word, and what
    510      1.1  christos exactly a type ID is and how you determine it.  (Information on the
    511      1.1  christos various type-kind- dependent things, like whether 'ctt_size' or
    512      1.1  christos 'ctt_type' is used, is described in the section devoted to each kind.)
    513      1.1  christos 
    514      1.1  christos * Menu:
    515      1.1  christos 
    516      1.1  christos * The info word::
    517      1.1  christos * Type indexes and type IDs::
    518      1.1  christos * Type kinds::
    519      1.1  christos * Integer types::
    520      1.1  christos * Floating-point types::
    521      1.1  christos * Slices::
    522      1.1  christos * Pointers typedefs and cvr-quals::
    523      1.1  christos * Arrays::
    524      1.1  christos * Function pointers::
    525      1.1  christos * Enums::
    526      1.1  christos * Structs and unions::
    527      1.1  christos * Forward declarations::
    528      1.1  christos 
    529      1.1  christos 
    530      1.1  christos File: ctf-spec.info,  Node: The info word,  Next: Type indexes and type IDs,  Up: The type section
    531      1.1  christos 
    532      1.1  christos 2.3.1 The info word, ctt_info
    533      1.1  christos -----------------------------
    534      1.1  christos 
    535      1.1  christos The info word is a bitfield split into three parts.  From MSB to LSB:
    536      1.1  christos 
    537      1.1  christos Bit offset   Name       Description
    538      1.1  christos ------------------------------------------------------------------------------------------
    539      1.1  christos 26-31        'kind'     Type kind: *note Type kinds::.
    540      1.1  christos                         
    541      1.1  christos 25           'isroot'   1 if this type is visible to name lookup
    542      1.1  christos                         
    543      1.1  christos 0-24         'vlen'     Length of variable-length data for this type (some kinds only).
    544      1.1  christos                         The variable-length data directly follows the 'ctf_type_t' or
    545      1.1  christos                         'ctf_stype_t'.  This is a kind-dependent array length value,
    546      1.1  christos                         not a length in bytes.  Some kinds have no variable-length
    547      1.1  christos                         data, or fixed-size variable-length data, and do not use this
    548      1.1  christos                         value.
    549      1.1  christos 
    550      1.1  christos    The most mysterious of these is undoubtedly 'isroot'.  This indicates
    551      1.1  christos whether types with names (nonzero 'ctt_name') are visible to name
    552      1.1  christos lookup: if zero, this type is considered a "non-root type" and you can't
    553      1.1  christos look it up by name at all.  Multiple types with the same name in the
    554      1.1  christos same C namespace (struct, union, enum, other) can exist in a single
    555      1.1  christos dictionary, but only one of them may have a nonzero value for 'isroot'.
    556      1.1  christos 'libctf' validates this at open time and refuses to open dictionaries
    557      1.1  christos that violate this constraint.
    558      1.1  christos 
    559      1.1  christos    Historically, this feature was introduced for the encoding of
    560      1.1  christos bitfields (*note Integer types::): for instance, int bitfields will all
    561      1.1  christos be named 'int' with different widths or offsets, but only the full-width
    562      1.1  christos one at offset zero is wanted when you look up the type named 'int'.
    563      1.1  christos With the introduction of slices (*note Slices::) as a more general
    564      1.1  christos bitfield encoding mechanism, this is less important, but we still use
    565      1.1  christos non-root types to handle conflicts if the linker API is used to fuse
    566      1.1  christos multiple translation units into one dictionary and those translation
    567      1.1  christos units contain types with the same name and conflicting definitions.  (We
    568      1.1  christos do not discuss this further here, because the linker never does this:
    569      1.1  christos only specialized type mergers do, like that used for the Linux kernel.
    570      1.1  christos The libctf documentation will describe this in more detail.)
    571      1.1  christos 
    572      1.1  christos    The 'CTF_TYPE_INFO' macro can be used to compose an info word from a
    573      1.1  christos 'kind', 'isroot', and 'vlen'; 'CTF_V2_INFO_KIND', 'CTF_V2_INFO_ISROOT'
    574      1.1  christos and 'CTF_V2_INFO_VLEN' pick it apart again.
    575      1.1  christos 
    576      1.1  christos 
    577      1.1  christos File: ctf-spec.info,  Node: Type indexes and type IDs,  Next: Type kinds,  Prev: The info word,  Up: The type section
    578      1.1  christos 
    579      1.1  christos 2.3.2 Type indexes and type IDs
    580      1.1  christos -------------------------------
    581      1.1  christos 
    582      1.1  christos Types are referred to within the CTF file via "type IDs".  A type ID is
    583      1.1  christos a number from 0 to 2^32, from a space divided in half.  Types 2^31-1 and
    584      1.1  christos below are in the "parent range": these IDs are used for dictionaries
    585      1.1  christos that have not had any other dictionary 'ctf_import'ed into it as a
    586      1.1  christos parent.  Both completely standalone dictionaries and parent dictionaries
    587      1.1  christos with children hanging off them have types in this range.  Types 2^31 and
    588      1.1  christos above are in the "child range": only types in child dictionaries are in
    589      1.1  christos this range.
    590      1.1  christos 
    591      1.1  christos    These IDs appear in 'ctf_type_t.ctt_type' (*note The type section::),
    592      1.1  christos but the types themselves have no visible ID: quite intentionally,
    593      1.1  christos because adding an ID uses space, and every ID is different so they don't
    594      1.1  christos compress well.  The IDs are implicit: at open time, the consumer walks
    595      1.1  christos through the entire type section and counts the types in the type
    596      1.1  christos section.  The type section is an array of variable-length elements, so
    597      1.1  christos each entry could be considered as having an index, starting from 1.  We
    598      1.1  christos count these indexes and associate each with its corresponding
    599      1.1  christos 'ctf_type_t' or 'ctf_stype_t'.
    600      1.1  christos 
    601      1.1  christos    Lookups of types with IDs in the parent space look in the parent
    602      1.1  christos dictionary if this dictionary has one associated with it; lookups of
    603      1.1  christos types with IDs in the child space error out if the dictionary does not
    604      1.1  christos have a parent, and otherwise convert the ID into an index by shaving off
    605      1.1  christos the top bit and look up the index in the child.
    606      1.1  christos 
    607      1.1  christos    These properties mean that the same dictionary can be used as a
    608      1.1  christos parent of child dictionaries and can also be used directly with no
    609      1.1  christos children at all, but a dictionary created as a child dictionary must
    610      1.1  christos always be associated with a parent -- usually, the same parent --
    611      1.1  christos because its references to its own types have the high bit turned on and
    612      1.1  christos this is only flipped off again if this is a child dictionary.  (This is
    613      1.1  christos not a problem, because if you _don't_ associate the child with a parent,
    614      1.1  christos any references within it to its parent types will fail, and there are
    615      1.1  christos almost certain to be many such references, or why is it a child at all?)
    616      1.1  christos 
    617      1.1  christos    This does mean that consumers should keep a close eye on the
    618      1.1  christos distinction between type IDs and type indexes: if you mix them up,
    619      1.1  christos everything will appear to work as long as you're only using parent
    620      1.1  christos dictionaries or standalone dictionaries, but as soon as you start using
    621      1.1  christos children, everything will fail horribly.
    622      1.1  christos 
    623      1.1  christos    Type index zero, and type ID zero, are used to indicate that this
    624      1.1  christos type cannot be represented in CTF as currently constituted: they are
    625      1.1  christos emitted by the compiler, but all type chains that terminate in the
    626      1.1  christos unknown type are erased at link time (structure fields that use them
    627      1.1  christos just vanish, etc).  So you will probably never see a use of type zero
    628      1.1  christos outside the symtypetab sections, where they serve as sentinels of sorts,
    629      1.1  christos to indicate symbols with no associated type.
    630      1.1  christos 
    631      1.1  christos    The macros 'CTF_V2_TYPE_TO_INDEX' and 'CTF_V2_INDEX_TO_TYPE' may help
    632      1.1  christos in translation between types and indexes: 'CTF_V2_TYPE_ISPARENT' and
    633      1.1  christos 'CTF_V2_TYPE_ISCHILD' can be used to tell whether a given ID is in the
    634      1.1  christos parent or child range.
    635      1.1  christos 
    636      1.1  christos    It is quite possible and indeed common for type IDs to point forward
    637      1.1  christos in the dictionary, as well as backward.
    638      1.1  christos 
    639      1.1  christos 
    640      1.1  christos File: ctf-spec.info,  Node: Type kinds,  Next: Integer types,  Prev: Type indexes and type IDs,  Up: The type section
    641      1.1  christos 
    642      1.1  christos 2.3.3 Type kinds
    643      1.1  christos ----------------
    644      1.1  christos 
    645      1.1  christos Every type in CTF is of some "kind".  Each kind is some variety of C
    646      1.1  christos type: all structures are a single kind, as are all unions, all pointers,
    647      1.1  christos all arrays, all integers regardless of their bitfield width, etc.  The
    648      1.1  christos kind of a type is given in the 'kind' field of the 'ctt_info' word
    649      1.1  christos (*note The info word::).
    650      1.1  christos 
    651      1.1  christos    The space of type kinds is only a quarter full so far, so there is
    652      1.1  christos plenty of room for expansion.  It is likely that in future versions of
    653      1.1  christos the file format, types with smaller kinds will be more efficiently
    654      1.1  christos encoded than types with larger kinds, so their numerical value will
    655      1.1  christos actually start to matter in future.  (So these IDs will probably change
    656      1.1  christos their numerical values in a later release of this format, to move more
    657      1.1  christos frequently-used kinds like structures and cv-quals towards the top of
    658      1.1  christos the space, and move rarely-used kinds like integers downwards.  Yes,
    659      1.1  christos integers are rare: how many kinds of 'int' are there in a program?
    660      1.1  christos They're just very frequently _referenced_.)
    661      1.1  christos 
    662      1.1  christos    Here's the set of kinds so far.  Each kind has a '#define' associated
    663      1.1  christos with it, also given here.
    664      1.1  christos 
    665      1.1  christos Kind   Macro              Purpose
    666      1.1  christos ----------------------------------------------------------------------------------------
    667      1.1  christos 0      'CTF_K_UNKNOWN'    Indicates a type that cannot be represented in CTF, or that
    668      1.1  christos                           is being skipped.  It is very similar to type ID 0, except
    669      1.1  christos                           that you can have _multiple_, distinct types of kind
    670      1.1  christos                           'CTF_K_UNKNOWN'.
    671      1.1  christos                           
    672      1.1  christos 1      'CTF_K_INTEGER'    An integer type.  *Note Integer types::.
    673      1.1  christos                           
    674      1.1  christos 2      'CTF_K_FLOAT'      A floating-point type.  *Note Floating-point types::.
    675      1.1  christos                           
    676      1.1  christos 3      'CTF_K_POINTER'    A pointer.  *Note Pointers typedefs and cvr-quals::.
    677      1.1  christos                           
    678      1.1  christos 4      'CTF_K_ARRAY'      An array.  *Note Arrays::.
    679      1.1  christos                           
    680      1.1  christos 5      'CTF_K_FUNCTION'   A function pointer.  *Note Function pointers::.
    681      1.1  christos                           
    682      1.1  christos 6      'CTF_K_STRUCT'     A structure.  *Note Structs and unions::.
    683      1.1  christos                           
    684      1.1  christos 7      'CTF_K_UNION'      A union.  *Note Structs and unions::.
    685      1.1  christos                           
    686      1.1  christos 8      'CTF_K_ENUM'       An enumerated type.  *Note Enums::.
    687      1.1  christos                           
    688      1.1  christos 9      'CTF_K_FORWARD'    A forward.  *Note Forward declarations::.
    689      1.1  christos                           
    690      1.1  christos 10     'CTF_K_TYPEDEF'    A typedef.  *Note Pointers typedefs and cvr-quals::.
    691      1.1  christos                           
    692      1.1  christos 11     'CTF_K_VOLATILE'   A volatile-qualified type.
    693      1.1  christos                           *Note Pointers typedefs and cvr-quals::.
    694      1.1  christos                           
    695      1.1  christos 12     'CTF_K_CONST'      A const-qualified type.
    696      1.1  christos                           *Note Pointers typedefs and cvr-quals::.
    697      1.1  christos                           
    698      1.1  christos 13     'CTF_K_RESTRICT'   A restrict-qualified type.
    699      1.1  christos                           *Note Pointers typedefs and cvr-quals::.
    700      1.1  christos                           
    701      1.1  christos 14     'CTF_K_SLICE'      A slice, a change of the bit-width or offset of some other
    702      1.1  christos                           type.  *Note Slices::.
    703      1.1  christos 
    704      1.1  christos    Now we cover all type kinds in turn.  Some are more complicated than
    705      1.1  christos others.
    706      1.1  christos 
    707      1.1  christos 
    708      1.1  christos File: ctf-spec.info,  Node: Integer types,  Next: Floating-point types,  Prev: Type kinds,  Up: The type section
    709      1.1  christos 
    710      1.1  christos 2.3.4 Integer types
    711      1.1  christos -------------------
    712      1.1  christos 
    713      1.1  christos Integral types are all represented as types of kind 'CTF_K_INTEGER'.
    714      1.1  christos These types fill out 'ctt_size' in the 'ctf_stype_t' with the size in
    715      1.1  christos bytes of the integral type in question.  They are always represented by
    716      1.1  christos 'ctf_stype_t', never 'ctf_type_t'.  Their variable-length data is one
    717      1.1  christos 'uint32_t' in length: 'vlen' in the info word should be disregarded and
    718      1.1  christos is always zero.
    719      1.1  christos 
    720      1.1  christos    The variable-length data for integers has multiple items packed into
    721      1.1  christos it much like the info word does.
    722      1.1  christos 
    723      1.1  christos Bit offset   Name       Description
    724      1.1  christos -----------------------------------------------------------------------------------
    725      1.1  christos 24-31        Encoding   The desired display representation of this integer.  You
    726      1.1  christos                         can extract this field with the 'CTF_INT_ENCODING'
    727      1.1  christos                         macro.  See below.
    728      1.1  christos                         
    729      1.1  christos 16-23        Offset     The offset of this integral type in bits from the start
    730      1.1  christos                         of its enclosing structure field, adjusted for
    731      1.1  christos                         endianness: *note Structs and unions::.  You can extract
    732      1.1  christos                         this field with the 'CTF_INT_OFFSET' macro.
    733      1.1  christos                         
    734      1.1  christos 0-15         Bit-width  The width of this integral type in bits.  You can
    735      1.1  christos                         extract this field with the 'CTF_INT_BITS' macro.
    736      1.1  christos 
    737      1.1  christos    If you choose, bitfields can be represented using the things above as
    738      1.1  christos a sort of integral type with the 'isroot' bit flipped off and the offset
    739      1.1  christos and bits values set in the vlen word: you can populate it with the
    740      1.1  christos 'CTF_INT_DATA' macro.  (But it may be more convenient to represent them
    741      1.1  christos using slices of a full-width integer: *note Slices::.)
    742      1.1  christos 
    743      1.1  christos    Integers that are bitfields usually have a 'ctt_size' rounded up to
    744      1.1  christos the nearest power of two in bytes, for natural alignment (e.g.  a 17-bit
    745      1.1  christos integer would have a 'ctt_size' of 4).  However, not all types are
    746      1.1  christos naturally aligned on all architectures: packed structures may in theory
    747      1.1  christos use integral bitfields with different 'ctt_size', though this is rarely
    748      1.1  christos observed.
    749      1.1  christos 
    750      1.1  christos    The "encoding" for integers is a bit-field comprised of the values
    751      1.1  christos below, which consumers can use to decide how to display values of this
    752      1.1  christos type:
    753      1.1  christos 
    754      1.1  christos Offset   Name                Description
    755      1.1  christos --------------------------------------------------------------------------------------------------------
    756      1.1  christos 0x01     'CTF_INT_SIGNED'    If set, this is a signed int: if false, unsigned.
    757      1.1  christos                              
    758      1.1  christos 0x02     'CTF_INT_CHAR'      If set, this is a char type.  It is platform-dependent whether unadorned
    759      1.1  christos                              'char' is signed or not: the 'CTF_CHAR' macro produces an integral type
    760      1.1  christos                              suitable for the definition of 'char' on this platform.
    761      1.1  christos                              
    762      1.1  christos 0x04     'CTF_INT_BOOL'      If set, this is a boolean type.  (It is theoretically possible to turn
    763      1.1  christos                              this and 'CTF_INT_CHAR' on at the same time, but it is not clear what
    764      1.1  christos                              this would mean.)
    765      1.1  christos                              
    766      1.1  christos 0x08     'CTF_INT_VARARGS'   If set, this is a varargs-promoted value in a K&R function definition.
    767      1.1  christos                              This is not currently produced or consumed by anything that we know of:
    768      1.1  christos                              it is set aside for future use.
    769      1.1  christos 
    770      1.1  christos    The GCC "'Complex int'" and fixed-point extensions are not yet
    771      1.1  christos supported: references to such types will be emitted as type 0.
    772      1.1  christos 
    773      1.1  christos 
    774      1.1  christos File: ctf-spec.info,  Node: Floating-point types,  Next: Slices,  Prev: Integer types,  Up: The type section
    775      1.1  christos 
    776      1.1  christos 2.3.5 Floating-point types
    777      1.1  christos --------------------------
    778      1.1  christos 
    779      1.1  christos Floating-point types are all represented as types of kind 'CTF_K_FLOAT'.
    780      1.1  christos Like integers, These types fill out 'ctt_size' in the 'ctf_stype_t' with
    781      1.1  christos the size in bytes of the floating-point type in question.  They are
    782      1.1  christos always represented by 'ctf_stype_t', never 'ctf_type_t'.
    783      1.1  christos 
    784      1.1  christos    This part of CTF shows many rough edges in the more obscure corners
    785      1.1  christos of floating-point handling, and is likely to change in format v4.
    786      1.1  christos 
    787      1.1  christos    The variable-length data for floats has multiple items packed into it
    788      1.1  christos just like integers do:
    789      1.1  christos 
    790      1.1  christos Bit offset   Name       Description
    791      1.1  christos -------------------------------------------------------------------------------------------
    792      1.1  christos 24-31        Encoding   The desired display representation of this float.  You can
    793      1.1  christos                         extract this field with the 'CTF_FP_ENCODING' macro.  See below.
    794      1.1  christos                         
    795      1.1  christos 16-23        Offset     The offset of this floating-point type in bits from the start of
    796      1.1  christos                         its enclosing structure field, adjusted for endianness:
    797      1.1  christos                         *note Structs and unions::.  You can extract this field with the
    798      1.1  christos                         'CTF_FP_OFFSET' macro.
    799      1.1  christos                         
    800      1.1  christos 0-15         Bit-width  The width of this floating-point type in bits.  You can extract
    801      1.1  christos                         this field with the 'CTF_FP_BITS' macro.
    802      1.1  christos 
    803      1.1  christos    The purpose of the floating-point offset and bit-width is somewhat
    804      1.1  christos opaque, since there are no such things as floating-point bitfields in C:
    805      1.1  christos the bit-width should be filled out with the full width of the type in
    806      1.1  christos bits, and the offset should always be zero.  It is likely that these
    807      1.1  christos fields will go away in the future.  As with integers, you can use
    808      1.1  christos 'CTF_FP_DATA' to assemble one of these vlen items from its component
    809      1.1  christos parts.
    810      1.1  christos 
    811      1.1  christos    The "encoding" for floats is not a bitfield but a simple value
    812      1.1  christos indicating the display representation.  Many of these are unused, relate
    813      1.1  christos to Solaris-specific compiler extensions, and will be recycled in future:
    814      1.1  christos some are unused and will become used in future.
    815      1.1  christos 
    816      1.1  christos Offset   Name                Description
    817      1.1  christos ----------------------------------------------------------------------------------------------
    818      1.1  christos 1        'CTF_FP_SINGLE'     This is a single-precision IEEE 754 'float'.
    819      1.1  christos 2        'CTF_FP_DOUBLE'     This is a double-precision IEEE 754 'double'.
    820      1.1  christos 3        'CTF_FP_CPLX'       This is a 'Complex float'.
    821      1.1  christos 4        'CTF_FP_DCPLX'      This is a 'Complex double'.
    822      1.1  christos 5        'CTF_FP_LDCPLX'     This is a 'Complex long double'.
    823      1.1  christos 6        'CTF_FP_LDOUBLE'    This is a 'long double'.
    824      1.1  christos 7        'CTF_FP_INTRVL'     This is a 'float' interval type, a Solaris-specific extension.
    825      1.1  christos                              Unused: will be recycled.
    826      1.1  christos 8        'CTF_FP_DINTRVL'    This is a 'double' interval type, a Solaris-specific
    827      1.1  christos                              extension.  Unused: will be recycled.
    828      1.1  christos 9        'CTF_FP_LDINTRVL'   This is a 'long double' interval type, a Solaris-specific
    829      1.1  christos                              extension.  Unused: will be recycled.
    830      1.1  christos 10       'CTF_FP_IMAGRY'     This is a the imaginary part of a 'Complex float'.  Not
    831      1.1  christos                              currently generated.  May change.
    832      1.1  christos 11       'CTF_FP_DIMAGRY'    This is a the imaginary part of a 'Complex double'.  Not
    833      1.1  christos                              currently generated.  May change.
    834      1.1  christos 12       'CTF_FP_LDIMAGRY'   This is a the imaginary part of a 'Complex long double'.  Not
    835      1.1  christos                              currently generated.  May change.
    836      1.1  christos 
    837      1.1  christos    The use of the complex floating-point encodings is obscure: it is
    838      1.1  christos possible that 'CTF_FP_CPLX' is meant to be used for only the real part
    839      1.1  christos of complex types, and 'CTF_FP_IMAGRY' et al for the imaginary part - but
    840      1.1  christos for now, we are emitting 'CTF_FP_CPLX' to cover the entire type, with no
    841      1.1  christos way to get at its constituent parts.  There appear to be no uses of
    842      1.1  christos these encodings anywhere, so they are quite likely to change
    843      1.1  christos incompatibly in future.
    844      1.1  christos 
    845      1.1  christos 
    846      1.1  christos File: ctf-spec.info,  Node: Slices,  Next: Pointers typedefs and cvr-quals,  Prev: Floating-point types,  Up: The type section
    847      1.1  christos 
    848      1.1  christos 2.3.6 Slices
    849      1.1  christos ------------
    850      1.1  christos 
    851      1.1  christos Slices, with kind 'CTF_K_SLICE', are an unusual CTF construct: they do
    852      1.1  christos not directly correspond to any C type, but are a way to model other
    853      1.1  christos types in a more convenient fashion for CTF generators.
    854      1.1  christos 
    855      1.1  christos    A slice is like a pointer or other reference type in that they are
    856      1.1  christos always represented by 'ctf_stype_t': but unlike pointers and other
    857      1.1  christos reference types, they populate the 'ctt_size' field just like integral
    858      1.1  christos types do, and come with an attached encoding and transform the encoding
    859      1.1  christos of the underlying type.  The underlying type is described in the
    860      1.1  christos variable-length data, similarly to structure and union fields: see
    861      1.1  christos below.  Requests for the type size should also chase down to the
    862      1.1  christos referenced type.
    863      1.1  christos 
    864      1.1  christos    Slices are always nameless: 'ctt_name' is always zero for them.
    865      1.1  christos 
    866      1.1  christos    (The 'libctf' API behaviour is unusual as well, and justifies the
    867      1.1  christos existence of slices: 'ctf_type_kind' never returns 'CTF_K_SLICE' but
    868      1.1  christos always the underlying type kind, so that consumers never need to know
    869      1.1  christos about slices: they can tell if an apparent integer is actually a slice
    870      1.1  christos if they need to by calling 'ctf_type_reference', which will uniquely
    871      1.1  christos return the underlying integral type rather than erroring out with
    872      1.1  christos 'ECTF_NOTREF' if this is actually a slice.  So slices act just like an
    873      1.1  christos integer with an encoding, but more closely mirror DWARF and other
    874      1.1  christos debugging information formats by allowing CTF file creators to represent
    875      1.1  christos a bitfield as a slice of an underlying integral type.)
    876      1.1  christos 
    877      1.1  christos    The vlen in the info word for a slice should be ignored and is always
    878      1.1  christos zero.  The variable-length data for a slice is a single 'ctf_slice_t':
    879      1.1  christos 
    880      1.1  christos typedef struct ctf_slice
    881      1.1  christos {
    882      1.1  christos   uint32_t cts_type;
    883      1.1  christos   unsigned short cts_offset;
    884      1.1  christos   unsigned short cts_bits;
    885      1.1  christos } ctf_slice_t;
    886      1.1  christos 
    887      1.1  christos Offset   Name                          Description
    888      1.1  christos ----------------------------------------------------------------------------------------
    889      1.1  christos 0x0      'uint32_t cts_type'           The type this slice is a slice of.  Must be an
    890      1.1  christos                                        integral type (or a floating-point type, but
    891      1.1  christos                                        this nonsensical option will go away in v4.)
    892      1.1  christos                                        
    893      1.1  christos 0x4      'unsigned short cts_offset'   The offset of this integral type in bits from
    894      1.1  christos                                        the start of its enclosing structure field,
    895      1.1  christos                                        adjusted for endianness:
    896      1.1  christos                                        *note Structs and unions::.  Identical
    897      1.1  christos                                        semantics to the 'CTF_INT_OFFSET' field:
    898      1.1  christos                                        *note Integer types::.  This field is much too
    899      1.1  christos                                        long, because the maximum possible offset of
    900      1.1  christos                                        an integral type would easily fit in a char:
    901      1.1  christos                                        this field is bigger just for the sake of
    902      1.1  christos                                        alignment.  This will change in v4.
    903      1.1  christos                                        
    904      1.1  christos 0x6      'unsigned short cts_bits'     The bit-width of this integral type.
    905      1.1  christos                                        Identical semantics to the 'CTF_INT_BITS'
    906      1.1  christos                                        field: *note Integer types::.  As above, this
    907      1.1  christos                                        field is really too large and will shrink in
    908      1.1  christos                                        v4.
    909      1.1  christos 
    910      1.1  christos 
    911      1.1  christos File: ctf-spec.info,  Node: Pointers typedefs and cvr-quals,  Next: Arrays,  Prev: Slices,  Up: The type section
    912      1.1  christos 
    913      1.1  christos 2.3.7 Pointers, typedefs, and cvr-quals
    914      1.1  christos ---------------------------------------
    915      1.1  christos 
    916      1.1  christos Pointers, 'typedef's, and 'const', 'volatile' and 'restrict' qualifiers
    917      1.1  christos are represented identically except for their type kind (though they may
    918      1.1  christos be treated differently by consuming libraries like 'libctf', since
    919      1.1  christos pointers affect assignment-compatibility in ways cvr-quals do not, and
    920      1.1  christos they may have different alignment requirements, etc).
    921      1.1  christos 
    922      1.1  christos    All of these are represented by 'ctf_stype_t', have no variable data
    923      1.1  christos at all, and populate 'ctt_type' with the type ID of the type they point
    924      1.1  christos to.  These types can stack: a 'CTF_K_RESTRICT' can point to a
    925      1.1  christos 'CTF_K_CONST' which can point to a 'CTF_K_POINTER' etc.
    926      1.1  christos 
    927      1.1  christos    They are all unnamed: 'ctt_name' is 0.
    928      1.1  christos 
    929      1.1  christos    The size of 'CTF_K_POINTER' is derived from the data model (*note
    930      1.1  christos Data models::), i.e.  in practice, from the target machine ABI, and is
    931      1.1  christos not explicitly represented.  The size of other kinds in this set should
    932      1.1  christos be determined by chasing ctf_types as necessary until a
    933      1.1  christos non-typedef/const/volatile/restrict is found, and using that.
    934      1.1  christos 
    935      1.1  christos 
    936      1.1  christos File: ctf-spec.info,  Node: Arrays,  Next: Function pointers,  Prev: Pointers typedefs and cvr-quals,  Up: The type section
    937      1.1  christos 
    938      1.1  christos 2.3.8 Arrays
    939      1.1  christos ------------
    940      1.1  christos 
    941      1.1  christos Arrays are encoded as types of kind 'CTF_K_ARRAY' in a 'ctf_stype_t'.
    942      1.1  christos Both size and kind for arrays are zero.  The variable-length data is a
    943      1.1  christos 'ctf_array_t': 'vlen' in the info word should be disregarded and is
    944      1.1  christos always zero.
    945      1.1  christos 
    946      1.1  christos typedef struct ctf_array
    947      1.1  christos {
    948      1.1  christos   uint32_t cta_contents;
    949      1.1  christos   uint32_t cta_index;
    950      1.1  christos   uint32_t cta_nelems;
    951      1.1  christos } ctf_array_t;
    952      1.1  christos 
    953      1.1  christos Offset   Name                            Description
    954      1.1  christos ----------------------------------------------------------------------------------------
    955      1.1  christos 0x0      'uint32_t cta_contents'         The type of the array elements: a type ID.
    956      1.1  christos                                          
    957      1.1  christos 0x4      'uint32_t cta_index'            The type of the array index: a type ID of an
    958      1.1  christos                                          integral type.  If this is a variable-length
    959      1.1  christos                                          array, the index type ID will be 0 (but the
    960      1.1  christos                                          actual index type of this array is probably
    961      1.1  christos                                          'int').  Probably redundant and may be
    962      1.1  christos                                          dropped in v4.
    963      1.1  christos                                          
    964      1.1  christos 0x8      'uint32_t cta_nelems'           The number of array elements.  0 for VLAs,
    965      1.1  christos                                          and also for the historical variety of VLA
    966      1.1  christos                                          which has explicit zero dimensions (which
    967      1.1  christos                                          will have a nonzero 'cta_index'.)
    968      1.1  christos 
    969      1.1  christos    The size of an array can be computed by simple multiplication of the
    970      1.1  christos size of the 'cta_contents' type by the 'cta_nelems'.
    971      1.1  christos 
    972      1.1  christos 
    973      1.1  christos File: ctf-spec.info,  Node: Function pointers,  Next: Enums,  Prev: Arrays,  Up: The type section
    974      1.1  christos 
    975      1.1  christos 2.3.9 Function pointers
    976      1.1  christos -----------------------
    977      1.1  christos 
    978      1.1  christos Function pointers are explicitly represented in the CTF type section by
    979      1.1  christos a type of kind 'CTF_K_FUNCTION', always encoded with a 'ctf_stype_t'.
    980      1.1  christos The 'ctt_type' is the function return type ID. The 'vlen' in the info
    981      1.1  christos word is the number of arguments, each of which is a type ID, a
    982      1.1  christos 'uint32_t': if the last argument is 0, this is a varargs function and
    983      1.1  christos the number of arguments is one less than indicated by the vlen.
    984      1.1  christos 
    985      1.1  christos    If the number of arguments is odd, a single 'uint32_t' of padding is
    986      1.1  christos inserted to maintain alignment.
    987      1.1  christos 
    988      1.1  christos 
    989      1.1  christos File: ctf-spec.info,  Node: Enums,  Next: Structs and unions,  Prev: Function pointers,  Up: The type section
    990      1.1  christos 
    991      1.1  christos 2.3.10 Enums
    992      1.1  christos ------------
    993      1.1  christos 
    994      1.1  christos Enumerated types are represented as types of kind 'CTF_K_ENUM' in a
    995      1.1  christos 'ctf_stype_t'.  The 'ctt_size' is always the size of an int from the
    996      1.1  christos data model (enum bitfields are implemented via slices).  The 'vlen' is a
    997      1.1  christos count of enumerations, each of which is represented by a 'ctf_enum_t' in
    998      1.1  christos the vlen:
    999      1.1  christos 
   1000      1.1  christos typedef struct ctf_enum
   1001      1.1  christos {
   1002      1.1  christos   uint32_t cte_name;
   1003      1.1  christos   int32_t cte_value;
   1004      1.1  christos } ctf_enum_t;
   1005      1.1  christos 
   1006      1.1  christos Offset   Name                  Description
   1007      1.1  christos ------------------------------------------------------------------------
   1008      1.1  christos 0x0      'uint32_t cte_name'   Strtab offset of the enumeration name.
   1009      1.1  christos                                Must not be 0.
   1010      1.1  christos                                
   1011      1.1  christos 0x4      'int32_t cte_value'   The enumeration value.
   1012      1.1  christos                                
   1013      1.1  christos 
   1014      1.1  christos    Enumeration values larger than 2^32 are not yet supported and are
   1015      1.1  christos omitted from the enumeration.  (v4 will lift this restriction by
   1016      1.1  christos encoding the value differently.)
   1017      1.1  christos 
   1018      1.1  christos    Forward declarations of enums are not implemented with this kind:
   1019      1.1  christos *note Forward declarations::.
   1020      1.1  christos 
   1021      1.1  christos    Enumerated type names, as usual in C, go into their own namespace,
   1022      1.1  christos and do not conflict with non-enums, structs, or unions with the same
   1023      1.1  christos name.
   1024      1.1  christos 
   1025      1.1  christos 
   1026      1.1  christos File: ctf-spec.info,  Node: Structs and unions,  Next: Forward declarations,  Prev: Enums,  Up: The type section
   1027      1.1  christos 
   1028      1.1  christos 2.3.11 Structs and unions
   1029      1.1  christos -------------------------
   1030      1.1  christos 
   1031      1.1  christos Structures and unions are represnted as types of kind 'CTF_K_STRUCT' and
   1032      1.1  christos 'CTF_K_UNION': their representation is otherwise identical, and it is
   1033      1.1  christos perfectly allowed for "structs" to contain overlapping fields etc, so we
   1034      1.1  christos will treat them together for the rest of this section.
   1035      1.1  christos 
   1036      1.1  christos    They fill out 'ctt_size', and use 'ctf_type_t' in preference to
   1037      1.1  christos 'ctf_stype_t' if the structure size is greater than 'CTF_MAX_SIZE'
   1038      1.1  christos (0xfffffffe).
   1039      1.1  christos 
   1040      1.1  christos    The vlen for structures and unions is a count of structure fields,
   1041      1.1  christos but the type used to represent a structure field (and thus the size of
   1042      1.1  christos the variable-length array element representing the type) depends on the
   1043      1.1  christos size of the structure: truly huge structures, greater than
   1044      1.1  christos 'CTF_LSTRUCT_THRESH' bytes in length, use a different type.
   1045      1.1  christos ('CTF_LSTRUCT_THRESH' is 536870912, so such structures are vanishingly
   1046      1.1  christos rare: in v4, this representation will change somewhat for greater
   1047      1.1  christos compactness.  It's inherited from v1, where the limits were much lower.)
   1048      1.1  christos 
   1049      1.1  christos    Most structures can get away with using 'ctf_member_t':
   1050      1.1  christos 
   1051      1.1  christos typedef struct ctf_member_v2
   1052      1.1  christos {
   1053      1.1  christos   uint32_t ctm_name;
   1054      1.1  christos   uint32_t ctm_offset;
   1055      1.1  christos   uint32_t ctm_type;
   1056      1.1  christos } ctf_member_t;
   1057      1.1  christos 
   1058      1.1  christos    Huge structures that are represented by 'ctf_type_t' rather than
   1059      1.1  christos 'ctf_stype_t' have to use 'ctf_lmember_t', which splits the offset as
   1060      1.1  christos 'ctf_type_t' splits the size:
   1061      1.1  christos 
   1062      1.1  christos typedef struct ctf_lmember_v2
   1063      1.1  christos {
   1064      1.1  christos   uint32_t ctlm_name;
   1065      1.1  christos   uint32_t ctlm_offsethi;
   1066      1.1  christos   uint32_t ctlm_type;
   1067      1.1  christos   uint32_t ctlm_offsetlo;
   1068      1.1  christos } ctf_lmember_t;
   1069      1.1  christos 
   1070      1.1  christos    Here's what the fields of 'ctf_member' mean:
   1071      1.1  christos 
   1072      1.1  christos Offset   Name                    Description
   1073      1.1  christos ---------------------------------------------------------------------------------------------------------
   1074      1.1  christos 0x00     'uint32_t ctm_name'     Strtab offset of the field name.
   1075      1.1  christos                                  
   1076      1.1  christos 0x04     'uint32_t ctm_offset'   The offset of this field _in bits_.  (Usually, for bitfields, this is
   1077      1.1  christos                                  machine-word-aligned and the individual field has an offset in bits,
   1078      1.1  christos                                  but the format allows for the offset to be encoded in bits here.)
   1079      1.1  christos                                  
   1080      1.1  christos 0x08     'uint32_t ctm_type'     The type ID of the type of the field.
   1081      1.1  christos 
   1082      1.1  christos    Here's what the fields of the very similar 'ctf_lmember' mean:
   1083      1.1  christos 
   1084      1.1  christos Offset   Name                       Description
   1085      1.1  christos ------------------------------------------------------------------------------------------------------------
   1086      1.1  christos 0x00     'uint32_t ctlm_name'       Strtab offset of the field name.
   1087      1.1  christos                                     
   1088      1.1  christos 0x04     'uint32_t ctlm_offsethi'   The high 32 bits of the offset of this field in bits.
   1089      1.1  christos                                     
   1090      1.1  christos 0x08     'uint32_t ctlm_type'       The type ID of the type of the field.
   1091      1.1  christos                                     
   1092      1.1  christos 0x0c     'uint32_t ctlm_offsetlo'   The low 32 bits of the offset of this field in bits.
   1093      1.1  christos 
   1094      1.1  christos    Macros 'CTF_LMEM_OFFSET', 'CTF_OFFSET_TO_LMEMHI' and
   1095      1.1  christos 'CTF_OFFSET_TO_LMEMLO' serve to extract and install the values of the
   1096      1.1  christos 'ctlm_offset' fields, much as with the split size fields in
   1097      1.1  christos 'ctf_type_t'.
   1098      1.1  christos 
   1099      1.1  christos    Unnamed structure and union fields are simply implemented by
   1100      1.1  christos collapsing the unnamed field's members into the containing structure or
   1101      1.1  christos union: this does mean that a structure containing an unnamed union can
   1102      1.1  christos end up being a "structure" with multiple members at the same offset.  (A
   1103      1.1  christos future format revision may collapse 'CTF_K_STRUCT' and 'CTF_K_UNION'
   1104      1.1  christos into the same kind and decide among them based on whether their members
   1105      1.1  christos do in fact overlap.)
   1106      1.1  christos 
   1107      1.1  christos    Structure and union type names, as usual in C, go into their own
   1108      1.1  christos namespace, just as enum type names do.
   1109      1.1  christos 
   1110      1.1  christos    Forward declarations of structures and unions are not implemented
   1111      1.1  christos with this kind: *note Forward declarations::.
   1112      1.1  christos 
   1113      1.1  christos 
   1114      1.1  christos File: ctf-spec.info,  Node: Forward declarations,  Prev: Structs and unions,  Up: The type section
   1115      1.1  christos 
   1116      1.1  christos 2.3.12 Forward declarations
   1117      1.1  christos ---------------------------
   1118      1.1  christos 
   1119      1.1  christos When the compiler encounters a forward declaration of a struct, union,
   1120      1.1  christos or enum, it emits a type of kind 'CTF_K_FORWARD'.  If it later
   1121      1.1  christos encounters a non- forward declaration of the same thing, it marks the
   1122      1.1  christos forward as non-root-visible: before link time, therefore,
   1123      1.1  christos non-root-visible forwards indicate that a non-forward is coming.
   1124      1.1  christos 
   1125      1.1  christos    After link time, forwards are fused with their corresponding
   1126      1.1  christos non-forwards by the deduplicator where possible.  They are kept if there
   1127      1.1  christos is no non-forward definition (maybe it's not visible from any TU at all)
   1128      1.1  christos or if 'multiple' conflicting structures with the same name might match
   1129      1.1  christos it.  Otherwise, all other forwards are converted to structures, unions,
   1130      1.1  christos or enums as appropriate, even across TUs if only one structure could
   1131      1.1  christos correspond to the forward (after all, all types across all TUs land in
   1132      1.1  christos the same dictionary unless they conflict, so promoting forwards to their
   1133      1.1  christos concrete type seems most helpful).
   1134      1.1  christos 
   1135      1.1  christos    A forward has a rather strange representation: it is encoded with a
   1136      1.1  christos 'ctf_stype_t' but the 'ctt_type' is populated not with a type (if it's a
   1137      1.1  christos forward, we don't have an underlying type yet: if we did, we'd have
   1138      1.1  christos promoted it and this wouldn't be a forward any more) but with the 'kind'
   1139      1.1  christos of the forward.  This means that we can distinguish forwards to structs,
   1140      1.1  christos enums and unions reliably and ensure they land in the appropriate
   1141      1.1  christos namespace even before the actual struct, union or enum is found.
   1142      1.1  christos 
   1143      1.1  christos 
   1144      1.1  christos File: ctf-spec.info,  Node: The symtypetab sections,  Next: The variable section,  Prev: The type section,  Up: CTF dictionaries
   1145      1.1  christos 
   1146      1.1  christos 2.4 The symtypetab sections
   1147      1.1  christos ===========================
   1148      1.1  christos 
   1149      1.1  christos These are two very simple sections with identical formats, used by
   1150      1.1  christos consumers to map from ELF function and data symbols directly to their
   1151      1.1  christos types.  So they are usually populated only in CTF sections that are
   1152      1.1  christos embedded in ELF objects.
   1153      1.1  christos 
   1154      1.1  christos    Their format is very simple: an array of type IDs.  Which symbol each
   1155      1.1  christos type ID corresponds to depends on whether the optional _index section_
   1156      1.1  christos associated with this symtypetab section has any content.
   1157      1.1  christos 
   1158      1.1  christos    If the index section is nonempty, it is an array of 'uint32_t' string
   1159      1.1  christos table offsets, each giving the name of the symbol whose type is at the
   1160      1.1  christos same offset in the corresponding non-index section: users can look up
   1161      1.1  christos symbols in such a table by name.  The index section and corresponding
   1162      1.1  christos symtypetab section is usually ASCIIbetically sorted (indicated by the
   1163      1.1  christos 'CTF_F_IDXSORTED' flag in the header): if it's sorted, it can be
   1164      1.1  christos bsearched for a symbol name rather than having to use a slower linear
   1165      1.1  christos search.
   1166      1.1  christos 
   1167      1.1  christos    If the data object index section is empty, the entries in the data
   1168      1.1  christos object and function info sections are associated 1:1 with ELF symbols of
   1169      1.1  christos type 'STT_OBJECT' (for data object) or 'STT_FUNC' (for function info)
   1170      1.1  christos with a nonzero value: the linker shuffles the symtypetab sections to
   1171      1.1  christos correspond with the order of the symbols in the ELF file.  Symbols with
   1172      1.1  christos no name, undefined symbols and symbols named "'_START_'" and "'_END_'"
   1173      1.1  christos are skipped and never appear in either section.  Symbols that have no
   1174      1.1  christos corresponding type are represented by type ID 0.  The section may have
   1175      1.1  christos fewer entries than the symbol table, in which case no later entries have
   1176      1.1  christos associated types.  This format is more compact than an indexed form if
   1177      1.1  christos most entries have types (since there is no need to record any symbol
   1178      1.1  christos names), but if the producer and consumer disagree even slightly about
   1179      1.1  christos which symbols are omitted, the types of all further symbols will be
   1180      1.1  christos wrong!
   1181      1.1  christos 
   1182      1.1  christos    The compiler always emits indexed symtypetab tables, because there is
   1183      1.1  christos no symbol table yet.  The linker will always have to read them all in
   1184      1.1  christos and always works through them from start to end, so there is no benefit
   1185      1.1  christos having the compiler sort them either.  The linker (actually, 'libctf''s
   1186      1.1  christos linking machinery) will automatically sort unsorted indexed sections,
   1187      1.1  christos and convert indexed sections that contain a lot of pads into the more
   1188      1.1  christos compact, unindexed form.
   1189      1.1  christos 
   1190      1.1  christos    If child dicts are in use, only symbols that use types actually
   1191      1.1  christos mentioned in the child appear in the child's symtypetab: symbols that
   1192      1.1  christos use only types in the parent appear in the parent's symtypetab instead.
   1193      1.1  christos So the child's symtypetab will almost always be very sparse, and thus
   1194      1.1  christos will usually use the indexed form even in fully linked objects.  (It is,
   1195      1.1  christos of course, impossible for symbols to exist that use types from multiple
   1196      1.1  christos child dicts at once, since it's impossible to declare a function in C
   1197      1.1  christos that uses types that are only visible in two different, disjoint
   1198      1.1  christos translation units.)
   1199      1.1  christos 
   1200      1.1  christos 
   1201      1.1  christos File: ctf-spec.info,  Node: The variable section,  Next: The label section,  Prev: The symtypetab sections,  Up: CTF dictionaries
   1202      1.1  christos 
   1203      1.1  christos 2.5 The variable section
   1204      1.1  christos ========================
   1205      1.1  christos 
   1206      1.1  christos The variable section is a simple array mapping names (strtab entries) to
   1207      1.1  christos type IDs, intended to provide a replacement for the data object section
   1208      1.1  christos in dynamic situations in which there is no static ELF strtab but the
   1209      1.1  christos consumer instead hands back names.  The section is sorted into
   1210      1.1  christos ASCIIbetical order by name for rapid lookup, like the CTF archive name
   1211      1.1  christos table.
   1212      1.1  christos 
   1213      1.1  christos    The section is an array of these structures:
   1214      1.1  christos 
   1215      1.1  christos typedef struct ctf_varent
   1216      1.1  christos {
   1217      1.1  christos   uint32_t ctv_name;
   1218      1.1  christos   uint32_t ctv_type;
   1219      1.1  christos } ctf_varent_t;
   1220      1.1  christos 
   1221      1.1  christos Offset   Name                  Description
   1222      1.1  christos -----------------------------------------------------------
   1223      1.1  christos 0x00     'uint32_t ctv_name'   Strtab offset of the name
   1224      1.1  christos                                
   1225      1.1  christos 0x04     'uint32_t ctv_type'   Type ID of this type
   1226      1.1  christos 
   1227      1.1  christos    There is no analogue of the function info section yet: v4 will
   1228      1.1  christos probably drop this section in favour of a way to put both indexed (thus,
   1229      1.1  christos named) and nonindexed symbols into the symtypetab sections at the same
   1230      1.1  christos time.
   1231      1.1  christos 
   1232      1.1  christos 
   1233      1.1  christos File: ctf-spec.info,  Node: The label section,  Next: The string section,  Prev: The variable section,  Up: CTF dictionaries
   1234      1.1  christos 
   1235      1.1  christos 2.6 The label section
   1236      1.1  christos =====================
   1237      1.1  christos 
   1238      1.1  christos The label section is a currently-unused facility allowing the tiling of
   1239      1.1  christos the type space with names taken from the strtab.  The section is an
   1240      1.1  christos array of these structures:
   1241      1.1  christos 
   1242      1.1  christos typedef struct ctf_lblent
   1243      1.1  christos {
   1244      1.1  christos   uint32_t ctl_label;
   1245      1.1  christos   uint32_t ctl_type;
   1246      1.1  christos } ctf_lblent_t;
   1247      1.1  christos 
   1248      1.1  christos Offset   Name                   Description
   1249      1.1  christos -------------------------------------------------------------
   1250      1.1  christos 0x00     'uint32_t ctl_label'   Strtab offset of the label
   1251      1.1  christos                                 
   1252      1.1  christos 0x04     'uint32_t ctl_type'    Type ID of the last type
   1253      1.1  christos                                 covered by this label
   1254      1.1  christos 
   1255      1.1  christos    Semantics will be attached to labels soon, probably in v4 (the plan
   1256      1.1  christos is to use them to allow multiple disjoint namespaces in a single CTF
   1257      1.1  christos file, removing many uses of CTF archives, in particular in the '.ctf'
   1258      1.1  christos section in ELF objects).
   1259      1.1  christos 
   1260      1.1  christos 
   1261      1.1  christos File: ctf-spec.info,  Node: The string section,  Next: Data models,  Prev: The label section,  Up: CTF dictionaries
   1262      1.1  christos 
   1263      1.1  christos 2.7 The string section
   1264      1.1  christos ======================
   1265      1.1  christos 
   1266      1.1  christos This section is a simple ELF-format strtab, starting with a zero byte
   1267      1.1  christos (thus ensuring that the string with offset 0 is the null string, as
   1268      1.1  christos assumed elsewhere in this spec).  The strtab is usually ASCIIbetically
   1269      1.1  christos sorted to somewhat improve compression efficiency.
   1270      1.1  christos 
   1271      1.1  christos    Where the strtab is unusual is the _references_ to it.  CTF has two
   1272      1.1  christos string tables, the internal strtab and an external strtab associated
   1273      1.1  christos with the CTF dictionary at open time: usually, this is the ELF dynamic
   1274      1.1  christos strtab ('.dynstr') of a CTF dictionary embedded in an ELF file.  We
   1275      1.1  christos distinguish between these strtabs by the most significant bit, bit 31,
   1276      1.1  christos of the 32-bit strtab references: if it is 0, the offset is in the
   1277      1.1  christos internal strtab: if 1, the offset is in the external strtab.
   1278      1.1  christos 
   1279      1.1  christos    There is a bug workaround in this area: in format v3 (the first
   1280      1.1  christos version to have working support for external strtabs), the external
   1281      1.1  christos strtab is '.strtab' unless the 'CTF_F_DYNSTR' flag is set on the
   1282      1.1  christos dictionary (*note CTF file-wide flags::).  Format v4 will introduce a
   1283      1.1  christos header field that explicitly names the external strtab, making this flag
   1284      1.1  christos unnecessary.
   1285      1.1  christos 
   1286      1.1  christos 
   1287      1.1  christos File: ctf-spec.info,  Node: Data models,  Next: Limits of CTF,  Prev: The string section,  Up: CTF dictionaries
   1288      1.1  christos 
   1289      1.1  christos 2.8 Data models
   1290      1.1  christos ===============
   1291      1.1  christos 
   1292      1.1  christos The data model is a simple integer which indicates the ABI in use on
   1293      1.1  christos this platform.  Right now, it is very simple, distinguishing only
   1294      1.1  christos between 32- and 64-bit types: a model of 1 indicates ILP32, 2 indicats
   1295      1.1  christos LP64.  The mapping from ABI integer to type sizes is hardwired into
   1296      1.1  christos 'libctf': currently, we use this to hardwire the size of pointers,
   1297      1.1  christos function pointers, and enumerated types,
   1298      1.1  christos 
   1299      1.1  christos    This is a very kludgy corner of CTF and will probably be replaced
   1300      1.1  christos with explicit header fields to record this sort of thing in future.
   1301      1.1  christos 
   1302      1.1  christos 
   1303      1.1  christos File: ctf-spec.info,  Node: Limits of CTF,  Prev: Data models,  Up: CTF dictionaries
   1304      1.1  christos 
   1305      1.1  christos 2.9 Limits of CTF
   1306      1.1  christos =================
   1307      1.1  christos 
   1308      1.1  christos The following limits are imposed by various aspects of CTF version 3:
   1309      1.1  christos 
   1310      1.1  christos 'CTF_MAX_TYPE'
   1311      1.1  christos      Maximum type identifier (maximum number of types accessible with
   1312      1.1  christos      parent and child containers in use): 0xfffffffe
   1313      1.1  christos 'CTF_MAX_PTYPE'
   1314      1.1  christos      Maximum type identifier in a parent dictioanry: maximum number of
   1315      1.1  christos      types in any one dictionary: 0x7fffffff
   1316      1.1  christos 'CTF_MAX_NAME'
   1317      1.1  christos      Maximum offset into a string table: 0x7fffffff
   1318      1.1  christos 'CTF_MAX_VLEN'
   1319      1.1  christos      Maximum number of members in a struct, union, or enum: maximum
   1320      1.1  christos      number of function args: 0xffffff
   1321      1.1  christos 'CTF_MAX_SIZE'
   1322      1.1  christos      Maximum size of a 'ctf_stype_t' in bytes before we fall back to
   1323      1.1  christos      'ctf_type_t': 0xfffffffe bytes
   1324      1.1  christos 
   1325      1.1  christos    Other maxima without associated macros:
   1326      1.1  christos    * Maximum value of an enumerated type: 2^32
   1327      1.1  christos    * Maximum size of an array element: 2^32
   1328      1.1  christos 
   1329      1.1  christos    These maxima are generally considered to be too low, because C
   1330      1.1  christos programs can and do exceed them: they will be lifted in format v4.
   1331      1.1  christos 
   1332      1.1  christos 
   1333      1.1  christos File: ctf-spec.info,  Node: Index,  Prev: CTF dictionaries,  Up: Top
   1334      1.1  christos 
   1335      1.1  christos Index
   1336      1.1  christos *****
   1337      1.1  christos 
   1338      1.1  christos [index]
   1339      1.1  christos * Menu:
   1340      1.1  christos 
   1341      1.1  christos * alignment:                             CTF Preamble.         (line 33)
   1342      1.1  christos * archive, CTF archive:                  CTF archive.          (line  6)
   1343      1.1  christos * Arrays:                                Arrays.               (line  6)
   1344      1.1  christos * bool:                                  Integer types.        (line  6)
   1345      1.1  christos * Bug workarounds, CTF_F_DYNSTR:         The symtypetab sections.
   1346      1.1  christos                                                                (line  6)
   1347      1.1  christos * Bug workarounds, CTF_F_DYNSTR <1>:     The string section.   (line 19)
   1348      1.1  christos * char:                                  Integer types.        (line  6)
   1349      1.1  christos * Child range:                           Type indexes and type IDs.
   1350      1.1  christos                                                                (line  6)
   1351      1.1  christos * Complex, double:                       Floating-point types. (line  6)
   1352      1.1  christos * Complex, float:                        Floating-point types. (line  6)
   1353      1.1  christos * Complex, signed double:                Floating-point types. (line  6)
   1354      1.1  christos * Complex, signed float:                 Floating-point types. (line  6)
   1355      1.1  christos * Complex, unsigned double:              Floating-point types. (line  6)
   1356      1.1  christos * Complex, unsigned float:               Floating-point types. (line  6)
   1357      1.1  christos * const:                                 Pointers typedefs and cvr-quals.
   1358      1.1  christos                                                                (line  6)
   1359      1.1  christos * cta_contents:                          Arrays.               (line 20)
   1360      1.1  christos * cta_index:                             Arrays.               (line 22)
   1361      1.1  christos * cta_nelems:                            Arrays.               (line 29)
   1362      1.1  christos * cte_name:                              Enums.                (line 21)
   1363      1.1  christos * cte_value:                             Enums.                (line 24)
   1364      1.1  christos * CTF header:                            CTF header.           (line  6)
   1365      1.1  christos * CTF versions, versions:                CTF Preamble.         (line 46)
   1366      1.1  christos * ctfa_ctfs:                             CTF archive.          (line 76)
   1367      1.1  christos * ctfa_magic:                            CTF archive.          (line 63)
   1368      1.1  christos * CTFA_MAGIC:                            CTF archive.          (line 64)
   1369      1.1  christos * ctfa_model:                            CTF archive.          (line 66)
   1370      1.1  christos * ctfa_names:                            CTF archive.          (line 72)
   1371      1.1  christos * ctfa_nfiles:                           CTF archive.          (line 71)
   1372      1.1  christos * ctf_archive_modent_t:                  CTF archive.          (line 83)
   1373      1.1  christos * ctf_archive_modent_t, ctf_offset:      CTF archive.          (line 88)
   1374      1.1  christos * ctf_archive_modent_t, name_offset:     CTF archive.          (line 86)
   1375      1.1  christos * ctf_array_t:                           Arrays.               (line 18)
   1376      1.1  christos * ctf_array_t, cta_contents:             Arrays.               (line 20)
   1377      1.1  christos * ctf_array_t, cta_index:                Arrays.               (line 22)
   1378      1.1  christos * ctf_array_t, cta_nelems:               Arrays.               (line 29)
   1379      1.1  christos * CTF_CHAR:                              Integer types.        (line 53)
   1380      1.1  christos * ctf_enum_t:                            Enums.                (line 18)
   1381      1.1  christos * ctf_enum_t, cte_name:                  Enums.                (line 21)
   1382      1.1  christos * ctf_enum_t, cte_value:                 Enums.                (line 24)
   1383      1.1  christos * CTF_FP_BITS:                           Floating-point types. (line 28)
   1384      1.1  christos * CTF_FP_CPLX:                           Floating-point types. (line 47)
   1385      1.1  christos * CTF_FP_DCPLX:                          Floating-point types. (line 48)
   1386      1.1  christos * CTF_FP_DIMAGRY:                        Floating-point types. (line 60)
   1387      1.1  christos * CTF_FP_DINTRVL:                        Floating-point types. (line 54)
   1388      1.1  christos * CTF_FP_DOUBLE:                         Floating-point types. (line 46)
   1389      1.1  christos * CTF_FP_ENCODING:                       Floating-point types. (line 21)
   1390      1.1  christos * CTF_FP_IMAGRY:                         Floating-point types. (line 58)
   1391      1.1  christos * CTF_FP_INTRVL:                         Floating-point types. (line 52)
   1392      1.1  christos * CTF_FP_LDCPLX:                         Floating-point types. (line 49)
   1393      1.1  christos * CTF_FP_LDIMAGRY:                       Floating-point types. (line 62)
   1394      1.1  christos * CTF_FP_LDINTRVL:                       Floating-point types. (line 56)
   1395      1.1  christos * CTF_FP_LDOUBLE:                        Floating-point types. (line 50)
   1396      1.1  christos * CTF_FP_OFFSET:                         Floating-point types. (line 25)
   1397      1.1  christos * CTF_FP_SINGLE:                         Floating-point types. (line 45)
   1398      1.1  christos * CTF_F_COMPRESS:                        CTF file-wide flags.  (line 17)
   1399      1.1  christos * CTF_F_DYNSTR:                          CTF file-wide flags.  (line 21)
   1400      1.1  christos * CTF_F_DYNSTR <1>:                      The symtypetab sections.
   1401      1.1  christos                                                                (line  6)
   1402      1.1  christos * CTF_F_DYNSTR <2>:                      The string section.   (line 19)
   1403      1.1  christos * CTF_F_IDXSORTED:                       CTF file-wide flags.  (line 20)
   1404      1.1  christos * CTF_F_IDXSORTED <1>:                   The symtypetab sections.
   1405      1.1  christos                                                                (line  6)
   1406      1.1  christos * CTF_F_NEWFUNCINFO:                     CTF file-wide flags.  (line 19)
   1407      1.1  christos * ctf_header_t:                          CTF header.           (line 44)
   1408      1.1  christos * ctf_header_t, cth_cuname:              CTF header.           (line 61)
   1409      1.1  christos * ctf_header_t, cth_flags:               CTF Preamble.         (line 30)
   1410      1.1  christos * ctf_header_t, cth_funcidxoff:          CTF header.           (line 82)
   1411      1.1  christos * ctf_header_t, cth_funcoff:             CTF header.           (line 74)
   1412      1.1  christos * ctf_header_t, cth_lbloff:              CTF header.           (line 66)
   1413      1.1  christos * ctf_header_t, cth_magic:               CTF Preamble.         (line 24)
   1414      1.1  christos * ctf_header_t, cth_objtidxoff:          CTF header.           (line 78)
   1415      1.1  christos * ctf_header_t, cth_objtoff:             CTF header.           (line 70)
   1416      1.1  christos * ctf_header_t, cth_parlabel:            CTF header.           (line 49)
   1417      1.1  christos * ctf_header_t, cth_parname:             CTF header.           (line 55)
   1418      1.1  christos * ctf_header_t, cth_preamble:            CTF header.           (line 47)
   1419      1.1  christos * ctf_header_t, cth_strlen:              CTF header.           (line 98)
   1420      1.1  christos * ctf_header_t, cth_stroff:              CTF header.           (line 95)
   1421      1.1  christos * ctf_header_t, cth_typeoff:             CTF header.           (line 91)
   1422      1.1  christos * ctf_header_t, cth_varoff:              CTF header.           (line 87)
   1423      1.1  christos * ctf_header_t, cth_version:             CTF Preamble.         (line 28)
   1424      1.1  christos * ctf_id_t:                              Type indexes and type IDs.
   1425      1.1  christos                                                                (line  6)
   1426      1.1  christos * CTF_INT_BITS:                          Integer types.        (line 28)
   1427      1.1  christos * CTF_INT_BOOL:                          Integer types.        (line 57)
   1428      1.1  christos * CTF_INT_CHAR:                          Integer types.        (line 53)
   1429      1.1  christos * CTF_INT_DATA:                          Integer types.        (line 34)
   1430      1.1  christos * CTF_INT_DATA <1>:                      Floating-point types. (line 36)
   1431      1.1  christos * CTF_INT_ENCODING:                      Integer types.        (line 20)
   1432      1.1  christos * CTF_INT_OFFSET:                        Integer types.        (line 25)
   1433      1.1  christos * CTF_INT_SIGNED:                        Integer types.        (line 49)
   1434      1.1  christos * CTF_K_CONST:                           Pointers typedefs and cvr-quals.
   1435      1.1  christos                                                                (line  6)
   1436      1.1  christos * CTF_K_ENUM:                            Enums.                (line  6)
   1437      1.1  christos * CTF_K_FLOAT:                           Floating-point types. (line  6)
   1438      1.1  christos * CTF_K_FORWARD:                         Forward declarations. (line  6)
   1439      1.1  christos * CTF_K_INTEGER:                         Integer types.        (line  6)
   1440      1.1  christos * CTF_K_POINTER:                         Pointers typedefs and cvr-quals.
   1441      1.1  christos                                                                (line  6)
   1442      1.1  christos * CTF_K_RESTRICT:                        Pointers typedefs and cvr-quals.
   1443      1.1  christos                                                                (line  6)
   1444      1.1  christos * CTF_K_SLICE:                           Slices.               (line  6)
   1445      1.1  christos * CTF_K_STRUCT:                          Structs and unions.   (line  6)
   1446      1.1  christos * CTF_K_TYPEDEF:                         Pointers typedefs and cvr-quals.
   1447      1.1  christos                                                                (line  6)
   1448      1.1  christos * CTF_K_UNION:                           Structs and unions.   (line  6)
   1449      1.1  christos * CTF_K_UNKNOWN:                         Type kinds.           (line 31)
   1450      1.1  christos * CTF_K_VOLATILE:                        Pointers typedefs and cvr-quals.
   1451      1.1  christos                                                                (line  6)
   1452      1.1  christos * ctf_lblent_t:                          The label section.    (line 16)
   1453      1.1  christos * ctf_lblent_t, ctl_label:               The label section.    (line 19)
   1454      1.1  christos * ctf_lblent_t, ctl_type:                The label section.    (line 20)
   1455      1.1  christos * ctf_lmember_t:                         Structs and unions.   (line 59)
   1456      1.1  christos * ctf_lmember_t, ctlm_name:              Structs and unions.   (line 61)
   1457      1.1  christos * ctf_lmember_t, ctlm_offsethi:          Structs and unions.   (line 64)
   1458      1.1  christos * ctf_lmember_t, ctlm_offsetlo:          Structs and unions.   (line 68)
   1459      1.1  christos * CTF_LSIZE_SENT:                        The type section.     (line 49)
   1460      1.1  christos * CTF_LSTRUCT_THRESH:                    Structs and unions.   (line 23)
   1461      1.1  christos * CTF_MAGIC:                             CTF Preamble.         (line 25)
   1462      1.1  christos * CTF_MAX_LSIZE:                         Structs and unions.   (line 13)
   1463      1.1  christos * ctf_member_t:                          Structs and unions.   (line 47)
   1464      1.1  christos * ctf_member_t, ctlm_type:               Structs and unions.   (line 65)
   1465      1.1  christos * ctf_member_t, ctm_name:                Structs and unions.   (line 49)
   1466      1.1  christos * ctf_member_t, ctm_offset:              Structs and unions.   (line 52)
   1467      1.1  christos * ctf_member_t, ctm_type:                Structs and unions.   (line 55)
   1468      1.1  christos * ctf_offset:                            CTF archive.          (line 88)
   1469      1.1  christos * ctf_preamble_t:                        CTF Preamble.         (line 22)
   1470      1.1  christos * ctf_preamble_t, ctp_flags:             CTF Preamble.         (line 30)
   1471      1.1  christos * ctf_preamble_t, ctp_magic:             CTF Preamble.         (line 24)
   1472      1.1  christos * ctf_preamble_t, ctp_version:           CTF Preamble.         (line 28)
   1473      1.1  christos * CTF_SIZE_TO_LSIZE_HI:                  The type section.     (line 79)
   1474      1.1  christos * CTF_SIZE_TO_LSIZE_LO:                  The type section.     (line 83)
   1475      1.1  christos * ctf_slice_t:                           Slices.               (line 42)
   1476      1.1  christos * ctf_slice_t, cts_bits:                 Slices.               (line 59)
   1477      1.1  christos * ctf_slice_t, cts_offset:               Slices.               (line 49)
   1478      1.1  christos * ctf_slice_t, cts_type:                 Slices.               (line 44)
   1479      1.1  christos * ctf_stype_t:                           The type section.     (line 53)
   1480      1.1  christos * ctf_stype_t, ctt_info:                 The type section.     (line 57)
   1481      1.1  christos * ctf_stype_t, ctt_size:                 The type section.     (line 62)
   1482      1.1  christos * ctf_stype_t, ctt_type:                 The type section.     (line 67)
   1483      1.1  christos * CTF_TYPE_INFO:                         The info word.        (line 45)
   1484      1.1  christos * CTF_TYPE_LSIZE:                        The type section.     (line 79)
   1485      1.1  christos * ctf_type_t:                            The type section.     (line 53)
   1486      1.1  christos * ctf_type_t, ctt_info:                  The type section.     (line 57)
   1487      1.1  christos * ctf_type_t, ctt_lsizehi:               The type section.     (line 76)
   1488      1.1  christos * ctf_type_t, ctt_lsizelo:               The type section.     (line 82)
   1489      1.1  christos * ctf_type_t, ctt_size:                  The type section.     (line 62)
   1490      1.1  christos * CTF_V2_INDEX_TO_TYPE:                  Type indexes and type IDs.
   1491      1.1  christos                                                                (line 58)
   1492      1.1  christos * CTF_V2_INFO_ISROOT:                    The info word.        (line 45)
   1493      1.1  christos * CTF_V2_INFO_KIND:                      The info word.        (line 45)
   1494      1.1  christos * CTF_V2_INFO_VLEN:                      The info word.        (line 45)
   1495      1.1  christos * CTF_V2_TYPE_ISCHILD:                   Type indexes and type IDs.
   1496      1.1  christos                                                                (line 58)
   1497      1.1  christos * CTF_V2_TYPE_ISPARENT:                  Type indexes and type IDs.
   1498      1.1  christos                                                                (line 58)
   1499      1.1  christos * CTF_V2_TYPE_TO_INDEX:                  Type indexes and type IDs.
   1500      1.1  christos                                                                (line 58)
   1501      1.1  christos * ctf_varent_t:                          The variable section. (line 21)
   1502      1.1  christos * ctf_varent_t, ctv_name:                The variable section. (line 24)
   1503      1.1  christos * ctf_varent_t, ctv_type:                The variable section. (line 26)
   1504      1.1  christos * CTF_VERSION_3:                         CTF Preamble.         (line 46)
   1505      1.1  christos * cth_cuname:                            CTF header.           (line 61)
   1506      1.1  christos * cth_flags:                             CTF Preamble.         (line 30)
   1507      1.1  christos * cth_funcidxoff:                        CTF header.           (line 82)
   1508      1.1  christos * cth_funcoff:                           CTF header.           (line 74)
   1509      1.1  christos * cth_lbloff:                            CTF header.           (line 66)
   1510      1.1  christos * cth_magic:                             CTF Preamble.         (line 24)
   1511      1.1  christos * cth_objtidxoff:                        CTF header.           (line 78)
   1512      1.1  christos * cth_objtoff:                           CTF header.           (line 70)
   1513      1.1  christos * cth_parlabel:                          CTF header.           (line 49)
   1514      1.1  christos * cth_parname:                           CTF header.           (line 55)
   1515      1.1  christos * cth_preamble:                          CTF header.           (line 47)
   1516      1.1  christos * cth_strlen:                            CTF header.           (line 98)
   1517      1.1  christos * cth_stroff:                            CTF header.           (line 95)
   1518      1.1  christos * cth_typeoff:                           CTF header.           (line 91)
   1519      1.1  christos * cth_varoff:                            CTF header.           (line 87)
   1520      1.1  christos * cth_version:                           CTF Preamble.         (line 28)
   1521      1.1  christos * ctlm_name:                             Structs and unions.   (line 61)
   1522      1.1  christos * ctlm_offsethi:                         Structs and unions.   (line 64)
   1523      1.1  christos * ctlm_offsetlo:                         Structs and unions.   (line 68)
   1524      1.1  christos * ctl_label:                             The label section.    (line 19)
   1525      1.1  christos * ctl_type:                              The label section.    (line 20)
   1526      1.1  christos * ctm_name:                              Structs and unions.   (line 49)
   1527      1.1  christos * ctm_offset:                            Structs and unions.   (line 52)
   1528      1.1  christos * ctm_type:                              Structs and unions.   (line 55)
   1529      1.1  christos * ctm_type <1>:                          Structs and unions.   (line 65)
   1530      1.1  christos * ctp_flags:                             CTF Preamble.         (line 30)
   1531      1.1  christos * ctp_flags <1>:                         CTF Preamble.         (line 58)
   1532      1.1  christos * ctp_magic:                             CTF Preamble.         (line 24)
   1533      1.1  christos * ctp_version:                           CTF Preamble.         (line 28)
   1534      1.1  christos * cts_bits:                              Slices.               (line 59)
   1535      1.1  christos * cts_offset:                            Slices.               (line 49)
   1536      1.1  christos * cts_type:                              Slices.               (line 44)
   1537      1.1  christos * ctt_info:                              The type section.     (line 57)
   1538      1.1  christos * ctt_lsizehi:                           The type section.     (line 76)
   1539      1.1  christos * ctt_lsizelo:                           The type section.     (line 82)
   1540      1.1  christos * ctt_name:                              The type section.     (line 55)
   1541      1.1  christos * ctt_size:                              The type section.     (line 62)
   1542      1.1  christos * ctt_type:                              The type section.     (line 67)
   1543      1.1  christos * ctv_name:                              The variable section. (line 24)
   1544      1.1  christos * ctv_type:                              The variable section. (line 26)
   1545      1.1  christos * cvr-quals:                             Pointers typedefs and cvr-quals.
   1546      1.1  christos                                                                (line  6)
   1547      1.1  christos * Data models:                           Data models.          (line  6)
   1548      1.1  christos * Data object index section:             The symtypetab sections.
   1549      1.1  christos                                                                (line  6)
   1550      1.1  christos * Data object section:                   The symtypetab sections.
   1551      1.1  christos                                                                (line  6)
   1552      1.1  christos * dictionary, CTF dictionary:            CTF dictionaries.     (line  6)
   1553      1.1  christos * double:                                Floating-point types. (line  6)
   1554      1.1  christos * endianness:                            CTF Preamble.         (line 37)
   1555      1.1  christos * enum:                                  Enums.                (line  6)
   1556      1.1  christos * enum <1>:                              Forward declarations. (line  6)
   1557      1.1  christos * Enums:                                 Enums.                (line  6)
   1558      1.1  christos * float:                                 Floating-point types. (line  6)
   1559      1.1  christos * Floating-point types:                  Floating-point types. (line  6)
   1560      1.1  christos * Forwards:                              Forward declarations. (line  6)
   1561      1.1  christos * Function info index section:           The symtypetab sections.
   1562      1.1  christos                                                                (line  6)
   1563      1.1  christos * Function info section:                 The symtypetab sections.
   1564      1.1  christos                                                                (line  6)
   1565      1.1  christos * Function pointers:                     Function pointers.    (line  6)
   1566      1.1  christos * int:                                   Integer types.        (line  6)
   1567      1.1  christos * Integer types:                         Integer types.        (line  6)
   1568      1.1  christos * Label section:                         The label section.    (line  6)
   1569      1.1  christos * libctf, effect of slices:              Slices.               (line 30)
   1570      1.1  christos * Limits:                                Limits of CTF.        (line  6)
   1571      1.1  christos * long:                                  Integer types.        (line  6)
   1572      1.1  christos * long long:                             Integer types.        (line  6)
   1573      1.1  christos * name_offset:                           CTF archive.          (line 86)
   1574      1.1  christos * Overview:                              Overview.             (line  6)
   1575      1.1  christos * Parent range:                          Type indexes and type IDs.
   1576      1.1  christos                                                                (line  6)
   1577      1.1  christos * Pointers:                              Pointers typedefs and cvr-quals.
   1578      1.1  christos                                                                (line  6)
   1579      1.1  christos * Pointers, to functions:                Function pointers.    (line  6)
   1580      1.1  christos * restrict:                              Pointers typedefs and cvr-quals.
   1581      1.1  christos                                                                (line  6)
   1582      1.1  christos * Sections, data object:                 The symtypetab sections.
   1583      1.1  christos                                                                (line  6)
   1584      1.1  christos * Sections, data object index:           The symtypetab sections.
   1585      1.1  christos                                                                (line  6)
   1586      1.1  christos * Sections, function info:               The symtypetab sections.
   1587      1.1  christos                                                                (line  6)
   1588      1.1  christos * Sections, function info index:         The symtypetab sections.
   1589      1.1  christos                                                                (line  6)
   1590      1.1  christos * Sections, header:                      CTF header.           (line  6)
   1591      1.1  christos * Sections, label:                       The label section.    (line  6)
   1592      1.1  christos * Sections, string:                      The string section.   (line  6)
   1593      1.1  christos * Sections, symtypetab:                  The symtypetab sections.
   1594      1.1  christos                                                                (line  6)
   1595      1.1  christos * Sections, type:                        The type section.     (line  6)
   1596      1.1  christos * Sections, variable:                    The variable section. (line  6)
   1597      1.1  christos * short:                                 Integer types.        (line  6)
   1598      1.1  christos * signed char:                           Integer types.        (line  6)
   1599      1.1  christos * signed double:                         Floating-point types. (line  6)
   1600      1.1  christos * signed float:                          Floating-point types. (line  6)
   1601      1.1  christos * signed int:                            Integer types.        (line  6)
   1602      1.1  christos * signed long:                           Integer types.        (line  6)
   1603      1.1  christos * signed long long:                      Integer types.        (line  6)
   1604      1.1  christos * signed short:                          Integer types.        (line  6)
   1605      1.1  christos * Slices:                                Slices.               (line  6)
   1606      1.1  christos * Slices, effect on ctf_type_kind:       Slices.               (line 30)
   1607      1.1  christos * Slices, effect on ctf_type_reference:  Slices.               (line 30)
   1608      1.1  christos * String section:                        The string section.   (line  6)
   1609      1.1  christos * struct:                                Structs and unions.   (line  6)
   1610      1.1  christos * struct <1>:                            Forward declarations. (line  6)
   1611      1.1  christos * struct ctf_archive:                    CTF archive.          (line 61)
   1612      1.1  christos * struct ctf_archive, ctfa_ctfs:         CTF archive.          (line 76)
   1613      1.1  christos * struct ctf_archive, ctfa_magic:        CTF archive.          (line 63)
   1614      1.1  christos * struct ctf_archive, ctfa_model:        CTF archive.          (line 66)
   1615      1.1  christos * struct ctf_archive, ctfa_names:        CTF archive.          (line 72)
   1616      1.1  christos * struct ctf_archive, ctfa_nfiles:       CTF archive.          (line 71)
   1617      1.1  christos * struct ctf_archive_modent:             CTF archive.          (line 83)
   1618      1.1  christos * struct ctf_archive_modent, ctf_offset: CTF archive.          (line 88)
   1619      1.1  christos * struct ctf_archive_modent, name_offset: CTF archive.         (line 86)
   1620      1.1  christos * struct ctf_array:                      Arrays.               (line 18)
   1621      1.1  christos * struct ctf_array, cta_contents:        Arrays.               (line 20)
   1622      1.1  christos * struct ctf_array, cta_index:           Arrays.               (line 22)
   1623      1.1  christos * struct ctf_array, cta_nelems:          Arrays.               (line 29)
   1624      1.1  christos * struct ctf_enum:                       Enums.                (line 18)
   1625      1.1  christos * struct ctf_enum, cte_name:             Enums.                (line 21)
   1626      1.1  christos * struct ctf_enum, cte_value:            Enums.                (line 24)
   1627      1.1  christos * struct ctf_header:                     CTF header.           (line 44)
   1628      1.1  christos * struct ctf_header, cth_cuname:         CTF header.           (line 61)
   1629      1.1  christos * struct ctf_header, cth_flags:          CTF Preamble.         (line 30)
   1630      1.1  christos * struct ctf_header, cth_funcidxoff:     CTF header.           (line 82)
   1631      1.1  christos * struct ctf_header, cth_funcoff:        CTF header.           (line 74)
   1632      1.1  christos * struct ctf_header, cth_lbloff:         CTF header.           (line 66)
   1633      1.1  christos * struct ctf_header, cth_magic:          CTF Preamble.         (line 24)
   1634      1.1  christos * struct ctf_header, cth_objtidxoff:     CTF header.           (line 78)
   1635      1.1  christos * struct ctf_header, cth_objtoff:        CTF header.           (line 70)
   1636      1.1  christos * struct ctf_header, cth_parlabel:       CTF header.           (line 49)
   1637      1.1  christos * struct ctf_header, cth_parname:        CTF header.           (line 55)
   1638      1.1  christos * struct ctf_header, cth_preamble:       CTF header.           (line 47)
   1639      1.1  christos * struct ctf_header, cth_strlen:         CTF header.           (line 98)
   1640      1.1  christos * struct ctf_header, cth_stroff:         CTF header.           (line 95)
   1641      1.1  christos * struct ctf_header, cth_typeoff:        CTF header.           (line 91)
   1642      1.1  christos * struct ctf_header, cth_varoff:         CTF header.           (line 87)
   1643      1.1  christos * struct ctf_header, cth_version:        CTF Preamble.         (line 28)
   1644      1.1  christos * struct ctf_lblent:                     The label section.    (line 16)
   1645      1.1  christos * struct ctf_lblent, ctl_label:          The label section.    (line 19)
   1646      1.1  christos * struct ctf_lblent, ctl_type:           The label section.    (line 20)
   1647      1.1  christos * struct ctf_lmember_v2:                 Structs and unions.   (line 59)
   1648      1.1  christos * struct ctf_lmember_v2, ctlm_name:      Structs and unions.   (line 61)
   1649      1.1  christos * struct ctf_lmember_v2, ctlm_offsethi:  Structs and unions.   (line 64)
   1650      1.1  christos * struct ctf_lmember_v2, ctlm_offsetlo:  Structs and unions.   (line 68)
   1651      1.1  christos * struct ctf_lmember_v2, ctlm_type:      Structs and unions.   (line 65)
   1652      1.1  christos * struct ctf_member_v2:                  Structs and unions.   (line 47)
   1653      1.1  christos * struct ctf_member_v2, ctm_name:        Structs and unions.   (line 49)
   1654      1.1  christos * struct ctf_member_v2, ctm_offset:      Structs and unions.   (line 52)
   1655      1.1  christos * struct ctf_member_v2, ctm_type:        Structs and unions.   (line 55)
   1656      1.1  christos * struct ctf_preamble:                   CTF Preamble.         (line 22)
   1657      1.1  christos * struct ctf_preamble, ctp_flags:        CTF Preamble.         (line 30)
   1658      1.1  christos * struct ctf_preamble, ctp_magic:        CTF Preamble.         (line 24)
   1659      1.1  christos * struct ctf_preamble, ctp_version:      CTF Preamble.         (line 28)
   1660      1.1  christos * struct ctf_slice:                      Slices.               (line 42)
   1661      1.1  christos * struct ctf_slice, cts_bits:            Slices.               (line 59)
   1662      1.1  christos * struct ctf_slice, cts_offset:          Slices.               (line 49)
   1663      1.1  christos * struct ctf_slice, cts_type:            Slices.               (line 44)
   1664      1.1  christos * struct ctf_stype:                      The type section.     (line 53)
   1665      1.1  christos * struct ctf_stype, ctt_info:            The type section.     (line 57)
   1666      1.1  christos * struct ctf_stype, ctt_size:            The type section.     (line 62)
   1667      1.1  christos * struct ctf_stype, ctt_type:            The type section.     (line 67)
   1668      1.1  christos * struct ctf_type:                       The type section.     (line 53)
   1669      1.1  christos * struct ctf_type, ctt_info:             The type section.     (line 57)
   1670      1.1  christos * struct ctf_type, ctt_lsizehi:          The type section.     (line 76)
   1671      1.1  christos * struct ctf_type, ctt_lsizelo:          The type section.     (line 82)
   1672      1.1  christos * struct ctf_type, ctt_size:             The type section.     (line 62)
   1673      1.1  christos * struct ctf_varent:                     The variable section. (line 21)
   1674      1.1  christos * struct ctf_varent, ctv_name:           The variable section. (line 24)
   1675      1.1  christos * struct ctf_varent, ctv_type:           The variable section. (line 26)
   1676      1.1  christos * Structures:                            Structs and unions.   (line  6)
   1677      1.1  christos * Symtypetab section:                    The symtypetab sections.
   1678      1.1  christos                                                                (line  6)
   1679      1.1  christos * Type IDs:                              Type indexes and type IDs.
   1680      1.1  christos                                                                (line  6)
   1681      1.1  christos * Type IDs, ranges:                      Type indexes and type IDs.
   1682      1.1  christos                                                                (line  6)
   1683      1.1  christos * Type indexes:                          Type indexes and type IDs.
   1684      1.1  christos                                                                (line  6)
   1685      1.1  christos * Type kinds:                            Type kinds.           (line  6)
   1686      1.1  christos * Type section:                          The type section.     (line  6)
   1687      1.1  christos * Type, IDs of:                          Type indexes and type IDs.
   1688      1.1  christos                                                                (line  6)
   1689      1.1  christos * Type, indexes of:                      Type indexes and type IDs.
   1690      1.1  christos                                                                (line  6)
   1691      1.1  christos * Type, kinds of:                        Type kinds.           (line  6)
   1692      1.1  christos * typedef:                               Pointers typedefs and cvr-quals.
   1693      1.1  christos                                                                (line  6)
   1694      1.1  christos * Typedefs:                              Pointers typedefs and cvr-quals.
   1695      1.1  christos                                                                (line  6)
   1696      1.1  christos * Types, floating-point:                 Floating-point types. (line  6)
   1697      1.1  christos * Types, integer:                        Integer types.        (line  6)
   1698      1.1  christos * Types, slices of integral:             Slices.               (line  6)
   1699      1.1  christos * union:                                 Structs and unions.   (line  6)
   1700      1.1  christos * union <1>:                             Forward declarations. (line  6)
   1701      1.1  christos * Unions:                                Structs and unions.   (line  6)
   1702      1.1  christos * unsigned char:                         Integer types.        (line  6)
   1703      1.1  christos * unsigned double:                       Floating-point types. (line  6)
   1704      1.1  christos * unsigned float:                        Floating-point types. (line  6)
   1705      1.1  christos * unsigned int:                          Integer types.        (line  6)
   1706      1.1  christos * unsigned long:                         Integer types.        (line  6)
   1707      1.1  christos * unsigned long long:                    Integer types.        (line  6)
   1708      1.1  christos * unsigned short:                        Integer types.        (line  6)
   1709      1.1  christos * Unused bits:                           Floating-point types. (line 52)
   1710      1.1  christos * Unused bits <1>:                       Floating-point types. (line 54)
   1711      1.1  christos * Unused bits <2>:                       Floating-point types. (line 56)
   1712      1.1  christos * Unused bits <3>:                       Floating-point types. (line 58)
   1713      1.1  christos * Unused bits <4>:                       Floating-point types. (line 60)
   1714      1.1  christos * Unused bits <5>:                       Floating-point types. (line 62)
   1715      1.1  christos * Variable section:                      The variable section. (line  6)
   1716      1.1  christos * volatile:                              Pointers typedefs and cvr-quals.
   1717      1.1  christos                                                                (line  6)
   1718      1.1  christos 
   1719      1.1  christos 
   1720      1.1  christos 
   1721      1.1  christos Tag Table:
   1722      1.1  christos Node: Top548
   1723      1.1  christos Node: Overview878
   1724      1.1  christos Node: CTF archive4165
   1725      1.1  christos Node: CTF dictionaries8791
   1726      1.1  christos Node: CTF Preamble9208
   1727      1.1  christos Node: CTF file-wide flags11818
   1728      1.1  christos Node: CTF header13276
   1729      1.1  christos Node: The type section19200
   1730  1.1.1.3  christos Node: The info word23866
   1731  1.1.1.3  christos Node: Type indexes and type IDs26396
   1732  1.1.1.3  christos Node: Type kinds29764
   1733  1.1.1.3  christos Node: Integer types33057
   1734  1.1.1.3  christos Node: Floating-point types36605
   1735  1.1.1.3  christos Node: Slices40630
   1736  1.1.1.3  christos Node: Pointers typedefs and cvr-quals44134
   1737  1.1.1.3  christos Node: Arrays45305
   1738  1.1.1.3  christos Node: Function pointers47036
   1739  1.1.1.3  christos Node: Enums47701
   1740  1.1.1.3  christos Node: Structs and unions48983
   1741  1.1.1.3  christos Node: Forward declarations52840
   1742  1.1.1.3  christos Node: The symtypetab sections54419
   1743  1.1.1.3  christos Node: The variable section57497
   1744  1.1.1.3  christos Node: The label section58635
   1745  1.1.1.3  christos Node: The string section59610
   1746  1.1.1.3  christos Node: Data models60872
   1747  1.1.1.3  christos Node: Limits of CTF61541
   1748  1.1.1.3  christos Node: Index62586
   1749      1.1  christos 
   1750      1.1  christos End Tag Table
   1751      1.1  christos 
   1752      1.1  christos 
   1753      1.1  christos Local Variables:
   1754      1.1  christos coding: utf-8
   1755      1.1  christos End:
   1756