Change as many error paths as possible in the CTF metadata parsing code
to append error causes. This will give clearer error messages to users
when the metadata can't be parsed. The errors are already printed to
stderr, but this will make them more obvious, as they will be printed in
the error stack.
For example, a syntax error caught by the metadata-info query:
$ cat test/metadata
/* CTF 1.8 */
trace {
foo = ;
};
$ ./src/cli/babeltrace2 query src.ctf.fs metadata-info -p 'path=test'
...
ERROR: [Babeltrace CLI] (/home/simark/src/babeltrace/src/cli/babeltrace2.c:649)
Failed to query component class: unknown error: plugin-name="ctf", comp-cls-name="fs", comp-cls-type=1 object="metadata-info"
CAUSED BY [libbabeltrace2] (/home/simark/src/babeltrace/src/lib/graph/query-executor.c:231)
Component class's "query" method failed: query-exec-addr=0x60b000001430, cc-addr=0x60f000000220, cc-type=SOURCE, cc-name="fs", cc-partial-descr="Read CTF traces from the file sy",
cc-is-frozen=0, cc-so-handle-addr=0x607000000100, cc-so-handle-path="/home/simark/build/babeltrace/src/plugins/ctf/babeltrace-plugin-ctf.la", object="metadata-info", params-addr=0x606000000980,
params-type=MAP, params-element-count=1, log-level=WARNING
CAUSED BY ['source.ctf.fs'] (/home/simark/src/babeltrace/src/plugins/ctf/fs-src/query.c:121)
Cannot update metadata decoder's content: path="test".
CAUSED BY ['source.ctf.fs'] (/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/decoder.c:279)
Cannot create the metadata AST out of the metadata text: mdec-addr=0x60c000003a00
CAUSED BY [CTF metadata parser] (/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/parser.y:925)
At line 4 in metadata stream: syntax error, unexpected CTF_SEMICOLON: token=";"
And a semantic error caught when trying to read the trace:
$ cat test/metadata
/* CTF 1.8 */
trace {
byte_order = 2;
};
$ ./src/cli/babeltrace2 test
...
ERROR: [Babeltrace CLI] (/home/simark/src/babeltrace/src/cli/babeltrace2.c:2462)
Cannot create components.
CAUSED BY [Babeltrace CLI] (/home/simark/src/babeltrace/src/cli/babeltrace2.c:2277)
Cannot create component: plugin-name="ctf", comp-cls-name="fs", comp-cls-type=1, comp-name="auto-disc-source-ctf-fs"
CAUSED BY [libbabeltrace2] (/home/simark/src/babeltrace/src/lib/graph/graph.c:1055)
Component initialization method failed: status=ERROR, comp-addr=0x60c000004f00, comp-name="auto-disc-source-ctf-fs", comp-log-level=WARNING, comp-class-type=SOURCE, comp-class-name="fs", comp-class-partial-descr="Read CTF traces
from the file sy", comp-class-is-frozen=1, comp-class-so-handle-addr=0x607000000100, comp-class-so-handle-path="/home/simark/build/babeltrace/src/plugins/ctf/babeltrace-plugin-ctf.la", comp-input-port-count=0,
comp-output-port-count=0
CAUSED BY [auto-disc-source-ctf-fs: 'source.ctf.fs'] (/home/simark/src/babeltrace/src/plugins/ctf/fs-src/fs.c:1186)
Cannot create trace for `/home/simark/build/babeltrace/test`.
CAUSED BY [auto-disc-source-ctf-fs: 'source.ctf.fs'] (/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/decoder.c:327)
Failed to visit AST node to create CTF IR objects: mdec-addr=0x60c0000052c0, ret=-22
CAUSED BY [auto-disc-source-ctf-fs: 'source.ctf.fs'] (/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/visitor-generate-ir.c:4722)
At line 0 in metadata stream: Cannot set trace's native byte order: ret=-22
CAUSED BY [auto-disc-source-ctf-fs: 'source.ctf.fs'] (/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/visitor-generate-ir.c:4148)
At line 4 in metadata stream: Invalid `byte_order` attribute in trace (`trace` block): expecting `le`, `be`, or `network`.
CAUSED BY [auto-disc-source-ctf-fs: 'source.ctf.fs'] (/home/simark/src/babeltrace/src/plugins/ctf/common/metadata/visitor-generate-ir.c:920)
At line 4 in metadata stream: "byte_order" attribute: expecting `be`, `le`, `network`, or `native`.
The metadata parser can be used in both component and component class
context. For logging purposes, only a component is passed through
ctf_metadata_decoder_config, when the parsing is done in the context of
a component. To be able to append error causes with the right component
class actor, add the option to pass a component class as well.
Change-Id: I8db734fa27cea5ea3b911e36800d535290c51ad9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/5693
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
14 files changed:
*/
#define BT_COMP_LOG_SELF_COMP (ctx->self_comp)
*/
#define BT_COMP_LOG_SELF_COMP (ctx->self_comp)
+#define BT_COMP_LOG_SELF_COMP_CLASS (ctx->self_comp_class)
#define BT_LOG_OUTPUT_LEVEL (ctx->log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/RESOLVE"
#include "logging/comp-logging.h"
#define BT_LOG_OUTPUT_LEVEL (ctx->log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/RESOLVE"
#include "logging/comp-logging.h"
*/
struct resolve_context {
bt_logging_level log_level;
*/
struct resolve_context {
bt_logging_level log_level;
+
+ /* Weak, exactly one of these must be set */
bt_self_component *self_comp;
bt_self_component *self_comp;
+ bt_self_component_class *self_comp_class;
+
struct ctf_trace_class *tc;
struct ctf_stream_class *sc;
struct ctf_event_class *ec;
struct ctf_trace_class *tc;
struct ctf_stream_class *sc;
struct ctf_event_class *ec;
struct field_class_stack_frame *frame = NULL;
if (!stack || !fc) {
struct field_class_stack_frame *frame = NULL;
if (!stack || !fc) {
- BT_COMP_LOGE("Invalid parameter: stack or field class is NULL.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid parameter: stack or field class is `NULL`.");
ret = -1;
goto end;
}
frame = g_new0(struct field_class_stack_frame, 1);
if (!frame) {
ret = -1;
goto end;
}
frame = g_new0(struct field_class_stack_frame, 1);
if (!frame) {
- BT_COMP_LOGE_STR("Failed to allocate one field class stack frame.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to allocate one field class stack frame.");
if (at == last) {
/* Error: empty token */
if (at == last) {
/* Error: empty token */
- BT_COMP_LOGE("Empty path token: path=\"%s\", pos=%u",
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Empty path token: path=\"%s\", pos=%u",
pathstr, (unsigned int) (at - pathstr));
goto error;
}
pathstr, (unsigned int) (at - pathstr));
goto error;
}
switch (field_path->root) {
case CTF_SCOPE_PACKET_HEADER:
if (ctx->tc->is_translated) {
switch (field_path->root) {
case CTF_SCOPE_PACKET_HEADER:
if (ctx->tc->is_translated) {
- BT_COMP_LOGE("Trace class is already translated: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Trace class is already translated: "
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
case CTF_SCOPE_EVENT_HEADER:
case CTF_SCOPE_EVENT_COMMON_CONTEXT:
if (!ctx->sc) {
case CTF_SCOPE_EVENT_HEADER:
case CTF_SCOPE_EVENT_COMMON_CONTEXT:
if (!ctx->sc) {
- BT_COMP_LOGE("No current stream class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("No current stream class: "
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
}
if (ctx->sc->is_translated) {
}
if (ctx->sc->is_translated) {
- BT_COMP_LOGE("Stream class is already translated: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Stream class is already translated: "
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
case CTF_SCOPE_EVENT_SPECIFIC_CONTEXT:
case CTF_SCOPE_EVENT_PAYLOAD:
if (!ctx->ec) {
case CTF_SCOPE_EVENT_SPECIFIC_CONTEXT:
case CTF_SCOPE_EVENT_PAYLOAD:
if (!ctx->ec) {
- BT_COMP_LOGE("No current event class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("No current event class: "
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
}
if (ctx->ec->is_translated) {
}
if (ctx->ec->is_translated) {
- BT_COMP_LOGE("Event class is already translated: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Event class is already translated: "
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
fc = borrow_class_from_ctx(ctx, field_path->root);
if (!fc) {
/* Error: root class is not available */
fc = borrow_class_from_ctx(ctx, field_path->root);
if (!fc) {
/* Error: root class is not available */
- BT_COMP_LOGE("Root field class is not available: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Root field class is not available: "
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
"root-scope=%s",
ctf_scope_string(field_path->root));
ret = -1;
/* Convert path string to path tokens */
ptokens = pathstr_to_ptokens(pathstr, ctx);
if (!ptokens) {
/* Convert path string to path tokens */
ptokens = pathstr_to_ptokens(pathstr, ctx);
if (!ptokens) {
- BT_COMP_LOGE("Cannot convert path string to path tokens: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot convert path string to path tokens: "
"path=\"%s\"", pathstr);
ret = -1;
goto end;
"path=\"%s\"", pathstr);
ret = -1;
goto end;
"scope=%s", ctf_scope_string(field_path->root));
ret = relative_ptokens_to_field_path(ptokens, field_path, ctx);
if (ret) {
"scope=%s", ctf_scope_string(field_path->root));
ret = relative_ptokens_to_field_path(ptokens, field_path, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot get relative field path of path string: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot get relative field path of path string: "
"path=\"%s\", start-scope=%s, end-scope=%s",
pathstr, ctf_scope_string(ctx->root_scope),
ctf_scope_string(field_path->root));
"path=\"%s\", start-scope=%s, end-scope=%s",
pathstr, ctf_scope_string(ctx->root_scope),
ctf_scope_string(field_path->root));
"scope=%s", ctf_scope_string(field_path->root));
ret = absolute_ptokens_to_field_path(ptokens, field_path, ctx);
if (ret) {
"scope=%s", ctf_scope_string(field_path->root));
ret = absolute_ptokens_to_field_path(ptokens, field_path, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot get absolute field path of path string: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot get absolute field path of path string: "
"path=\"%s\", root-scope=%s",
pathstr, ctf_scope_string(root_scope));
goto end;
"path=\"%s\", root-scope=%s",
pathstr, ctf_scope_string(root_scope));
goto end;
fc = borrow_class_from_ctx(ctx, field_path->root);
if (!fc) {
/* Error: root class is not available */
fc = borrow_class_from_ctx(ctx, field_path->root);
if (!fc) {
/* Error: root class is not available */
- BT_COMP_LOGE("Root field class is not available: root-scope=%s",
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Root field class is not available: root-scope=%s",
ctf_scope_string(field_path->root));
goto end;
}
ctf_scope_string(field_path->root));
goto end;
}
* This is invalid because the target cannot be
* an ancestor of the source.
*/
* This is invalid because the target cannot be
* an ancestor of the source.
*/
- BT_COMP_LOGE("Source field class is an ancestor of target field class or vice versa: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Source field class is an ancestor of target field class or vice versa: "
"lca-index=%" PRId64 ", "
"field-path-1-len=%" PRIu64 ", "
"field-path-2-len=%" PRIu64,
"lca-index=%" PRId64 ", "
"field-path-1-len=%" PRIu64 ", "
"field-path-2-len=%" PRIu64,
* Make sure the target is not a root.
*/
if (target_field_path_len == 0) {
* Make sure the target is not a root.
*/
if (target_field_path_len == 0) {
- BT_COMP_LOGE_STR("Target field path's length is 0 (targeting the root).");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Target field path's length is 0 (targeting the root).");
* after the context field path's root.
*/
if (target_field_path->root > ctx_field_path.root) {
* after the context field path's root.
*/
if (target_field_path->root > ctx_field_path.root) {
- BT_COMP_LOGE("Target field class is located after source field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Target field class is located after source field class: "
"target-root=%s, source-root=%s",
ctf_scope_string(target_field_path->root),
ctf_scope_string(ctx_field_path.root));
"target-root=%s, source-root=%s",
ctf_scope_string(target_field_path->root),
ctf_scope_string(ctx_field_path.root));
lca_index = get_field_paths_lca_index(target_field_path,
&ctx_field_path, ctx);
if (lca_index < 0) {
lca_index = get_field_paths_lca_index(target_field_path,
&ctx_field_path, ctx);
if (lca_index < 0) {
- BT_COMP_LOGE_STR("Cannot get least common ancestor.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot get least common ancestor.");
&ctx_field_path, (uint64_t) lca_index);
if (target_index >= ctx_index) {
&ctx_field_path, (uint64_t) lca_index);
if (target_index >= ctx_index) {
- BT_COMP_LOGE("Target field class's index is greater than or equal to source field class's index in LCA: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Target field class's index is greater than or equal to source field class's index in LCA: "
"lca-index=%" PRId64 ", "
"target-index=%" PRId64 ", "
"source-index=%" PRId64,
"lca-index=%" PRId64 ", "
"target-index=%" PRId64 ", "
"source-index=%" PRId64,
switch (ctx->cur_fc->type) {
case CTF_FIELD_CLASS_TYPE_VARIANT:
if (target_fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
switch (ctx->cur_fc->type) {
case CTF_FIELD_CLASS_TYPE_VARIANT:
if (target_fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE("Variant field class's tag field class is not an enumeration field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Variant field class's tag field class is not an enumeration field class: "
"tag-fc-addr=%p, tag-fc-id=%d",
target_fc, target_fc->type);
ret = -1;
"tag-fc-addr=%p, tag-fc-id=%d",
target_fc, target_fc->type);
ret = -1;
if (target_fc->type != CTF_FIELD_CLASS_TYPE_INT &&
target_fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (target_fc->type != CTF_FIELD_CLASS_TYPE_INT &&
target_fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE("Sequence field class's length field class is not an unsigned integer field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Sequence field class's length field class is not an unsigned integer field class: "
"length-fc-addr=%p, length-fc-id=%d",
target_fc, target_fc->type);
ret = -1;
"length-fc-addr=%p, length-fc-id=%d",
target_fc, target_fc->type);
ret = -1;
}
if (int_fc->is_signed) {
}
if (int_fc->is_signed) {
- BT_COMP_LOGE("Sequence field class's length field class is not an unsigned integer field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Sequence field class's length field class is not an unsigned integer field class: "
"length-fc-addr=%p, length-fc-id=%d",
target_fc, target_fc->type);
ret = -1;
"length-fc-addr=%p, length-fc-id=%d",
target_fc, target_fc->type);
ret = -1;
- BT_COMP_LOGE_STR("Cannot get path string.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot get path string.");
/* Get target field path out of path string */
ret = pathstr_to_field_path(pathstr, &target_field_path, ctx);
if (ret) {
/* Get target field path out of path string */
ret = pathstr_to_field_path(pathstr, &target_field_path, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot get target field path for path string: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot get target field path for path string: "
"path=\"%s\"", pathstr);
goto end;
}
"path=\"%s\"", pathstr);
goto end;
}
/* Get target field class */
target_fc = field_path_to_field_class(&target_field_path, ctx);
if (!target_fc) {
/* Get target field class */
target_fc = field_path_to_field_class(&target_field_path, ctx);
if (!target_fc) {
- BT_COMP_LOGE("Cannot get target field class for path string: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot get target field class for path string: "
"path=\"%s\", target-field-path=\"%s\"",
pathstr, target_field_path_pretty_str);
ret = -1;
"path=\"%s\", target-field-path=\"%s\"",
pathstr, target_field_path_pretty_str);
ret = -1;
ret = validate_target_field_path(&target_field_path,
target_fc, ctx);
if (ret) {
ret = validate_target_field_path(&target_field_path,
target_fc, ctx);
if (ret) {
- BT_COMP_LOGE("Invalid target field path for path string: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid target field path for path string: "
"path=\"%s\", target-field-path=\"%s\"",
pathstr, target_field_path_pretty_str);
goto end;
"path=\"%s\", target-field-path=\"%s\"",
pathstr, target_field_path_pretty_str);
goto end;
case CTF_FIELD_CLASS_TYPE_VARIANT:
ret = resolve_sequence_or_variant_field_class(fc, ctx);
if (ret) {
case CTF_FIELD_CLASS_TYPE_VARIANT:
ret = resolve_sequence_or_variant_field_class(fc, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot resolve sequence field class's length or variant field class's tag: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve sequence field class's length or variant field class's tag: "
"ret=%d, fc-addr=%p", ret, fc);
goto end;
}
"ret=%d, fc-addr=%p", ret, fc);
goto end;
}
ret = field_class_stack_push(ctx->field_class_stack, fc, ctx);
if (ret) {
ret = field_class_stack_push(ctx->field_class_stack, fc, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot push field class on context's stack: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot push field class on context's stack: "
"fc-addr=%p", fc);
goto end;
}
"fc-addr=%p", fc);
goto end;
}
ctx->scopes.event_spec_context = ec->spec_context_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_COMMON_CONTEXT, ctx);
if (ret) {
ctx->scopes.event_spec_context = ec->spec_context_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_COMMON_CONTEXT, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot resolve event specific context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve event specific context field class: "
"ret=%d", ret);
goto end;
}
"ret=%d", ret);
goto end;
}
ctx->scopes.event_payload = ec->payload_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_PAYLOAD, ctx);
if (ret) {
ctx->scopes.event_payload = ec->payload_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_PAYLOAD, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot resolve event payload field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve event payload field class: "
"ret=%d", ret);
goto end;
}
"ret=%d", ret);
goto end;
}
ctx->scopes.packet_context = sc->packet_context_fc;
ret = resolve_root_class(CTF_SCOPE_PACKET_CONTEXT, ctx);
if (ret) {
ctx->scopes.packet_context = sc->packet_context_fc;
ret = resolve_root_class(CTF_SCOPE_PACKET_CONTEXT, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot resolve packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve packet context field class: "
"ret=%d", ret);
goto end;
}
"ret=%d", ret);
goto end;
}
ctx->scopes.event_header = sc->event_header_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_HEADER, ctx);
if (ret) {
ctx->scopes.event_header = sc->event_header_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_HEADER, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot resolve event header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve event header field class: "
"ret=%d", ret);
goto end;
}
"ret=%d", ret);
goto end;
}
ctx->scopes.event_common_context = sc->event_common_context_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_COMMON_CONTEXT, ctx);
if (ret) {
ctx->scopes.event_common_context = sc->event_common_context_fc;
ret = resolve_root_class(CTF_SCOPE_EVENT_COMMON_CONTEXT, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot resolve event common context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve event common context field class: "
"ret=%d", ret);
goto end;
}
"ret=%d", ret);
goto end;
}
ret = resolve_event_class_field_classes(ctx, ec);
if (ret) {
ret = resolve_event_class_field_classes(ctx, ec);
if (ret) {
- BT_COMP_LOGE("Cannot resolve event class's field classes: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve event class's field classes: "
"ec-id=%" PRIu64 ", ec-name=\"%s\"",
ec->id, ec->name->str);
goto end;
"ec-id=%" PRIu64 ", ec-name=\"%s\"",
ec->id, ec->name->str);
goto end;
struct resolve_context local_ctx = {
.log_level = log_cfg->log_level,
.self_comp = log_cfg->self_comp,
struct resolve_context local_ctx = {
.log_level = log_cfg->log_level,
.self_comp = log_cfg->self_comp,
+ .self_comp_class = log_cfg->self_comp_class,
.tc = tc,
.sc = NULL,
.ec = NULL,
.tc = tc,
.sc = NULL,
.ec = NULL,
/* Initialize class stack */
ctx->field_class_stack = field_class_stack_create();
if (!ctx->field_class_stack) {
/* Initialize class stack */
ctx->field_class_stack = field_class_stack_create();
if (!ctx->field_class_stack) {
- BT_COMP_LOGE_STR("Cannot create field class stack.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot create field class stack.");
ctx->scopes.packet_header = tc->packet_header_fc;
ret = resolve_root_class(CTF_SCOPE_PACKET_HEADER, ctx);
if (ret) {
ctx->scopes.packet_header = tc->packet_header_fc;
ret = resolve_root_class(CTF_SCOPE_PACKET_HEADER, ctx);
if (ret) {
- BT_COMP_LOGE("Cannot resolve packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve packet header field class: "
"ret=%d", ret);
goto end;
}
"ret=%d", ret);
goto end;
}
ret = resolve_stream_class_field_classes(ctx, sc);
if (ret) {
ret = resolve_stream_class_field_classes(ctx, sc);
if (ret) {
- BT_COMP_LOGE("Cannot resolve stream class's field classes: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot resolve stream class's field classes: "
"sc-id=%" PRIu64, sc->id);
goto end;
}
"sc-id=%" PRIu64, sc->id);
goto end;
}
*/
#define BT_COMP_LOG_SELF_COMP (log_cfg->self_comp)
*/
#define BT_COMP_LOG_SELF_COMP (log_cfg->self_comp)
+#define BT_COMP_LOG_SELF_COMP_CLASS (log_cfg->self_comp_class)
#define BT_LOG_OUTPUT_LEVEL (log_cfg->log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/UPDATE-DEF-CC"
#include "logging/comp-logging.h"
#define BT_LOG_OUTPUT_LEVEL (log_cfg->log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/UPDATE-DEF-CC"
#include "logging/comp-logging.h"
if (int_fc->mapped_clock_class) {
if (*clock_class && *clock_class !=
int_fc->mapped_clock_class) {
if (int_fc->mapped_clock_class) {
if (*clock_class && *clock_class !=
int_fc->mapped_clock_class) {
- BT_COMP_LOGE("Stream class contains more than one "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Stream class contains more than one "
"clock class: expected-cc-name=\"%s\", "
"other-cc-name=\"%s\"",
(*clock_class)->name->str,
"clock class: expected-cc-name=\"%s\", "
"other-cc-name=\"%s\"",
(*clock_class)->name->str,
ret = update_stream_class_default_clock_class(
ctf_tc->stream_classes->pdata[i], log_cfg);
if (ret) {
ret = update_stream_class_default_clock_class(
ctf_tc->stream_classes->pdata[i], log_cfg);
if (ret) {
- BT_COMP_LOGE("Stream class contains more than one "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Stream class contains more than one "
"clock class: stream-class-id=%" PRIu64,
sc->id);
goto end;
"clock class: stream-class-id=%" PRIu64,
sc->id);
goto end;
*/
#define BT_COMP_LOG_SELF_COMP (log_cfg->self_comp)
*/
#define BT_COMP_LOG_SELF_COMP (log_cfg->self_comp)
+#define BT_COMP_LOG_SELF_COMP_CLASS (log_cfg->self_comp_class)
#define BT_LOG_OUTPUT_LEVEL (log_cfg->log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/VALIDATE"
#include "logging/comp-logging.h"
#define BT_LOG_OUTPUT_LEVEL (log_cfg->log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/VALIDATE"
#include "logging/comp-logging.h"
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`timestamp_begin` member is not an integer field class.");
goto invalid;
}
"`timestamp_begin` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`timestamp_begin` member is signed.");
goto invalid;
}
"`timestamp_begin` member is signed.");
goto invalid;
}
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`timestamp_end` member is not an integer field class.");
goto invalid;
}
"`timestamp_end` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`timestamp_end` member is signed.");
goto invalid;
}
"`timestamp_end` member is signed.");
goto invalid;
}
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`events_discarded` member is not an integer field class.");
goto invalid;
}
"`events_discarded` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`events_discarded` member is signed.");
goto invalid;
}
"`events_discarded` member is signed.");
goto invalid;
}
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`packet_seq_num` member is not an integer field class.");
goto invalid;
}
"`packet_seq_num` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`packet_seq_num` member is signed.");
goto invalid;
}
"`packet_seq_num` member is signed.");
goto invalid;
}
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`packet_size` member is not an integer field class.");
goto invalid;
}
"`packet_size` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`packet_size` member is signed.");
goto invalid;
}
"`packet_size` member is signed.");
goto invalid;
}
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`content_size` member is not an integer field class.");
goto invalid;
}
"`content_size` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet context field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet context field class: "
"`content_size` member is signed.");
goto invalid;
}
"`content_size` member is signed.");
goto invalid;
}
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid event header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid event header field class: "
"`id` member is not an integer field class.");
goto invalid;
}
"`id` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid event header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid event header field class: "
"`id` member is signed.");
goto invalid;
}
} else {
if (sc->event_classes->len > 1) {
"`id` member is signed.");
goto invalid;
}
} else {
if (sc->event_classes->len > 1) {
- BT_COMP_LOGE_STR("Invalid event header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid event header field class: "
"missing `id` member as there's "
"more than one event class.");
goto invalid;
"missing `id` member as there's "
"more than one event class.");
goto invalid;
0);
if (named_fc->fc != fc) {
0);
if (named_fc->fc != fc) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`magic` member is not the first member.");
goto invalid;
}
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
"`magic` member is not the first member.");
goto invalid;
}
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`magic` member is not an integer field class.");
goto invalid;
}
"`magic` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`magic` member is signed.");
goto invalid;
}
if (int_fc->base.size != 32) {
"`magic` member is signed.");
goto invalid;
}
if (int_fc->base.size != 32) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`magic` member is not 32-bit.");
goto invalid;
}
"`magic` member is not 32-bit.");
goto invalid;
}
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`stream_id` member is not an integer field class.");
goto invalid;
}
"`stream_id` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`stream_id` member is signed.");
goto invalid;
}
} else {
if (ctf_tc->stream_classes->len > 1) {
"`stream_id` member is signed.");
goto invalid;
}
} else {
if (ctf_tc->stream_classes->len > 1) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"missing `stream_id` member as there's "
"more than one stream class.");
goto invalid;
"missing `stream_id` member as there's "
"more than one stream class.");
goto invalid;
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (fc) {
if (fc->type != CTF_FIELD_CLASS_TYPE_INT &&
fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`stream_instance_id` member is not an integer field class.");
goto invalid;
}
"`stream_instance_id` member is not an integer field class.");
goto invalid;
}
int_fc = (void *) fc;
if (int_fc->is_signed) {
int_fc = (void *) fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`stream_instance_id` member is signed.");
goto invalid;
}
"`stream_instance_id` member is signed.");
goto invalid;
}
struct ctf_field_class_array *array_fc = (void *) fc;
if (fc->type != CTF_FIELD_CLASS_TYPE_ARRAY) {
struct ctf_field_class_array *array_fc = (void *) fc;
if (fc->type != CTF_FIELD_CLASS_TYPE_ARRAY) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`uuid` member is not an array field class.");
goto invalid;
}
"`uuid` member is not an array field class.");
goto invalid;
}
array_fc = (void *) fc;
if (array_fc->length != 16) {
array_fc = (void *) fc;
if (array_fc->length != 16) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`uuid` member is not a 16-element array field class.");
goto invalid;
}
if (array_fc->base.elem_fc->type != CTF_FIELD_CLASS_TYPE_INT) {
"`uuid` member is not a 16-element array field class.");
goto invalid;
}
if (array_fc->base.elem_fc->type != CTF_FIELD_CLASS_TYPE_INT) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`uuid` member's element field class is not "
"an integer field class.");
goto invalid;
"`uuid` member's element field class is not "
"an integer field class.");
goto invalid;
int_fc = (void *) array_fc->base.elem_fc;
if (int_fc->is_signed) {
int_fc = (void *) array_fc->base.elem_fc;
if (int_fc->is_signed) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`uuid` member's element field class "
"is a signed integer field class.");
goto invalid;
}
if (int_fc->base.size != 8) {
"`uuid` member's element field class "
"is a signed integer field class.");
goto invalid;
}
if (int_fc->base.size != 8) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`uuid` member's element field class "
"is not an 8-bit integer field class.");
goto invalid;
}
if (int_fc->base.base.alignment != 8) {
"`uuid` member's element field class "
"is not an 8-bit integer field class.");
goto invalid;
}
if (int_fc->base.base.alignment != 8) {
- BT_COMP_LOGE_STR("Invalid packet header field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid packet header field class: "
"`uuid` member's element field class's "
"alignment is not 8.");
goto invalid;
"`uuid` member's element field class's "
"alignment is not 8.");
goto invalid;
ret = validate_stream_class(sc, log_cfg);
if (ret) {
ret = validate_stream_class(sc, log_cfg);
if (ret) {
- BT_COMP_LOGE("Invalid stream class: sc-id=%" PRIu64, sc->id);
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid stream class: sc-id=%" PRIu64, sc->id);
*/
#define BT_COMP_LOG_SELF_COMP self_comp
*/
#define BT_COMP_LOG_SELF_COMP self_comp
+#define BT_COMP_LOG_SELF_COMP_CLASS self_comp_class
#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/CTF/META/DECODER-DECODE-PACKET"
#include "logging/comp-logging.h"
#define BT_LOG_OUTPUT_LEVEL log_level
#define BT_LOG_TAG "PLUGIN/CTF/META/DECODER-DECODE-PACKET"
#include "logging/comp-logging.h"
static
int decode_packet(FILE *in_fp, FILE *out_fp,
int byte_order, bool *is_uuid_set, uint8_t *uuid,
static
int decode_packet(FILE *in_fp, FILE *out_fp,
int byte_order, bool *is_uuid_set, uint8_t *uuid,
- bt_logging_level log_level, bt_self_component *self_comp)
+ bt_logging_level log_level, bt_self_component *self_comp,
+ bt_self_component_class *self_comp_class)
{
struct packet_header header;
size_t readlen, writelen, toread;
{
struct packet_header header;
size_t readlen, writelen, toread;
const long offset = ftell(in_fp);
if (offset < 0) {
const long offset = ftell(in_fp);
if (offset < 0) {
- BT_COMP_LOGE_ERRNO("Failed to get current metadata file position",
+ BT_COMP_LOGE_APPEND_CAUSE_ERRNO(BT_COMP_LOG_SELF_COMP,
+ "Failed to get current metadata file position",
goto end;
}
if (readlen < 1) {
goto end;
}
if (readlen < 1) {
- BT_COMP_LOGE("Cannot decode metadata packet: offset=%ld", offset);
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot decode metadata packet: offset=%ld", offset);
}
if (header.compression_scheme) {
}
if (header.compression_scheme) {
- BT_COMP_LOGE("Metadata packet compression is not supported as of this version: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Metadata packet compression is not supported as of this version: "
"compression-scheme=%u, offset=%ld",
(unsigned int) header.compression_scheme, offset);
goto error;
}
if (header.encryption_scheme) {
"compression-scheme=%u, offset=%ld",
(unsigned int) header.compression_scheme, offset);
goto error;
}
if (header.encryption_scheme) {
- BT_COMP_LOGE("Metadata packet encryption is not supported as of this version: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Metadata packet encryption is not supported as of this version: "
"encryption-scheme=%u, offset=%ld",
(unsigned int) header.encryption_scheme, offset);
goto error;
}
if (header.checksum || header.checksum_scheme) {
"encryption-scheme=%u, offset=%ld",
(unsigned int) header.encryption_scheme, offset);
goto error;
}
if (header.checksum || header.checksum_scheme) {
- BT_COMP_LOGE("Metadata packet checksum verification is not supported as of this version: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Metadata packet checksum verification is not supported as of this version: "
"checksum-scheme=%u, checksum=%x, offset=%ld",
(unsigned int) header.checksum_scheme, header.checksum,
offset);
"checksum-scheme=%u, checksum=%x, offset=%ld",
(unsigned int) header.checksum_scheme, header.checksum,
offset);
if (!ctf_metadata_decoder_is_packet_version_valid(header.major,
header.minor)) {
if (!ctf_metadata_decoder_is_packet_version_valid(header.major,
header.minor)) {
- BT_COMP_LOGE("Invalid metadata packet version: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid metadata packet version: "
"version=%u.%u, offset=%ld",
header.major, header.minor, offset);
goto error;
"version=%u.%u, offset=%ld",
header.major, header.minor, offset);
goto error;
bt_uuid_copy(uuid, header.uuid);
*is_uuid_set = true;
} else if (bt_uuid_compare(header.uuid, uuid)) {
bt_uuid_copy(uuid, header.uuid);
*is_uuid_set = true;
} else if (bt_uuid_compare(header.uuid, uuid)) {
- BT_COMP_LOGE("Metadata UUID mismatch between packets of the same stream: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Metadata UUID mismatch between packets of the same stream: "
"packet-uuid=\"" BT_UUID_FMT "\", "
"expected-uuid=\"" BT_UUID_FMT "\", "
"offset=%ld",
"packet-uuid=\"" BT_UUID_FMT "\", "
"expected-uuid=\"" BT_UUID_FMT "\", "
"offset=%ld",
}
if ((header.content_size / CHAR_BIT) < sizeof(header)) {
}
if ((header.content_size / CHAR_BIT) < sizeof(header)) {
- BT_COMP_LOGE("Bad metadata packet content size: content-size=%u, "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Bad metadata packet content size: content-size=%u, "
"offset=%ld", header.content_size, offset);
goto error;
}
"offset=%ld", header.content_size, offset);
goto error;
}
loop_read = MIN(sizeof(buf) - 1, toread);
readlen = fread(buf, sizeof(uint8_t), loop_read, in_fp);
if (ferror(in_fp)) {
loop_read = MIN(sizeof(buf) - 1, toread);
readlen = fread(buf, sizeof(uint8_t), loop_read, in_fp);
if (ferror(in_fp)) {
- BT_COMP_LOGE("Cannot read metadata packet buffer: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot read metadata packet buffer: "
"offset=%ld, read-size=%zu",
ftell(in_fp), loop_read);
goto error;
}
if (readlen > loop_read) {
"offset=%ld, read-size=%zu",
ftell(in_fp), loop_read);
goto error;
}
if (readlen > loop_read) {
- BT_COMP_LOGE("fread returned more byte than expected: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("fread returned more byte than expected: "
"read-size-asked=%zu, read-size-returned=%zu",
loop_read, readlen);
goto error;
"read-size-asked=%zu, read-size-returned=%zu",
loop_read, readlen);
goto error;
writelen = fwrite(buf, sizeof(uint8_t), readlen, out_fp);
if (writelen < readlen || ferror(out_fp)) {
writelen = fwrite(buf, sizeof(uint8_t), readlen, out_fp);
if (writelen < readlen || ferror(out_fp)) {
- BT_COMP_LOGE("Cannot write decoded metadata text to buffer: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot write decoded metadata text to buffer: "
"read-offset=%ld, write-size=%zu",
ftell(in_fp), readlen);
goto error;
"read-offset=%ld, write-size=%zu",
ftell(in_fp), readlen);
goto error;
int ctf_metadata_decoder_packetized_file_stream_to_buf(FILE *fp,
char **buf, int byte_order, bool *is_uuid_set,
uint8_t *uuid, bt_logging_level log_level,
int ctf_metadata_decoder_packetized_file_stream_to_buf(FILE *fp,
char **buf, int byte_order, bool *is_uuid_set,
uint8_t *uuid, bt_logging_level log_level,
- bt_self_component *self_comp)
+ bt_self_component *self_comp,
+ bt_self_component_class *self_comp_class)
{
FILE *out_fp;
size_t size;
{
FILE *out_fp;
size_t size;
out_fp = bt_open_memstream(buf, &size);
if (!out_fp) {
out_fp = bt_open_memstream(buf, &size);
if (!out_fp) {
- BT_COMP_LOGE("Cannot open memory stream: %s.",
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot open memory stream: %s.",
strerror(errno));
goto error;
}
strerror(errno));
goto error;
}
}
tret = decode_packet(fp, out_fp, byte_order, is_uuid_set,
}
tret = decode_packet(fp, out_fp, byte_order, is_uuid_set,
- uuid, log_level, self_comp);
+ uuid, log_level, self_comp, self_comp_class);
- BT_COMP_LOGE("Cannot decode packet: index=%zu",
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot decode packet: index=%zu",
packet_index);
goto error;
}
packet_index);
goto error;
}
/* Make sure the whole string ends with a null character */
tret = fputc('\0', out_fp);
if (tret == EOF) {
/* Make sure the whole string ends with a null character */
tret = fputc('\0', out_fp);
if (tret == EOF) {
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(
"Cannot append '\\0' to the decoded metadata buffer.");
goto error;
}
"Cannot append '\\0' to the decoded metadata buffer.");
goto error;
}
*/
out_fp = NULL;
if (ret < 0) {
*/
out_fp = NULL;
if (ret < 0) {
- BT_COMP_LOGE_ERRNO("Cannot close memory stream", ".");
+ BT_COMP_LOGE_APPEND_CAUSE_ERRNO(BT_COMP_LOG_SELF_COMP, "Cannot close memory stream", ".");
int ctf_metadata_decoder_packetized_file_stream_to_buf(FILE *fp,
char **buf, int byte_order, bool *is_uuid_set,
uint8_t *uuid, bt_logging_level log_level,
int ctf_metadata_decoder_packetized_file_stream_to_buf(FILE *fp,
char **buf, int byte_order, bool *is_uuid_set,
uint8_t *uuid, bt_logging_level log_level,
- bt_self_component *self_comp);
+ bt_self_component *self_comp,
+ bt_self_component_class *self_comp_class);
#endif /* SRC_PLUGINS_CTF_COMMON_METADATA_DECODER_PACKETIZED_FILE_STREAM_TO_BUF */
#endif /* SRC_PLUGINS_CTF_COMMON_METADATA_DECODER_PACKETIZED_FILE_STREAM_TO_BUF */
*/
#define BT_COMP_LOG_SELF_COMP (mdec->config.self_comp)
*/
#define BT_COMP_LOG_SELF_COMP (mdec->config.self_comp)
+#define BT_COMP_LOG_SELF_COMP_CLASS (mdec->config.self_comp_class)
#define BT_LOG_OUTPUT_LEVEL (mdec->config.log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/DECODER"
#include "logging/comp-logging.h"
#define BT_LOG_OUTPUT_LEVEL (mdec->config.log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/DECODER"
#include "logging/comp-logging.h"
#include "scanner.h"
#include "logging.h"
#include "parser-wrap.h"
#include "scanner.h"
#include "logging.h"
#include "parser-wrap.h"
+#include "decoder-packetized-file-stream-to-buf.h"
#define TSDL_MAGIC 0x75d11d57
#define TSDL_MAGIC 0x75d11d57
uint8_t minor;
} __attribute__((__packed__));
uint8_t minor;
} __attribute__((__packed__));
-BT_HIDDEN
-int ctf_metadata_decoder_packetized_file_stream_to_buf(FILE *fp,
- char **buf, int byte_order, bool *is_uuid_set,
- uint8_t *uuid, bt_logging_level log_level,
- bt_self_component *self_comp);
-
BT_HIDDEN
int ctf_metadata_decoder_is_packetized(FILE *fp, bool *is_packetized,
int *byte_order, bt_logging_level log_level,
BT_HIDDEN
int ctf_metadata_decoder_is_packetized(FILE *fp, bool *is_packetized,
int *byte_order, bt_logging_level log_level,
mdec->log_cfg.log_level = config->log_level;
mdec->log_cfg.self_comp = config->self_comp;
mdec->log_cfg.log_level = config->log_level;
mdec->log_cfg.self_comp = config->self_comp;
+ mdec->log_cfg.self_comp_class = config->self_comp_class;
mdec->scanner = ctf_scanner_alloc();
if (!mdec->scanner) {
mdec->scanner = ctf_scanner_alloc();
if (!mdec->scanner) {
- BT_COMP_LOGE("Cannot allocate a metadata lexical scanner: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot allocate a metadata lexical scanner: "
"mdec-addr=%p", mdec);
goto error;
}
mdec->text = g_string_new(NULL);
if (!mdec->text) {
"mdec-addr=%p", mdec);
goto error;
}
mdec->text = g_string_new(NULL);
if (!mdec->text) {
- BT_COMP_LOGE("Failed to allocate one GString: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to allocate one GString: "
"mdec-addr=%p", mdec);
goto error;
}
"mdec-addr=%p", mdec);
goto error;
}
mdec->config = *config;
mdec->visitor = ctf_visitor_generate_ir_create(config);
if (!mdec->visitor) {
mdec->config = *config;
mdec->visitor = ctf_visitor_generate_ir_create(config);
if (!mdec->visitor) {
- BT_COMP_LOGE("Failed to create a CTF IR metadata AST visitor: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to create a CTF IR metadata AST visitor: "
"mdec-addr=%p", mdec);
goto error;
}
"mdec-addr=%p", mdec);
goto error;
}
ret = ctf_metadata_decoder_packetized_file_stream_to_buf(fp,
&buf, mdec->bo, &mdec->is_uuid_set,
mdec->uuid, mdec->config.log_level,
ret = ctf_metadata_decoder_packetized_file_stream_to_buf(fp,
&buf, mdec->bo, &mdec->is_uuid_set,
mdec->uuid, mdec->config.log_level,
- mdec->config.self_comp);
+ mdec->config.self_comp,
+ mdec->config.self_comp_class);
- BT_COMP_LOGE("Cannot decode packetized metadata packets to metadata text: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot decode packetized metadata packets to metadata text: "
"mdec-addr=%p, ret=%d", mdec, ret);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
"mdec-addr=%p, ret=%d", mdec, ret);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
fp = bt_fmemopen(buf, strlen(buf), "rb");
close_fp = true;
if (!fp) {
fp = bt_fmemopen(buf, strlen(buf), "rb");
close_fp = true;
if (!fp) {
- BT_COMP_LOGE("Cannot memory-open metadata buffer: %s: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot memory-open metadata buffer: %s: "
"mdec-addr=%p", strerror(errno), mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
"mdec-addr=%p", strerror(errno), mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
BT_COMP_LOGI("Metadata stream is plain text: mdec-addr=%p", mdec);
if (init_pos < 0) {
BT_COMP_LOGI("Metadata stream is plain text: mdec-addr=%p", mdec);
if (init_pos < 0) {
- BT_COMP_LOGE_ERRNO("Failed to get current file position", ".");
+ BT_COMP_LOGE_APPEND_CAUSE_ERRNO(BT_COMP_LOG_SELF_COMP,
+ "Failed to get current file position", ".");
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
}
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
}
if (!ctf_metadata_decoder_is_packet_version_valid(major,
minor)) {
if (!ctf_metadata_decoder_is_packet_version_valid(major,
minor)) {
- BT_COMP_LOGE("Invalid metadata version found in plain text signature: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid metadata version found in plain text signature: "
"version=%u.%u, mdec-addr=%p", major, minor,
mdec);
status = CTF_METADATA_DECODER_STATUS_INVAL_VERSION;
"version=%u.%u, mdec-addr=%p", major, minor,
mdec);
status = CTF_METADATA_DECODER_STATUS_INVAL_VERSION;
}
if (fseek(fp, init_pos, SEEK_SET)) {
}
if (fseek(fp, init_pos, SEEK_SET)) {
- BT_COMP_LOGE("Cannot seek metadata file stream to initial position: %s: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot seek metadata file stream to initial position: %s: "
"mdec-addr=%p", strerror(errno), mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
"mdec-addr=%p", strerror(errno), mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
/* Append the metadata text content */
ret = ctf_scanner_append_ast(mdec->scanner, fp);
if (ret) {
/* Append the metadata text content */
ret = ctf_scanner_append_ast(mdec->scanner, fp);
if (ret) {
- BT_COMP_LOGE("Cannot create the metadata AST out of the metadata text: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot create the metadata AST out of the metadata text: "
"mdec-addr=%p", mdec);
status = CTF_METADATA_DECODER_STATUS_INCOMPLETE;
goto end;
"mdec-addr=%p", mdec);
status = CTF_METADATA_DECODER_STATUS_INCOMPLETE;
goto end;
BT_ASSERT(start_pos != -1);
ret = fseek(fp, start_pos, SEEK_SET);
if (ret) {
BT_ASSERT(start_pos != -1);
ret = fseek(fp, start_pos, SEEK_SET);
if (ret) {
- BT_COMP_LOGE("Failed to seek file: ret=%d, mdec-addr=%p",
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to seek file: ret=%d, mdec-addr=%p",
ret, mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
ret, mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
ret = bt_common_append_file_content_to_g_string(mdec->text, fp);
if (ret) {
ret = bt_common_append_file_content_to_g_string(mdec->text, fp);
if (ret) {
- BT_COMP_LOGE("Failed to append to current plain text: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to append to current plain text: "
"ret=%d, mdec-addr=%p", ret, mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
"ret=%d, mdec-addr=%p", ret, mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
ret = ctf_visitor_semantic_check(0, &mdec->scanner->ast->root,
&mdec->log_cfg);
if (ret) {
ret = ctf_visitor_semantic_check(0, &mdec->scanner->ast->root,
&mdec->log_cfg);
if (ret) {
- BT_COMP_LOGE("Validation of the metadata semantics failed: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Validation of the metadata semantics failed: "
"mdec-addr=%p", mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
"mdec-addr=%p", mdec);
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
status = CTF_METADATA_DECODER_STATUS_INCOMPLETE;
goto end;
default:
status = CTF_METADATA_DECODER_STATUS_INCOMPLETE;
goto end;
default:
- BT_COMP_LOGE("Failed to visit AST node to create CTF IR objects: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to visit AST node to create CTF IR objects: "
"mdec-addr=%p, ret=%d", mdec, ret);
status = CTF_METADATA_DECODER_STATUS_IR_VISITOR_ERROR;
goto end;
"mdec-addr=%p, ret=%d", mdec, ret);
status = CTF_METADATA_DECODER_STATUS_IR_VISITOR_ERROR;
goto end;
left = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.left);
if (!left) {
left = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.left);
if (!left) {
- BT_COMP_LOGE("Cannot concatenate unary strings.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot concatenate unary strings.");
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
}
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
}
uuid, mdec->config.log_level,
mdec->config.self_comp);
if (ret) {
uuid, mdec->config.log_level,
mdec->config.self_comp);
if (ret) {
- BT_COMP_LOGE("Invalid trace's `uuid` attribute.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Invalid trace's `uuid` attribute.");
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
}
status = CTF_METADATA_DECODER_STATUS_ERROR;
goto end;
}
/* Active log level to use */
bt_logging_level log_level;
/* Active log level to use */
bt_logging_level log_level;
- /* Component to use for logging (can be `NULL`); weak */
+ /*
+ * Component or component class to use for logging (exactly one of
+ * them must be non-`NULL`); weak
+ */
bt_self_component *self_comp;
bt_self_component *self_comp;
+ bt_self_component_class *self_comp_class;
/* Additional clock class offset to apply */
int64_t clock_class_offset_s;
/* Additional clock class offset to apply */
int64_t clock_class_offset_s;
errno = 0; \
yylval->ull = strtoull(yytext, NULL, base); \
if (errno) { \
errno = 0; \
yylval->ull = strtoull(yytext, NULL, base); \
if (errno) { \
- _BT_LOGE_LINENO(yylineno, \
+ _BT_LOGE_APPEND_CAUSE_LINENO(yylineno, \
"Cannot parser constant integer: " \
"base=%d, text=\"%s\"", base, yytext); \
return CTF_ERROR; \
"Cannot parser constant integer: " \
"base=%d, text=\"%s\"", base, yytext); \
return CTF_ERROR; \
{IDENTIFIER} BT_LOGT("Got identifier: id=\"%s\"", yytext); setstring(yyextra, yylval, yytext); if (is_type(yyextra, yytext)) return ID_TYPE; else return IDENTIFIER;
[ \t\r\n] ; /* ignore */
{IDENTIFIER} BT_LOGT("Got identifier: id=\"%s\"", yytext); setstring(yyextra, yylval, yytext); if (is_type(yyextra, yytext)) return ID_TYPE; else return IDENTIFIER;
[ \t\r\n] ; /* ignore */
-. _BT_LOGE_LINENO(yylineno, "Invalid character: char=\"%c\", val=0x%02x", isprint((unsigned char) yytext[0]) ? yytext[0] : '\0', yytext[0]); return CTF_ERROR;
+. _BT_LOGE_APPEND_CAUSE_LINENO(yylineno, "Invalid character: char=\"%c\", val=0x%02x", isprint((unsigned char) yytext[0]) ? yytext[0] : '\0', yytext[0]); return CTF_ERROR;
struct meta_log_config {
bt_logging_level log_level;
struct meta_log_config {
bt_logging_level log_level;
+ /* Weak, exactly one of these must be set */
bt_self_component *self_comp;
bt_self_component *self_comp;
+ bt_self_component_class *self_comp_class;
};
#define _BT_LOGT_LINENO(_lineno, _msg, args...) \
};
#define _BT_LOGT_LINENO(_lineno, _msg, args...) \
#define _BT_LOGW_LINENO(_lineno, _msg, args...) \
BT_LOGW("At line %u in metadata stream: " _msg, _lineno, ## args)
#define _BT_LOGW_LINENO(_lineno, _msg, args...) \
BT_LOGW("At line %u in metadata stream: " _msg, _lineno, ## args)
-#define _BT_LOGE_LINENO(_lineno, _msg, args...) \
- BT_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args)
+#define _BT_LOGE_APPEND_CAUSE_LINENO(_lineno, _msg, args...) \
+ do { \
+ BT_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args); \
+ (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN( \
+ "CTF metadata parser", "At line %u in metadata stream: " _msg, _lineno, ## args); \
+ } while (0)
#define _BT_COMP_LOGT_LINENO(_lineno, _msg, args...) \
BT_COMP_LOGT("At line %u in metadata stream: " _msg, _lineno, ## args)
#define _BT_COMP_LOGT_LINENO(_lineno, _msg, args...) \
BT_COMP_LOGT("At line %u in metadata stream: " _msg, _lineno, ## args)
#define _BT_COMP_LOGE_LINENO(_lineno, _msg, args...) \
BT_COMP_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args)
#define _BT_COMP_LOGE_LINENO(_lineno, _msg, args...) \
BT_COMP_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args)
+#define _BT_COMP_LOGE_APPEND_CAUSE_LINENO(_lineno, _msg, args...) \
+ BT_COMP_LOGE_APPEND_CAUSE(BT_COMP_LOG_SELF_COMP, "At line %u in metadata stream: " _msg, _lineno, ## args)
+
+#define _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(_msg, args...) \
+ BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE( \
+ BT_COMP_LOG_SELF_COMP, \
+ BT_COMP_LOG_SELF_COMP_CLASS, \
+ _msg, ## args)
+
#endif /* CTF_METADATA_LOGGING_H */
#endif /* CTF_METADATA_LOGGING_H */
lvalp->s = objstack_alloc(scanner->objstack, len);
if (src[0] == 'L') {
// TODO: import wide string
lvalp->s = objstack_alloc(scanner->objstack, len);
if (src[0] == 'L') {
// TODO: import wide string
- _BT_LOGE_LINENO(yyget_lineno(scanner),
+ _BT_LOGE_APPEND_CAUSE_LINENO(yyget_lineno(scanner),
"wide characters are not supported as of this version: "
"scanner-addr=%p", scanner);
return -1;
"wide characters are not supported as of this version: "
"scanner-addr=%p", scanner);
return -1;
node = objstack_alloc(scanner->objstack, sizeof(*node));
if (!node) {
node = objstack_alloc(scanner->objstack, sizeof(*node));
if (!node) {
- _BT_LOGE_LINENO(yyget_lineno(scanner->scanner),
+ _BT_LOGE_APPEND_CAUSE_LINENO(yyget_lineno(scanner->scanner),
"failed to allocate one stack entry: "
"scanner-addr=%p", scanner);
return &error_node;
"failed to allocate one stack entry: "
"scanner-addr=%p", scanner);
return &error_node;
static
void yyerror(struct ctf_scanner *scanner, yyscan_t yyscanner, const char *str)
{
static
void yyerror(struct ctf_scanner *scanner, yyscan_t yyscanner, const char *str)
{
- _BT_LOGE_LINENO(yyget_lineno(scanner->scanner),
+ _BT_LOGE_APPEND_CAUSE_LINENO(yyget_lineno(scanner->scanner),
"%s: token=\"%s\"", str, yyget_text(scanner->scanner));
}
"%s: token=\"%s\"", str, yyget_text(scanner->scanner));
}
*/
#define BT_COMP_LOG_SELF_COMP (ctx->log_cfg.self_comp)
*/
#define BT_COMP_LOG_SELF_COMP (ctx->log_cfg.self_comp)
+#define BT_COMP_LOG_SELF_COMP_CLASS (ctx->log_cfg.self_comp_class)
#define BT_LOG_OUTPUT_LEVEL (ctx->log_cfg.log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/IR-VISITOR"
#include "logging/comp-logging.h"
#define BT_LOG_OUTPUT_LEVEL (ctx->log_cfg.log_level)
#define BT_LOG_TAG "PLUGIN/CTF/META/IR-VISITOR"
#include "logging/comp-logging.h"
do { \
ret = ctx_push_scope(ctx); \
if (ret) { \
do { \
ret = ctx_push_scope(ctx); \
if (ret) { \
- BT_COMP_LOGE_STR("Cannot push scope."); \
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot push scope."); \
goto error; \
} \
} while (0)
goto error; \
} \
} while (0)
#define _BT_LIST_FIRST_ENTRY(_ptr, _class, _member) \
bt_list_entry((_ptr)->next, _class, _member)
#define _BT_LIST_FIRST_ENTRY(_ptr, _class, _member) \
bt_list_entry((_ptr)->next, _class, _member)
-#define _BT_COMP_LOGE_DUP_ATTR(_node, _attr, _entity) \
- _BT_COMP_LOGE_LINENO((_node)->lineno, \
+#define _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(_node, _attr, _entity) \
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO((_node)->lineno, \
"Duplicate attribute in %s: attr-name=\"%s\"", \
_entity, _attr)
#define _BT_COMP_LOGE_NODE(_node, _msg, args...) \
_BT_COMP_LOGE_LINENO((_node)->lineno, _msg, ## args)
"Duplicate attribute in %s: attr-name=\"%s\"", \
_entity, _attr)
#define _BT_COMP_LOGE_NODE(_node, _msg, args...) \
_BT_COMP_LOGE_LINENO((_node)->lineno, _msg, ## args)
+#define _BT_COMP_LOGE_APPEND_CAUSE_NODE(_node, _msg, args...) \
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO((_node)->lineno, _msg, ## args)
+
#define _BT_COMP_LOGW_NODE(_node, _msg, args...) \
_BT_COMP_LOGW_LINENO((_node)->lineno, _msg, ## args)
#define _BT_COMP_LOGW_NODE(_node, _msg, args...) \
_BT_COMP_LOGW_LINENO((_node)->lineno, _msg, ## args)
scope = g_new(struct ctx_decl_scope, 1);
if (!scope) {
scope = g_new(struct ctx_decl_scope, 1);
if (!scope) {
- BT_COMP_LOGE_STR("Failed to allocate one declaration scope.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to allocate one declaration scope.");
/* Prefix character + original string + '\0' */
char *prname = g_new(char, strlen(name) + 2);
if (!prname) {
/* Prefix character + original string + '\0' */
char *prname = g_new(char, strlen(name) + 2);
if (!prname) {
- BT_COMP_LOGE_STR("Failed to allocate a string.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Failed to allocate a string.");
ctx->log_cfg.log_level = decoder_config->log_level;
ctx->log_cfg.self_comp = decoder_config->self_comp;
ctx->log_cfg.log_level = decoder_config->log_level;
ctx->log_cfg.self_comp = decoder_config->self_comp;
+ ctx->log_cfg.self_comp_class = decoder_config->self_comp_class;
if (decoder_config->self_comp) {
ctx->trace_class = bt_trace_class_create(
decoder_config->self_comp);
if (!ctx->trace_class) {
if (decoder_config->self_comp) {
ctx->trace_class = bt_trace_class_create(
decoder_config->self_comp);
if (!ctx->trace_class) {
- BT_COMP_LOGE_STR("Cannot create empty trace class.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot create empty trace class.");
goto error;
}
}
ctx->ctf_tc = ctf_trace_class_create();
if (!ctx->ctf_tc) {
goto error;
}
}
ctx->ctf_tc = ctf_trace_class_create();
if (!ctx->ctf_tc) {
- BT_COMP_LOGE_STR("Cannot create CTF trace class.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot create CTF trace class.");
goto error;
}
/* Root declaration scope */
ctx->current_scope = ctx_decl_scope_create(ctx, NULL);
if (!ctx->current_scope) {
goto error;
}
/* Root declaration scope */
ctx->current_scope = ctx_decl_scope_create(ctx, NULL);
if (!ctx->current_scope) {
- BT_COMP_LOGE_STR("Cannot create declaration scope.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot create declaration scope.");
BT_ASSERT(ctx);
new_scope = ctx_decl_scope_create(ctx, ctx->current_scope);
if (!new_scope) {
BT_ASSERT(ctx);
new_scope = ctx_decl_scope_create(ctx, ctx->current_scope);
if (!new_scope) {
- BT_COMP_LOGE_STR("Cannot create declaration scope.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot create declaration scope.");
ret = -ENOMEM;
goto end;
}
ret = -ENOMEM;
goto end;
}
uexpr_type != UNARY_UNSIGNED_CONSTANT ||
uexpr_link != UNARY_LINK_UNKNOWN || i != 0;
if (cond) {
uexpr_type != UNARY_UNSIGNED_CONSTANT ||
uexpr_link != UNARY_LINK_UNKNOWN || i != 0;
if (cond) {
- _BT_COMP_LOGE_NODE(node, "Invalid constant unsigned integer.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Invalid constant unsigned integer.");
ret = -EINVAL;
goto end;
}
ret = -EINVAL;
goto end;
}
int ret = 0;
if (unary_expr->type != NODE_UNARY_EXPRESSION) {
int ret = 0;
if (unary_expr->type != NODE_UNARY_EXPRESSION) {
- _BT_COMP_LOGE_NODE(unary_expr,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(unary_expr,
"Expecting unary expression: node-type=%d",
unary_expr->type);
ret = -EINVAL;
"Expecting unary expression: node-type=%d",
unary_expr->type);
ret = -EINVAL;
} else if (strcmp(str, "false") == 0 || strcmp(str, "FALSE") == 0) {
ret = FALSE;
} else {
} else if (strcmp(str, "false") == 0 || strcmp(str, "FALSE") == 0) {
ret = FALSE;
} else {
- _BT_COMP_LOGE_NODE(unary_expr,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(unary_expr,
"Unexpected boolean value: value=\"%s\"", str);
ret = -EINVAL;
goto end;
"Unexpected boolean value: value=\"%s\"", str);
ret = -EINVAL;
goto end;
- _BT_COMP_LOGE_NODE(unary_expr,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(unary_expr,
"Unexpected unary expression type: node-type=%d",
unary_expr->u.unary_expression.type);
ret = -EINVAL;
"Unexpected unary expression type: node-type=%d",
unary_expr->u.unary_expression.type);
ret = -EINVAL;
enum ctf_byte_order bo = CTF_BYTE_ORDER_UNKNOWN;
if (unary_expr->u.unary_expression.type != UNARY_STRING) {
enum ctf_byte_order bo = CTF_BYTE_ORDER_UNKNOWN;
if (unary_expr->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_NODE(unary_expr,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(unary_expr,
"\"byte_order\" attribute: expecting `be`, `le`, `network`, or `native`.");
goto end;
}
"\"byte_order\" attribute: expecting `be`, `le`, `network`, or `native`.");
goto end;
}
} else if (strcmp(str, "native") == 0) {
bo = CTF_BYTE_ORDER_DEFAULT;
} else {
} else if (strcmp(str, "native") == 0) {
bo = CTF_BYTE_ORDER_DEFAULT;
} else {
- _BT_COMP_LOGE_NODE(unary_expr,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(unary_expr,
"Unexpected \"byte_order\" attribute value: "
"expecting `be`, `le`, `network`, or `native`: value=\"%s\"",
str);
"Unexpected \"byte_order\" attribute value: "
"expecting `be`, `le`, `network`, or `native`: value=\"%s\"",
str);
int ret = 0;
if (cls_specifier->type != NODE_TYPE_SPECIFIER) {
int ret = 0;
if (cls_specifier->type != NODE_TYPE_SPECIFIER) {
- _BT_COMP_LOGE_NODE(cls_specifier,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier,
"Unexpected node type: node-type=%d",
cls_specifier->type);
ret = -EINVAL;
"Unexpected node type: node-type=%d",
cls_specifier->type);
ret = -EINVAL;
struct ctf_node *node = cls_specifier->u.field_class_specifier.node;
if (!node->u._struct.name) {
struct ctf_node *node = cls_specifier->u.field_class_specifier.node;
if (!node->u._struct.name) {
- _BT_COMP_LOGE_NODE(node, "Unexpected empty structure field class name.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Unexpected empty structure field class name.");
ret = -EINVAL;
goto end;
}
ret = -EINVAL;
goto end;
}
struct ctf_node *node = cls_specifier->u.field_class_specifier.node;
if (!node->u.variant.name) {
struct ctf_node *node = cls_specifier->u.field_class_specifier.node;
if (!node->u.variant.name) {
- _BT_COMP_LOGE_NODE(node, "Unexpected empty variant field class name.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Unexpected empty variant field class name.");
ret = -EINVAL;
goto end;
}
ret = -EINVAL;
goto end;
}
struct ctf_node *node = cls_specifier->u.field_class_specifier.node;
if (!node->u._enum.enum_id) {
struct ctf_node *node = cls_specifier->u.field_class_specifier.node;
if (!node->u._enum.enum_id) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected empty enumeration field class (`enum`) name.");
ret = -EINVAL;
goto end;
"Unexpected empty enumeration field class (`enum`) name.");
ret = -EINVAL;
goto end;
case TYPESPEC_INTEGER:
case TYPESPEC_STRING:
default:
case TYPESPEC_INTEGER:
case TYPESPEC_STRING:
default:
- _BT_COMP_LOGE_NODE(cls_specifier->u.field_class_specifier.node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier->u.field_class_specifier.node,
"Unexpected field class specifier type: %d",
cls_specifier->u.field_class_specifier.type);
ret = -EINVAL;
"Unexpected field class specifier type: %d",
cls_specifier->u.field_class_specifier.type);
ret = -EINVAL;
if (node_field_class_declarator) {
if (node_field_class_declarator->u.field_class_declarator.type ==
TYPEDEC_UNKNOWN) {
if (node_field_class_declarator) {
if (node_field_class_declarator->u.field_class_declarator.type ==
TYPEDEC_UNKNOWN) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"Unexpected field class declarator type: type=%d",
node_field_class_declarator->u.field_class_declarator.type);
ret = -EINVAL;
"Unexpected field class declarator type: type=%d",
node_field_class_declarator->u.field_class_declarator.type);
ret = -EINVAL;
/* TODO: GCC bitfields not supported yet */
if (node_field_class_declarator->u.field_class_declarator.bitfield_len !=
NULL) {
/* TODO: GCC bitfields not supported yet */
if (node_field_class_declarator->u.field_class_declarator.bitfield_len !=
NULL) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"GCC bitfields are not supported as of this version.");
ret = -EPERM;
goto error;
"GCC bitfields are not supported as of this version.");
ret = -EPERM;
goto error;
ctx->current_scope,
g_quark_to_string(qalias), -1, true);
if (!nested_decl) {
ctx->current_scope,
g_quark_to_string(qalias), -1, true);
if (!nested_decl) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"Cannot find class alias: name=\"%s\"",
g_quark_to_string(qalias));
ret = -EINVAL;
"Cannot find class alias: name=\"%s\"",
g_quark_to_string(qalias));
ret = -EINVAL;
/* Create array/sequence, pass nested_decl as child */
if (bt_list_empty(length)) {
/* Create array/sequence, pass nested_decl as child */
if (bt_list_empty(length)) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"Expecting length field reference or value.");
ret = -EINVAL;
goto error;
"Expecting length field reference or value.");
ret = -EINVAL;
goto error;
first = _BT_LIST_FIRST_ENTRY(length, struct ctf_node, siblings);
if (first->type != NODE_UNARY_EXPRESSION) {
first = _BT_LIST_FIRST_ENTRY(length, struct ctf_node, siblings);
if (first->type != NODE_UNARY_EXPRESSION) {
- _BT_COMP_LOGE_NODE(first,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(first,
"Unexpected node type: node-type=%d",
first->type);
ret = -EINVAL;
"Unexpected node type: node-type=%d",
first->type);
ret = -EINVAL;
char *length_name = ctf_ast_concatenate_unary_strings(length);
if (!length_name) {
char *length_name = ctf_ast_concatenate_unary_strings(length);
if (!length_name) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
"Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
struct ctf_field_class_array *array_decl;
if (!env_entry) {
struct ctf_field_class_array *array_decl;
if (!env_entry) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"Cannot find environment entry: "
"name=\"%s\"", env_entry_name);
ret = -EINVAL;
"Cannot find environment entry: "
"name=\"%s\"", env_entry_name);
ret = -EINVAL;
}
if (env_entry->type != CTF_TRACE_CLASS_ENV_ENTRY_TYPE_INT) {
}
if (env_entry->type != CTF_TRACE_CLASS_ENV_ENTRY_TYPE_INT) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"Wrong environment entry type "
"(expecting integer): "
"name=\"%s\"", env_entry_name);
"Wrong environment entry type "
"(expecting integer): "
"name=\"%s\"", env_entry_name);
}
if (env_entry->value.i < 0) {
}
if (env_entry->value.i < 0) {
- _BT_COMP_LOGE_NODE(node_field_class_declarator,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node_field_class_declarator,
"Invalid, negative array length: "
"env-entry-name=\"%s\", "
"value=%" PRId64,
"Invalid, negative array length: "
"env-entry-name=\"%s\", "
"value=%" PRId64,
&qfield_name, iter, &field_decl, NULL);
if (ret) {
BT_ASSERT(!field_decl);
&qfield_name, iter, &field_decl, NULL);
if (ret) {
BT_ASSERT(!field_decl);
- _BT_COMP_LOGE_NODE(cls_specifier_list,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier_list,
"Cannot visit field class declarator: ret=%d", ret);
goto error;
}
"Cannot visit field class declarator: ret=%d", ret);
goto error;
}
/* Check if field with same name already exists */
if (ctf_field_class_struct_borrow_member_by_name(
struct_decl, field_name)) {
/* Check if field with same name already exists */
if (ctf_field_class_struct_borrow_member_by_name(
struct_decl, field_name)) {
- _BT_COMP_LOGE_NODE(cls_specifier_list,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier_list,
"Duplicate field in structure field class: "
"field-name=\"%s\"", field_name);
ret = -EINVAL;
"Duplicate field in structure field class: "
"field-name=\"%s\"", field_name);
ret = -EINVAL;
&qfield_name, iter, &field_decl, NULL);
if (ret) {
BT_ASSERT(!field_decl);
&qfield_name, iter, &field_decl, NULL);
if (ret) {
BT_ASSERT(!field_decl);
- _BT_COMP_LOGE_NODE(cls_specifier_list,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier_list,
"Cannot visit field class declarator: ret=%d", ret);
goto error;
}
"Cannot visit field class declarator: ret=%d", ret);
goto error;
}
/* Check if field with same name already exists */
if (ctf_field_class_variant_borrow_option_by_name(
variant_decl, field_name)) {
/* Check if field with same name already exists */
if (ctf_field_class_variant_borrow_option_by_name(
variant_decl, field_name)) {
- _BT_COMP_LOGE_NODE(cls_specifier_list,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier_list,
"Duplicate field in variant field class: "
"field-name=\"%s\"", field_name);
ret = -EINVAL;
"Duplicate field in variant field class: "
"field-name=\"%s\"", field_name);
ret = -EINVAL;
ret = visit_field_class_declarator(ctx, cls_specifier_list,
&qidentifier, iter, &class_decl, NULL);
if (ret) {
ret = visit_field_class_declarator(ctx, cls_specifier_list,
&qidentifier, iter, &class_decl, NULL);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit field class declarator: ret=%d", ret);
ret = -EINVAL;
goto end;
"Cannot visit field class declarator: ret=%d", ret);
ret = -EINVAL;
goto end;
(void *) class_decl;
if (var_fc->tag_path.path->len == 0) {
(void *) class_decl;
if (var_fc->tag_path.path->len == 0) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Type definition of untagged variant field class is not allowed.");
ret = -EPERM;
goto end;
"Type definition of untagged variant field class is not allowed.");
ret = -EPERM;
goto end;
ret = ctx_decl_scope_register_alias(ctx, ctx->current_scope,
g_quark_to_string(qidentifier), class_decl);
if (ret) {
ret = ctx_decl_scope_register_alias(ctx, ctx->current_scope,
g_quark_to_string(qidentifier), class_decl);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot register field class alias: name=\"%s\"",
g_quark_to_string(qidentifier));
goto end;
"Cannot register field class alias: name=\"%s\"",
g_quark_to_string(qidentifier));
goto end;
&qdummy_field_name, node, &class_decl, NULL);
if (ret) {
BT_ASSERT(!class_decl);
&qdummy_field_name, node, &class_decl, NULL);
if (ret) {
BT_ASSERT(!class_decl);
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot visit field class declarator: ret=%d", ret);
goto end;
}
"Cannot visit field class declarator: ret=%d", ret);
goto end;
}
struct ctf_field_class_variant *var_fc = (void *) class_decl;
if (var_fc->tag_path.path->len == 0) {
struct ctf_field_class_variant *var_fc = (void *) class_decl;
if (var_fc->tag_path.path->len == 0) {
- _BT_COMP_LOGE_NODE(target,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(target,
"Type definition of untagged variant field class is not allowed.");
ret = -EPERM;
goto end;
"Type definition of untagged variant field class is not allowed.");
ret = -EPERM;
goto end;
* abstract or not (if it has an identifier). Check it here.
*/
if (qdummy_field_name != 0) {
* abstract or not (if it has an identifier). Check it here.
*/
if (qdummy_field_name != 0) {
- _BT_COMP_LOGE_NODE(target,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(target,
"Expecting empty identifier: id=\"%s\"",
g_quark_to_string(qdummy_field_name));
ret = -EINVAL;
"Expecting empty identifier: id=\"%s\"",
g_quark_to_string(qdummy_field_name));
ret = -EINVAL;
ret = ctx_decl_scope_register_alias(ctx, ctx->current_scope,
g_quark_to_string(qalias), class_decl);
if (ret) {
ret = ctx_decl_scope_register_alias(ctx, ctx->current_scope,
g_quark_to_string(qalias), class_decl);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot register class alias: name=\"%s\"",
g_quark_to_string(qalias));
goto end;
"Cannot register class alias: name=\"%s\"",
g_quark_to_string(qalias));
goto end;
entry_node->u.field_class_def.field_class_specifier_list,
&entry_node->u.field_class_def.field_class_declarators);
if (ret) {
entry_node->u.field_class_def.field_class_specifier_list,
&entry_node->u.field_class_def.field_class_declarators);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot add field class found in structure field class: ret=%d",
ret);
goto end;
"Cannot add field class found in structure field class: ret=%d",
ret);
goto end;
ret = visit_field_class_alias(ctx, entry_node->u.field_class_alias.target,
entry_node->u.field_class_alias.alias);
if (ret) {
ret = visit_field_class_alias(ctx, entry_node->u.field_class_alias.target,
entry_node->u.field_class_alias.alias);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot add field class alias found in structure field class: ret=%d",
ret);
goto end;
"Cannot add field class alias found in structure field class: ret=%d",
ret);
goto end;
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected node type: node-type=%d", entry_node->type);
ret = -EINVAL;
goto end;
"Unexpected node type: node-type=%d", entry_node->type);
ret = -EINVAL;
goto end;
entry_node->u.field_class_def.field_class_specifier_list,
&entry_node->u.field_class_def.field_class_declarators);
if (ret) {
entry_node->u.field_class_def.field_class_specifier_list,
&entry_node->u.field_class_def.field_class_declarators);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot add field class found in variant field class: ret=%d",
ret);
goto end;
"Cannot add field class found in variant field class: ret=%d",
ret);
goto end;
ret = visit_field_class_alias(ctx, entry_node->u.field_class_alias.target,
entry_node->u.field_class_alias.alias);
if (ret) {
ret = visit_field_class_alias(ctx, entry_node->u.field_class_alias.target,
entry_node->u.field_class_alias.alias);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot add field class alias found in variant field class: ret=%d",
ret);
goto end;
"Cannot add field class alias found in variant field class: ret=%d",
ret);
goto end;
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected node type: node-type=%d",
entry_node->type);
ret = -EINVAL;
"Unexpected node type: node-type=%d",
entry_node->type);
ret = -EINVAL;
/* For named struct (without body), lookup in declaration scope */
if (!has_body) {
if (!name) {
/* For named struct (without body), lookup in declaration scope */
if (!has_body) {
if (!name) {
- BT_COMP_LOGE_STR("Bodyless structure field class: missing name.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Bodyless structure field class: missing name.");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
*struct_decl = ctx_decl_scope_lookup_struct(ctx, ctx->current_scope,
name, -1, true);
if (!*struct_decl) {
*struct_decl = ctx_decl_scope_lookup_struct(ctx, ctx->current_scope,
name, -1, true);
if (!*struct_decl) {
- BT_COMP_LOGE("Cannot find structure field class: name=\"struct %s\"",
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot find structure field class: name=\"struct %s\"",
name);
ret = -EINVAL;
goto error;
name);
ret = -EINVAL;
goto error;
if (name) {
if (ctx_decl_scope_lookup_struct(ctx,
ctx->current_scope, name, 1, false)) {
if (name) {
if (ctx_decl_scope_lookup_struct(ctx,
ctx->current_scope, name, 1, false)) {
- BT_COMP_LOGE("Structure field class already declared in local scope: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Structure field class already declared in local scope: "
"name=\"struct %s\"", name);
ret = -EINVAL;
goto error;
"name=\"struct %s\"", name);
ret = -EINVAL;
goto error;
ret = get_unary_unsigned(ctx, min_align,
&min_align_value);
if (ret) {
ret = get_unary_unsigned(ctx, min_align,
&min_align_value);
if (ret) {
- BT_COMP_LOGE("Unexpected unary expression for structure field class's `align` attribute: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Unexpected unary expression for structure field class's `align` attribute: "
"ret=%d", ret);
goto error;
}
"ret=%d", ret);
goto error;
}
ret = visit_struct_decl_entry(ctx, entry_node,
*struct_decl);
if (ret) {
ret = visit_struct_decl_entry(ctx, entry_node,
*struct_decl);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot visit structure field class entry: "
"ret=%d", ret);
ctx_pop_scope(ctx);
"Cannot visit structure field class entry: "
"ret=%d", ret);
ctx_pop_scope(ctx);
ret = ctx_decl_scope_register_struct(ctx,
ctx->current_scope, name, *struct_decl);
if (ret) {
ret = ctx_decl_scope_register_struct(ctx,
ctx->current_scope, name, *struct_decl);
if (ret) {
- BT_COMP_LOGE("Cannot register structure field class in declaration scope: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot register structure field class in declaration scope: "
"name=\"struct %s\", ret=%d", name, ret);
goto error;
}
"name=\"struct %s\", ret=%d", name, ret);
goto error;
}
/* For named variant (without body), lookup in declaration scope */
if (!has_body) {
if (!name) {
/* For named variant (without body), lookup in declaration scope */
if (!has_body) {
if (!name) {
- BT_COMP_LOGE_STR("Bodyless variant field class: missing name.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Bodyless variant field class: missing name.");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
ctx_decl_scope_lookup_variant(ctx, ctx->current_scope,
name, -1, true);
if (!untagged_variant_decl) {
ctx_decl_scope_lookup_variant(ctx, ctx->current_scope,
name, -1, true);
if (!untagged_variant_decl) {
- BT_COMP_LOGE("Cannot find variant field class: name=\"variant %s\"",
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot find variant field class: name=\"variant %s\"",
name);
ret = -EINVAL;
goto error;
name);
ret = -EINVAL;
goto error;
if (name) {
if (ctx_decl_scope_lookup_variant(ctx,
ctx->current_scope, name, 1, false)) {
if (name) {
if (ctx_decl_scope_lookup_variant(ctx,
ctx->current_scope, name, 1, false)) {
- BT_COMP_LOGE("Variant field class already declared in local scope: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Variant field class already declared in local scope: "
"name=\"variant %s\"", name);
ret = -EINVAL;
goto error;
"name=\"variant %s\"", name);
ret = -EINVAL;
goto error;
ret = visit_variant_decl_entry(ctx, entry_node,
untagged_variant_decl);
if (ret) {
ret = visit_variant_decl_entry(ctx, entry_node,
untagged_variant_decl);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot visit variant field class entry: "
"ret=%d", ret);
ctx_pop_scope(ctx);
"Cannot visit variant field class entry: "
"ret=%d", ret);
ctx_pop_scope(ctx);
ctx->current_scope, name,
untagged_variant_decl);
if (ret) {
ctx->current_scope, name,
untagged_variant_decl);
if (ret) {
- BT_COMP_LOGE("Cannot register variant field class in declaration scope: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot register variant field class in declaration scope: "
"name=\"variant %s\", ret=%d", name, ret);
goto error;
}
"name=\"variant %s\", ret=%d", name, ret);
goto error;
}
struct uori *target;
if (iter->type != NODE_UNARY_EXPRESSION) {
struct uori *target;
if (iter->type != NODE_UNARY_EXPRESSION) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Wrong expression for enumeration field class label: "
"node-type=%d, label=\"%s\"", iter->type,
label);
"Wrong expression for enumeration field class label: "
"node-type=%d, label=\"%s\"", iter->type,
label);
iter->u.unary_expression.u.unsigned_constant;
break;
default:
iter->u.unary_expression.u.unsigned_constant;
break;
default:
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Invalid enumeration field class entry: "
"expecting constant signed or unsigned integer: "
"node-type=%d, label=\"%s\"",
"Invalid enumeration field class entry: "
"expecting constant signed or unsigned integer: "
"node-type=%d, label=\"%s\"",
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Invalid enumeration field class entry: label=\"%s\"",
label);
ret = -EINVAL;
"Invalid enumeration field class entry: label=\"%s\"",
label);
ret = -EINVAL;
/* For named enum (without body), lookup in declaration scope */
if (!has_body) {
if (!name) {
/* For named enum (without body), lookup in declaration scope */
if (!has_body) {
if (!name) {
- BT_COMP_LOGE_STR("Bodyless enumeration field class: missing name.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Bodyless enumeration field class: missing name.");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
*enum_decl = ctx_decl_scope_lookup_enum(ctx, ctx->current_scope,
name, -1, true);
if (!*enum_decl) {
*enum_decl = ctx_decl_scope_lookup_enum(ctx, ctx->current_scope,
name, -1, true);
if (!*enum_decl) {
- BT_COMP_LOGE("Cannot find enumeration field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot find enumeration field class: "
"name=\"enum %s\"", name);
ret = -EINVAL;
goto error;
"name=\"enum %s\"", name);
ret = -EINVAL;
goto error;
if (name) {
if (ctx_decl_scope_lookup_enum(ctx, ctx->current_scope,
name, 1, false)) {
if (name) {
if (ctx_decl_scope_lookup_enum(ctx, ctx->current_scope,
name, 1, false)) {
- BT_COMP_LOGE("Enumeration field class already declared in local scope: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Enumeration field class already declared in local scope: "
"name=\"enum %s\"", name);
ret = -EINVAL;
goto error;
"name=\"enum %s\"", name);
ret = -EINVAL;
goto error;
integer_decl = (void *) ctx_decl_scope_lookup_alias(ctx,
ctx->current_scope, "int", -1, true);
if (!integer_decl) {
integer_decl = (void *) ctx_decl_scope_lookup_alias(ctx,
ctx->current_scope, "int", -1, true);
if (!integer_decl) {
- BT_COMP_LOGE_STR("Cannot find implicit `int` field class alias for enumeration field class.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot find implicit `int` field class alias for enumeration field class.");
ret = -EINVAL;
goto error;
}
ret = -EINVAL;
goto error;
}
BT_ASSERT(integer_decl);
if (integer_decl->base.base.type != CTF_FIELD_CLASS_TYPE_INT) {
BT_ASSERT(integer_decl);
if (integer_decl->base.base.type != CTF_FIELD_CLASS_TYPE_INT) {
- BT_COMP_LOGE("Container field class for enumeration field class is not an integer field class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Container field class for enumeration field class is not an integer field class: "
"fc-type=%d", integer_decl->base.base.type);
ret = -EINVAL;
goto error;
"fc-type=%d", integer_decl->base.base.type);
ret = -EINVAL;
goto error;
ret = visit_enum_decl_entry(ctx, iter, *enum_decl,
&last_value);
if (ret) {
ret = visit_enum_decl_entry(ctx, iter, *enum_decl,
&last_value);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit enumeration field class entry: "
"ret=%d", ret);
goto error;
"Cannot visit enumeration field class entry: "
"ret=%d", ret);
goto error;
ret = ctx_decl_scope_register_enum(ctx,
ctx->current_scope, name, *enum_decl);
if (ret) {
ret = ctx_decl_scope_register_enum(ctx,
ctx->current_scope, name, *enum_decl);
if (ret) {
- BT_COMP_LOGE("Cannot register enumeration field class in declaration scope: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot register enumeration field class in declaration scope: "
"ret=%d", ret);
goto error;
}
"ret=%d", ret);
goto error;
}
str = g_string_new("");
ret = get_class_specifier_list_name(ctx, cls_specifier_list, str);
if (ret) {
str = g_string_new("");
ret = get_class_specifier_list_name(ctx, cls_specifier_list, str);
if (ret) {
- _BT_COMP_LOGE_NODE(cls_specifier_list,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier_list,
"Cannot get field class specifier list's name: ret=%d", ret);
goto error;
}
"Cannot get field class specifier list's name: ret=%d", ret);
goto error;
}
*decl = ctx_decl_scope_lookup_alias(ctx, ctx->current_scope, str->str,
-1, true);
if (!*decl) {
*decl = ctx_decl_scope_lookup_alias(ctx, ctx->current_scope, str->str,
-1, true);
if (!*decl) {
- _BT_COMP_LOGE_NODE(cls_specifier_list,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(cls_specifier_list,
"Cannot find field class alias: name=\"%s\"", str->str);
ret = -EINVAL;
goto error;
"Cannot find field class alias: name=\"%s\"", str->str);
ret = -EINVAL;
goto error;
siblings);
if (left->u.unary_expression.type != UNARY_STRING) {
siblings);
if (left->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_NODE(left,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(left,
"Unexpected unary expression type: type=%d",
left->u.unary_expression.type);
ret = -EINVAL;
"Unexpected unary expression type: type=%d",
left->u.unary_expression.type);
ret = -EINVAL;
if (strcmp(left->u.unary_expression.u.string, "signed") == 0) {
if (_IS_SET(&set, _INTEGER_SIGNED_SET)) {
if (strcmp(left->u.unary_expression.u.string, "signed") == 0) {
if (_IS_SET(&set, _INTEGER_SIGNED_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "signed",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "signed",
"integer field class");
ret = -EPERM;
goto error;
"integer field class");
ret = -EPERM;
goto error;
signedness = get_boolean(ctx, right);
if (signedness < 0) {
signedness = get_boolean(ctx, right);
if (signedness < 0) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid boolean value for integer field class's `signed` attribute: "
"ret=%d", ret);
ret = -EINVAL;
"Invalid boolean value for integer field class's `signed` attribute: "
"ret=%d", ret);
ret = -EINVAL;
_SET(&set, _INTEGER_SIGNED_SET);
} else if (strcmp(left->u.unary_expression.u.string, "byte_order") == 0) {
if (_IS_SET(&set, _INTEGER_BYTE_ORDER_SET)) {
_SET(&set, _INTEGER_SIGNED_SET);
} else if (strcmp(left->u.unary_expression.u.string, "byte_order") == 0) {
if (_IS_SET(&set, _INTEGER_BYTE_ORDER_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "byte_order",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "byte_order",
"integer field class");
ret = -EPERM;
goto error;
"integer field class");
ret = -EPERM;
goto error;
byte_order = get_real_byte_order(ctx, right);
if (byte_order == CTF_BYTE_ORDER_UNKNOWN) {
byte_order = get_real_byte_order(ctx, right);
if (byte_order == CTF_BYTE_ORDER_UNKNOWN) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `byte_order` attribute in integer field class: "
"ret=%d", ret);
ret = -EINVAL;
"Invalid `byte_order` attribute in integer field class: "
"ret=%d", ret);
ret = -EINVAL;
_SET(&set, _INTEGER_BYTE_ORDER_SET);
} else if (strcmp(left->u.unary_expression.u.string, "size") == 0) {
if (_IS_SET(&set, _INTEGER_SIZE_SET)) {
_SET(&set, _INTEGER_BYTE_ORDER_SET);
} else if (strcmp(left->u.unary_expression.u.string, "size") == 0) {
if (_IS_SET(&set, _INTEGER_SIZE_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "size",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "size",
"integer field class");
ret = -EPERM;
goto error;
"integer field class");
ret = -EPERM;
goto error;
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `size` attribute in integer field class: "
"expecting unsigned constant integer: "
"node-type=%d",
"Invalid `size` attribute in integer field class: "
"expecting unsigned constant integer: "
"node-type=%d",
size = right->u.unary_expression.u.unsigned_constant;
if (size == 0) {
size = right->u.unary_expression.u.unsigned_constant;
if (size == 0) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `size` attribute in integer field class: "
"expecting positive constant integer: "
"size=%" PRIu64, size);
ret = -EINVAL;
goto error;
} else if (size > 64) {
"Invalid `size` attribute in integer field class: "
"expecting positive constant integer: "
"size=%" PRIu64, size);
ret = -EINVAL;
goto error;
} else if (size > 64) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `size` attribute in integer field class: "
"integer fields over 64 bits are not supported as of this version: "
"size=%" PRIu64, size);
"Invalid `size` attribute in integer field class: "
"integer fields over 64 bits are not supported as of this version: "
"size=%" PRIu64, size);
_SET(&set, _INTEGER_SIZE_SET);
} else if (strcmp(left->u.unary_expression.u.string, "align") == 0) {
if (_IS_SET(&set, _INTEGER_ALIGN_SET)) {
_SET(&set, _INTEGER_SIZE_SET);
} else if (strcmp(left->u.unary_expression.u.string, "align") == 0) {
if (_IS_SET(&set, _INTEGER_ALIGN_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "align",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "align",
"integer field class");
ret = -EPERM;
goto error;
"integer field class");
ret = -EPERM;
goto error;
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `align` attribute in integer field class: "
"expecting unsigned constant integer: "
"node-type=%d",
"Invalid `align` attribute in integer field class: "
"expecting unsigned constant integer: "
"node-type=%d",
alignment =
right->u.unary_expression.u.unsigned_constant;
if (!is_align_valid(alignment)) {
alignment =
right->u.unary_expression.u.unsigned_constant;
if (!is_align_valid(alignment)) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `align` attribute in integer field class: "
"expecting power of two: "
"align=%" PRIu64, alignment);
"Invalid `align` attribute in integer field class: "
"expecting power of two: "
"align=%" PRIu64, alignment);
_SET(&set, _INTEGER_ALIGN_SET);
} else if (strcmp(left->u.unary_expression.u.string, "base") == 0) {
if (_IS_SET(&set, _INTEGER_BASE_SET)) {
_SET(&set, _INTEGER_ALIGN_SET);
} else if (strcmp(left->u.unary_expression.u.string, "base") == 0) {
if (_IS_SET(&set, _INTEGER_BASE_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "base",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "base",
"integer field class");
ret = -EPERM;
goto error;
"integer field class");
ret = -EPERM;
goto error;
base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL;
break;
default:
base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL;
break;
default:
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `base` attribute in integer field class: "
"base=%" PRIu64,
right->u.unary_expression.u.unsigned_constant);
"Invalid `base` attribute in integer field class: "
"base=%" PRIu64,
right->u.unary_expression.u.unsigned_constant);
char *s_right = ctf_ast_concatenate_unary_strings(
&expression->u.ctf_expression.right);
if (!s_right) {
char *s_right = ctf_ast_concatenate_unary_strings(
&expression->u.ctf_expression.right);
if (!s_right) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Unexpected unary expression for integer field class's `base` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for integer field class's `base` attribute.");
ret = -EINVAL;
goto error;
strcmp(s_right, "b") == 0) {
base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY;
} else {
strcmp(s_right, "b") == 0) {
base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY;
} else {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Unexpected unary expression for integer field class's `base` attribute: "
"base=\"%s\"", s_right);
g_free(s_right);
"Unexpected unary expression for integer field class's `base` attribute: "
"base=\"%s\"", s_right);
g_free(s_right);
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `base` attribute in integer field class: "
"expecting unsigned constant integer or unary string.");
ret = -EINVAL;
"Invalid `base` attribute in integer field class: "
"expecting unsigned constant integer or unary string.");
ret = -EINVAL;
char *s_right;
if (_IS_SET(&set, _INTEGER_ENCODING_SET)) {
char *s_right;
if (_IS_SET(&set, _INTEGER_ENCODING_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "encoding",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "encoding",
"integer field class");
ret = -EPERM;
goto error;
}
if (right->u.unary_expression.type != UNARY_STRING) {
"integer field class");
ret = -EPERM;
goto error;
}
if (right->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `encoding` attribute in integer field class: "
"expecting unary string.");
ret = -EINVAL;
"Invalid `encoding` attribute in integer field class: "
"expecting unary string.");
ret = -EINVAL;
s_right = ctf_ast_concatenate_unary_strings(
&expression->u.ctf_expression.right);
if (!s_right) {
s_right = ctf_ast_concatenate_unary_strings(
&expression->u.ctf_expression.right);
if (!s_right) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Unexpected unary expression for integer field class's `encoding` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for integer field class's `encoding` attribute.");
ret = -EINVAL;
goto error;
} else if (strcmp(s_right, "none") == 0) {
encoding = CTF_ENCODING_NONE;
} else {
} else if (strcmp(s_right, "none") == 0) {
encoding = CTF_ENCODING_NONE;
} else {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `encoding` attribute in integer field class: "
"unknown encoding: encoding=\"%s\"",
s_right);
"Invalid `encoding` attribute in integer field class: "
"unknown encoding: encoding=\"%s\"",
s_right);
const char *clock_name;
if (_IS_SET(&set, _INTEGER_MAP_SET)) {
const char *clock_name;
if (_IS_SET(&set, _INTEGER_MAP_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "map",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "map",
"integer field class");
ret = -EPERM;
goto error;
}
if (right->u.unary_expression.type != UNARY_STRING) {
"integer field class");
ret = -EPERM;
goto error;
}
if (right->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `map` attribute in integer field class: "
"expecting unary string.");
ret = -EINVAL;
"Invalid `map` attribute in integer field class: "
"expecting unary string.");
ret = -EINVAL;
&expression->u.ctf_expression.right);
if (!s_right) {
&expression->u.ctf_expression.right);
if (!s_right) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Unexpected unary expression for integer field class's `map` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for integer field class's `map` attribute.");
ret = -EINVAL;
goto error;
ctf_trace_class_borrow_clock_class_by_name(
ctx->ctf_tc, clock_name);
if (!mapped_clock_class) {
ctf_trace_class_borrow_clock_class_by_name(
ctx->ctf_tc, clock_name);
if (!mapped_clock_class) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `map` attribute in integer field class: "
"cannot find clock class at this point: name=\"%s\"",
clock_name);
"Invalid `map` attribute in integer field class: "
"cannot find clock class at this point: name=\"%s\"",
clock_name);
}
if (!_IS_SET(&set, _INTEGER_SIZE_SET)) {
}
if (!_IS_SET(&set, _INTEGER_SIZE_SET)) {
- BT_COMP_LOGE_STR("Missing `size` attribute in integer field class.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Missing `size` attribute in integer field class.");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
siblings);
if (left->u.unary_expression.type != UNARY_STRING) {
siblings);
if (left->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_NODE(left,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(left,
"Unexpected unary expression type: type=%d",
left->u.unary_expression.type);
ret = -EINVAL;
"Unexpected unary expression type: type=%d",
left->u.unary_expression.type);
ret = -EINVAL;
if (strcmp(left->u.unary_expression.u.string, "byte_order") == 0) {
if (_IS_SET(&set, _FLOAT_BYTE_ORDER_SET)) {
if (strcmp(left->u.unary_expression.u.string, "byte_order") == 0) {
if (_IS_SET(&set, _FLOAT_BYTE_ORDER_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "byte_order",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "byte_order",
"floating point number field class");
ret = -EPERM;
goto error;
"floating point number field class");
ret = -EPERM;
goto error;
byte_order = get_real_byte_order(ctx, right);
if (byte_order == CTF_BYTE_ORDER_UNKNOWN) {
byte_order = get_real_byte_order(ctx, right);
if (byte_order == CTF_BYTE_ORDER_UNKNOWN) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `byte_order` attribute in floating point number field class: "
"ret=%d", ret);
ret = -EINVAL;
"Invalid `byte_order` attribute in floating point number field class: "
"ret=%d", ret);
ret = -EINVAL;
_SET(&set, _FLOAT_BYTE_ORDER_SET);
} else if (strcmp(left->u.unary_expression.u.string, "exp_dig") == 0) {
if (_IS_SET(&set, _FLOAT_EXP_DIG_SET)) {
_SET(&set, _FLOAT_BYTE_ORDER_SET);
} else if (strcmp(left->u.unary_expression.u.string, "exp_dig") == 0) {
if (_IS_SET(&set, _FLOAT_EXP_DIG_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "exp_dig",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "exp_dig",
"floating point number field class");
ret = -EPERM;
goto error;
"floating point number field class");
ret = -EPERM;
goto error;
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `exp_dig` attribute in floating point number field class: "
"expecting unsigned constant integer: "
"node-type=%d",
"Invalid `exp_dig` attribute in floating point number field class: "
"expecting unsigned constant integer: "
"node-type=%d",
_SET(&set, _FLOAT_EXP_DIG_SET);
} else if (strcmp(left->u.unary_expression.u.string, "mant_dig") == 0) {
if (_IS_SET(&set, _FLOAT_MANT_DIG_SET)) {
_SET(&set, _FLOAT_EXP_DIG_SET);
} else if (strcmp(left->u.unary_expression.u.string, "mant_dig") == 0) {
if (_IS_SET(&set, _FLOAT_MANT_DIG_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "mant_dig",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "mant_dig",
"floating point number field class");
ret = -EPERM;
goto error;
"floating point number field class");
ret = -EPERM;
goto error;
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `mant_dig` attribute in floating point number field class: "
"expecting unsigned constant integer: "
"node-type=%d",
"Invalid `mant_dig` attribute in floating point number field class: "
"expecting unsigned constant integer: "
"node-type=%d",
_SET(&set, _FLOAT_MANT_DIG_SET);
} else if (strcmp(left->u.unary_expression.u.string, "align") == 0) {
if (_IS_SET(&set, _FLOAT_ALIGN_SET)) {
_SET(&set, _FLOAT_MANT_DIG_SET);
} else if (strcmp(left->u.unary_expression.u.string, "align") == 0) {
if (_IS_SET(&set, _FLOAT_ALIGN_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "align",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "align",
"floating point number field class");
ret = -EPERM;
goto error;
"floating point number field class");
ret = -EPERM;
goto error;
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
if (right->u.unary_expression.type !=
UNARY_UNSIGNED_CONSTANT) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `align` attribute in floating point number field class: "
"expecting unsigned constant integer: "
"node-type=%d",
"Invalid `align` attribute in floating point number field class: "
"expecting unsigned constant integer: "
"node-type=%d",
unsigned_constant;
if (!is_align_valid(alignment)) {
unsigned_constant;
if (!is_align_valid(alignment)) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `align` attribute in floating point number field class: "
"expecting power of two: "
"align=%" PRIu64, alignment);
"Invalid `align` attribute in floating point number field class: "
"expecting power of two: "
"align=%" PRIu64, alignment);
}
if (!_IS_SET(&set, _FLOAT_MANT_DIG_SET)) {
}
if (!_IS_SET(&set, _FLOAT_MANT_DIG_SET)) {
- BT_COMP_LOGE_STR("Missing `mant_dig` attribute in floating point number field class.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Missing `mant_dig` attribute in floating point number field class.");
ret = -EPERM;
goto error;
}
if (!_IS_SET(&set, _FLOAT_EXP_DIG_SET)) {
ret = -EPERM;
goto error;
}
if (!_IS_SET(&set, _FLOAT_EXP_DIG_SET)) {
- BT_COMP_LOGE_STR("Missing `exp_dig` attribute in floating point number field class.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Missing `exp_dig` attribute in floating point number field class.");
ret = -EPERM;
goto error;
}
if (mant_dig != 24 && mant_dig != 53) {
ret = -EPERM;
goto error;
}
if (mant_dig != 24 && mant_dig != 53) {
- BT_COMP_LOGE_STR("`mant_dig` attribute: expecting 24 or 53.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("`mant_dig` attribute: expecting 24 or 53.");
ret = -EPERM;
goto error;
}
if (mant_dig == 24 && exp_dig != 8) {
ret = -EPERM;
goto error;
}
if (mant_dig == 24 && exp_dig != 8) {
- BT_COMP_LOGE_STR("`exp_dig` attribute: expecting 8 because `mant_dig` is 24.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("`exp_dig` attribute: expecting 8 because `mant_dig` is 24.");
ret = -EPERM;
goto error;
}
if (mant_dig == 53 && exp_dig != 11) {
ret = -EPERM;
goto error;
}
if (mant_dig == 53 && exp_dig != 11) {
- BT_COMP_LOGE_STR("`exp_dig` attribute: expecting 11 because `mant_dig` is 53.");
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("`exp_dig` attribute: expecting 11 because `mant_dig` is 53.");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
siblings);
if (left->u.unary_expression.type != UNARY_STRING) {
siblings);
if (left->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_NODE(left,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(left,
"Unexpected unary expression type: type=%d",
left->u.unary_expression.type);
ret = -EINVAL;
"Unexpected unary expression type: type=%d",
left->u.unary_expression.type);
ret = -EINVAL;
char *s_right;
if (_IS_SET(&set, _STRING_ENCODING_SET)) {
char *s_right;
if (_IS_SET(&set, _STRING_ENCODING_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(left, "encoding",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(left, "encoding",
"string field class");
ret = -EPERM;
goto error;
}
if (right->u.unary_expression.type != UNARY_STRING) {
"string field class");
ret = -EPERM;
goto error;
}
if (right->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `encoding` attribute in string field class: "
"expecting unary string.");
ret = -EINVAL;
"Invalid `encoding` attribute in string field class: "
"expecting unary string.");
ret = -EINVAL;
s_right = ctf_ast_concatenate_unary_strings(
&expression->u.ctf_expression.right);
if (!s_right) {
s_right = ctf_ast_concatenate_unary_strings(
&expression->u.ctf_expression.right);
if (!s_right) {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Unexpected unary expression for string field class's `encoding` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for string field class's `encoding` attribute.");
ret = -EINVAL;
goto error;
} else if (strcmp(s_right, "none") == 0) {
encoding = CTF_ENCODING_NONE;
} else {
} else if (strcmp(s_right, "none") == 0) {
encoding = CTF_ENCODING_NONE;
} else {
- _BT_COMP_LOGE_NODE(right,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(right,
"Invalid `encoding` attribute in string field class: "
"unknown encoding: encoding=\"%s\"",
s_right);
"Invalid `encoding` attribute in string field class: "
"unknown encoding: encoding=\"%s\"",
s_right);
*decl = NULL;
if (ts_list->type != NODE_TYPE_SPECIFIER_LIST) {
*decl = NULL;
if (ts_list->type != NODE_TYPE_SPECIFIER_LIST) {
- _BT_COMP_LOGE_NODE(ts_list,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(ts_list,
"Unexpected node type: node-type=%d", ts_list->type);
ret = -EINVAL;
goto error;
"Unexpected node type: node-type=%d", ts_list->type);
ret = -EINVAL;
goto error;
first = _BT_LIST_FIRST_ENTRY(&ts_list->u.field_class_specifier_list.head,
struct ctf_node, siblings);
if (first->type != NODE_TYPE_SPECIFIER) {
first = _BT_LIST_FIRST_ENTRY(&ts_list->u.field_class_specifier_list.head,
struct ctf_node, siblings);
if (first->type != NODE_TYPE_SPECIFIER) {
- _BT_COMP_LOGE_NODE(first,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(first,
"Unexpected node type: node-type=%d", first->type);
ret = -EINVAL;
goto error;
"Unexpected node type: node-type=%d", first->type);
ret = -EINVAL;
goto error;
case TYPESPEC_ID_TYPE:
ret = visit_field_class_specifier(ctx, ts_list, decl);
if (ret) {
case TYPESPEC_ID_TYPE:
ret = visit_field_class_specifier(ctx, ts_list, decl);
if (ret) {
- _BT_COMP_LOGE_NODE(first,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(first,
"Cannot visit field class specifier: ret=%d",
ret);
BT_ASSERT(!*decl);
"Cannot visit field class specifier: ret=%d",
ret);
BT_ASSERT(!*decl);
- _BT_COMP_LOGE_NODE(first,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(first,
"Unexpected field class specifier type: node-type=%d",
first->u.field_class_specifier.type);
ret = -EINVAL;
"Unexpected field class specifier type: node-type=%d",
first->u.field_class_specifier.type);
ret = -EINVAL;
ret = visit_field_class_def(ctx, node->u.field_class_def.field_class_specifier_list,
&node->u.field_class_def.field_class_declarators);
if (ret) {
ret = visit_field_class_def(ctx, node->u.field_class_def.field_class_specifier_list,
&node->u.field_class_def.field_class_declarators);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot add field class found in event class.");
goto error;
}
"Cannot add field class found in event class.");
goto error;
}
ret = visit_field_class_alias(ctx, node->u.field_class_alias.target,
node->u.field_class_alias.alias);
if (ret) {
ret = visit_field_class_alias(ctx, node->u.field_class_alias.target,
node->u.field_class_alias.alias);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot add field class alias found in event class.");
goto error;
}
"Cannot add field class alias found in event class.");
goto error;
}
{
left = ctf_ast_concatenate_unary_strings(&node->u.ctf_expression.left);
if (!left) {
{
left = ctf_ast_concatenate_unary_strings(&node->u.ctf_expression.left);
if (!left) {
- _BT_COMP_LOGE_NODE(node, "Cannot concatenate unary strings.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
}
ret = -EINVAL;
goto error;
}
if (strcmp(left, "name") == 0) {
/* This is already known at this stage */
if (_IS_SET(set, _EVENT_NAME_SET)) {
if (strcmp(left, "name") == 0) {
/* This is already known at this stage */
if (_IS_SET(set, _EVENT_NAME_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "name", "event class");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "name", "event class");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
int64_t id = -1;
if (_IS_SET(set, _EVENT_ID_SET)) {
int64_t id = -1;
if (_IS_SET(set, _EVENT_ID_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "id", "event class");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "id", "event class");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
(uint64_t *) &id);
/* Only read "id" if get_unary_unsigned() succeeded. */
if (ret || (!ret && id < 0)) {
(uint64_t *) &id);
/* Only read "id" if get_unary_unsigned() succeeded. */
if (ret || (!ret && id < 0)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected unary expression for event class's `id` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for event class's `id` attribute.");
ret = -EINVAL;
goto error;
_SET(set, _EVENT_ID_SET);
} else if (strcmp(left, "stream_id") == 0) {
if (_IS_SET(set, _EVENT_STREAM_ID_SET)) {
_SET(set, _EVENT_ID_SET);
} else if (strcmp(left, "stream_id") == 0) {
if (_IS_SET(set, _EVENT_STREAM_ID_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "stream_id",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "stream_id",
"event class");
ret = -EPERM;
goto error;
"event class");
ret = -EPERM;
goto error;
* succeeded.
*/
if (ret) {
* succeeded.
*/
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected unary expression for event class's `stream_id` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for event class's `stream_id` attribute.");
ret = -EINVAL;
goto error;
_SET(set, _EVENT_STREAM_ID_SET);
} else if (strcmp(left, "context") == 0) {
if (_IS_SET(set, _EVENT_CONTEXT_SET)) {
_SET(set, _EVENT_STREAM_ID_SET);
} else if (strcmp(left, "context") == 0) {
if (_IS_SET(set, _EVENT_CONTEXT_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate `context` entry in event class.");
ret = -EPERM;
goto error;
"Duplicate `context` entry in event class.");
ret = -EPERM;
goto error;
struct ctf_node, siblings),
&event_class->spec_context_fc);
if (ret) {
struct ctf_node, siblings),
&event_class->spec_context_fc);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot create event class's context field class.");
goto error;
}
"Cannot create event class's context field class.");
goto error;
}
_SET(set, _EVENT_CONTEXT_SET);
} else if (strcmp(left, "fields") == 0) {
if (_IS_SET(set, _EVENT_FIELDS_SET)) {
_SET(set, _EVENT_CONTEXT_SET);
} else if (strcmp(left, "fields") == 0) {
if (_IS_SET(set, _EVENT_FIELDS_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate `fields` entry in event class.");
ret = -EPERM;
goto error;
"Duplicate `fields` entry in event class.");
ret = -EPERM;
goto error;
struct ctf_node, siblings),
&event_class->payload_fc);
if (ret) {
struct ctf_node, siblings),
&event_class->payload_fc);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot create event class's payload field class.");
goto error;
}
"Cannot create event class's payload field class.");
goto error;
}
bt_event_class_log_level log_level = -1;
if (_IS_SET(set, _EVENT_LOG_LEVEL_SET)) {
bt_event_class_log_level log_level = -1;
if (_IS_SET(set, _EVENT_LOG_LEVEL_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "loglevel",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "loglevel",
"event class");
ret = -EPERM;
goto error;
"event class");
ret = -EPERM;
goto error;
ret = get_unary_unsigned(ctx,
&node->u.ctf_expression.right, &loglevel_value);
if (ret) {
ret = get_unary_unsigned(ctx,
&node->u.ctf_expression.right, &loglevel_value);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected unary expression for event class's `loglevel` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for event class's `loglevel` attribute.");
ret = -EINVAL;
goto error;
char *right;
if (_IS_SET(set, _EVENT_MODEL_EMF_URI_SET)) {
char *right;
if (_IS_SET(set, _EVENT_MODEL_EMF_URI_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "model.emf.uri",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "model.emf.uri",
"event class");
ret = -EPERM;
goto error;
"event class");
ret = -EPERM;
goto error;
right = ctf_ast_concatenate_unary_strings(
&node->u.ctf_expression.right);
if (!right) {
right = ctf_ast_concatenate_unary_strings(
&node->u.ctf_expression.right);
if (!right) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected unary expression for event class's `model.emf.uri` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for event class's `model.emf.uri` attribute.");
ret = -EINVAL;
goto error;
left = ctf_ast_concatenate_unary_strings(&iter->u.ctf_expression.left);
if (!left) {
left = ctf_ast_concatenate_unary_strings(&iter->u.ctf_expression.left);
if (!left) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot concatenate unary strings.");
goto error;
}
"Cannot concatenate unary strings.");
goto error;
}
name = ctf_ast_concatenate_unary_strings(
&iter->u.ctf_expression.right);
if (!name) {
name = ctf_ast_concatenate_unary_strings(
&iter->u.ctf_expression.right);
if (!name) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Unexpected unary expression for event class's `name` attribute.");
goto error;
}
"Unexpected unary expression for event class's `name` attribute.");
goto error;
}
node->visited = TRUE;
event_name = get_event_decl_name(ctx, node);
if (!event_name) {
node->visited = TRUE;
event_name = get_event_decl_name(ctx, node);
if (!event_name) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Missing `name` attribute in event class.");
ret = -EPERM;
goto error;
"Missing `name` attribute in event class.");
ret = -EPERM;
goto error;
ret = visit_event_decl_entry(ctx, iter, event_class,
&stream_id, &set);
if (ret) {
ret = visit_event_decl_entry(ctx, iter, event_class,
&stream_id, &set);
if (ret) {
- _BT_COMP_LOGE_NODE(iter, "Cannot visit event class's entry: "
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter, "Cannot visit event class's entry: "
"ret=%d", ret);
goto error;
}
"ret=%d", ret);
goto error;
}
stream_id = stream_class->id;
break;
default:
stream_id = stream_class->id;
break;
default:
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Missing `stream_id` attribute in event class.");
ret = -EPERM;
goto error;
"Missing `stream_id` attribute in event class.");
ret = -EPERM;
goto error;
stream_class = ctf_trace_class_borrow_stream_class_by_id(
ctx->ctf_tc, stream_id);
if (!stream_class) {
stream_class = ctf_trace_class_borrow_stream_class_by_id(
ctx->ctf_tc, stream_id);
if (!stream_class) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot find stream class at this point: "
"id=%" PRId64, stream_id);
ret = -EINVAL;
"Cannot find stream class at this point: "
"id=%" PRId64, stream_id);
ret = -EINVAL;
if (!_IS_SET(&set, _EVENT_ID_SET)) {
/* Allow only one event without ID per stream */
if (stream_class->event_classes->len != 0) {
if (!_IS_SET(&set, _EVENT_ID_SET)) {
/* Allow only one event without ID per stream */
if (stream_class->event_classes->len != 0) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Missing `id` attribute in event class.");
ret = -EPERM;
goto error;
"Missing `id` attribute in event class.");
ret = -EPERM;
goto error;
if (ctf_stream_class_borrow_event_class_by_id(stream_class,
event_class->id)) {
if (ctf_stream_class_borrow_event_class_by_id(stream_class,
event_class->id)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate event class (same ID) in the same stream class: "
"id=%" PRId64, event_class->id);
ret = -EEXIST;
"Duplicate event class (same ID) in the same stream class: "
"id=%" PRId64, event_class->id);
ret = -EEXIST;
* Timestamp field not mapped to a clock class and there's more
* than one clock class in the trace: this is an error.
*/
* Timestamp field not mapped to a clock class and there's more
* than one clock class in the trace: this is an error.
*/
- BT_COMP_LOGE_STR("Timestamp field found with no mapped clock class, "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Timestamp field found with no mapped clock class, "
"but there's more than one clock class in the trace at this point.");
ret = -1;
goto end;
"but there's more than one clock class in the trace at this point.");
ret = -1;
goto end;
ret = auto_map_field_to_trace_clock_class(ctx,
named_fc->fc);
if (ret) {
ret = auto_map_field_to_trace_clock_class(ctx,
named_fc->fc);
if (ret) {
- BT_COMP_LOGE("Cannot automatically map field to trace's clock class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot automatically map field to trace's clock class: "
"field-name=\"%s\"", field_name);
goto end;
}
"field-name=\"%s\"", field_name);
goto end;
}
ret = auto_map_fields_to_trace_clock_class(ctx, named_fc->fc,
field_name);
if (ret) {
ret = auto_map_fields_to_trace_clock_class(ctx, named_fc->fc,
field_name);
if (ret) {
- BT_COMP_LOGE("Cannot automatically map structure or variant field class's fields to trace's clock class: "
+ _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE("Cannot automatically map structure or variant field class's fields to trace's clock class: "
"field-name=\"%s\", root-field-name=\"%s\"",
field_name, named_fc->name->str);
goto end;
"field-name=\"%s\", root-field-name=\"%s\"",
field_name, named_fc->name->str);
goto end;
ret = visit_field_class_def(ctx, node->u.field_class_def.field_class_specifier_list,
&node->u.field_class_def.field_class_declarators);
if (ret) {
ret = visit_field_class_def(ctx, node->u.field_class_def.field_class_specifier_list,
&node->u.field_class_def.field_class_declarators);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot add field class found in stream class.");
goto error;
}
"Cannot add field class found in stream class.");
goto error;
}
ret = visit_field_class_alias(ctx, node->u.field_class_alias.target,
node->u.field_class_alias.alias);
if (ret) {
ret = visit_field_class_alias(ctx, node->u.field_class_alias.target,
node->u.field_class_alias.alias);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot add field class alias found in stream class.");
goto error;
}
"Cannot add field class alias found in stream class.");
goto error;
}
{
left = ctf_ast_concatenate_unary_strings(&node->u.ctf_expression.left);
if (!left) {
{
left = ctf_ast_concatenate_unary_strings(&node->u.ctf_expression.left);
if (!left) {
- _BT_COMP_LOGE_NODE(node, "Cannot concatenate unary strings.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
}
ret = -EINVAL;
goto error;
}
int64_t id;
if (_IS_SET(set, _STREAM_ID_SET)) {
int64_t id;
if (_IS_SET(set, _STREAM_ID_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "id",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "id",
"stream declaration");
ret = -EPERM;
goto error;
"stream declaration");
ret = -EPERM;
goto error;
/* Only read "id" if get_unary_unsigned() succeeded. */
if (ret || (!ret && id < 0)) {
/* Only read "id" if get_unary_unsigned() succeeded. */
if (ret || (!ret && id < 0)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected unary expression for stream class's `id` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for stream class's `id` attribute.");
ret = -EINVAL;
goto error;
if (ctf_trace_class_borrow_stream_class_by_id(
ctx->ctf_tc, id)) {
if (ctf_trace_class_borrow_stream_class_by_id(
ctx->ctf_tc, id)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate stream class (same ID): id=%" PRId64,
id);
ret = -EEXIST;
"Duplicate stream class (same ID): id=%" PRId64,
id);
ret = -EEXIST;
_SET(set, _STREAM_ID_SET);
} else if (strcmp(left, "event.header") == 0) {
if (_IS_SET(set, _STREAM_EVENT_HEADER_SET)) {
_SET(set, _STREAM_ID_SET);
} else if (strcmp(left, "event.header") == 0) {
if (_IS_SET(set, _STREAM_EVENT_HEADER_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate `event.header` entry in stream class.");
ret = -EPERM;
goto error;
"Duplicate `event.header` entry in stream class.");
ret = -EPERM;
goto error;
struct ctf_node, siblings),
&stream_class->event_header_fc);
if (ret) {
struct ctf_node, siblings),
&stream_class->event_header_fc);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot create stream class's event header field class.");
goto error;
}
"Cannot create stream class's event header field class.");
goto error;
}
ret = auto_map_fields_to_trace_clock_class(ctx,
stream_class->event_header_fc, "timestamp");
if (ret) {
ret = auto_map_fields_to_trace_clock_class(ctx,
stream_class->event_header_fc, "timestamp");
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot automatically map specific event header field class fields named `timestamp` to trace's clock class.");
goto error;
}
"Cannot automatically map specific event header field class fields named `timestamp` to trace's clock class.");
goto error;
}
_SET(set, _STREAM_EVENT_HEADER_SET);
} else if (strcmp(left, "event.context") == 0) {
if (_IS_SET(set, _STREAM_EVENT_CONTEXT_SET)) {
_SET(set, _STREAM_EVENT_HEADER_SET);
} else if (strcmp(left, "event.context") == 0) {
if (_IS_SET(set, _STREAM_EVENT_CONTEXT_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate `event.context` entry in stream class.");
ret = -EPERM;
goto error;
"Duplicate `event.context` entry in stream class.");
ret = -EPERM;
goto error;
struct ctf_node, siblings),
&stream_class->event_common_context_fc);
if (ret) {
struct ctf_node, siblings),
&stream_class->event_common_context_fc);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot create stream class's event context field class.");
goto error;
}
"Cannot create stream class's event context field class.");
goto error;
}
_SET(set, _STREAM_EVENT_CONTEXT_SET);
} else if (strcmp(left, "packet.context") == 0) {
if (_IS_SET(set, _STREAM_PACKET_CONTEXT_SET)) {
_SET(set, _STREAM_EVENT_CONTEXT_SET);
} else if (strcmp(left, "packet.context") == 0) {
if (_IS_SET(set, _STREAM_PACKET_CONTEXT_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate `packet.context` entry in stream class.");
ret = -EPERM;
goto error;
"Duplicate `packet.context` entry in stream class.");
ret = -EPERM;
goto error;
struct ctf_node, siblings),
&stream_class->packet_context_fc);
if (ret) {
struct ctf_node, siblings),
&stream_class->packet_context_fc);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot create stream class's packet context field class.");
goto error;
}
"Cannot create stream class's packet context field class.");
goto error;
}
stream_class->packet_context_fc,
"timestamp_begin");
if (ret) {
stream_class->packet_context_fc,
"timestamp_begin");
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot automatically map specific packet context field class fields named `timestamp_begin` to trace's clock class.");
goto error;
}
"Cannot automatically map specific packet context field class fields named `timestamp_begin` to trace's clock class.");
goto error;
}
stream_class->packet_context_fc,
"timestamp_end");
if (ret) {
stream_class->packet_context_fc,
"timestamp_end");
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot automatically map specific packet context field class fields named `timestamp_end` to trace's clock class.");
goto error;
}
"Cannot automatically map specific packet context field class fields named `timestamp_end` to trace's clock class.");
goto error;
}
bt_list_for_each_entry(iter, decl_list, siblings) {
ret = visit_stream_decl_entry(ctx, iter, stream_class, &set);
if (ret) {
bt_list_for_each_entry(iter, decl_list, siblings) {
ret = visit_stream_decl_entry(ctx, iter, stream_class, &set);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit stream class's entry: "
"ret=%d", ret);
ctx_pop_scope(ctx);
"Cannot visit stream class's entry: "
"ret=%d", ret);
ctx_pop_scope(ctx);
struct ctf_named_field_class *named_fc = NULL;
if (!ctx->ctf_tc->packet_header_fc) {
struct ctf_named_field_class *named_fc = NULL;
if (!ctx->ctf_tc->packet_header_fc) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Stream class has a `id` attribute, "
"but trace has no packet header field class.");
ret = -EINVAL;
"Stream class has a `id` attribute, "
"but trace has no packet header field class.");
ret = -EINVAL;
named_fc = ctf_field_class_struct_borrow_member_by_name(
(void *) ctx->ctf_tc->packet_header_fc, "stream_id");
if (!named_fc) {
named_fc = ctf_field_class_struct_borrow_member_by_name(
(void *) ctx->ctf_tc->packet_header_fc, "stream_id");
if (!named_fc) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Stream class has a `id` attribute, "
"but trace's packet header field class has no `stream_id` field.");
ret = -EINVAL;
"Stream class has a `id` attribute, "
"but trace's packet header field class has no `stream_id` field.");
ret = -EINVAL;
if (named_fc->fc->type != CTF_FIELD_CLASS_TYPE_INT &&
named_fc->fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
if (named_fc->fc->type != CTF_FIELD_CLASS_TYPE_INT &&
named_fc->fc->type != CTF_FIELD_CLASS_TYPE_ENUM) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Stream class has a `id` attribute, "
"but trace's packet header field class's `stream_id` field is not an integer field class.");
ret = -EINVAL;
"Stream class has a `id` attribute, "
"but trace's packet header field class's `stream_id` field is not an integer field class.");
ret = -EINVAL;
} else {
/* Allow only _one_ ID-less stream */
if (ctx->ctf_tc->stream_classes->len != 0) {
} else {
/* Allow only _one_ ID-less stream */
if (ctx->ctf_tc->stream_classes->len != 0) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Missing `id` attribute in stream class as there's more than one stream class in the trace.");
ret = -EPERM;
goto error;
"Missing `id` attribute in stream class as there's more than one stream class in the trace.");
ret = -EPERM;
goto error;
*/
if (ctf_trace_class_borrow_stream_class_by_id(ctx->ctf_tc,
stream_class->id)) {
*/
if (ctf_trace_class_borrow_stream_class_by_id(ctx->ctf_tc,
stream_class->id)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate stream class (same ID): id=%" PRId64,
stream_class->id);
ret = -EINVAL;
"Duplicate stream class (same ID): id=%" PRId64,
stream_class->id);
ret = -EINVAL;
ret = visit_field_class_def(ctx, node->u.field_class_def.field_class_specifier_list,
&node->u.field_class_def.field_class_declarators);
if (ret) {
ret = visit_field_class_def(ctx, node->u.field_class_def.field_class_specifier_list,
&node->u.field_class_def.field_class_declarators);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot add field class found in trace (`trace` block).");
goto error;
}
"Cannot add field class found in trace (`trace` block).");
goto error;
}
ret = visit_field_class_alias(ctx, node->u.field_class_alias.target,
node->u.field_class_alias.alias);
if (ret) {
ret = visit_field_class_alias(ctx, node->u.field_class_alias.target,
node->u.field_class_alias.alias);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot add field class alias found in trace (`trace` block).");
goto error;
}
"Cannot add field class alias found in trace (`trace` block).");
goto error;
}
{
left = ctf_ast_concatenate_unary_strings(&node->u.ctf_expression.left);
if (!left) {
{
left = ctf_ast_concatenate_unary_strings(&node->u.ctf_expression.left);
if (!left) {
- _BT_COMP_LOGE_NODE(node, "Cannot concatenate unary strings.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
}
if (strcmp(left, "major") == 0) {
if (_IS_SET(set, _TRACE_MAJOR_SET)) {
ret = -EINVAL;
goto error;
}
if (strcmp(left, "major") == 0) {
if (_IS_SET(set, _TRACE_MAJOR_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "major", "trace");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "major", "trace");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
ret = get_unary_unsigned(ctx,
&node->u.ctf_expression.right, &val);
if (ret) {
ret = get_unary_unsigned(ctx,
&node->u.ctf_expression.right, &val);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected unary expression for trace's `major` attribute.");
ret = -EINVAL;
goto error;
}
if (val != 1) {
"Unexpected unary expression for trace's `major` attribute.");
ret = -EINVAL;
goto error;
}
if (val != 1) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Invalid trace's `minor` attribute: expecting 1.");
ret = -EINVAL;
goto error;
"Invalid trace's `minor` attribute: expecting 1.");
ret = -EINVAL;
goto error;
_SET(set, _TRACE_MAJOR_SET);
} else if (strcmp(left, "minor") == 0) {
if (_IS_SET(set, _TRACE_MINOR_SET)) {
_SET(set, _TRACE_MAJOR_SET);
} else if (strcmp(left, "minor") == 0) {
if (_IS_SET(set, _TRACE_MINOR_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "minor", "trace");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "minor", "trace");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
ret = get_unary_unsigned(ctx,
&node->u.ctf_expression.right, &val);
if (ret) {
ret = get_unary_unsigned(ctx,
&node->u.ctf_expression.right, &val);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected unary expression for trace's `minor` attribute.");
ret = -EINVAL;
goto error;
}
if (val != 8) {
"Unexpected unary expression for trace's `minor` attribute.");
ret = -EINVAL;
goto error;
}
if (val != 8) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Invalid trace's `minor` attribute: expecting 8.");
ret = -EINVAL;
goto error;
"Invalid trace's `minor` attribute: expecting 8.");
ret = -EINVAL;
goto error;
_SET(set, _TRACE_MINOR_SET);
} else if (strcmp(left, "uuid") == 0) {
if (_IS_SET(set, _TRACE_UUID_SET)) {
_SET(set, _TRACE_MINOR_SET);
} else if (strcmp(left, "uuid") == 0) {
if (_IS_SET(set, _TRACE_UUID_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "uuid", "trace");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "uuid", "trace");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
&node->u.ctf_expression.right,
ctx->ctf_tc->uuid);
if (ret) {
&node->u.ctf_expression.right,
ctx->ctf_tc->uuid);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Invalid trace's `uuid` attribute.");
goto error;
}
"Invalid trace's `uuid` attribute.");
goto error;
}
} else if (strcmp(left, "byte_order") == 0) {
/* Default byte order is already known at this stage */
if (_IS_SET(set, _TRACE_BYTE_ORDER_SET)) {
} else if (strcmp(left, "byte_order") == 0) {
/* Default byte order is already known at this stage */
if (_IS_SET(set, _TRACE_BYTE_ORDER_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "byte_order",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "byte_order",
"trace");
ret = -EPERM;
goto error;
"trace");
ret = -EPERM;
goto error;
_SET(set, _TRACE_BYTE_ORDER_SET);
} else if (strcmp(left, "packet.header") == 0) {
if (_IS_SET(set, _TRACE_PACKET_HEADER_SET)) {
_SET(set, _TRACE_BYTE_ORDER_SET);
} else if (strcmp(left, "packet.header") == 0) {
if (_IS_SET(set, _TRACE_PACKET_HEADER_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate `packet.header` entry in trace.");
ret = -EPERM;
goto error;
"Duplicate `packet.header` entry in trace.");
ret = -EPERM;
goto error;
struct ctf_node, siblings),
&ctx->ctf_tc->packet_header_fc);
if (ret) {
struct ctf_node, siblings),
&ctx->ctf_tc->packet_header_fc);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot create trace's packet header field class.");
goto error;
}
"Cannot create trace's packet header field class.");
goto error;
}
- _BT_COMP_LOGE_NODE(node, "Unknown expression in trace.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Unknown expression in trace.");
ret = -EINVAL;
goto error;
}
ret = -EINVAL;
goto error;
}
node->visited = TRUE;
if (ctx->is_trace_visited) {
node->visited = TRUE;
if (ctx->is_trace_visited) {
- _BT_COMP_LOGE_NODE(node, "Duplicate trace (`trace` block).");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node, "Duplicate trace (`trace` block).");
ret = -EEXIST;
goto error;
}
ret = -EEXIST;
goto error;
}
bt_list_for_each_entry(iter, decl_list, siblings) {
ret = visit_trace_decl_entry(ctx, iter, &set);
if (ret) {
bt_list_for_each_entry(iter, decl_list, siblings) {
ret = visit_trace_decl_entry(ctx, iter, &set);
if (ret) {
- _BT_COMP_LOGE_NODE(iter, "Cannot visit trace's entry (`trace` block): "
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter, "Cannot visit trace's entry (`trace` block): "
"ret=%d", ret);
ctx_pop_scope(ctx);
goto error;
"ret=%d", ret);
ctx_pop_scope(ctx);
goto error;
ctx_pop_scope(ctx);
if (!_IS_SET(&set, _TRACE_MAJOR_SET)) {
ctx_pop_scope(ctx);
if (!_IS_SET(&set, _TRACE_MAJOR_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Missing `major` attribute in trace (`trace` block).");
ret = -EPERM;
goto error;
}
if (!_IS_SET(&set, _TRACE_MINOR_SET)) {
"Missing `major` attribute in trace (`trace` block).");
ret = -EPERM;
goto error;
}
if (!_IS_SET(&set, _TRACE_MINOR_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Missing `minor` attribute in trace (`trace` block).");
ret = -EPERM;
goto error;
}
if (!_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) {
"Missing `minor` attribute in trace (`trace` block).");
ret = -EPERM;
goto error;
}
if (!_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Missing `byte_order` attribute in trace (`trace` block).");
ret = -EPERM;
goto error;
"Missing `byte_order` attribute in trace (`trace` block).");
ret = -EPERM;
goto error;
&entry_node->u.ctf_expression.right;
if (entry_node->type != NODE_CTF_EXPRESSION) {
&entry_node->u.ctf_expression.right;
if (entry_node->type != NODE_CTF_EXPRESSION) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Wrong expression in environment entry: "
"node-type=%d", entry_node->type);
ret = -EPERM;
"Wrong expression in environment entry: "
"node-type=%d", entry_node->type);
ret = -EPERM;
left = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.left);
if (!left) {
left = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.left);
if (!left) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot get environment entry's name.");
ret = -EINVAL;
goto error;
"Cannot get environment entry's name.");
ret = -EINVAL;
goto error;
char *right = ctf_ast_concatenate_unary_strings(right_head);
if (!right) {
char *right = ctf_ast_concatenate_unary_strings(right_head);
if (!right) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for environment entry's value: "
"name=\"%s\"", left);
ret = -EINVAL;
"Unexpected unary expression for environment entry's value: "
"name=\"%s\"", left);
ret = -EINVAL;
ret = get_unary_signed(right_head, &v);
}
if (ret) {
ret = get_unary_signed(right_head, &v);
}
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for environment entry's value: "
"name=\"%s\"", left);
ret = -EINVAL;
"Unexpected unary expression for environment entry's value: "
"name=\"%s\"", left);
ret = -EINVAL;
left = ctf_ast_concatenate_unary_strings(
&node->u.ctf_expression.left);
if (!left) {
left = ctf_ast_concatenate_unary_strings(
&node->u.ctf_expression.left);
if (!left) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
"Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
enum ctf_byte_order bo;
if (_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) {
enum ctf_byte_order bo;
if (_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(node, "byte_order",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(node, "byte_order",
"trace");
ret = -EPERM;
goto error;
"trace");
ret = -EPERM;
goto error;
bo = byte_order_from_unary_expr(ctx,
right_node);
if (bo == CTF_BYTE_ORDER_UNKNOWN) {
bo = byte_order_from_unary_expr(ctx,
right_node);
if (bo == CTF_BYTE_ORDER_UNKNOWN) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Invalid `byte_order` attribute in trace (`trace` block): "
"expecting `le`, `be`, or `network`.");
ret = -EINVAL;
goto error;
} else if (bo == CTF_BYTE_ORDER_DEFAULT) {
"Invalid `byte_order` attribute in trace (`trace` block): "
"expecting `le`, `be`, or `network`.");
ret = -EINVAL;
goto error;
} else if (bo == CTF_BYTE_ORDER_DEFAULT) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Invalid `byte_order` attribute in trace (`trace` block): "
"cannot be set to `native` here.");
ret = -EPERM;
"Invalid `byte_order` attribute in trace (`trace` block): "
"cannot be set to `native` here.");
ret = -EPERM;
}
if (!_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) {
}
if (!_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) {
- _BT_COMP_LOGE_NODE(trace_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(trace_node,
"Missing `byte_order` attribute in trace (`trace` block).");
ret = -EINVAL;
goto error;
"Missing `byte_order` attribute in trace (`trace` block).");
ret = -EINVAL;
goto error;
char *left = NULL;
if (entry_node->type != NODE_CTF_EXPRESSION) {
char *left = NULL;
if (entry_node->type != NODE_CTF_EXPRESSION) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected node type: node-type=%d",
entry_node->type);
ret = -EPERM;
"Unexpected node type: node-type=%d",
entry_node->type);
ret = -EPERM;
left = ctf_ast_concatenate_unary_strings(&entry_node->u.ctf_expression.left);
if (!left) {
left = ctf_ast_concatenate_unary_strings(&entry_node->u.ctf_expression.left);
if (!left) {
- _BT_COMP_LOGE_NODE(entry_node, "Cannot concatenate unary strings.");
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node, "Cannot concatenate unary strings.");
ret = -EINVAL;
goto error;
}
ret = -EINVAL;
goto error;
}
char *right;
if (_IS_SET(set, _CLOCK_NAME_SET)) {
char *right;
if (_IS_SET(set, _CLOCK_NAME_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "name", "clock class");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "name", "clock class");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
right = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.right);
if (!right) {
right = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.right);
if (!right) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for clock class's `name` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for clock class's `name` attribute.");
ret = -EINVAL;
goto error;
bt_uuid_t uuid;
if (_IS_SET(set, _CLOCK_UUID_SET)) {
bt_uuid_t uuid;
if (_IS_SET(set, _CLOCK_UUID_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "uuid", "clock class");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "uuid", "clock class");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
ret = get_unary_uuid(ctx, &entry_node->u.ctf_expression.right,
uuid);
if (ret) {
ret = get_unary_uuid(ctx, &entry_node->u.ctf_expression.right,
uuid);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Invalid clock class's `uuid` attribute.");
goto error;
}
"Invalid clock class's `uuid` attribute.");
goto error;
}
char *right;
if (_IS_SET(set, _CLOCK_DESCRIPTION_SET)) {
char *right;
if (_IS_SET(set, _CLOCK_DESCRIPTION_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "description",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "description",
"clock class");
ret = -EPERM;
goto error;
"clock class");
ret = -EPERM;
goto error;
right = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.right);
if (!right) {
right = ctf_ast_concatenate_unary_strings(
&entry_node->u.ctf_expression.right);
if (!right) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for clock class's `description` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for clock class's `description` attribute.");
ret = -EINVAL;
goto error;
uint64_t freq = UINT64_C(-1);
if (_IS_SET(set, _CLOCK_FREQ_SET)) {
uint64_t freq = UINT64_C(-1);
if (_IS_SET(set, _CLOCK_FREQ_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "freq", "clock class");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "freq", "clock class");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
ret = get_unary_unsigned(ctx,
&entry_node->u.ctf_expression.right, &freq);
if (ret) {
ret = get_unary_unsigned(ctx,
&entry_node->u.ctf_expression.right, &freq);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for clock class's `freq` attribute.");
ret = -EINVAL;
goto error;
}
if (freq == UINT64_C(-1) || freq == 0) {
"Unexpected unary expression for clock class's `freq` attribute.");
ret = -EINVAL;
goto error;
}
if (freq == UINT64_C(-1) || freq == 0) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Invalid clock class frequency: freq=%" PRIu64,
freq);
ret = -EINVAL;
"Invalid clock class frequency: freq=%" PRIu64,
freq);
ret = -EINVAL;
uint64_t precision;
if (_IS_SET(set, _CLOCK_PRECISION_SET)) {
uint64_t precision;
if (_IS_SET(set, _CLOCK_PRECISION_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "precision",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "precision",
"clock class");
ret = -EPERM;
goto error;
"clock class");
ret = -EPERM;
goto error;
ret = get_unary_unsigned(ctx,
&entry_node->u.ctf_expression.right, &precision);
if (ret) {
ret = get_unary_unsigned(ctx,
&entry_node->u.ctf_expression.right, &precision);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for clock class's `precision` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for clock class's `precision` attribute.");
ret = -EINVAL;
goto error;
_SET(set, _CLOCK_PRECISION_SET);
} else if (strcmp(left, "offset_s") == 0) {
if (_IS_SET(set, _CLOCK_OFFSET_S_SET)) {
_SET(set, _CLOCK_PRECISION_SET);
} else if (strcmp(left, "offset_s") == 0) {
if (_IS_SET(set, _CLOCK_OFFSET_S_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "offset_s",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "offset_s",
"clock class");
ret = -EPERM;
goto error;
"clock class");
ret = -EPERM;
goto error;
ret = get_unary_signed(
&entry_node->u.ctf_expression.right, offset_seconds);
if (ret) {
ret = get_unary_signed(
&entry_node->u.ctf_expression.right, offset_seconds);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for clock class's `offset_s` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for clock class's `offset_s` attribute.");
ret = -EINVAL;
goto error;
_SET(set, _CLOCK_OFFSET_S_SET);
} else if (strcmp(left, "offset") == 0) {
if (_IS_SET(set, _CLOCK_OFFSET_SET)) {
_SET(set, _CLOCK_OFFSET_S_SET);
} else if (strcmp(left, "offset") == 0) {
if (_IS_SET(set, _CLOCK_OFFSET_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "offset", "clock class");
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "offset", "clock class");
ret = -EPERM;
goto error;
}
ret = -EPERM;
goto error;
}
ret = get_unary_unsigned(ctx,
&entry_node->u.ctf_expression.right, offset_cycles);
if (ret) {
ret = get_unary_unsigned(ctx,
&entry_node->u.ctf_expression.right, offset_cycles);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for clock class's `offset` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for clock class's `offset` attribute.");
ret = -EINVAL;
goto error;
struct ctf_node *right;
if (_IS_SET(set, _CLOCK_ABSOLUTE_SET)) {
struct ctf_node *right;
if (_IS_SET(set, _CLOCK_ABSOLUTE_SET)) {
- _BT_COMP_LOGE_DUP_ATTR(entry_node, "absolute",
+ _BT_COMP_LOGE_APPEND_CAUSE_DUP_ATTR(entry_node, "absolute",
"clock class");
ret = -EPERM;
goto error;
"clock class");
ret = -EPERM;
goto error;
struct ctf_node, siblings);
ret = get_boolean(ctx, right);
if (ret < 0) {
struct ctf_node, siblings);
ret = get_boolean(ctx, right);
if (ret < 0) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Unexpected unary expression for clock class's `absolute` attribute.");
ret = -EINVAL;
goto error;
"Unexpected unary expression for clock class's `absolute` attribute.");
ret = -EINVAL;
goto error;
/* CTF 1.8's default frequency for a clock class is 1 GHz */
clock = ctf_clock_class_create();
if (!clock) {
/* CTF 1.8's default frequency for a clock class is 1 GHz */
clock = ctf_clock_class_create();
if (!clock) {
- _BT_COMP_LOGE_NODE(clock_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(clock_node,
"Cannot create default clock class.");
ret = -ENOMEM;
goto end;
"Cannot create default clock class.");
ret = -ENOMEM;
goto end;
ret = visit_clock_decl_entry(ctx, entry_node, clock, &set,
&offset_seconds, &offset_cycles);
if (ret) {
ret = visit_clock_decl_entry(ctx, entry_node, clock, &set,
&offset_seconds, &offset_cycles);
if (ret) {
- _BT_COMP_LOGE_NODE(entry_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(entry_node,
"Cannot visit clock class's entry: ret=%d",
ret);
goto end;
"Cannot visit clock class's entry: ret=%d",
ret);
goto end;
}
if (!_IS_SET(&set, _CLOCK_NAME_SET)) {
}
if (!_IS_SET(&set, _CLOCK_NAME_SET)) {
- _BT_COMP_LOGE_NODE(clock_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(clock_node,
"Missing `name` attribute in clock class.");
ret = -EPERM;
goto end;
"Missing `name` attribute in clock class.");
ret = -EPERM;
goto end;
root_decl_node->u.field_class_def.field_class_specifier_list,
&root_decl_node->u.field_class_def.field_class_declarators);
if (ret) {
root_decl_node->u.field_class_def.field_class_specifier_list,
&root_decl_node->u.field_class_def.field_class_declarators);
if (ret) {
- _BT_COMP_LOGE_NODE(root_decl_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(root_decl_node,
"Cannot add field class found in root scope.");
goto end;
}
"Cannot add field class found in root scope.");
goto end;
}
ret = visit_field_class_alias(ctx, root_decl_node->u.field_class_alias.target,
root_decl_node->u.field_class_alias.alias);
if (ret) {
ret = visit_field_class_alias(ctx, root_decl_node->u.field_class_alias.target,
root_decl_node->u.field_class_alias.alias);
if (ret) {
- _BT_COMP_LOGE_NODE(root_decl_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(root_decl_node,
"Cannot add field class alias found in root scope.");
goto end;
}
"Cannot add field class alias found in root scope.");
goto end;
}
*/
ret = visit_field_class_specifier_list(ctx, root_decl_node, &decl);
if (ret) {
*/
ret = visit_field_class_specifier_list(ctx, root_decl_node, &decl);
if (ret) {
- _BT_COMP_LOGE_NODE(root_decl_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(root_decl_node,
"Cannot visit root scope's field class: "
"ret=%d", ret);
BT_ASSERT(!decl);
"Cannot visit root scope's field class: "
"ret=%d", ret);
BT_ASSERT(!decl);
- _BT_COMP_LOGE_NODE(root_decl_node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(root_decl_node,
"Unexpected node type: node-type=%d",
root_decl_node->type);
ret = -EPERM;
"Unexpected node type: node-type=%d",
root_decl_node->type);
ret = -EPERM;
if (ctx->ctf_tc->default_byte_order == CTF_BYTE_ORDER_UNKNOWN) {
bt_list_for_each_entry(iter, &node->u.root.trace, siblings) {
if (got_trace_decl) {
if (ctx->ctf_tc->default_byte_order == CTF_BYTE_ORDER_UNKNOWN) {
bt_list_for_each_entry(iter, &node->u.root.trace, siblings) {
if (got_trace_decl) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Duplicate trace (`trace` block).");
ret = -1;
goto end;
"Duplicate trace (`trace` block).");
ret = -1;
goto end;
ret = set_trace_byte_order(ctx, iter);
if (ret) {
ret = set_trace_byte_order(ctx, iter);
if (ret) {
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Cannot set trace's native byte order: "
"ret=%d", ret);
goto end;
"Cannot set trace's native byte order: "
"ret=%d", ret);
goto end;
bt_list_for_each_entry(iter, &node->u.root.env, siblings) {
ret = visit_env(ctx, iter);
if (ret) {
bt_list_for_each_entry(iter, &node->u.root.env, siblings) {
ret = visit_env(ctx, iter);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit trace's environment (`env` block) entry: "
"ret=%d", ret);
goto end;
"Cannot visit trace's environment (`env` block) entry: "
"ret=%d", ret);
goto end;
bt_list_for_each_entry(iter, &node->u.root.clock, siblings) {
ret = visit_clock_decl(ctx, iter);
if (ret) {
bt_list_for_each_entry(iter, &node->u.root.clock, siblings) {
ret = visit_clock_decl(ctx, iter);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit clock class: ret=%d",
ret);
goto end;
"Cannot visit clock class: ret=%d",
ret);
goto end;
siblings) {
ret = visit_root_decl(ctx, iter);
if (ret) {
siblings) {
ret = visit_root_decl(ctx, iter);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit root entry: ret=%d",
ret);
goto end;
"Cannot visit root entry: ret=%d",
ret);
goto end;
bt_list_for_each_entry(iter, &node->u.root.trace, siblings) {
ret = visit_trace_decl(ctx, iter);
if (ret) {
bt_list_for_each_entry(iter, &node->u.root.trace, siblings) {
ret = visit_trace_decl(ctx, iter);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit trace (`trace` block): "
"ret=%d", ret);
goto end;
"Cannot visit trace (`trace` block): "
"ret=%d", ret);
goto end;
bt_list_for_each_entry(iter, &node->u.root.stream, siblings) {
ret = visit_stream_decl(ctx, iter);
if (ret) {
bt_list_for_each_entry(iter, &node->u.root.stream, siblings) {
ret = visit_stream_decl(ctx, iter);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit stream class: ret=%d",
ret);
goto end;
"Cannot visit stream class: ret=%d",
ret);
goto end;
bt_list_for_each_entry(iter, &node->u.root.event, siblings) {
ret = visit_event_decl(ctx, iter);
if (ret) {
bt_list_for_each_entry(iter, &node->u.root.event, siblings) {
ret = visit_event_decl(ctx, iter);
if (ret) {
- _BT_COMP_LOGE_NODE(iter,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(iter,
"Cannot visit event class: ret=%d",
ret);
goto end;
"Cannot visit event class: ret=%d",
ret);
goto end;
- _BT_COMP_LOGE_NODE(node,
+ _BT_COMP_LOGE_APPEND_CAUSE_NODE(node,
"Unexpected node type: node-type=%d",
node->type);
ret = -EINVAL;
"Unexpected node type: node-type=%d",
node->type);
ret = -EINVAL;
case UNARY_DOTDOTDOT:
break;
default:
case UNARY_DOTDOTDOT:
break;
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown expression link type: type=%d\n",
node->u.unary_expression.link);
return -EINVAL;
"Unknown expression link type: type=%d\n",
node->u.unary_expression.link);
return -EINVAL;
case UNARY_UNKNOWN:
default:
case UNARY_UNKNOWN:
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown expression link type: type=%d\n",
node->u.unary_expression.link);
return -EINVAL;
"Unknown expression link type: type=%d\n",
node->u.unary_expression.link);
return -EINVAL;
case TYPESPEC_UNKNOWN:
default:
case TYPESPEC_UNKNOWN:
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown type specifier: type=%d\n",
node->u.field_class_specifier.type);
return -EINVAL;
"Unknown type specifier: type=%d\n",
node->u.field_class_specifier.type);
return -EINVAL;
break;
case TYPEDEC_UNKNOWN:
default:
break;
case TYPEDEC_UNKNOWN:
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown type declarator: type=%d\n",
node->u.field_class_declarator.type);
return -EINVAL;
"Unknown type declarator: type=%d\n",
node->u.field_class_declarator.type);
return -EINVAL;
case NODE_UNKNOWN:
default:
case NODE_UNKNOWN:
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown node type: type=%d\n", node->type);
return -EINVAL;
}
"Unknown node type: type=%d\n", node->type);
return -EINVAL;
}
* We are only allowed to be a string.
*/
if (node->u.unary_expression.type != UNARY_STRING) {
* We are only allowed to be a string.
*/
if (node->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Left child of a CTF expression is only allowed to be a string.");
goto errperm;
}
"Left child of a CTF expression is only allowed to be a string.");
goto errperm;
}
case UNARY_STRING:
break;
default:
case UNARY_STRING:
break;
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Children of field class declarator and `enum` can only be unsigned numeric constants or references to fields (e.g., `a.b.c`).");
goto errperm;
}
"Children of field class declarator and `enum` can only be unsigned numeric constants or references to fields (e.g., `a.b.c`).");
goto errperm;
}
case UNARY_UNSIGNED_CONSTANT:
break;
default:
case UNARY_UNSIGNED_CONSTANT:
break;
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Structure alignment attribute can only be an unsigned numeric constant.");
goto errperm;
}
"Structure alignment attribute can only be an unsigned numeric constant.");
goto errperm;
}
* We disallow nested unary expressions and "sbrac" unary
* expressions.
*/
* We disallow nested unary expressions and "sbrac" unary
* expressions.
*/
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Nested unary expressions not allowed (`()` and `[]`).");
goto errperm;
"Nested unary expressions not allowed (`()` and `[]`).");
goto errperm;
&node->parent->u.ctf_expression.right,
struct ctf_node,
siblings) != node) {
&node->parent->u.ctf_expression.right,
struct ctf_node,
siblings) != node) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Empty link is not allowed except on first node of unary expression (need to separate nodes with `.` or `->`).");
goto errperm;
}
"Empty link is not allowed except on first node of unary expression (need to separate nodes with `.` or `->`).");
goto errperm;
}
case UNARY_ARROWLINK:
/* We only allow -> and . links between children of ctf_expression. */
if (node->parent->type != NODE_CTF_EXPRESSION) {
case UNARY_ARROWLINK:
/* We only allow -> and . links between children of ctf_expression. */
if (node->parent->type != NODE_CTF_EXPRESSION) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Links `.` and `->` are only allowed as children of CTF expression.");
goto errperm;
}
"Links `.` and `->` are only allowed as children of CTF expression.");
goto errperm;
}
* This includes "", '' and non-quoted identifiers.
*/
if (node->u.unary_expression.type != UNARY_STRING) {
* This includes "", '' and non-quoted identifiers.
*/
if (node->u.unary_expression.type != UNARY_STRING) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Links `.` and `->` are only allowed to separate strings and identifiers.");
goto errperm;
}
"Links `.` and `->` are only allowed to separate strings and identifiers.");
goto errperm;
}
&node->parent->u.ctf_expression.right,
struct ctf_node,
siblings) == node) {
&node->parent->u.ctf_expression.right,
struct ctf_node,
siblings) == node) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Links `.` and `->` are not allowed before first node of the unary expression list.");
goto errperm;
}
"Links `.` and `->` are not allowed before first node of the unary expression list.");
goto errperm;
}
case UNARY_DOTDOTDOT:
/* We only allow ... link between children of enumerator. */
if (node->parent->type != NODE_ENUMERATOR) {
case UNARY_DOTDOTDOT:
/* We only allow ... link between children of enumerator. */
if (node->parent->type != NODE_ENUMERATOR) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Link `...` is only allowed within enumerator.");
goto errperm;
}
"Link `...` is only allowed within enumerator.");
goto errperm;
}
if (_bt_list_first_entry(&node->parent->u.enumerator.values,
struct ctf_node,
siblings) == node) {
if (_bt_list_first_entry(&node->parent->u.enumerator.values,
struct ctf_node,
siblings) == node) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Link `...` is not allowed on the first node of the unary expression list.");
goto errperm;
}
break;
default:
"Link `...` is not allowed on the first node of the unary expression list.");
goto errperm;
}
break;
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown expression link type: type=%d",
node->u.unary_expression.link);
return -EINVAL;
"Unknown expression link type: type=%d",
node->u.unary_expression.link);
return -EINVAL;
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
errperm:
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
errperm:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Semantic error: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EPERM; /* Structure not allowed */
"Semantic error: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EPERM; /* Structure not allowed */
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
bt_list_for_each_entry(iter, &node->u.field_class_declarator.u.nested.length,
siblings) {
if (iter->type != NODE_UNARY_EXPRESSION) {
bt_list_for_each_entry(iter, &node->u.field_class_declarator.u.nested.length,
siblings) {
if (iter->type != NODE_UNARY_EXPRESSION) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Expecting unary expression as length: node-type=%s",
node_type(iter));
return -EINVAL;
"Expecting unary expression as length: node-type=%s",
node_type(iter));
return -EINVAL;
}
} else {
if (node->parent->type == NODE_TYPEALIAS_TARGET) {
}
} else {
if (node->parent->type == NODE_TYPEALIAS_TARGET) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Abstract array declarator not permitted as target of field class alias.");
return -EINVAL;
}
"Abstract array declarator not permitted as target of field class alias.");
return -EINVAL;
}
}
case TYPEDEC_UNKNOWN:
default:
}
case TYPEDEC_UNKNOWN:
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown field class declarator: type=%d",
node->u.field_class_declarator.type);
return -EINVAL;
"Unknown field class declarator: type=%d",
node->u.field_class_declarator.type);
return -EINVAL;
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
errperm:
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
errperm:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Semantic error: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EPERM; /* Structure not allowed */
"Semantic error: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EPERM; /* Structure not allowed */
nr_declarators++;
}
if (nr_declarators > 1) {
nr_declarators++;
}
if (nr_declarators > 1) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Too many declarators in field class alias's name (maximum is 1): count=%d",
nr_declarators);
return -EINVAL;
"Too many declarators in field class alias's name (maximum is 1): count=%d",
nr_declarators);
return -EINVAL;
nr_declarators++;
}
if (nr_declarators > 1) {
nr_declarators++;
}
if (nr_declarators > 1) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Too many declarators in field class alias's name (maximum is 1): count=%d",
nr_declarators);
return -EINVAL;
"Too many declarators in field class alias's name (maximum is 1): count=%d",
nr_declarators);
return -EINVAL;
|| (iter->u.unary_expression.type != UNARY_SIGNED_CONSTANT
&& iter->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT)
|| iter->u.unary_expression.link != UNARY_LINK_UNKNOWN) {
|| (iter->u.unary_expression.type != UNARY_SIGNED_CONSTANT
&& iter->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT)
|| iter->u.unary_expression.link != UNARY_LINK_UNKNOWN) {
- _BT_COMP_LOGE_LINENO(iter->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(iter->lineno,
"First unary expression of enumerator is unexpected.");
goto errperm;
}
"First unary expression of enumerator is unexpected.");
goto errperm;
}
|| (iter->u.unary_expression.type != UNARY_SIGNED_CONSTANT
&& iter->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT)
|| iter->u.unary_expression.link != UNARY_DOTDOTDOT) {
|| (iter->u.unary_expression.type != UNARY_SIGNED_CONSTANT
&& iter->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT)
|| iter->u.unary_expression.link != UNARY_DOTDOTDOT) {
- _BT_COMP_LOGE_LINENO(iter->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(iter->lineno,
"Second unary expression of enumerator is unexpected.");
goto errperm;
}
"Second unary expression of enumerator is unexpected.");
goto errperm;
}
case NODE_UNKNOWN:
default:
case NODE_UNKNOWN:
default:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Unknown node type: type=%d", node->type);
return -EINVAL;
}
return ret;
errinval:
"Unknown node type: type=%d", node->type);
return -EINVAL;
}
return ret;
errinval:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
errperm:
"Incoherent parent node's type: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EINVAL; /* Incoherent structure */
errperm:
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Semantic error: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EPERM; /* Structure not allowed */
"Semantic error: node-type=%s, parent-node-type=%s",
node_type(node), node_type(node->parent));
return -EPERM; /* Structure not allowed */
*/
ret = ctf_visitor_parent_links(depth, node, log_cfg);
if (ret) {
*/
ret = ctf_visitor_parent_links(depth, node, log_cfg);
if (ret) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Cannot create parent links in metadata's AST: "
"ret=%d", ret);
goto end;
"Cannot create parent links in metadata's AST: "
"ret=%d", ret);
goto end;
ret = _ctf_visitor_semantic_check(depth, node, log_cfg);
if (ret) {
ret = _ctf_visitor_semantic_check(depth, node, log_cfg);
if (ret) {
- _BT_COMP_LOGE_LINENO(node->lineno,
+ _BT_COMP_LOGE_APPEND_CAUSE_LINENO(node->lineno,
"Cannot check metadata's AST semantics: "
"ret=%d", ret);
goto end;
"Cannot check metadata's AST semantics: "
"ret=%d", ret);
goto end;
}
decoder_cfg.log_level = log_level;
}
decoder_cfg.log_level = log_level;
+ decoder_cfg.self_comp_class = self_comp_class;
decoder_cfg.keep_plain_text = true;
decoder = ctf_metadata_decoder_create(&decoder_cfg);
if (!decoder) {
decoder_cfg.keep_plain_text = true;
decoder = ctf_metadata_decoder_create(&decoder_cfg);
if (!decoder) {
bt_uuid_t uuid;
metadata_decoder_config.log_level = log_level;
bt_uuid_t uuid;
metadata_decoder_config.log_level = log_level;
+ metadata_decoder_config.self_comp_class =
+ bt_self_component_class_source_as_self_component_class(comp_class);
metadata_decoder = ctf_metadata_decoder_create(
&metadata_decoder_config);
metadata_decoder = ctf_metadata_decoder_create(
&metadata_decoder_config);