As per CTF 1.8.3:
> Enumerations need to contain at least one entry.
Before this patch, ythose were legal:
class: uenum
size: 8
class: uenum
size: 8
mappings: {}
class: uenum
size: 8
mappings:
A: []
CTF consumers would not like the resulting metadata stream. For
example, Babeltrace 2.1.0-rc1 [
v1.2.0-3520-g73f74ae1f]:
09-24 13:26:41.740 80492 80492 E PLUGIN/CTF/META/PARSER yyerror@parser.y:925 At line 109 in metadata stream: syntax error, unexpected CTF_RBRAC: token="}"
09-24 13:26:41.740 80492 80492 E PLUGIN/CTF/META/DECODER ctf_metadata_decoder_append_content@decoder.c:280 [N/A] Cannot create the metadata AST out of the metadata text: mdec-addr=0x559dd9546a10
09-24 13:26:41.740 80492 80492 W PLUGIN/SRC.CTF.FS/QUERY support_info_query@query.c:459 cannot append metadata content: metadata-decoder-status=-2
09-24 13:26:41.741 80492 80492 W LIB/QUERY-EXECUTOR bt_query_executor_query@query-executor.c:231 Component class's "query" method failed: query-exec-addr=0x559dd9548070, cc-addr=0x559dd95233e0, cc-type=SOURCE, cc-name="fs", cc-partial-descr="Read CTF traces from the file sy", cc-is-frozen=0, cc-so-handle-addr=0x559dd9522770, cc-so-handle-path="lib/babeltrace2/plugins/babeltrace-plugin-ctf.so", object="babeltrace.support-info", params-addr=0x559dd9545f10, params-type=MAP, params-element-count=2, log-level=WARNING
09-24 13:26:41.741 80492 80492 E CLI-CFG-SRC-AUTO-DISC support_info_query_all_sources@autodisc.c:493 babeltrace.support-info query failed.
09-24 13:26:41.741 80492 80492 E CLI main@babeltrace2.c:2644 Command-line error: retcode=1
ERROR: [Babeltrace CLI] (babeltrace2.c:2644)
Command-line error: retcode=1
CAUSED BY [Source auto-discovery] (autodisc.c:493)
babeltrace.support-info query failed.
CAUSED BY [libbabeltrace2] (query-executor.c:231)
Component class's "query" method failed: query-exec-addr=0x559dd9548070, cc-addr=0x559dd95233e0, cc-type=SOURCE, cc-name="fs", cc-partial-descr="Read CTF traces from
the file sy", cc-is-frozen=0, cc-so-handle-addr=0x559dd9522770, cc-so-handle-path="babeltrace2/plugins/babeltrace-plugin-ctf.so",
object="babeltrace.support-info", params-addr=0x559dd9545f10, params-type=MAP, params-element-count=2, log-level=WARNING
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
}[ft_node['class']]
mappings = collections.OrderedDict()
- for label, mapping_node in ft_node.get('mappings', {}).items():
+ for label, mapping_node in ft_node['mappings'].items():
ranges = set()
for range_node in mapping_node:
$ref: '#/definitions/int-ft'
members:
type: array
+ minItems: 1
items:
if:
type: object
additionalProperties: false
enum-ft:
properties:
+ class: true
+ size: true
+ alignment: true
+ preferred-display-base: true
mappings:
if:
type: object
patternProperties:
'.*':
type: array
+ minItems: 1
items:
if:
type: array
maxItems: 2
else:
type: integer
+ minProperties: 1
else:
type: 'null'
- properties:
- class: true
- size: true
- alignment: true
- preferred-display-base: true
- mappings: true
additionalProperties: false
+ required:
+ - mappings
uenum-ft-class-prop:
type: string
enum:
An enumeration data field is an integer data field.
An enumeration field type is an integer field type with
-<<mappings-prop,_mappings_>>. An enumeration field type mapping is a labeled
-set of integer ranges. An enumeration data field can have zero or more
-labels depending on its value.
+<<mappings-prop,_mappings_>>. An enumeration field type mapping is a
+labeled set of integer ranges. An enumeration data field can have zero
+or more labels depending on its value.
[[props]]
== Properties
|Mappings of this enumeration field type.
Each mapping assigns a label to a set of integer ranges.
-|No
-|No mappings
+
+This mapping must contain at least one entry.
+|Yes
+|
|===
[[enum-ft-mapping-seq]]
+
In other words, `17` is equivalent to `+[17, 17]+`.
+This sequence must contain at least one item.
+
== Generated C{nbsp}types
include::partial$int-ft-obj-c-types-table.adoc[]
== Examples
-.Basic <<size-prop,8-bit>> unsigned enumeration field type object.
+.Basic <<size-prop,8-bit>> unsigned enumeration field type object with a single <<mappings-prop,mapping>>
====
[source,yaml]
----
class: unsigned-enumeration
size: 8
+mappings:
+ A: [0]
----
====