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