Specify that size includes headers
[ctf.git] / common-trace-format-proposal.txt
CommitLineData
5ba9f198 1
4767a9e7 2RFC: Common Trace Format (CTF) Proposal (pre-v1.7)
5ba9f198
MD
3
4Mathieu Desnoyers, EfficiOS Inc.
5
6The goal of the present document is to propose a trace format that suits the
cc089c3a 7needs of the embedded, telecom, high-performance and kernel communities. It is
5ba9f198 8based on the Common Trace Format Requirements (v1.4) document. It is designed to
cc089c3a 9allow traces to be natively generated by the Linux kernel, Linux user-space
6c7226e9
MD
10applications written in C/C++, and hardware components. One major element of
11CTF is the Trace Stream Description Language (TSDL) which flexibility
12enables description of various binary trace stream layouts.
cc089c3a
MD
13
14The latest version of this document can be found at:
15
16 git tree: git://git.efficios.com/ctf.git
17 gitweb: http://git.efficios.com/?p=ctf.git
5ba9f198
MD
18
19A reference implementation of a library to read and write this trace format is
20being implemented within the BabelTrace project, a converter between trace
21formats. The development tree is available at:
22
23 git tree: git://git.efficios.com/babeltrace.git
24 gitweb: http://git.efficios.com/?p=babeltrace.git
25
26
271. Preliminary definitions
28
3bf79539
MD
29 - Event Trace: An ordered sequence of events.
30 - Event Stream: An ordered sequence of events, containing a subset of the
31 trace event types.
32 - Event Packet: A sequence of physically contiguous events within an event
33 stream.
5ba9f198
MD
34 - Event: This is the basic entry in a trace. (aka: a trace record).
35 - An event identifier (ID) relates to the class (a type) of event within
3bf79539
MD
36 an event stream.
37 e.g. event: irq_entry.
5ba9f198
MD
38 - An event (or event record) relates to a specific instance of an event
39 class.
3bf79539
MD
40 e.g. event: irq_entry, at time X, on CPU Y
41 - Source Architecture: Architecture writing the trace.
42 - Reader Architecture: Architecture reading the trace.
5ba9f198
MD
43
44
452. High-level representation of a trace
46
3bf79539
MD
47A trace is divided into multiple event streams. Each event stream contains a
48subset of the trace event types.
5ba9f198 49
3bf79539
MD
50The final output of the trace, after its generation and optional transport over
51the network, is expected to be either on permanent or temporary storage in a
52virtual file system. Because each event stream is appended to while a trace is
53being recorded, each is associated with a separate file for output. Therefore,
54a stored trace can be represented as a directory containing one file per stream.
5ba9f198 55
6c7226e9
MD
56A metadata event stream contains information on trace event types
57expressed in the Trace Stream Description Language (TSDL). It describes:
5ba9f198
MD
58
59- Trace version.
60- Types available.
3bf79539
MD
61- Per-stream event header description.
62- Per-stream event header selection.
63- Per-stream event context fields.
5ba9f198 64- Per-event
3bf79539 65 - Event type to stream mapping.
5ba9f198
MD
66 - Event type to name mapping.
67 - Event type to ID mapping.
68 - Event fields description.
69
70
3bf79539 713. Event stream
5ba9f198 72
3bf79539 73An event stream is divided in contiguous event packets of variable size. These
ae8c075a
MD
74subdivisions have a variable size. An event packet can contain a certain
75amount of padding at the end. The stream header is repeated at the
76beginning of each event packet. The rationale for the event stream
77design choices is explained in Appendix B. Stream Header Rationale.
5ba9f198 78
3bf79539
MD
79The event stream header will therefore be referred to as the "event packet
80header" throughout the rest of this document.
5ba9f198
MD
81
82
834. Types
84
1fad7a85
MD
85Types are organized as type classes. Each type class belong to either of two
86kind of types: basic types or compound types.
87
5ba9f198
MD
884.1 Basic types
89
1fad7a85
MD
90A basic type is a scalar type, as described in this section. It includes
91integers, GNU/C bitfields, enumerations, and floating point values.
5ba9f198
MD
92
934.1.1 Type inheritance
94
80fd2569
MD
95Type specifications can be inherited to allow deriving types from a
96type class. For example, see the uint32_t named type derived from the "integer"
97type class below ("Integers" section). Types have a precise binary
98representation in the trace. A type class has methods to read and write these
99types, but must be derived into a type to be usable in an event field.
5ba9f198
MD
100
1014.1.2 Alignment
102
103We define "byte-packed" types as aligned on the byte size, namely 8-bit.
104We define "bit-packed" types as following on the next bit, as defined by the
370eae99 105"Integers" section.
5ba9f198 106
3bf79539
MD
107All basic types, except bitfields, are either aligned on an architecture-defined
108specific alignment or byte-packed, depending on the architecture preference.
109Architectures providing fast unaligned write byte-packed basic types to save
5ba9f198 110space, aligning each type on byte boundaries (8-bit). Architectures with slow
3bf79539 111unaligned writes align types on specific alignment values. If no specific
370eae99
MD
112alignment is declared for a type, it is assumed to be bit-packed for
113integers with size not multiple of 8 bits and for gcc bitfields. All
114other types are byte-packed.
5ba9f198 115
3bf79539 116Metadata attribute representation of a specific alignment:
5ba9f198
MD
117
118 align = value; /* value in bits */
119
1204.1.3 Byte order
121
3bf79539
MD
122By default, the native endianness of the source architecture the trace is used.
123Byte order can be overridden for a basic type by specifying a "byte_order"
124attribute. Typical use-case is to specify the network byte order (big endian:
125"be") to save data captured from the network into the trace without conversion.
126If not specified, the byte order is native.
5ba9f198
MD
127
128Metadata representation:
129
130 byte_order = native OR network OR be OR le; /* network and be are aliases */
131
1324.1.4 Size
133
134Type size, in bits, for integers and floats is that returned by "sizeof()" in C
135multiplied by CHAR_BIT.
136We require the size of "char" and "unsigned char" types (CHAR_BIT) to be fixed
137to 8 bits for cross-endianness compatibility.
138
139Metadata representation:
140
141 size = value; (value is in bits)
142
1434.1.5 Integers
144
145Signed integers are represented in two-complement. Integer alignment, size,
146signedness and byte ordering are defined in the metadata. Integers aligned on
147byte size (8-bit) and with length multiple of byte size (8-bit) correspond to
148the C99 standard integers. In addition, integers with alignment and/or size that
149are _not_ a multiple of the byte size are permitted; these correspond to the C99
150standard bitfields, with the added specification that the CTF integer bitfields
151have a fixed binary representation. A MIT-licensed reference implementation of
152the CTF portable bitfields is available at:
153
154 http://git.efficios.com/?p=babeltrace.git;a=blob;f=include/babeltrace/bitfield.h
155
156Binary representation of integers:
157
158- On little and big endian:
159 - Within a byte, high bits correspond to an integer high bits, and low bits
160 correspond to low bits.
161- On little endian:
162 - Integer across multiple bytes are placed from the less significant to the
163 most significant.
164 - Consecutive integers are placed from lower bits to higher bits (even within
165 a byte).
166- On big endian:
167 - Integer across multiple bytes are placed from the most significant to the
168 less significant.
169 - Consecutive integers are placed from higher bits to lower bits (even within
170 a byte).
171
172This binary representation is derived from the bitfield implementation in GCC
173for little and big endian. However, contrary to what GCC does, integers can
174cross units boundaries (no padding is required). Padding can be explicitely
175added (see 4.1.6 GNU/C bitfields) to follow the GCC layout if needed.
176
177Metadata representation:
178
80fd2569 179 integer {
5ba9f198
MD
180 signed = true OR false; /* default false */
181 byte_order = native OR network OR be OR le; /* default native */
182 size = value; /* value in bits, no default */
183 align = value; /* value in bits */
2152348f 184 }
5ba9f198 185
80fd2569 186Example of type inheritance (creation of a uint32_t named type):
5ba9f198 187
359894ac 188typealias integer {
9e4e34e9 189 size = 32;
5ba9f198
MD
190 signed = false;
191 align = 32;
38b8da21 192} := uint32_t;
5ba9f198 193
80fd2569 194Definition of a named 5-bit signed bitfield:
5ba9f198 195
359894ac 196typealias integer {
5ba9f198
MD
197 size = 5;
198 signed = true;
199 align = 1;
38b8da21 200} := int5_t;
5ba9f198
MD
201
2024.1.6 GNU/C bitfields
203
204The GNU/C bitfields follow closely the integer representation, with a
205particularity on alignment: if a bitfield cannot fit in the current unit, the
80fd2569
MD
206unit is padded and the bitfield starts at the following unit. The unit size is
207defined by the size of the type "unit_type".
5ba9f198 208
2152348f 209Metadata representation:
80fd2569
MD
210
211 unit_type name:size:
212
5ba9f198
MD
213As an example, the following structure declared in C compiled by GCC:
214
215struct example {
216 short a:12;
217 short b:5;
218};
219
2152348f
MD
220The example structure is aligned on the largest element (short). The second
221bitfield would be aligned on the next unit boundary, because it would not fit in
222the current unit.
5ba9f198
MD
223
2244.1.7 Floating point
225
226The floating point values byte ordering is defined in the metadata.
227
228Floating point values follow the IEEE 754-2008 standard interchange formats.
229Description of the floating point values include the exponent and mantissa size
230in bits. Some requirements are imposed on the floating point values:
231
232- FLT_RADIX must be 2.
233- mant_dig is the number of digits represented in the mantissa. It is specified
234 by the ISO C99 standard, section 5.2.4, as FLT_MANT_DIG, DBL_MANT_DIG and
235 LDBL_MANT_DIG as defined by <float.h>.
236- exp_dig is the number of digits represented in the exponent. Given that
237 mant_dig is one bit more than its actual size in bits (leading 1 is not
238 needed) and also given that the sign bit always takes one bit, exp_dig can be
239 specified as:
240
241 - sizeof(float) * CHAR_BIT - FLT_MANT_DIG
242 - sizeof(double) * CHAR_BIT - DBL_MANT_DIG
243 - sizeof(long double) * CHAR_BIT - LDBL_MANT_DIG
244
245Metadata representation:
246
80fd2569 247floating_point {
5ba9f198
MD
248 exp_dig = value;
249 mant_dig = value;
250 byte_order = native OR network OR be OR le;
2152348f 251}
5ba9f198
MD
252
253Example of type inheritance:
254
359894ac 255typealias floating_point {
5ba9f198
MD
256 exp_dig = 8; /* sizeof(float) * CHAR_BIT - FLT_MANT_DIG */
257 mant_dig = 24; /* FLT_MANT_DIG */
258 byte_order = native;
38b8da21 259} := float;
5ba9f198
MD
260
261TODO: define NaN, +inf, -inf behavior.
262
2634.1.8 Enumerations
264
265Enumerations are a mapping between an integer type and a table of strings. The
266numerical representation of the enumeration follows the integer type specified
267by the metadata. The enumeration mapping table is detailed in the enumeration
3bf79539
MD
268description within the metadata. The mapping table maps inclusive value ranges
269(or single values) to strings. Instead of being limited to simple
270"value -> string" mappings, these enumerations map
80fd2569 271"[ start_value ... end_value ] -> string", which map inclusive ranges of
3bf79539
MD
272values to strings. An enumeration from the C language can be represented in
273this format by having the same start_value and end_value for each element, which
274is in fact a range of size 1. This single-value range is supported without
4767a9e7 275repeating the start and end values with the value = string declaration.
80fd2569 276
a9b83695 277enum name : integer_type {
359894ac 278 somestring = start_value1 ... end_value1,
80fd2569
MD
279 "other string" = start_value2 ... end_value2,
280 yet_another_string, /* will be assigned to end_value2 + 1 */
281 "some other string" = value,
282 ...
283};
284
285If the values are omitted, the enumeration starts at 0 and increment of 1 for
286each entry:
287
a9b83695 288enum name : unsigned int {
80fd2569
MD
289 ZERO,
290 ONE,
291 TWO,
292 TEN = 10,
293 ELEVEN,
3bf79539 294};
5ba9f198 295
80fd2569 296Overlapping ranges within a single enumeration are implementation defined.
5ba9f198 297
2152348f
MD
298A nameless enumeration can be declared as a field type or as part of a typedef:
299
a9b83695 300enum : integer_type {
2152348f
MD
301 ...
302}
303
c2742c56
MD
304Enumerations omitting the container type ": integer_type" use the "int"
305type (for compatibility with C99). The "int" type must be previously
306declared. E.g.:
307
308typealias integer { size = 32; align = 32; signed = true } := int;
309
310enum {
311 ...
312}
313
1fad7a85 314
5ba9f198
MD
3154.2 Compound types
316
1fad7a85
MD
317Compound are aggregation of type declarations. Compound types include
318structures, variant, arrays, sequences, and strings.
319
5ba9f198
MD
3204.2.1 Structures
321
322Structures are aligned on the largest alignment required by basic types
323contained within the structure. (This follows the ISO/C standard for structures)
324
80fd2569 325Metadata representation of a named structure:
5ba9f198 326
80fd2569
MD
327struct name {
328 field_type field_name;
329 field_type field_name;
330 ...
331};
5ba9f198
MD
332
333Example:
334
80fd2569
MD
335struct example {
336 integer { /* Nameless type */
337 size = 16;
338 signed = true;
339 align = 16;
340 } first_field_name;
341 uint64_t second_field_name; /* Named type declared in the metadata */
3bf79539 342};
5ba9f198
MD
343
344The fields are placed in a sequence next to each other. They each possess a
345field name, which is a unique identifier within the structure.
346
2152348f 347A nameless structure can be declared as a field type or as part of a typedef:
80fd2569
MD
348
349struct {
350 ...
2152348f 351}
80fd2569 352
77a98c82 3534.2.2 Variants (Discriminated/Tagged Unions)
fcba70d4 354
fdf2bb05
MD
355A CTF variant is a selection between different types. A CTF variant must
356always be defined within the scope of a structure or within fields
357contained within a structure (defined recursively). A "tag" enumeration
358field must appear in either the same lexical scope, prior to the variant
359field (in field declaration order), in an uppermost lexical scope (see
6c7226e9 360Section 7.3.1), or in an uppermost dynamic scope (see Section 7.3.2).
fdf2bb05
MD
361The type selection is indicated by the mapping from the enumeration
362value to the string used as variant type selector. The field to use as
363tag is specified by the "tag_field", specified between "< >" after the
364"variant" keyword for unnamed variants, and after "variant name" for
365named variants.
fcba70d4
MD
366
367The alignment of the variant is the alignment of the type as selected by the tag
368value for the specific instance of the variant. The alignment of the type
369containing the variant is independent of the variant alignment. The size of the
370variant is the size as selected by the tag value for the specific instance of
371the variant.
372
373A named variant declaration followed by its definition within a structure
374declaration:
375
376variant name {
377 field_type sel1;
378 field_type sel2;
379 field_type sel3;
380 ...
381};
382
383struct {
a9b83695 384 enum : integer_type { sel1, sel2, sel3, ... } tag_field;
fcba70d4
MD
385 ...
386 variant name <tag_field> v;
387}
388
389An unnamed variant definition within a structure is expressed by the following
390metadata:
391
392struct {
a9b83695 393 enum : integer_type { sel1, sel2, sel3, ... } tag_field;
fcba70d4
MD
394 ...
395 variant <tag_field> {
396 field_type sel1;
397 field_type sel2;
398 field_type sel3;
399 ...
400 } v;
401}
402
403Example of a named variant within a sequence that refers to a single tag field:
404
405variant example {
406 uint32_t a;
407 uint64_t b;
408 short c;
409};
410
411struct {
a9b83695 412 enum : uint2_t { a, b, c } choice;
15850440 413 variant example <choice> v[unsigned int];
fcba70d4
MD
414}
415
416Example of an unnamed variant:
417
418struct {
a9b83695 419 enum : uint2_t { a, b, c, d } choice;
fcba70d4
MD
420 /* Unrelated fields can be added between the variant and its tag */
421 int32_t somevalue;
422 variant <choice> {
423 uint32_t a;
424 uint64_t b;
425 short c;
426 struct {
427 unsigned int field1;
428 uint64_t field2;
429 } d;
430 } s;
431}
432
433Example of an unnamed variant within an array:
434
435struct {
a9b83695 436 enum : uint2_t { a, b, c } choice;
fcba70d4
MD
437 variant <choice> {
438 uint32_t a;
439 uint64_t b;
440 short c;
15850440 441 } v[10];
fcba70d4
MD
442}
443
444Example of a variant type definition within a structure, where the defined type
445is then declared within an array of structures. This variant refers to a tag
446located in an upper lexical scope. This example clearly shows that a variant
447type definition referring to the tag "x" uses the closest preceding field from
448the lexical scope of the type definition.
449
450struct {
a9b83695 451 enum : uint2_t { a, b, c, d } x;
fcba70d4
MD
452
453 typedef variant <x> { /*
454 * "x" refers to the preceding "x" enumeration in the
455 * lexical scope of the type definition.
456 */
457 uint32_t a;
458 uint64_t b;
459 short c;
460 } example_variant;
461
462 struct {
a9b83695 463 enum : int { x, y, z } x; /* This enumeration is not used by "v". */
fcba70d4 464 example_variant v; /*
a9b83695 465 * "v" uses the "enum : uint2_t { a, b, c, d }"
fcba70d4
MD
466 * tag.
467 */
468 } a[10];
469}
470
4714.2.3 Arrays
5ba9f198
MD
472
473Arrays are fixed-length. Their length is declared in the type declaration within
474the metadata. They contain an array of "inner type" elements, which can refer to
475any type not containing the type of the array being declared (no circular
3bf79539 476dependency). The length is the number of elements in an array.
5ba9f198 477
2152348f 478Metadata representation of a named array:
80fd2569
MD
479
480typedef elem_type name[length];
5ba9f198 481
2152348f 482A nameless array can be declared as a field type within a structure, e.g.:
5ba9f198 483
2152348f 484 uint8_t field_name[10];
80fd2569 485
5ba9f198 486
fcba70d4 4874.2.4 Sequences
5ba9f198
MD
488
489Sequences are dynamically-sized arrays. They start with an integer that specify
490the length of the sequence, followed by an array of "inner type" elements.
3bf79539 491The length is the number of elements in the sequence.
5ba9f198 492
2152348f 493Metadata representation for a named sequence:
80fd2569
MD
494
495typedef elem_type name[length_type];
496
497A nameless sequence can be declared as a field type, e.g.:
498
80fd2569
MD
499long field_name[int];
500
501The length type follows the integer types specifications, and the sequence
5ba9f198
MD
502elements follow the "array" specifications.
503
fcba70d4 5044.2.5 Strings
5ba9f198
MD
505
506Strings are an array of bytes of variable size and are terminated by a '\0'
507"NULL" character. Their encoding is described in the metadata. In absence of
508encoding attribute information, the default encoding is UTF-8.
509
80fd2569
MD
510Metadata representation of a named string type:
511
359894ac 512typealias string {
5ba9f198 513 encoding = UTF8 OR ASCII;
38b8da21 514} := name;
5ba9f198 515
80fd2569
MD
516A nameless string type can be declared as a field type:
517
518string field_name; /* Use default UTF8 encoding */
5ba9f198 519
3bf79539
MD
5205. Event Packet Header
521
522The event packet header consists of two part: one is mandatory and have a fixed
523layout. The second part, the "event packet context", has its layout described in
524the metadata.
5ba9f198 525
3bf79539
MD
526- Aligned on page size. Fixed size. Fields either aligned or packed (depending
527 on the architecture preference).
528 No padding at the end of the event packet header. Native architecture byte
5ba9f198 529 ordering.
3bf79539
MD
530
531Fixed layout (event packet header):
532
58997e9e
MD
533- Magic number (CTF magic number: 0xC1FC1FC1 This magic number specifies
534 that we use the CTF metadata description language described in this
535 document. Different magic numbers should be used for other metadata
536 description languages.
3bf79539 537- Trace UUID, used to ensure the event packet match the metadata used.
5ba9f198
MD
538 (note: we cannot use a metadata checksum because metadata can be appended to
539 while tracing is active)
3bf79539
MD
540- Stream ID, used as reference to stream description in metadata.
541
542Metadata-defined layout (event packet context):
543
544- Event packet content size (in bytes).
545- Event packet size (in bytes, includes padding).
546- Event packet content checksum (optional). Checksum excludes the event packet
547 header.
548- Per-stream event packet sequence count (to deal with UDP packet loss). The
549 number of significant sequence counter bits should also be present, so
b11853af 550 wrap-arounds are dealt with correctly.
3bf79539
MD
551- Timestamp at the beginning and timestamp at the end of the event packet.
552 Both timestamps are written in the packet header, but sampled respectively
553 while (or before) writing the first event and while (or after) writing the
554 last event in the packet. The inclusive range between these timestamps should
555 include all event timestamps assigned to events contained within the packet.
5ba9f198 556- Events discarded count
3bf79539
MD
557 - Snapshot of a per-stream free-running counter, counting the number of
558 events discarded that were supposed to be written in the stream prior to
559 the first event in the event packet.
5ba9f198 560 * Note: producer-consumer buffer full condition should fill the current
3bf79539 561 event packet with padding so we know exactly where events have been
5ba9f198 562 discarded.
3bf79539
MD
563- Lossless compression scheme used for the event packet content. Applied
564 directly to raw data. New types of compression can be added in following
565 versions of the format.
5ba9f198
MD
566 0: no compression scheme
567 1: bzip2
568 2: gzip
3bf79539
MD
569 3: xz
570- Cypher used for the event packet content. Applied after compression.
5ba9f198
MD
571 0: no encryption
572 1: AES
3bf79539 573- Checksum scheme used for the event packet content. Applied after encryption.
5ba9f198
MD
574 0: no checksum
575 1: md5
576 2: sha1
577 3: crc32
578
3bf79539
MD
5795.1 Event Packet Header Fixed Layout Description
580
fc5425db
MD
581The event packet header layout is indicated by the trace packet.header
582field. Here is an example structure type for the packet header with the
583fields typically expected:
584
80fd2569
MD
585struct event_packet_header {
586 uint32_t magic;
587 uint8_t trace_uuid[16];
3bf79539 588 uint32_t stream_id;
80fd2569 589};
5ba9f198 590
fc5425db
MD
591trace {
592 ...
593 packet.header := struct event_packet_header;
594};
595
37b39e47
MD
596If the trace_uuid is not present, no validation that the metadata
597actually corresponds to the stream is performed.
598
599If the stream_id packet header field is missing, the trace can only
600contain a single stream. Its "id" field can be left out, and its events
601don't need to declare a "stream_id" field.
602
603
3bf79539
MD
6045.2 Event Packet Context Description
605
606Event packet context example. These are declared within the stream declaration
6a7c61df
MD
607in the metadata. All these fields are optional. If the packet size field is
608missing, the whole stream only contains a single packet. If the content
f6b81726
MD
609size field is missing, the packet is filled (no padding). The content
610and packet sizes include all headers.
3bf79539
MD
611
612An example event packet context type:
613
80fd2569 614struct event_packet_context {
3bf79539
MD
615 uint64_t timestamp_begin;
616 uint64_t timestamp_end;
617 uint32_t checksum;
618 uint32_t stream_packet_count;
619 uint32_t events_discarded;
620 uint32_t cpu_id;
621 uint32_t/uint16_t content_size;
622 uint32_t/uint16_t packet_size;
623 uint8_t stream_packet_count_bits; /* Significant counter bits */
624 uint8_t compression_scheme;
625 uint8_t encryption_scheme;
3b0f8e4d 626 uint8_t checksum_scheme;
3bf79539 627};
5ba9f198 628
fcba70d4 629
5ba9f198
MD
6306. Event Structure
631
632The overall structure of an event is:
633
fcba70d4 6341 - Stream Packet Context (as specified by the stream metadata)
fdf2bb05
MD
635 2 - Event Header (as specified by the stream metadata)
636 3 - Stream Event Context (as specified by the stream metadata)
637 4 - Event Context (as specified by the event metadata)
638 5 - Event Payload (as specified by the event metadata)
5ba9f198 639
fdf2bb05 640This structure defines an implicit dynamic scoping, where variants
7d9d7e92
MD
641located in inner structures (those with a higher number in the listing
642above) can refer to the fields of outer structures (with lower number in
6c7226e9 643the listing above). See Section 7.3 TSDL Scopes for more detail.
5ba9f198 644
fdf2bb05 6456.1 Event Header
fcba70d4
MD
646
647Event headers can be described within the metadata. We hereby propose, as an
648example, two types of events headers. Type 1 accommodates streams with less than
64931 event IDs. Type 2 accommodates streams with 31 or more event IDs.
5ba9f198 650
3bf79539
MD
651One major factor can vary between streams: the number of event IDs assigned to
652a stream. Luckily, this information tends to stay relatively constant (modulo
5ba9f198 653event registration while trace is being recorded), so we can specify different
3bf79539 654representations for streams containing few event IDs and streams containing
5ba9f198
MD
655many event IDs, so we end up representing the event ID and timestamp as densely
656as possible in each case.
657
fcba70d4
MD
658The header is extended in the rare occasions where the information cannot be
659represented in the ranges available in the standard event header. They are also
3bf79539
MD
660used in the rare occasions where the data required for a field could not be
661collected: the flag corresponding to the missing field within the missing_fields
662array is then set to 1.
5ba9f198
MD
663
664Types uintX_t represent an X-bit unsigned integer.
665
666
fdf2bb05 6676.1.1 Type 1 - Few event IDs
5ba9f198
MD
668
669 - Aligned on 32-bit (or 8-bit if byte-packed, depending on the architecture
670 preference).
5ba9f198 671 - Native architecture byte ordering.
fcba70d4
MD
672 - For "compact" selection
673 - Fixed size: 32 bits.
674 - For "extended" selection
675 - Size depends on the architecture and variant alignment.
5ba9f198 676
80fd2569 677struct event_header_1 {
fcba70d4
MD
678 /*
679 * id: range: 0 - 30.
680 * id 31 is reserved to indicate an extended header.
681 */
a9b83695 682 enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
fcba70d4
MD
683 variant <id> {
684 struct {
685 uint27_t timestamp;
686 } compact;
687 struct {
688 uint32_t id; /* 32-bit event IDs */
689 uint64_t timestamp; /* 64-bit timestamps */
690 } extended;
691 } v;
5ba9f198
MD
692};
693
5ba9f198 694
fdf2bb05 6956.1.2 Type 2 - Many event IDs
5ba9f198 696
fcba70d4 697 - Aligned on 16-bit (or 8-bit if byte-packed, depending on the architecture
5ba9f198 698 preference).
5ba9f198 699 - Native architecture byte ordering.
fcba70d4
MD
700 - For "compact" selection
701 - Size depends on the architecture and variant alignment.
702 - For "extended" selection
703 - Size depends on the architecture and variant alignment.
5ba9f198 704
80fd2569 705struct event_header_2 {
fcba70d4
MD
706 /*
707 * id: range: 0 - 65534.
708 * id 65535 is reserved to indicate an extended header.
709 */
a9b83695 710 enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
fcba70d4
MD
711 variant <id> {
712 struct {
713 uint32_t timestamp;
714 } compact;
715 struct {
716 uint32_t id; /* 32-bit event IDs */
717 uint64_t timestamp; /* 64-bit timestamps */
718 } extended;
719 } v;
5ba9f198
MD
720};
721
5ba9f198
MD
722
7236.2 Event Context
724
725The event context contains information relative to the current event. The choice
fcba70d4
MD
726and meaning of this information is specified by the metadata "stream" and
727"event" information. The "stream" context is applied to all events within the
728stream. The "stream" context structure follows the event header. The "event"
729context is applied to specific events. Its structure follows the "stream"
730context stucture.
5ba9f198 731
fcba70d4
MD
732An example of stream-level event context is to save the event payload size with
733each event, or to save the current PID with each event. These are declared
734within the stream declaration within the metadata:
5ba9f198 735
fcba70d4
MD
736 stream {
737 ...
738 event {
739 ...
4fa992a5 740 context := struct {
80fd2569
MD
741 uint pid;
742 uint16_t payload_size;
3bf79539 743 };
fcba70d4
MD
744 }
745 };
746
747An example of event-specific event context is to declare a bitmap of missing
748fields, only appended after the stream event context if the extended event
749header is selected. NR_FIELDS is the number of fields within the event (a
750numeric value).
5ba9f198 751
fcba70d4
MD
752 event {
753 context = struct {
754 variant <id> {
755 struct { } compact;
756 struct {
757 uint1_t missing_fields[NR_FIELDS]; /* missing event fields bitmap */
758 } extended;
759 } v;
760 };
761 ...
762 }
5ba9f198
MD
763
7646.3 Event Payload
765
766An event payload contains fields specific to a given event type. The fields
767belonging to an event type are described in the event-specific metadata
768within a structure type.
769
7706.3.1 Padding
771
772No padding at the end of the event payload. This differs from the ISO/C standard
773for structures, but follows the CTF standard for structures. In a trace, even
774though it makes sense to align the beginning of a structure, it really makes no
775sense to add padding at the end of the structure, because structures are usually
776not followed by a structure of the same type.
777
778This trick can be done by adding a zero-length "end" field at the end of the C
779structures, and by using the offset of this field rather than using sizeof()
3bf79539 780when calculating the size of a structure (see Appendix "A. Helper macros").
5ba9f198
MD
781
7826.3.2 Alignment
783
784The event payload is aligned on the largest alignment required by types
785contained within the payload. (This follows the ISO/C standard for structures)
786
787
6c7226e9
MD
7887. Trace Stream Description Language (TSDL)
789
790The Trace Stream Description Language (TSDL) allows expression of the
791binary trace streams layout in a C99-like Domain Specific Language
792(DSL).
793
794
7957.1 Metadata
796
797The trace stream layout description is located in the trace meta-data.
798The meta-data is itself located in a stream identified by its name:
799"metadata".
5ba9f198 800
4fafe1ad
MD
801It is made of "event packets", which each start with an event packet
802header. The event type within the metadata stream have no event header
6c7226e9
MD
803nor event context. Each event only contains a "string" payload without
804any null-character. The events are packed one next to another. Each
805event packet start with an event packet header, which contains, amongst
806other fields, the magic number, trace UUID and packet length. In the
807event packet header, the trace UUID is represented as an array of bytes.
808Within the string-based metadata description, the trace UUID is
809represented as a string of hexadecimal digits and dashes "-".
4fafe1ad 810
6c7226e9
MD
811The metadata can be parsed by reading characters within the metadata
812stream, for each packet starting after the packet header, for the length
813of the packet payload specified in the header. Text contained within
814"/*" and "*/", as well as within "//" and end of line, are treated as
815comments. Boolean values can be represented as true, TRUE, or 1 for
816true, and false, FALSE, or 0 for false.
fcba70d4 817
fdf2bb05 818
6c7226e9 8197.2 Declaration vs Definition
fdf2bb05
MD
820
821A declaration associates a layout to a type, without specifying where
822this type is located in the event structure hierarchy (see Section 6).
823This therefore includes typedef, typealias, as well as all type
824specifiers. In certain circumstances (typedef, structure field and
825variant field), a declaration is followed by a declarator, which specify
826the newly defined type name (for typedef), or the field name (for
827declarations located within structure and variants). Array and sequence,
828declared with square brackets ("[" "]"), are part of the declarator,
a9b83695 829similarly to C99. The enumeration base type is specified by
6c7226e9 830": enum_base", which is part of the type specifier. The variant tag
a9b83695 831name, specified between "<" ">", is also part of the type specifier.
fdf2bb05
MD
832
833A definition associates a type to a location in the event structure
b9606a77
MD
834hierarchy (see Section 6). This association is denoted by ":=", as shown
835in Section 7.3.
fdf2bb05
MD
836
837
6c7226e9 8387.3 TSDL Scopes
fdf2bb05 839
6c7226e9
MD
840TSDL uses two different types of scoping: a lexical scope is used for
841declarations and type definitions, and a dynamic scope is used for
842variants references to tag fields.
fdf2bb05 843
6c7226e9 8447.3.1 Lexical Scope
fdf2bb05 845
d285084f
MD
846Each of "trace", "stream", "event", "struct" and "variant" have their own
847nestable declaration scope, within which types can be declared using "typedef"
fdf2bb05 848and "typealias". A root declaration scope also contains all declarations
7d9d7e92 849located outside of any of the aforementioned declarations. An inner
fdf2bb05 850declaration scope can refer to type declared within its container
7d9d7e92
MD
851lexical scope prior to the inner declaration scope. Redefinition of a
852typedef or typealias is not valid, although hiding an upper scope
fdf2bb05
MD
853typedef or typealias is allowed within a sub-scope.
854
6c7226e9 8557.3.2 Dynamic Scope
fdf2bb05 856
7d9d7e92
MD
857A dynamic scope consists in the lexical scope augmented with the
858implicit event structure definition hierarchy presented at Section 6.
859The dynamic scope is only used for variant tag definitions. It is used
860at definition time to look up the location of the tag field associated
861with a variant.
862
863Therefore, variants in lower levels in the dynamic scope (e.g. event
864context) can refer to a tag field located in upper levels (e.g. in the
865event header) by specifying, in this case, the associated tag with
866<header.field_name>. This allows, for instance, the event context to
867define a variant referring to the "id" field of the event header as
868selector.
fdf2bb05
MD
869
870The target dynamic scope must be specified explicitly when referring to
871a field outside of the local static scope. The dynamic scope prefixes
872are thus:
873
e0d9e2c7 874 - Trace Packet Header: <trace.packet.header. >,
7d9d7e92
MD
875 - Stream Packet Context: <stream.packet.context. >,
876 - Event Header: <stream.event.header. >,
877 - Stream Event Context: <stream.event.context. >,
878 - Event Context: <event.context. >,
879 - Event Payload: <event.fields. >.
fdf2bb05
MD
880
881Multiple declarations of the same field name within a single scope is
882not valid. It is however valid to re-use the same field name in
883different scopes. There is no possible conflict, because the dynamic
884scope must be specified when a variant refers to a tag field located in
885a different dynamic scope.
886
457d8b0a
MD
887The information available in the dynamic scopes can be thought of as the
888current tracing context. At trace production, information about the
889current context is saved into the specified scope field levels. At trace
890consumption, for each event, the current trace context is therefore
891readable by accessing the upper dynamic scopes.
892
fdf2bb05 893
6c7226e9 8947.4 TSDL Examples
d285084f 895
6c7226e9
MD
896The grammar representing the TSDL metadata is presented in Appendix C.
897TSDL Grammar. This section presents a rather ligher reading that
969f30c0
MD
898consists in examples of TSDL metadata, with template values.
899
350bb633
MD
900The stream "id" can be left out if there is only one stream in the
901trace. The event "id" field can be left out if there is only one event
902in a stream.
903
5ba9f198 904trace {
fdf2bb05 905 major = value; /* Trace format version */
5ba9f198 906 minor = value;
fdf2bb05 907 uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"; /* Trace UUID */
58997e9e 908 byte_order = be OR le; /* Endianness (required) */
fc5425db
MD
909 packet.header := struct {
910 uint32_t magic;
911 uint8_t trace_uuid[16];
912 uint32_t stream_id;
913 };
3bf79539 914};
5ba9f198 915
3bf79539
MD
916stream {
917 id = stream_id;
fdf2bb05 918 /* Type 1 - Few event IDs; Type 2 - Many event IDs. See section 6.1. */
4fa992a5
MD
919 event.header := event_header_1 OR event_header_2;
920 event.context := struct {
77a98c82 921 ...
3bf79539 922 };
4fa992a5 923 packet.context := struct {
77a98c82 924 ...
3bf79539
MD
925 };
926};
5ba9f198
MD
927
928event {
3d13ef1a 929 name = event_name;
3bf79539
MD
930 id = value; /* Numeric identifier within the stream */
931 stream = stream_id;
4fa992a5 932 context := struct {
fcba70d4
MD
933 ...
934 };
4fa992a5 935 fields := struct {
80fd2569
MD
936 ...
937 };
3bf79539 938};
5ba9f198
MD
939
940/* More detail on types in section 4. Types */
941
3d13ef1a
MD
942/*
943 * Named types:
944 *
4fa992a5 945 * Type declarations behave similarly to the C standard.
3d13ef1a
MD
946 */
947
80af8ac6 948typedef aliased_type_specifiers new_type_declarators;
2152348f 949
3d13ef1a 950/* e.g.: typedef struct example new_type_name[10]; */
80fd2569 951
4fa992a5
MD
952/*
953 * typealias
954 *
955 * The "typealias" declaration can be used to give a name (including
80af8ac6
MD
956 * pointer declarator specifier) to a type. It should also be used to
957 * map basic C types (float, int, unsigned long, ...) to a CTF type.
958 * Typealias is a superset of "typedef": it also allows assignment of a
38b8da21 959 * simple variable identifier to a type.
4fa992a5
MD
960 */
961
962typealias type_class {
80fd2569 963 ...
38b8da21 964} := type_specifiers type_declarator;
2152348f 965
3d13ef1a
MD
966/*
967 * e.g.:
4fa992a5 968 * typealias integer {
3d13ef1a
MD
969 * size = 32;
970 * align = 32;
971 * signed = false;
38b8da21 972 * } := struct page *;
359894ac
MD
973 *
974 * typealias integer {
975 * size = 32;
976 * align = 32;
977 * signed = true;
38b8da21 978 * } := int;
3d13ef1a 979 */
80fd2569
MD
980
981struct name {
3bf79539
MD
982 ...
983};
5ba9f198 984
fcba70d4
MD
985variant name {
986 ...
987};
988
a9b83695 989enum name : integer_type {
3bf79539
MD
990 ...
991};
992
2152348f 993
4fa992a5
MD
994/*
995 * Unnamed types, contained within compound type fields, typedef or typealias.
996 */
2152348f 997
80fd2569
MD
998struct {
999 ...
2152348f 1000}
5ba9f198 1001
fcba70d4
MD
1002variant {
1003 ...
1004}
1005
a9b83695 1006enum : integer_type {
80fd2569 1007 ...
2152348f
MD
1008}
1009
1010typedef type new_type[length];
3bf79539 1011
2152348f
MD
1012struct {
1013 type field_name[length];
1014}
1015
1016typedef type new_type[length_type];
1017
1018struct {
1019 type field_name[length_type];
1020}
1021
1022integer {
80fd2569 1023 ...
2152348f 1024}
3bf79539 1025
2152348f 1026floating_point {
80fd2569 1027 ...
2152348f
MD
1028}
1029
1030struct {
1031 integer_type field_name:size; /* GNU/C bitfield */
1032}
1033
1034struct {
1035 string field_name;
1036}
3bf79539 1037
fcba70d4 1038
3bf79539 1039A. Helper macros
5ba9f198
MD
1040
1041The two following macros keep track of the size of a GNU/C structure without
1042padding at the end by placing HEADER_END as the last field. A one byte end field
1043is used for C90 compatibility (C99 flexible arrays could be used here). Note
1044that this does not affect the effective structure size, which should always be
1045calculated with the header_sizeof() helper.
1046
1047#define HEADER_END char end_field
1048#define header_sizeof(type) offsetof(typeof(type), end_field)
3bf79539
MD
1049
1050
1051B. Stream Header Rationale
1052
1053An event stream is divided in contiguous event packets of variable size. These
1054subdivisions allow the trace analyzer to perform a fast binary search by time
1055within the stream (typically requiring to index only the event packet headers)
1056without reading the whole stream. These subdivisions have a variable size to
1057eliminate the need to transfer the event packet padding when partially filled
1058event packets must be sent when streaming a trace for live viewing/analysis.
1059An event packet can contain a certain amount of padding at the end. Dividing
1060streams into event packets is also useful for network streaming over UDP and
1061flight recorder mode tracing (a whole event packet can be swapped out of the
1062buffer atomically for reading).
1063
1064The stream header is repeated at the beginning of each event packet to allow
1065flexibility in terms of:
1066
1067 - streaming support,
1068 - allowing arbitrary buffers to be discarded without making the trace
1069 unreadable,
1070 - allow UDP packet loss handling by either dealing with missing event packet
1071 or asking for re-transmission.
1072 - transparently support flight recorder mode,
1073 - transparently support crash dump.
1074
1075The event stream header will therefore be referred to as the "event packet
1076header" throughout the rest of this document.
fcba70d4 1077
6c7226e9
MD
1078
1079C. TSDL Grammar
fcba70d4 1080
4fa992a5 1081/*
6c7226e9 1082 * Common Trace Format (CTF) Trace Stream Description Language (TSDL) Grammar.
4fa992a5
MD
1083 *
1084 * Inspired from the C99 grammar:
1085 * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf (Annex A)
6c7226e9
MD
1086 * and c++1x grammar (draft)
1087 * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3291.pdf (Annex A)
4fa992a5
MD
1088 *
1089 * Specialized for CTF needs by including only constant and declarations from
1090 * C99 (excluding function declarations), and by adding support for variants,
6c7226e9
MD
1091 * sequences and CTF-specific specifiers. Enumeration container types
1092 * semantic is inspired from c++1x enum-base.
4fa992a5
MD
1093 */
1094
10951) Lexical grammar
1096
10971.1) Lexical elements
1098
1099token:
1100 keyword
1101 identifier
1102 constant
1103 string-literal
1104 punctuator
1105
11061.2) Keywords
1107
1108keyword: is one of
1109
1110const
1111char
1112double
1113enum
1114event
1115floating_point
1116float
1117integer
1118int
1119long
1120short
1121signed
1122stream
1123string
1124struct
1125trace
3e1e1a78 1126typealias
4fa992a5
MD
1127typedef
1128unsigned
1129variant
1130void
1131_Bool
1132_Complex
1133_Imaginary
1134
1135
11361.3) Identifiers
1137
1138identifier:
1139 identifier-nondigit
1140 identifier identifier-nondigit
1141 identifier digit
1142
1143identifier-nondigit:
1144 nondigit
1145 universal-character-name
1146 any other implementation-defined characters
1147
1148nondigit:
1149 _
1150 [a-zA-Z] /* regular expression */
1151
1152digit:
1153 [0-9] /* regular expression */
1154
11551.4) Universal character names
1156
1157universal-character-name:
1158 \u hex-quad
1159 \U hex-quad hex-quad
1160
1161hex-quad:
1162 hexadecimal-digit hexadecimal-digit hexadecimal-digit hexadecimal-digit
1163
11641.5) Constants
1165
1166constant:
1167 integer-constant
1168 enumeration-constant
1169 character-constant
1170
1171integer-constant:
1172 decimal-constant integer-suffix-opt
1173 octal-constant integer-suffix-opt
1174 hexadecimal-constant integer-suffix-opt
1175
1176decimal-constant:
1177 nonzero-digit
1178 decimal-constant digit
1179
1180octal-constant:
1181 0
1182 octal-constant octal-digit
1183
1184hexadecimal-constant:
1185 hexadecimal-prefix hexadecimal-digit
1186 hexadecimal-constant hexadecimal-digit
1187
1188hexadecimal-prefix:
1189 0x
1190 0X
1191
1192nonzero-digit:
1193 [1-9]
1194
1195integer-suffix:
1196 unsigned-suffix long-suffix-opt
1197 unsigned-suffix long-long-suffix
1198 long-suffix unsigned-suffix-opt
1199 long-long-suffix unsigned-suffix-opt
1200
1201unsigned-suffix:
1202 u
1203 U
1204
1205long-suffix:
1206 l
1207 L
1208
1209long-long-suffix:
1210 ll
1211 LL
1212
1213digit-sequence:
1214 digit
1215 digit-sequence digit
1216
1217hexadecimal-digit-sequence:
1218 hexadecimal-digit
1219 hexadecimal-digit-sequence hexadecimal-digit
1220
1221enumeration-constant:
1222 identifier
1223 string-literal
1224
1225character-constant:
1226 ' c-char-sequence '
1227 L' c-char-sequence '
1228
1229c-char-sequence:
1230 c-char
1231 c-char-sequence c-char
1232
1233c-char:
1234 any member of source charset except single-quote ('), backslash
1235 (\), or new-line character.
1236 escape-sequence
1237
1238escape-sequence:
1239 simple-escape-sequence
1240 octal-escape-sequence
1241 hexadecimal-escape-sequence
1242 universal-character-name
1243
1244simple-escape-sequence: one of
1245 \' \" \? \\ \a \b \f \n \r \t \v
1246
1247octal-escape-sequence:
1248 \ octal-digit
1249 \ octal-digit octal-digit
1250 \ octal-digit octal-digit octal-digit
1251
1252hexadecimal-escape-sequence:
1253 \x hexadecimal-digit
1254 hexadecimal-escape-sequence hexadecimal-digit
1255
12561.6) String literals
1257
1258string-literal:
1259 " s-char-sequence-opt "
1260 L" s-char-sequence-opt "
1261
1262s-char-sequence:
1263 s-char
1264 s-char-sequence s-char
1265
1266s-char:
1267 any member of source charset except double-quote ("), backslash
1268 (\), or new-line character.
1269 escape-sequence
1270
12711.7) Punctuators
1272
1273punctuator: one of
1274 [ ] ( ) { } . -> * + - < > : ; ... = ,
1275
1276
12772) Phrase structure grammar
1278
1279primary-expression:
1280 identifier
1281 constant
1282 string-literal
1283 ( unary-expression )
1284
1285postfix-expression:
1286 primary-expression
1287 postfix-expression [ unary-expression ]
1288 postfix-expression . identifier
1289 postfix-expressoin -> identifier
1290
1291unary-expression:
1292 postfix-expression
1293 unary-operator postfix-expression
1294
1295unary-operator: one of
1296 + -
1297
4fa992a5
MD
1298assignment-operator:
1299 =
1300
b9606a77
MD
1301type-assignment-operator:
1302 :=
1303
4fa992a5
MD
1304constant-expression:
1305 unary-expression
1306
1307constant-expression-range:
1308 constant-expression ... constant-expression
1309
13102.2) Declarations:
1311
1312declaration:
689e04b4 1313 declaration-specifiers declarator-list-opt ;
4fa992a5
MD
1314 ctf-specifier ;
1315
1316declaration-specifiers:
689e04b4 1317 storage-class-specifier declaration-specifiers-opt
4fa992a5
MD
1318 type-specifier declaration-specifiers-opt
1319 type-qualifier declaration-specifiers-opt
1320
1321declarator-list:
1322 declarator
1323 declarator-list , declarator
1324
d285084f
MD
1325abstract-declarator-list:
1326 abstract-declarator
1327 abstract-declarator-list , abstract-declarator
1328
4fa992a5
MD
1329storage-class-specifier:
1330 typedef
1331
1332type-specifier:
1333 void
1334 char
1335 short
1336 int
1337 long
1338 float
1339 double
1340 signed
1341 unsigned
1342 _Bool
1343 _Complex
cfdd51ec 1344 _Imaginary
9dfcfc0f
MD
1345 struct-specifier
1346 variant-specifier
4fa992a5
MD
1347 enum-specifier
1348 typedef-name
1349 ctf-type-specifier
1350
1351struct-specifier:
3b0f8e4d 1352 struct identifier-opt { struct-or-variant-declaration-list-opt }
4fa992a5
MD
1353 struct identifier
1354
1355struct-or-variant-declaration-list:
1356 struct-or-variant-declaration
1357 struct-or-variant-declaration-list struct-or-variant-declaration
1358
1359struct-or-variant-declaration:
1360 specifier-qualifier-list struct-or-variant-declarator-list ;
550aca33 1361 declaration-specifiers storage-class-specifier declaration-specifiers declarator-list ;
38b8da21
MD
1362 typealias declaration-specifiers abstract-declarator-list := declaration-specifiers abstract-declarator-list ;
1363 typealias declaration-specifiers abstract-declarator-list := declarator-list ;
4fa992a5
MD
1364
1365specifier-qualifier-list:
1366 type-specifier specifier-qualifier-list-opt
1367 type-qualifier specifier-qualifier-list-opt
1368
1369struct-or-variant-declarator-list:
1370 struct-or-variant-declarator
1371 struct-or-variant-declarator-list , struct-or-variant-declarator
1372
1373struct-or-variant-declarator:
1374 declarator
1375 declarator-opt : constant-expression
1376
1377variant-specifier:
1378 variant identifier-opt variant-tag-opt { struct-or-variant-declaration-list }
1379 variant identifier variant-tag
1380
1381variant-tag:
1382 < identifier >
1383
1384enum-specifier:
1385 enum identifier-opt { enumerator-list }
1386 enum identifier-opt { enumerator-list , }
1387 enum identifier
a9b83695
MD
1388 enum identifier-opt : declaration-specifiers { enumerator-list }
1389 enum identifier-opt : declaration-specifiers { enumerator-list , }
4fa992a5
MD
1390
1391enumerator-list:
1392 enumerator
1393 enumerator-list , enumerator
1394
1395enumerator:
1396 enumeration-constant
1397 enumeration-constant = constant-expression
1398 enumeration-constant = constant-expression-range
1399
1400type-qualifier:
1401 const
1402
1403declarator:
1404 pointer-opt direct-declarator
1405
1406direct-declarator:
1407 identifier
1408 ( declarator )
1409 direct-declarator [ type-specifier ]
1410 direct-declarator [ constant-expression ]
1411
d285084f
MD
1412abstract-declarator:
1413 pointer-opt direct-abstract-declarator
1414
1415direct-abstract-declarator:
1416 identifier-opt
1417 ( abstract-declarator )
1418 direct-abstract-declarator [ type-specifier ]
1419 direct-abstract-declarator [ constant-expression ]
1420 direct-abstract-declarator [ ]
1421
4fa992a5 1422pointer:
3b0f8e4d
MD
1423 * type-qualifier-list-opt
1424 * type-qualifier-list-opt pointer
4fa992a5
MD
1425
1426type-qualifier-list:
1427 type-qualifier
1428 type-qualifier-list type-qualifier
1429
4fa992a5
MD
1430typedef-name:
1431 identifier
1432
14332.3) CTF-specific declarations
1434
1435ctf-specifier:
1436 event { ctf-assignment-expression-list-opt }
1437 stream { ctf-assignment-expression-list-opt }
1438 trace { ctf-assignment-expression-list-opt }
38b8da21
MD
1439 typealias declaration-specifiers abstract-declarator-list := declaration-specifiers abstract-declarator-list ;
1440 typealias declaration-specifiers abstract-declarator-list := declarator-list ;
4fa992a5
MD
1441
1442ctf-type-specifier:
1443 floating_point { ctf-assignment-expression-list-opt }
1444 integer { ctf-assignment-expression-list-opt }
1445 string { ctf-assignment-expression-list-opt }
1446
1447ctf-assignment-expression-list:
1448 ctf-assignment-expression
1449 ctf-assignment-expression-list ; ctf-assignment-expression
1450
1451ctf-assignment-expression:
1452 unary-expression assignment-operator unary-expression
1453 unary-expression type-assignment-operator type-specifier
550aca33 1454 declaration-specifiers storage-class-specifier declaration-specifiers declarator-list
38b8da21
MD
1455 typealias declaration-specifiers abstract-declarator-list := declaration-specifiers abstract-declarator-list
1456 typealias declaration-specifiers abstract-declarator-list := declarator-list
This page took 0.094699 seconds and 4 git commands to generate.