assert(node->u.unary_expression.link == UNARY_LINK_UNKNOWN);
assert(i == 0);
src_string = node->u.unary_expression.u.string;
- ret = uuid_parse(node->u.unary_expression.u.string, *uuid);
+ ret = uuid_parse(src_string, *uuid);
}
return ret;
}
ret = ctf_struct_declaration_list_visit(fd, depth + 1, iter,
struct_declaration, trace);
if (ret)
- goto error;
+ goto error_free_declaration;
}
if (name) {
ret = register_struct_declaration(g_quark_from_string(name),
}
return &struct_declaration->p;
}
-error:
+error_free_declaration:
struct_declaration->p.declaration_free(&struct_declaration->p);
+error:
return NULL;
}
struct ctf_trace *trace)
{
struct ctf_node *expression;
- uint64_t alignment, size;
+ uint64_t alignment = 1, size;
int byte_order = trace->byte_order;
int signedness = 0;
int has_alignment = 0, has_size = 0;
struct ctf_trace *trace)
{
struct ctf_node *expression;
- uint64_t alignment, exp_dig, mant_dig, byte_order = trace->byte_order;
+ uint64_t alignment = 1, exp_dig = 0, mant_dig = 0,
+ byte_order = trace->byte_order;
int has_alignment = 0, has_exp_dig = 0, has_mant_dig = 0;
struct declaration_float *float_declaration;
ret = -EPERM;
goto error;
} else {
- trace->byte_order = byte_order;
+ if (byte_order != trace->byte_order) {
+ trace->byte_order = byte_order;
+ /*
+ * We need to restart
+ * construction of the
+ * intermediate representation.
+ */
+ trace->field_mask = 0;
+ CTF_TRACE_SET_FIELD(trace, byte_order);
+ ret = -EINTR;
+ goto error;
+ }
}
CTF_TRACE_SET_FIELD(trace, byte_order);
} else if (!strcmp(left, "packet.header")) {
return 0;
error:
- if (trace->packet_header_decl)
+ if (trace->packet_header_decl) {
declaration_unref(&trace->packet_header_decl->p);
+ trace->packet_header_decl = NULL;
+ }
g_ptr_array_free(trace->streams, TRUE);
free_declaration_scope(trace->declaration_scope);
+ trace->declaration_scope = NULL;
return ret;
}
struct ctf_node *iter;
printf_verbose("CTF visitor: metadata construction... ");
- trace->root_declaration_scope = new_declaration_scope(NULL);
trace->byte_order = byte_order;
+retry:
+ trace->root_declaration_scope = new_declaration_scope(NULL);
+
switch (node->type) {
case NODE_ROOT:
cds_list_for_each_entry(iter, &node->u.root.declaration_list,
}
cds_list_for_each_entry(iter, &node->u.root.trace, siblings) {
ret = ctf_trace_visit(fd, depth + 1, iter, trace);
+ if (ret == -EINTR) {
+ free_declaration_scope(trace->root_declaration_scope);
+ /*
+ * Need to restart creation of type
+ * definitions, aliases and
+ * trace header declarations.
+ */
+ goto retry;
+ }
if (ret) {
fprintf(fd, "[error] %s: trace declaration error\n", __func__);
goto error;