lib: assign a unique ID to each pre/postcond. and report it on failure
[babeltrace.git] / src / lib / trace-ir / resolve-field-path.c
index ac8aed7e7153c72d330fbdee1084de0836b867f4..51719387e97624cc3d0af638254653d87243b5be 100644 (file)
@@ -496,9 +496,11 @@ end:
 static
 struct bt_field_path *resolve_field_path(struct bt_field_class *src_fc,
                struct bt_field_class *tgt_fc,
-               struct bt_resolve_field_path_context *ctx)
+               struct bt_resolve_field_path_context *ctx,
+               const char *api_func)
 {
-       BT_ASSERT_PRE_DEV(field_path_is_valid(src_fc, tgt_fc, ctx),
+       BT_ASSERT_PRE_DEV_FROM_FUNC(api_func, "valid-field-class",
+               field_path_is_valid(src_fc, tgt_fc, ctx),
                "Invalid target field class: %![req-fc-]+F, %![tgt-fc-]+F",
                src_fc, tgt_fc);
        return find_field_class_in_ctx(tgt_fc, ctx);
@@ -506,7 +508,8 @@ struct bt_field_path *resolve_field_path(struct bt_field_class *src_fc,
 
 BT_HIDDEN
 int bt_resolve_field_paths(struct bt_field_class *fc,
-               struct bt_resolve_field_path_context *ctx)
+               struct bt_resolve_field_path_context *ctx,
+               const char *api_func)
 {
        int ret = 0;
 
@@ -520,7 +523,7 @@ int bt_resolve_field_paths(struct bt_field_class *fc,
                BT_ASSERT(opt_fc->selector_fc);
                BT_ASSERT(!opt_fc->selector_field_path);
                opt_fc->selector_field_path = resolve_field_path(
-                       fc, opt_fc->selector_fc, ctx);
+                       fc, opt_fc->selector_fc, ctx, __func__);
                if (!opt_fc->selector_field_path) {
                        ret = -1;
                        goto end;
@@ -531,7 +534,7 @@ int bt_resolve_field_paths(struct bt_field_class *fc,
                BT_ASSERT(dyn_array_fc->length_fc);
                BT_ASSERT(!dyn_array_fc->length_field_path);
                dyn_array_fc->length_field_path = resolve_field_path(
-                       fc, dyn_array_fc->length_fc, ctx);
+                       fc, dyn_array_fc->length_fc, ctx, __func__);
                if (!dyn_array_fc->length_field_path) {
                        ret = -1;
                        goto end;
@@ -545,7 +548,8 @@ int bt_resolve_field_paths(struct bt_field_class *fc,
                        BT_ASSERT(!var_fc->selector_field_path);
                        var_fc->selector_field_path =
                                resolve_field_path(fc,
-                                       (void *) var_fc->selector_fc, ctx);
+                                       (void *) var_fc->selector_fc, ctx,
+                                       __func__);
                        if (!var_fc->selector_field_path) {
                                ret = -1;
                                goto end;
@@ -557,7 +561,7 @@ int bt_resolve_field_paths(struct bt_field_class *fc,
        if (bt_field_class_type_is(fc->type, BT_FIELD_CLASS_TYPE_OPTION)) {
                struct bt_field_class_option *opt_fc = (void *) fc;
 
-               ret = bt_resolve_field_paths(opt_fc->content_fc, ctx);
+               ret = bt_resolve_field_paths(opt_fc->content_fc, ctx, api_func);
        } else if (fc->type == BT_FIELD_CLASS_TYPE_STRUCTURE ||
                        bt_field_class_type_is(fc->type,
                                BT_FIELD_CLASS_TYPE_VARIANT)) {
@@ -569,7 +573,8 @@ int bt_resolve_field_paths(struct bt_field_class *fc,
                        struct bt_named_field_class *named_fc =
                                container_fc->named_fcs->pdata[i];
 
-                       ret = bt_resolve_field_paths(named_fc->fc, ctx);
+                       ret = bt_resolve_field_paths(named_fc->fc, ctx,
+                               api_func);
                        if (ret) {
                                goto end;
                        }
@@ -578,7 +583,8 @@ int bt_resolve_field_paths(struct bt_field_class *fc,
                        BT_FIELD_CLASS_TYPE_ARRAY)) {
                struct bt_field_class_array *array_fc = (void *) fc;
 
-               ret = bt_resolve_field_paths(array_fc->element_fc, ctx);
+               ret = bt_resolve_field_paths(array_fc->element_fc, ctx,
+                       api_func);
        }
 
 end:
This page took 0.025881 seconds and 4 git commands to generate.