Next: CTF header, Up: CTF dictionaries [Contents][Index]
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;
#define
s 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.
Offset | Name | Description |
---|---|---|
0x00 | unsigned short ctp_magic
| The magic number for CTF dictionaries, CTF_MAGIC : 0xdff2.
|
0x02 | unsigned char ctp_version
| The version number of this CTF dictionary. |
0x03 | ctp_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:
Version | Number | Description |
---|---|---|
CTF_VERSION_1 | 1 | First version, rare. Very similar to Solaris CTF. See section CTF version 1. |
CTF_VERSION_1_UPGRADED_3 | 2 | First version, upgraded to v3 or higher and written out again. Name may change. Very rare. See section CTF version 1. |
CTF_VERSION_2 | 3 | Second version, with many range limits lifted. See section CTF version 2. |
CTF_VERSION_3 | 4 | Third and current version. |
This section documents CTF_VERSION_3
: differences in older versions are
described in See section Older versions.
• CTF file-wide flags |
Next: CTF header, Up: CTF dictionaries [Contents][Index]