Next: , Up: CTF dictionaries   [Contents][Index]


2.1 CTF Preamble

The preamble is the only part of the CTF dictionary whose format cannot vary between versions. It is never compressed. It is correspondingly simple:

typedef struct ctf_preamble
{
  unsigned short ctp_magic;
  unsigned char ctp_version;
  unsigned char ctp_flags;
} ctf_preamble_t;

#defines are provided under the names cth_magic, cth_version and cth_flags to make the fields of the ctf_preamble_t appear to be part of the ctf_header_t, so consuming programs rarely need to consider the existence of the preamble as a separate structure.

OffsetNameDescription
0x00unsigned short ctp_magic The magic number for CTF dictionaries, CTF_MAGIC: 0xdff2.
0x02unsigned char ctp_version The version number of this CTF dictionary.
0x03ctp_flags Flags for this CTF file. See section CTF file-wide flags.

Every element of a dictionary must be naturally aligned unless otherwise specified. (This restriction will be lifted in later versions.)

CTF dictionaries are stored in the native endianness of the system that generates them: the consumer (e.g., libctf) can detect whether to endian-flip a CTF dictionary by inspecting the ctp_magic. (If it appears as 0xf2df, endian-flipping is needed.)

The version of the CTF dictionary can be determined by inspecting ctp_version. The following versions are currently valid, and libctf can read all of them:

VersionNumberDescription
CTF_VERSION_11First version, rare. Very similar to Solaris CTF. See section CTF version 1.
CTF_VERSION_1_UPGRADED_32First version, upgraded to v3 or higher and written out again. Name may change. Very rare. See section CTF version 1.
CTF_VERSION_23Second version, with many range limits lifted. See section CTF version 2.
CTF_VERSION_34Third and current version.

This section documents CTF_VERSION_3: differences in older versions are described in See section Older versions.


Next: , Up: CTF dictionaries   [Contents][Index]