X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=common-trace-format-proposal.txt;h=238fbadfead6c69709bcffad007f8478d558dd67;hb=2e7d7fcb288895571a682e1ae3344d15578b1f55;hp=dd1996ae498749e27fcbff6f592f41b511afb9ab;hpb=ec4404a7302479761f14e36a567b57692d93b44d;p=ctf.git diff --git a/common-trace-format-proposal.txt b/common-trace-format-proposal.txt index dd1996a..238fbad 100644 --- a/common-trace-format-proposal.txt +++ b/common-trace-format-proposal.txt @@ -190,6 +190,9 @@ TSDL meta-data representation: byte_order = native OR network OR be OR le; /* default native */ size = value; /* value in bits, no default */ align = value; /* value in bits */ + /* based used for pretty-printing output, default: decimal. */ + base = decimal OR dec OR OR d OR i OR u OR 10 OR hexadecimal OR hex OR x OR X OR p OR 16 + OR octal OR oct OR o OR 8 OR binary OR b OR 2; } Example of type inheritance (creation of a uint32_t named type): @@ -381,11 +384,11 @@ A CTF variant is a selection between different types. A CTF variant must always be defined within the scope of a structure or within fields contained within a structure (defined recursively). A "tag" enumeration field must appear in either the same lexical scope, prior to the variant -field (in field declaration order), in an uppermost lexical scope (see -Section 7.3.1), or in an uppermost dynamic scope (see Section 7.3.2). -The type selection is indicated by the mapping from the enumeration -value to the string used as variant type selector. The field to use as -tag is specified by the "tag_field", specified between "< >" after the +field (in field declaration order), in an upper lexical scope (see +Section 7.3.1), or in an upper dynamic scope (see Section 7.3.2). The +type selection is indicated by the mapping from the enumeration value to +the string used as variant type selector. The field to use as tag is +specified by the "tag_field", specified between "< >" after the "variant" keyword for unnamed variants, and after "variant name" for named variants. @@ -435,7 +438,8 @@ variant example { struct { enum : uint2_t { a, b, c } choice; - variant example v[unsigned int]; + unsigned int seqlen; + variant example v[seqlen]; } Example of an unnamed variant: @@ -513,20 +517,51 @@ Arrays are always aligned on their element alignment requirement. 4.2.4 Sequences -Sequences are dynamically-sized arrays. They start with an integer that specify -the length of the sequence, followed by an array of "inner type" elements. -The length is the number of elements in the sequence. +Sequences are dynamically-sized arrays. They refer to a a "length" +unsigned integer field, which must appear in either the same lexical scope, +prior to the sequence field (in field declaration order), in an upper +lexical scope (see Section 7.3.1), or in an upper dynamic scope (see +Section 7.3.2). This length field represents the number of elements in +the sequence. The sequence per se is an array of "inner type" elements. -TSDL meta-data representation for a named sequence: +TSDL meta-data representation for a sequence type definition: -typedef elem_type name[length_type]; +struct { + unsigned int length_field; + typedef elem_type typename[length_field]; + typename seq_field_name; +} + +A sequence can also be declared as a field type, e.g.: + +struct { + unsigned int length_field; + long seq_field_name[length_field]; +} -A nameless sequence can be declared as a field type, e.g.: +Multiple sequences can refer to the same length field, and these length +fields can be in a different upper dynamic scope: -long field_name[int]; +e.g., assuming the stream.event.header defines: -The length type follows the integer types specifications, and the sequence -elements follow the "array" specifications. +stream { + ... + id = 1; + event.header := struct { + uint16_t seq_len; + }; +}; + +event { + ... + stream_id = 1; + fields := struct { + long seq_a[stream.event.header.seq_len]; + char seq_b[stream.event.header.seq_len]; + }; +}; + +The sequence elements follow the "array" specifications. 4.2.5 Strings @@ -901,7 +936,8 @@ in Section 7.3. TSDL uses two different types of scoping: a lexical scope is used for declarations and type definitions, and a dynamic scope is used for -variants references to tag fields. +variants references to tag fields and for sequence references to length +fields. 7.3.1 Lexical Scope @@ -918,16 +954,17 @@ typedef or typealias is allowed within a sub-scope. A dynamic scope consists in the lexical scope augmented with the implicit event structure definition hierarchy presented at Section 6. -The dynamic scope is only used for variant tag definitions. It is used -at definition time to look up the location of the tag field associated -with a variant. - -Therefore, variants in lower levels in the dynamic scope (e.g. event -context) can refer to a tag field located in upper levels (e.g. in the -event header) by specifying, in this case, the associated tag with -. This allows, for instance, the event context to -define a variant referring to the "id" field of the event header as -selector. +The dynamic scope is used for variant tag and sequence length +definitions. It is used at definition time to look up the location of +the tag field associated with a variant, and to lookup up the location +of the length field associated with a sequence. + +Therefore, variants (or sequences) in lower levels in the dynamic scope +(e.g. event context) can refer to a tag (or length) field located in +upper levels (e.g. in the event header) by specifying, in this case, the +associated tag with . This allows, for instance, the +event context to define a variant referring to the "id" field of the +event header as selector. The target dynamic scope must be specified explicitly when referring to a field outside of the local static scope. The dynamic scope prefixes @@ -1357,11 +1394,8 @@ assignment-operator: type-assignment-operator: := -constant-expression: - unary-expression - constant-expression-range: - constant-expression ... constant-expression + unary-expression ... unary-expression 2.2) Declarations: @@ -1405,7 +1439,7 @@ type-specifier: ctf-type-specifier align-attribute: - align ( constant-expression ) + align ( unary-expression ) struct-specifier: struct identifier-opt { struct-or-variant-declaration-list-opt } align-attribute-opt @@ -1431,7 +1465,7 @@ struct-or-variant-declarator-list: struct-or-variant-declarator: declarator - declarator-opt : constant-expression + declarator-opt : unary-expression variant-specifier: variant identifier-opt variant-tag-opt { struct-or-variant-declaration-list } @@ -1453,7 +1487,7 @@ enumerator-list: enumerator: enumeration-constant - enumeration-constant = constant-expression + enumeration-constant = unary-expression enumeration-constant = constant-expression-range type-qualifier: @@ -1465,8 +1499,7 @@ declarator: direct-declarator: identifier ( declarator ) - direct-declarator [ type-specifier ] - direct-declarator [ constant-expression ] + direct-declarator [ unary-expression ] abstract-declarator: pointer-opt direct-abstract-declarator @@ -1474,8 +1507,7 @@ abstract-declarator: direct-abstract-declarator: identifier-opt ( abstract-declarator ) - direct-abstract-declarator [ type-specifier ] - direct-abstract-declarator [ constant-expression ] + direct-abstract-declarator [ unary-expression ] direct-abstract-declarator [ ] pointer: