bt_list_for_each_entry(node, head, siblings) {
if (node->type != NODE_UNARY_EXPRESSION
- || node->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT
|| (node->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT && node->u.unary_expression.type != UNARY_SIGNED_CONSTANT)
|| node->u.unary_expression.link != UNARY_LINK_UNKNOWN
|| i != 0)
fprintf(fd, "[error] %s: cannot find typealias \"%s\".\n", __func__, g_quark_to_string(alias_q));
return NULL;
}
- if (nested_declaration->id == CTF_TYPE_INTEGER) {
+ if (nested_declaration->id == BT_CTF_TYPE_ID_INTEGER) {
struct declaration_integer *integer_declaration =
container_of(nested_declaration, struct declaration_integer, p);
/* For base to 16 for pointers (expected pretty-print) */
fprintf(fd, "[error] %s: expecting length field reference or value.\n", __func__);
return NULL;
}
- first = _bt_list_first_entry(&node_type_declarator->u.type_declarator.u.nested.length,
+ first = _bt_list_first_entry(&node_type_declarator->u.type_declarator.u.nested.length,
struct ctf_node, siblings);
if (first->type != NODE_UNARY_EXPRESSION) {
return NULL;
* Don't allow typedef and typealias of untagged
* variants.
*/
- if (type_declaration->id == CTF_TYPE_UNTAGGED_VARIANT) {
+ if (type_declaration->id == BT_CTF_TYPE_ID_UNTAGGED_VARIANT) {
fprintf(fd, "[error] %s: typedef of untagged variant is not permitted.\n", __func__);
bt_declaration_unref(type_declaration);
return -EPERM;
* Don't allow typedef and typealias of untagged
* variants.
*/
- if (type_declaration->id == CTF_TYPE_UNTAGGED_VARIANT) {
+ if (type_declaration->id == BT_CTF_TYPE_ID_UNTAGGED_VARIANT) {
fprintf(fd, "[error] %s: typedef of untagged variant is not permitted.\n", __func__);
bt_declaration_unref(type_declaration);
return -EPERM;
}
}
if (!container_type) {
- declaration = bt_lookup_declaration(g_quark_from_static_string("int"),
+ declaration = bt_lookup_declaration(g_quark_from_string("int"),
declaration_scope);
if (!declaration) {
fprintf(fd, "[error] %s: \"int\" type declaration missing for enumeration\n", __func__);
fprintf(fd, "[error] %s: unable to create container type for enumeration\n", __func__);
return NULL;
}
- if (declaration->id != CTF_TYPE_INTEGER) {
+ if (declaration->id != BT_CTF_TYPE_ID_INTEGER) {
fprintf(fd, "[error] %s: container type for enumeration is not integer\n", __func__);
return NULL;
}
switch (right->u.unary_expression.type) {
case UNARY_UNSIGNED_CONSTANT:
switch (right->u.unary_expression.u.unsigned_constant) {
- case 2:
+ case 2:
case 8:
case 10:
case 16:
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
return ret;
}
-
+
static
int ctf_stream_declaration_visit(FILE *fd, int depth, struct ctf_node *node, struct ctf_stream_declaration *stream, struct ctf_trace *trace)
{
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
if (CTF_STREAM_FIELD_IS_SET(stream, stream_id)) {
/* check that packet header has stream_id field. */
if (!trace->packet_header_decl
- || bt_struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_static_string("stream_id")) < 0) {
+ || bt_struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_string("stream_id")) < 0) {
ret = -EPERM;
fprintf(fd, "[error] %s: missing stream_id field in packet header declaration, but stream_id attribute is declared for stream.\n", __func__);
goto error;
ret = -EPERM;
goto error;
}
- if (declaration->id != CTF_TYPE_STRUCT) {
+ if (declaration->id != BT_CTF_TYPE_ID_STRUCT) {
ret = -EPERM;
goto error;
}
if (!CTF_TRACE_FIELD_IS_SET(trace, byte_order)) {
/* check that the packet header contains a "magic" field */
if (!trace->packet_header_decl
- || bt_struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_static_string("magic")) < 0) {
+ || bt_struct_declaration_lookup_field_index(trace->packet_header_decl, g_quark_from_string("magic")) < 0) {
ret = -EPERM;
fprintf(fd, "[error] %s: missing both byte_order and packet header magic number in trace declaration\n", __func__);
goto error;
ret = -EPERM;
goto error;
}
- ret = get_unary_unsigned(&node->u.ctf_expression.right, &clock->offset_s);
+ ret = get_unary_signed(&node->u.ctf_expression.right, &clock->offset_s);
if (ret) {
fprintf(fd, "[error] %s: unexpected unary expression for clock offset_s\n", __func__);
ret = -EINVAL;
ret = -EPERM;
goto error;
}
- ret = get_unary_unsigned(&node->u.ctf_expression.right, &clock->offset);
+ ret = get_unary_signed(&node->u.ctf_expression.right, &clock->offset);
if (ret) {
fprintf(fd, "[error] %s: unexpected unary expression for clock offset\n", __func__);
ret = -EINVAL;
env->domain[TRACER_ENV_LEN - 1] = '\0';
printf_verbose("env.domain = \"%s\"\n", env->domain);
g_free(right);
+ } else if (!strcmp(left, "tracer_name")) {
+ char *right;
+
+ if (env->tracer_name[0]) {
+ fprintf(fd, "[warning] %s: duplicated env tracer_name\n", __func__);
+ goto error; /* ret is 0, so not an actual error, just warn. */
+ }
+ right = concatenate_unary_strings(&node->u.ctf_expression.right);
+ if (!right) {
+ fprintf(fd, "[warning] %s: unexpected unary expression for env tracer_name\n", __func__);
+ goto error; /* ret is 0, so not an actual error, just warn. */
+ }
+ strncpy(env->tracer_name, right, TRACER_ENV_LEN);
+ env->tracer_name[TRACER_ENV_LEN - 1] = '\0';
+ printf_verbose("env.tracer_name = \"%s\"\n", env->tracer_name);
+ g_free(right);
} else if (!strcmp(left, "sysname")) {
char *right;