From: Philippe Proulx Date: Fri, 18 Oct 2019 15:59:27 +0000 (-0400) Subject: Always evaluate BT_ASSERT(); add BT_ASSERT_DBG() for debug mode only X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=98b15851a941e7342b8bb19e265cdc3a40fabfb8 Always evaluate BT_ASSERT(); add BT_ASSERT_DBG() for debug mode only This patch makes BT_ASSERT() always evaluate its condition. The goal is to make a lot of _slow path_ assertions evaluated whatever the debug or non-debug mode. This will help detect project programming errors and hopefully end users will report them. What used to be BT_ASSERT() is now BT_ASSERT_DBG(), that is, only evaluated in debug mode. This is similar to how BT_ASSERT_PRE() is always evaluated while BT_ASSERT_PRE_DEV() is only evaluated in developer mode. I went over each single BT_ASSERT() statement in `src` and decided whether to use BT_ASSERT() or BT_ASSERT_DBG(). My strategy is similar to what we do for BT_ASSERT_PRE(), that is: * Use BT_ASSERT_DBG() in anything potentially executed once or more per _event_ message. Other messages occur so infrequently compared to event messages that we don't care. * Use BT_ASSERT_DBG() in property getters and object borrowing functions. We don't know how frequently the user can call those, so we don't take any chance. Everything else uses BT_ASSERT(), for example: * In the library and plugins, everything related to metadata objects. * Everything related to graph topology. * Everything in the CLI. * Network communication functions in `src.ctf.lttng-live`. I believe some BT_ASSERT_DBG() statements could still be converted BT_ASSERT(), but this patch is a good starting point. I left the whole CTF writer code with BT_ASSERT_DBG() for the moment as this library is not a priority. All the tests use BT_ASSERT() because they are not an end user use case; we don't care if they are less efficient in production mode. This change does not seem to affect the production build's performance; I compared, before and after, and I do not get a run time difference that's greater than the observed measurement error. Signed-off-by: Philippe Proulx Change-Id: Ia74951a39b1fcc79579661562f6a98ed208fd9bb Reviewed-on: https://review.lttng.org/c/babeltrace/+/2217 Tested-by: jenkins --- diff --git a/src/bindings/python/bt2/bt2/native_bt_component_class.i.h b/src/bindings/python/bt2/bt2/native_bt_component_class.i.h index a80d059d..f830afa3 100644 --- a/src/bindings/python/bt2/bt2/native_bt_component_class.i.h +++ b/src/bindings/python/bt2/bt2/native_bt_component_class.i.h @@ -1208,8 +1208,7 @@ component_class_message_iterator_next( PyObject *py_message_iter = bt_self_message_iterator_get_data(message_iterator); PyObject *py_method_result = NULL; - BT_ASSERT(py_message_iter); - + BT_ASSERT_DBG(py_message_iter); py_method_result = PyObject_CallMethod(py_message_iter, "_bt_next_from_native", NULL); if (!py_method_result) { @@ -1226,7 +1225,7 @@ component_class_message_iterator_next( *count = 1; /* Overflow errors should never happen. */ - BT_ASSERT(!PyErr_Occurred()); + BT_ASSERT_DBG(!PyErr_Occurred()); status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; @@ -1244,7 +1243,7 @@ component_class_sink_consume(bt_self_component_sink *self_component_sink) PyObject *py_method_result = NULL; bt_component_class_sink_consume_method_status status; - BT_ASSERT(py_comp); + BT_ASSERT_DBG(py_comp); py_method_result = PyObject_CallMethod(py_comp, "_user_consume", NULL); diff --git a/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h b/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h index 76b2c876..deb149cf 100644 --- a/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h +++ b/src/bindings/python/bt2/bt2/native_bt_message_iterator.i.h @@ -66,9 +66,9 @@ static PyObject *bt_bt2_get_user_component_from_user_msg_iter( bt_self_component *self_component = bt_self_message_iterator_borrow_component(self_message_iterator); PyObject *py_comp; - BT_ASSERT(self_component); + BT_ASSERT_DBG(self_component); py_comp = bt_self_component_get_data(self_component); - BT_ASSERT(py_comp); + BT_ASSERT_DBG(py_comp); /* Return new reference */ Py_INCREF(py_comp); diff --git a/src/common/assert.h b/src/common/assert.h index 4e7151de..f6a2ed60 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -2,8 +2,8 @@ #define BABELTRACE_ASSERT_INTERNAL_H /* - * Copyright (c) 2018 EfficiOS Inc. and Linux Foundation - * Copyright (c) 2018 Philippe Proulx + * Copyright (c) 2018-2019 EfficiOS Inc. and Linux Foundation + * Copyright (c) 2018-2019 Philippe Proulx * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,16 +29,17 @@ #include "common/macros.h" -#ifdef BT_DEBUG_MODE - extern void bt_common_assert_failed(const char *file, int line, - const char *func, const char *assertion) __attribute__((noreturn)); + const char *func, const char *assertion) + __attribute__((noreturn)); /* * Internal assertion (to detect logic errors on which the library user - * has no influence). Use BT_ASSERT_PRE() or BT_ASSERT_POST() to check + * has no influence). Use BT_ASSERT_PRE*() or BT_ASSERT_POST*() to check * preconditions or postconditions which must be directly or indirectly * satisfied by the library user. + * + * BT_ASSERT() is enabled in both debug and non-debug modes. */ #define BT_ASSERT(_cond) \ do { \ @@ -51,20 +52,36 @@ extern void bt_common_assert_failed(const char *file, int line, /* * Marks a function as being only used within a BT_ASSERT() context. */ -# define BT_ASSERT_FUNC -#else +#define BT_ASSERT_FUNC + +#ifdef BT_DEBUG_MODE + +/* + * Debug mode internal assertion. + */ +#define BT_ASSERT_DBG(_cond) BT_ASSERT(_cond) + /* - * When BT_DEBUG_MODE is not defined, define BT_ASSERT() macro to the following - * to trick the compiler into thinking that the variable passed as condition to - * the assertion is used. This is to prevent set-but-not-used warnings from the - * compiler when assertions are disabled. The `sizeof` operator also makes sure - * that the `_cond` expression is not evaluated, thus preventing unwanted side - * effects. + * Marks a function as being only used within a BT_ASSERT_DBG() context. + */ +#define BT_ASSERT_DBG_FUNC + +#else /* BT_DEBUG_MODE */ + +/* + * When `BT_DEBUG_MODE` is _not_ defined, define BT_ASSERT_DBG() macro + * to the following to trick the compiler into thinking that the + * variable passed as condition to the assertion is used. This is to + * prevent set-but-not-used warnings from the compiler when assertions + * are disabled. The sizeof() operator also makes sure that the `_cond` + * expression is not evaluated, thus preventing unwanted side effects. * - * In-depth explanation: https://stackoverflow.com/questions/37411809/how-to-elegantly-fix-this-unused-variable-warning/37412551#37412551 + * In-depth explanation: + * https://stackoverflow.com/questions/37411809/how-to-elegantly-fix-this-unused-variable-warning/37412551#37412551 */ -# define BT_ASSERT(_cond) ((void) sizeof((void) (_cond), 0)) -# define BT_ASSERT_FUNC __attribute__((unused)) +# define BT_ASSERT_DBG(_cond) ((void) sizeof((void) (_cond), 0)) +# define BT_ASSERT_DBG_FUNC __attribute__((unused)) + #endif /* BT_DEBUG_MODE */ #endif /* BABELTRACE_ASSERT_INTERNAL_H */ diff --git a/src/common/common.c b/src/common/common.c index 2616da25..90524f2a 100644 --- a/src/common/common.c +++ b/src/common/common.c @@ -580,7 +580,7 @@ bool bt_common_string_is_printable(const char *input) { const char *ch; bool printable = true; - BT_ASSERT(input); + BT_ASSERT_DBG(input); for (ch = input; *ch != '\0'; ch++) { if (!isprint(*ch) && *ch != '\n' && *ch != '\r' && @@ -1271,7 +1271,7 @@ size_t bt_common_get_page_size(int log_level) strncpy(_tmp_fmt, *out_fmt_ch, _tmp_fmt_size); \ _tmp_fmt[_tmp_fmt_size] = '\0'; \ _count = snprintf(*buf_ch, _size, _tmp_fmt, __VA_ARGS__); \ - BT_ASSERT(_count >= 0); \ + BT_ASSERT_DBG(_count >= 0); \ *buf_ch += MIN(_count, _size); \ } while (0) @@ -1528,13 +1528,13 @@ void bt_common_custom_vsnprintf(char *buf, size_t buf_size, const char *fmt_ch = fmt; char *buf_ch = buf; - BT_ASSERT(buf); - BT_ASSERT(fmt); + BT_ASSERT_DBG(buf); + BT_ASSERT_DBG(fmt); while (*fmt_ch != '\0') { switch (*fmt_ch) { case '%': - BT_ASSERT(fmt_ch[1] != '\0'); + BT_ASSERT_DBG(fmt_ch[1] != '\0'); if (fmt_ch[1] == intro) { handle_specifier(priv_data, &buf_ch, @@ -1586,12 +1586,12 @@ void bt_common_sep_digits(char *str, unsigned int digits_per_group, char sep) uint64_t sep_count; uint64_t new_len; - BT_ASSERT(digits_per_group > 0); - BT_ASSERT(sep != '\0'); + BT_ASSERT_DBG(digits_per_group > 0); + BT_ASSERT_DBG(sep != '\0'); /* Compute new length of `str` */ orig_len = strlen(str); - BT_ASSERT(orig_len > 0); + BT_ASSERT_DBG(orig_len > 0); sep_count = (orig_len - 1) / digits_per_group; new_len = strlen(str) + sep_count; @@ -1691,10 +1691,10 @@ GString *bt_common_fold(const char *str, unsigned int total_length, gchar * const *line; unsigned int i; - BT_ASSERT(str); - BT_ASSERT(indent < total_length); - BT_ASSERT(tmp_line); - BT_ASSERT(folded); + BT_ASSERT_DBG(str); + BT_ASSERT_DBG(indent < total_length); + BT_ASSERT_DBG(tmp_line); + BT_ASSERT_DBG(folded); if (strlen(str) == 0) { /* Empty input string: empty output string */ @@ -1703,7 +1703,7 @@ GString *bt_common_fold(const char *str, unsigned int total_length, /* Split lines */ lines = g_strsplit(str, "\n", 0); - BT_ASSERT(lines); + BT_ASSERT_DBG(lines); /* For each source line */ for (line = lines; *line; line++) { @@ -1720,7 +1720,7 @@ GString *bt_common_fold(const char *str, unsigned int total_length, /* Split words */ line_words = g_strsplit(*line, " ", 0); - BT_ASSERT(line_words); + BT_ASSERT_DBG(line_words); /* * Indent for first line (we know there's at least one @@ -1788,7 +1788,7 @@ end: g_strfreev(lines); } - BT_ASSERT(!line_words); + BT_ASSERT_DBG(!line_words); if (tmp_line) { g_string_free(tmp_line, TRUE); diff --git a/src/common/common.h b/src/common/common.h index 7fc2ba18..ab19d098 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -372,10 +372,10 @@ ssize_t bt_common_read(int fd, void *buf, size_t count, int log_level) size_t i = 0; ssize_t ret; - BT_ASSERT(buf); + BT_ASSERT_DBG(buf); /* Never return an overflow value. */ - BT_ASSERT(count <= SSIZE_MAX); + BT_ASSERT_DBG(count <= SSIZE_MAX); do { ret = read(fd, buf + i, count - i); @@ -398,7 +398,7 @@ ssize_t bt_common_read(int fd, void *buf, size_t count, int log_level) } } i += ret; - BT_ASSERT(i <= count); + BT_ASSERT_DBG(i <= count); } while (count - i > 0 && ret > 0); end: @@ -567,7 +567,7 @@ GString *bt_common_field_path_string(struct bt_field_path *path) GString *str = g_string_new(NULL); uint64_t i; - BT_ASSERT(path); + BT_ASSERT_DBG(path); if (!str) { goto end; @@ -667,7 +667,7 @@ int bt_common_clock_value_from_ns_from_origin( uint64_t value_period_cycles; int64_t ns_to_add; - BT_ASSERT(raw_value); + BT_ASSERT_DBG(raw_value); /* Compute offset part of requested value, in nanoseconds */ if (!bt_safe_to_mul_int64(cc_offset_seconds, NS_PER_S_I)) { diff --git a/src/common/uuid.c b/src/common/uuid.c index 7f817d01..d59f750c 100644 --- a/src/common/uuid.c +++ b/src/common/uuid.c @@ -70,8 +70,8 @@ void bt_uuid_generate(bt_uuid_t uuid_out) BT_HIDDEN void bt_uuid_to_str(const bt_uuid_t uuid_in, char *str_out) { - BT_ASSERT(uuid_in); - BT_ASSERT(str_out); + BT_ASSERT_DBG(uuid_in); + BT_ASSERT_DBG(str_out); sprintf(str_out, BT_UUID_FMT, BT_UUID_FMT_VALUES(uuid_in)); } @@ -82,8 +82,8 @@ int bt_uuid_from_str(const char *str_in, bt_uuid_t uuid_out) int ret = 0; bt_uuid_t uuid_scan; - BT_ASSERT(uuid_out); - BT_ASSERT(str_in); + BT_ASSERT_DBG(uuid_out); + BT_ASSERT_DBG(str_in); if (strnlen(str_in, BT_UUID_STR_LEN + 1) != BT_UUID_STR_LEN) { ret = -1; diff --git a/src/compat/stdio.h b/src/compat/stdio.h index a484ed29..12a7ba65 100644 --- a/src/compat/stdio.h +++ b/src/compat/stdio.h @@ -94,7 +94,7 @@ ssize_t bt_getline(char **lineptr, size_t *n, FILE *stream) /* ferror() is set, errno set by fgetc(). */ return -1; } - BT_ASSERT(feof(stream)); + BT_ASSERT_DBG(feof(stream)); found_eof = 1; break; } diff --git a/src/ctf-writer/assert-pre.h b/src/ctf-writer/assert-pre.h index fbff4a7b..4ae74afe 100644 --- a/src/ctf-writer/assert-pre.h +++ b/src/ctf-writer/assert-pre.h @@ -85,7 +85,7 @@ * arguments using BT_LOGF(), and abort. * * To assert that a postcondition is satisfied or that some internal - * object/context/value is in the expected state, use BT_ASSERT(). + * object/context/value is in the expected state, use BT_ASSERT_DBG(). */ # define BT_CTF_ASSERT_PRE(_cond, _fmt, ...) \ do { \ diff --git a/src/ctf-writer/attributes.c b/src/ctf-writer/attributes.c index 78d892b2..3665d1fc 100644 --- a/src/ctf-writer/attributes.c +++ b/src/ctf-writer/attributes.c @@ -319,7 +319,7 @@ int bt_ctf_attributes_freeze(struct bt_ctf_private_value *attr_obj) BT_LOGD("Freezing attributes object: value-addr=%p", attr_obj); count = bt_ctf_value_array_get_length(bt_ctf_private_value_as_value(attr_obj)); - BT_ASSERT(count >= 0); + BT_ASSERT_DBG(count >= 0); /* * We do not freeze the array value object itself here, since diff --git a/src/ctf-writer/clock-class.c b/src/ctf-writer/clock-class.c index c1d3caff..9e1b7241 100644 --- a/src/ctf-writer/clock-class.c +++ b/src/ctf-writer/clock-class.c @@ -545,8 +545,8 @@ int bt_ctf_clock_class_compare(struct bt_ctf_clock_class *clock_class_a, struct bt_ctf_clock_class *clock_class_b) { int ret = 1; - BT_ASSERT(clock_class_a); - BT_ASSERT(clock_class_b); + BT_ASSERT_DBG(clock_class_a); + BT_ASSERT_DBG(clock_class_b); /* Name */ if (strcmp(clock_class_a->name->str, clock_class_b->name->str) != 0) { diff --git a/src/ctf-writer/clock.c b/src/ctf-writer/clock.c index b6889a6c..bd9b4c56 100644 --- a/src/ctf-writer/clock.c +++ b/src/ctf-writer/clock.c @@ -70,7 +70,7 @@ struct bt_ctf_clock *bt_ctf_clock_create(const char *name) bt_uuid_generate(cc_uuid); ret = bt_ctf_clock_class_set_uuid(clock->clock_class, cc_uuid); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); return clock; error: diff --git a/src/ctf-writer/event-class.c b/src/ctf-writer/event-class.c index 823165c8..beb2be9d 100644 --- a/src/ctf-writer/event-class.c +++ b/src/ctf-writer/event-class.c @@ -118,7 +118,7 @@ error: BT_HIDDEN void bt_ctf_event_class_common_freeze(struct bt_ctf_event_class_common *event_class) { - BT_ASSERT(event_class); + BT_ASSERT_DBG(event_class); if (event_class->frozen) { return; @@ -141,8 +141,8 @@ int bt_ctf_event_class_common_validate_single_clock_class( { int ret = 0; - BT_ASSERT(event_class); - BT_ASSERT(expected_clock_class); + BT_ASSERT_DBG(event_class); + BT_ASSERT_DBG(expected_clock_class); ret = bt_ctf_field_type_common_validate_single_clock_class( event_class->context_field_type, expected_clock_class); @@ -347,7 +347,7 @@ int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, goto end; } - BT_ASSERT(bt_ctf_field_type_common_get_type_id( + BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id( event_class->common.payload_field_type) == BT_CTF_FIELD_TYPE_ID_STRUCT); ret = bt_ctf_field_type_structure_add_field( @@ -382,7 +382,7 @@ int64_t bt_ctf_event_class_get_payload_type_field_count( goto end; } - BT_ASSERT(bt_ctf_field_type_common_get_type_id( + BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id( event_class->common.payload_field_type) == BT_CTF_FIELD_TYPE_ID_STRUCT); ret = bt_ctf_field_type_common_structure_get_field_count( @@ -413,7 +413,7 @@ int bt_ctf_event_class_get_payload_type_field_by_index( goto end; } - BT_ASSERT(bt_ctf_field_type_common_get_type_id( + BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id( event_class->common.payload_field_type) == BT_CTF_FIELD_TYPE_ID_STRUCT); ret = bt_ctf_field_type_structure_get_field_by_index( @@ -446,7 +446,7 @@ bt_ctf_event_class_get_payload_type_field_type_by_name( goto end; } - BT_ASSERT(bt_ctf_field_type_common_get_type_id( + BT_ASSERT_DBG(bt_ctf_field_type_common_get_type_id( event_class->common.payload_field_type) == BT_CTF_FIELD_TYPE_ID_STRUCT); name_quark = g_quark_try_string(name); @@ -474,8 +474,8 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, int ret = 0; struct bt_ctf_value *attr_value = NULL; - BT_ASSERT(event_class); - BT_ASSERT(context); + BT_ASSERT_DBG(event_class); + BT_ASSERT_DBG(context); BT_LOGD("Serializing event class's metadata: " "event-class-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", metadata-context-addr=%p", @@ -488,7 +488,7 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, /* Serialize attributes */ g_string_append_printf(context->string, "\tname = \"%s\";\n", event_class->common.name->str); - BT_ASSERT(event_class->common.id >= 0); + BT_ASSERT_DBG(event_class->common.id >= 0); g_string_append_printf(context->string, "\tid = %" PRId64 ";\n", event_class->common.id); g_string_append_printf(context->string, "\tstream_id = %" PRId64 ";\n", @@ -567,7 +567,7 @@ struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name( goto end; } - BT_ASSERT(event_class->common.payload_field_type->id == + BT_ASSERT_DBG(event_class->common.payload_field_type->id == BT_CTF_FIELD_TYPE_ID_STRUCT); name_quark = g_quark_try_string(name); if (!name_quark) { diff --git a/src/ctf-writer/event-class.h b/src/ctf-writer/event-class.h index 522f15e4..3c44b57c 100644 --- a/src/ctf-writer/event-class.h +++ b/src/ctf-writer/event-class.h @@ -70,7 +70,7 @@ static inline struct bt_ctf_stream_class_common *bt_ctf_event_class_common_borrow_stream_class( struct bt_ctf_event_class_common *event_class) { - BT_ASSERT(event_class); + BT_ASSERT_DBG(event_class); return (void *) bt_ctf_object_borrow_parent(&event_class->base); } @@ -94,7 +94,7 @@ const char *bt_ctf_event_class_common_get_name( struct bt_ctf_event_class_common *event_class) { BT_CTF_ASSERT_PRE_NON_NULL(event_class, "Event class"); - BT_ASSERT(event_class->name); + BT_ASSERT_DBG(event_class->name); return event_class->name->str; } diff --git a/src/ctf-writer/event.c b/src/ctf-writer/event.c index 44019efa..ea29dcf1 100644 --- a/src/ctf-writer/event.c +++ b/src/ctf-writer/event.c @@ -72,14 +72,14 @@ int bt_ctf_event_common_validate_types_for_create( struct bt_ctf_private_value *environment = NULL; stream_class = bt_ctf_event_class_common_borrow_stream_class(event_class); - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); trace = bt_ctf_stream_class_common_borrow_trace(stream_class); if (trace) { BT_LOGD_STR("Event class is part of a trace."); packet_header_type = bt_ctf_trace_common_borrow_packet_header_field_type(trace); trace_valid = trace->valid; - BT_ASSERT(trace_valid); + BT_ASSERT_DBG(trace_valid); environment = trace->environment; } @@ -219,7 +219,7 @@ int _bt_ctf_event_common_validate(struct bt_ctf_event_common *event) int ret = 0; struct bt_ctf_stream_class_common *stream_class; - BT_ASSERT(event); + BT_ASSERT_DBG(event); if (event->header_field) { ret = bt_ctf_field_common_validate_recursive( event->header_field->field); @@ -237,7 +237,7 @@ int _bt_ctf_event_common_validate(struct bt_ctf_event_common *event) * We should not have been able to create the event without associating * the event class to a stream class. */ - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); if (stream_class->event_context_field_type) { ret = bt_ctf_field_common_validate_recursive( @@ -276,7 +276,7 @@ BT_HIDDEN void _bt_ctf_event_common_set_is_frozen(struct bt_ctf_event_common *event, bool is_frozen) { - BT_ASSERT(event); + BT_ASSERT_DBG(event); BT_LOGD("Freezing event: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, event, bt_ctf_event_class_common_get_name(event->class), @@ -348,7 +348,7 @@ int bt_ctf_event_common_initialize(struct bt_ctf_event_common *event, event_class); /* The event class was frozen when added to its stream class */ - BT_ASSERT(event_class->frozen); + BT_ASSERT_DBG(event_class->frozen); trace = bt_ctf_stream_class_common_borrow_trace(stream_class); if (must_be_in_trace) { @@ -538,7 +538,7 @@ static void destroy_event_header_field(struct bt_ctf_field_wrapper *field_wrapper, struct bt_ctf_stream_class *stream_class) { - BT_ASSERT(field_wrapper); + BT_ASSERT_DBG(field_wrapper); bt_ctf_object_put_ref(field_wrapper->field); bt_ctf_field_wrapper_destroy(field_wrapper); } @@ -580,7 +580,7 @@ static void release_event_header_field(struct bt_ctf_field_wrapper *field_wrapper, struct bt_ctf_event_common *event_common) { - BT_ASSERT(field_wrapper); + BT_ASSERT_DBG(field_wrapper); BT_CTF_OBJECT_PUT_REF_AND_RESET(field_wrapper->field); bt_ctf_field_wrapper_destroy(field_wrapper); } @@ -648,7 +648,7 @@ struct bt_ctf_event_class *bt_ctf_event_get_class(struct bt_ctf_event *event) BT_HIDDEN struct bt_ctf_stream *bt_ctf_event_borrow_stream(struct bt_ctf_event *event) { - BT_ASSERT(event); + BT_ASSERT_DBG(event); return (struct bt_ctf_stream *) bt_ctf_object_borrow_parent(&BT_CTF_TO_COMMON(event)->base); } @@ -717,8 +717,8 @@ int bt_ctf_event_serialize(struct bt_ctf_event *event, { int ret = 0; - BT_ASSERT(event); - BT_ASSERT(ctfser); + BT_ASSERT_DBG(event); + BT_ASSERT_DBG(ctfser); BT_LOGT_STR("Serializing event's context field."); if (event->common.context_field) { diff --git a/src/ctf-writer/event.h b/src/ctf-writer/event.h index ed21444a..ae6692d1 100644 --- a/src/ctf-writer/event.h +++ b/src/ctf-writer/event.h @@ -82,7 +82,7 @@ static inline struct bt_ctf_event_class_common *bt_ctf_event_common_borrow_class( struct bt_ctf_event_common *event) { - BT_ASSERT(event); + BT_ASSERT_DBG(event); return event->class; } diff --git a/src/ctf-writer/field-path.c b/src/ctf-writer/field-path.c index 6770290c..56426973 100644 --- a/src/ctf-writer/field-path.c +++ b/src/ctf-writer/field-path.c @@ -101,7 +101,7 @@ struct bt_ctf_field_path *bt_ctf_field_path_copy( { struct bt_ctf_field_path *new_path; - BT_ASSERT(path); + BT_ASSERT_DBG(path); BT_LOGD("Copying field path: addr=%p, index-count=%u", path, path->indexes->len); new_path = bt_ctf_field_path_create(); diff --git a/src/ctf-writer/field-types.c b/src/ctf-writer/field-types.c index 30b2cdc3..a3fde0ec 100644 --- a/src/ctf-writer/field-types.c +++ b/src/ctf-writer/field-types.c @@ -58,7 +58,7 @@ void bt_ctf_field_type_common_initialize(struct bt_ctf_field_type_common *ft, bool init_bo, bt_ctf_object_release_func release_func, struct bt_ctf_field_type_common_methods *methods) { - BT_ASSERT(ft && (ft->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN) && + BT_ASSERT_DBG(ft && (ft->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN) && (ft->id < BT_CTF_FIELD_TYPE_ID_NR)); bt_ctf_object_init_shared(&ft->base, release_func); @@ -71,7 +71,7 @@ void bt_ctf_field_type_common_initialize(struct bt_ctf_field_type_common *ft, BT_LOGD("Setting initial field type's byte order: bo=%s", bt_ctf_byte_order_string(bo)); ret = bt_ctf_field_type_common_set_byte_order(ft, bo); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); } ft->alignment = 1; @@ -85,7 +85,7 @@ void bt_ctf_field_type_common_integer_initialize( { struct bt_ctf_field_type_common_integer *int_ft = BT_CTF_FROM_COMMON(ft); - BT_ASSERT(size > 0); + BT_ASSERT_DBG(size > 0); BT_LOGD("Initializing common integer field type object: size=%u", size); ft->id = BT_CTF_FIELD_TYPE_ID_INTEGER; @@ -124,7 +124,7 @@ void bt_ctf_field_type_common_enumeration_initialize( { struct bt_ctf_field_type_common_enumeration *enum_ft = BT_CTF_FROM_COMMON(ft); - BT_ASSERT(container_ft); + BT_ASSERT_DBG(container_ft); BT_LOGD("Initializing common enumeration field type object: int-ft-addr=%p", container_ft); ft->id = BT_CTF_FIELD_TYPE_ID_ENUM; @@ -179,7 +179,7 @@ void bt_ctf_field_type_common_array_initialize( { struct bt_ctf_field_type_common_array *array_ft = BT_CTF_FROM_COMMON(ft); - BT_ASSERT(element_ft); + BT_ASSERT_DBG(element_ft); BT_LOGD("Initializing common array field type object: element-ft-addr=%p, " "length=%u", element_ft, length); ft->id = BT_CTF_FIELD_TYPE_ID_ARRAY; @@ -200,9 +200,9 @@ void bt_ctf_field_type_common_sequence_initialize( { struct bt_ctf_field_type_common_sequence *seq_ft = BT_CTF_FROM_COMMON(ft); - BT_ASSERT(element_ft); - BT_ASSERT(length_field_name); - BT_ASSERT(bt_ctf_identifier_is_valid(length_field_name)); + BT_ASSERT_DBG(element_ft); + BT_ASSERT_DBG(length_field_name); + BT_ASSERT_DBG(bt_ctf_identifier_is_valid(length_field_name)); BT_LOGD("Initializing common sequence field type object: element-ft-addr=%p, " "length-field-name=\"%s\"", element_ft, length_field_name); ft->id = BT_CTF_FIELD_TYPE_ID_SEQUENCE; @@ -224,7 +224,7 @@ void bt_ctf_field_type_common_variant_initialize( { struct bt_ctf_field_type_common_variant *var_ft = BT_CTF_FROM_COMMON(ft); - BT_ASSERT(!tag_name || bt_ctf_identifier_is_valid(tag_name)); + BT_ASSERT_DBG(!tag_name || bt_ctf_identifier_is_valid(tag_name)); BT_LOGD("Initializing common variant field type object: " "tag-ft-addr=%p, tag-field-name=\"%s\"", tag_ft, tag_name); @@ -556,10 +556,10 @@ int add_structure_variant_member(GArray *members, member_ft = &choice->type; member_name = &choice->name; - BT_ASSERT(!choice->ranges); + BT_ASSERT_DBG(!choice->ranges); choice->ranges = g_array_new(FALSE, TRUE, sizeof(struct bt_ctf_field_type_common_variant_choice_range)); - BT_ASSERT(choice->ranges); + BT_ASSERT_DBG(choice->ranges); } else { struct bt_ctf_field_type_common_structure_field *field = &g_array_index(members, @@ -975,14 +975,14 @@ int bt_ctf_field_type_common_structure_validate_recursive( bt_ctf_field_type_common_structure_get_field_count(ft); int64_t i; - BT_ASSERT(field_count >= 0); + BT_ASSERT_DBG(field_count >= 0); for (i = 0; i < field_count; ++i) { const char *field_name; ret = bt_ctf_field_type_common_structure_borrow_field_by_index(ft, &field_name, &child_ft, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = bt_ctf_field_type_common_validate(child_ft); if (ret) { BT_LOGW("Invalid structure field type: " @@ -1071,7 +1071,7 @@ int bt_ctf_field_type_common_variant_validate_recursive( ret = bt_ctf_field_type_common_variant_borrow_field_by_index(ft, &field_name, &child_ft, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = bt_ctf_field_type_common_validate(child_ft); if (ret) { BT_LOGW("Invalid variant field type: " @@ -1100,7 +1100,7 @@ int bt_ctf_field_type_common_validate(struct bt_ctf_field_type_common *ft) { int ret = 0; - BT_ASSERT(ft); + BT_ASSERT_DBG(ft); if (ft->valid) { /* Already marked as valid */ @@ -1443,7 +1443,7 @@ int bt_ctf_field_type_common_enumeration_signed_get_mapping_by_index( if (mapping_name) { *mapping_name = g_quark_to_string(mapping->string); - BT_ASSERT(*mapping_name); + BT_ASSERT_DBG(*mapping_name); } if (range_begin) { @@ -1479,7 +1479,7 @@ int bt_ctf_field_type_common_enumeration_unsigned_get_mapping_by_index( if (mapping_name) { *mapping_name = g_quark_to_string(mapping->string); - BT_ASSERT(*mapping_name); + BT_ASSERT_DBG(*mapping_name); } if (range_begin) { @@ -1824,10 +1824,10 @@ int bt_ctf_field_type_common_structure_replace_field( GQuark name_quark; uint64_t i; - BT_ASSERT(ft); - BT_ASSERT(field_name); - BT_ASSERT(field_type); - BT_ASSERT(ft->id == BT_CTF_FIELD_TYPE_ID_STRUCT); + BT_ASSERT_DBG(ft); + BT_ASSERT_DBG(field_name); + BT_ASSERT_DBG(field_type); + BT_ASSERT_DBG(ft->id == BT_CTF_FIELD_TYPE_ID_STRUCT); name_quark = g_quark_from_string(field_name); for (i = 0; i < struct_ft->fields->len; i++) { @@ -1943,7 +1943,7 @@ int bt_ctf_field_type_common_structure_borrow_field_by_index( if (field_name) { *field_name = g_quark_to_string(field->name); - BT_ASSERT(*field_name); + BT_ASSERT_DBG(*field_name); } return 0; @@ -2240,7 +2240,7 @@ int bt_ctf_field_type_common_variant_borrow_field_by_index( if (field_name) { *field_name = g_quark_to_string(choice->name); - BT_ASSERT(*field_name); + BT_ASSERT_DBG(*field_name); } return 0; @@ -2255,8 +2255,8 @@ int64_t bt_ctf_field_type_common_variant_find_choice_index( uint64_t i; struct bt_ctf_field_type_common_variant *var_ft = BT_CTF_FROM_COMMON(ft); - BT_ASSERT(ft); - BT_ASSERT(ft->id == BT_CTF_FIELD_TYPE_ID_VARIANT); + BT_ASSERT_DBG(ft); + BT_ASSERT_DBG(ft->id == BT_CTF_FIELD_TYPE_ID_VARIANT); if (bt_ctf_field_type_common_variant_update_choices(ft)) { ret = INT64_C(-1); @@ -2313,7 +2313,7 @@ bt_ctf_field_type_common_array_borrow_element_field_type( BT_CTF_ASSERT_PRE_NON_NULL(ft, "Field type"); BT_CTF_ASSERT_PRE_CTF_FT_COMMON_HAS_ID(ft, BT_CTF_FIELD_TYPE_ID_ARRAY, "Field type"); - BT_ASSERT(array_ft && array_ft->element_ft); + BT_ASSERT_DBG(array_ft && array_ft->element_ft); return array_ft->element_ft; } @@ -2503,7 +2503,7 @@ int bt_ctf_field_type_common_get_alignment(struct bt_ctf_field_type_common *ft) struct bt_ctf_field_type_common *element_ft = bt_ctf_field_type_common_sequence_borrow_element_field_type(ft); - BT_ASSERT(element_ft); + BT_ASSERT_DBG(element_ft); ret = bt_ctf_field_type_common_get_alignment(element_ft); break; } @@ -2512,7 +2512,7 @@ int bt_ctf_field_type_common_get_alignment(struct bt_ctf_field_type_common *ft) struct bt_ctf_field_type_common *element_ft = bt_ctf_field_type_common_array_borrow_element_field_type(ft); - BT_ASSERT(element_ft); + BT_ASSERT_DBG(element_ft); ret = bt_ctf_field_type_common_get_alignment(element_ft); break; } @@ -2522,7 +2522,7 @@ int bt_ctf_field_type_common_get_alignment(struct bt_ctf_field_type_common *ft) element_count = bt_ctf_field_type_common_structure_get_field_count( ft); - BT_ASSERT(element_count >= 0); + BT_ASSERT_DBG(element_count >= 0); for (i = 0; i < element_count; i++) { struct bt_ctf_field_type_common *field = NULL; @@ -2530,8 +2530,8 @@ int bt_ctf_field_type_common_get_alignment(struct bt_ctf_field_type_common *ft) ret = bt_ctf_field_type_common_structure_borrow_field_by_index( ft, NULL, &field, i); - BT_ASSERT(ret == 0); - BT_ASSERT(field); + BT_ASSERT_DBG(ret == 0); + BT_ASSERT_DBG(field); field_alignment = bt_ctf_field_type_common_get_alignment( field); if (field_alignment < 0) { @@ -2667,7 +2667,7 @@ enum bt_ctf_byte_order bt_ctf_field_type_common_get_byte_order( goto end; } - BT_ASSERT(ret == BT_CTF_BYTE_ORDER_NATIVE || + BT_ASSERT_DBG(ret == BT_CTF_BYTE_ORDER_NATIVE || ret == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN || ret == BT_CTF_BYTE_ORDER_BIG_ENDIAN || ret == BT_CTF_BYTE_ORDER_NETWORK); @@ -2732,7 +2732,7 @@ void bt_ctf_field_type_common_freeze(struct bt_ctf_field_type_common *ft) return; } - BT_ASSERT(ft->methods->freeze); + BT_ASSERT_DBG(ft->methods->freeze); ft->methods->freeze(ft); } @@ -2817,7 +2817,7 @@ struct bt_ctf_field_type_common *bt_ctf_field_type_common_copy( struct bt_ctf_field_type_common *ft_copy = NULL; BT_CTF_ASSERT_PRE_NON_NULL(ft, "Field type"); - BT_ASSERT(ft->methods->copy); + BT_ASSERT_DBG(ft->methods->copy); ft_copy = ft->methods->copy(ft); if (!ft_copy) { BT_LOGE_STR("Cannot copy field type."); @@ -3060,7 +3060,7 @@ int bt_ctf_field_type_common_variant_update_choices(struct bt_ctf_field_type_com goto end; } - BT_ASSERT(var_ft->tag_ft); + BT_ASSERT_DBG(var_ft->tag_ft); is_signed = !!var_ft->tag_ft->container_ft->is_signed; for (i = 0; i < var_ft->choices->len; i++) { @@ -3076,7 +3076,7 @@ int bt_ctf_field_type_common_variant_update_choices(struct bt_ctf_field_type_com goto end; } - BT_ASSERT(choice->ranges); + BT_ASSERT_DBG(choice->ranges); g_array_set_size(choice->ranges, 0); while (bt_ctf_field_type_enumeration_mapping_iterator_next(iter) == 0) { @@ -3092,7 +3092,7 @@ int bt_ctf_field_type_common_variant_update_choices(struct bt_ctf_field_type_com &range.lower.u, &range.upper.u); } - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); g_array_append_val(choice->ranges, range); } @@ -3740,7 +3740,7 @@ int bt_ctf_field_type_common_compare(struct bt_ctf_field_type_common *ft_a, goto end; } - BT_ASSERT(ft_a->methods->compare); + BT_ASSERT_DBG(ft_a->methods->compare); ret = ft_a->methods->compare(ft_a, ft_b); if (ret == 1) { BT_LOGT("Field types differ: ft-a-addr=%p, ft-b-addr=%p", @@ -3880,7 +3880,7 @@ int bt_ctf_field_type_common_validate_single_clock_class( goto end; } - BT_ASSERT(expected_clock_class); + BT_ASSERT_DBG(expected_clock_class); switch (ft->id) { case BT_CTF_FIELD_TYPE_ID_INTEGER: @@ -3943,7 +3943,7 @@ int bt_ctf_field_type_common_validate_single_clock_class( abort(); } - BT_ASSERT(sub_ft); + BT_ASSERT_DBG(sub_ft); ret = bt_ctf_field_type_common_validate_single_clock_class(sub_ft, expected_clock_class); break; @@ -3960,7 +3960,7 @@ int bt_ctf_field_type_common_validate_single_clock_class( ret = bt_ctf_field_type_common_structure_borrow_field_by_index( ft, &name, &member_type, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = bt_ctf_field_type_common_validate_single_clock_class( member_type, expected_clock_class); if (ret) { @@ -3986,7 +3986,7 @@ int bt_ctf_field_type_common_validate_single_clock_class( ret = bt_ctf_field_type_common_variant_borrow_field_by_index( ft, &name, &member_type, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = bt_ctf_field_type_common_validate_single_clock_class( member_type, expected_clock_class); if (ret) { @@ -4123,8 +4123,8 @@ int bt_ctf_field_type_serialize_recursive(struct bt_ctf_field_type *type, struct bt_ctf_field_type_common *type_common = (void *) type; bt_ctf_field_type_serialize_func serialize_func; - BT_ASSERT(type); - BT_ASSERT(context); + BT_ASSERT_DBG(type); + BT_ASSERT_DBG(context); /* Make sure field type is valid before serializing it */ ret = bt_ctf_field_type_common_validate((void *) type); @@ -4224,7 +4224,7 @@ int bt_ctf_field_type_integer_serialize(struct bt_ctf_field_type_common *type, const char *clock_name = bt_ctf_clock_class_get_name( integer->mapped_clock_class); - BT_ASSERT(clock_name); + BT_ASSERT_DBG(clock_name); g_string_append_printf(context->string, "; map = clock.%s.value", clock_name); } @@ -4249,10 +4249,10 @@ int bt_ctf_field_type_enumeration_serialize_recursive( "ft-addr=%p, metadata-context-addr=%p", type, context); container_type = bt_ctf_field_type_common_enumeration_borrow_container_field_type(type); - BT_ASSERT(container_type); + BT_ASSERT_DBG(container_type); container_signed = bt_ctf_field_type_common_integer_is_signed( container_type); - BT_ASSERT(container_signed >= 0); + BT_ASSERT_DBG(container_signed >= 0); g_string_append(context->string, "enum : "); BT_LOGD_STR("Serializing CTF writer enumeration field type's container field type's metadata."); ret = bt_ctf_field_type_serialize_recursive( @@ -4961,14 +4961,14 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( "Tag field"); container = bt_ctf_field_enumeration_borrow_container(tag_field); - BT_ASSERT(container); + BT_ASSERT_DBG(container); if (var_ft->tag_ft->container_ft->is_signed) { int64_t val; ret = bt_ctf_field_integer_signed_get_value(container, &val); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); choice_index = bt_ctf_field_type_common_variant_find_choice_index( (void *) ft, (uint64_t) val, true); } else { @@ -4976,7 +4976,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( ret = bt_ctf_field_integer_unsigned_get_value(container, &val); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); choice_index = bt_ctf_field_type_common_variant_find_choice_index( (void *) ft, val, false); } @@ -4989,7 +4989,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( ret = bt_ctf_field_type_variant_get_field_by_index(ft, NULL, &ret_ft, choice_index); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); end: return ret_ft; @@ -5435,7 +5435,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_copy_recursive( /* Copy ranges */ copy_entry->ranges = g_array_new(FALSE, TRUE, sizeof(struct bt_ctf_field_type_common_variant_choice_range)); - BT_ASSERT(copy_entry->ranges); + BT_ASSERT_DBG(copy_entry->ranges); g_array_set_size(copy_entry->ranges, entry->ranges->len); for (range_i = 0; range_i < entry->ranges->len; range_i++) { diff --git a/src/ctf-writer/field-wrapper.c b/src/ctf-writer/field-wrapper.c index ee5234ab..6b1625db 100644 --- a/src/ctf-writer/field-wrapper.c +++ b/src/ctf-writer/field-wrapper.c @@ -54,7 +54,7 @@ BT_HIDDEN void bt_ctf_field_wrapper_destroy(struct bt_ctf_field_wrapper *field_wrapper) { BT_LOGD("Destroying field wrapper: addr=%p", field_wrapper); - BT_ASSERT(!field_wrapper->field); + BT_ASSERT_DBG(!field_wrapper->field); BT_LOGD_STR("Putting stream class."); g_free(field_wrapper); } @@ -65,15 +65,15 @@ struct bt_ctf_field_wrapper *bt_ctf_field_wrapper_create( { struct bt_ctf_field_wrapper *field_wrapper = NULL; - BT_ASSERT(pool); - BT_ASSERT(ft); + BT_ASSERT_DBG(pool); + BT_ASSERT_DBG(ft); field_wrapper = bt_ctf_object_pool_create_object(pool); if (!field_wrapper) { BT_LOGE("Cannot allocate one field wrapper"); goto end; } - BT_ASSERT(field_wrapper->field); + BT_ASSERT_DBG(field_wrapper->field); end: return field_wrapper; diff --git a/src/ctf-writer/fields.c b/src/ctf-writer/fields.c index 2d3fc63c..53ce8b60 100644 --- a/src/ctf-writer/fields.c +++ b/src/ctf-writer/fields.c @@ -55,8 +55,8 @@ struct bt_ctf_field_common *bt_ctf_field_common_copy(struct bt_ctf_field_common struct bt_ctf_field_common *copy = NULL; BT_CTF_ASSERT_PRE_NON_NULL(field, "Field"); - BT_ASSERT(field_type_common_has_known_id(field->type)); - BT_ASSERT(field->methods->copy); + BT_ASSERT_DBG(field_type_common_has_known_id(field->type)); + BT_ASSERT_DBG(field->methods->copy); copy = field->methods->copy(field); if (!copy) { BT_LOGW("Cannot create field: ft-addr=%p", field->type); @@ -206,7 +206,7 @@ int bt_ctf_field_common_array_initialize(struct bt_ctf_field_common *field, uint64_t i; BT_LOGD("Initializing common array field object: ft-addr=%p", type); - BT_ASSERT(type); + BT_ASSERT_DBG(type); bt_ctf_field_common_initialize(field, type, is_shared, release_func, methods); array_length = array_type->length; @@ -246,7 +246,7 @@ int bt_ctf_field_common_sequence_initialize(struct bt_ctf_field_common *field, int ret = 0; BT_LOGD("Initializing common sequence field object: ft-addr=%p", type); - BT_ASSERT(type); + BT_ASSERT_DBG(type); bt_ctf_field_common_initialize(field, type, is_shared, release_func, methods); sequence->elements = g_ptr_array_new(); @@ -276,7 +276,7 @@ int bt_ctf_field_common_structure_validate_recursive(struct bt_ctf_field_common int ret = 0; struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < structure->fields->len; i++) { ret = bt_ctf_field_common_validate_recursive( @@ -288,7 +288,7 @@ int bt_ctf_field_common_structure_validate_recursive(struct bt_ctf_field_common this_ret = bt_ctf_field_type_common_structure_borrow_field_by_index( field->type, &name, NULL, i); - BT_ASSERT(this_ret == 0); + BT_ASSERT_DBG(this_ret == 0); BT_CTF_ASSERT_PRE_MSG("Invalid structure field's field: " "struct-field-addr=%p, field-name=\"%s\", " "index=%" PRId64 ", field-addr=%p", @@ -307,7 +307,7 @@ int bt_ctf_field_common_variant_validate_recursive(struct bt_ctf_field_common *f int ret = 0; struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); if (!variant->current_field) { ret = -1; @@ -327,7 +327,7 @@ int bt_ctf_field_common_array_validate_recursive(struct bt_ctf_field_common *fie int ret = 0; struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < array->elements->len; i++) { ret = bt_ctf_field_common_validate_recursive((void *) array->elements->pdata[i]); @@ -351,7 +351,7 @@ int bt_ctf_field_common_sequence_validate_recursive(struct bt_ctf_field_common * int ret = 0; struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < sequence->elements->len; i++) { ret = bt_ctf_field_common_validate_recursive( @@ -371,7 +371,7 @@ end: BT_HIDDEN void bt_ctf_field_common_generic_reset(struct bt_ctf_field_common *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); field->payload_set = false; } @@ -381,7 +381,7 @@ void bt_ctf_field_common_structure_reset_recursive(struct bt_ctf_field_common *f int64_t i; struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < structure->fields->len; i++) { struct bt_ctf_field_common *member = structure->fields->pdata[i]; @@ -404,7 +404,7 @@ void bt_ctf_field_common_variant_reset_recursive(struct bt_ctf_field_common *fie { struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); variant->current_field = NULL; } @@ -414,7 +414,7 @@ void bt_ctf_field_common_array_reset_recursive(struct bt_ctf_field_common *field size_t i; struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < array->elements->len; i++) { struct bt_ctf_field_common *member = array->elements->pdata[i]; @@ -437,7 +437,7 @@ void bt_ctf_field_common_sequence_reset_recursive(struct bt_ctf_field_common *fi struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field); uint64_t i; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < sequence->elements->len; i++) { if (sequence->elements->pdata[i]) { @@ -555,8 +555,8 @@ void _bt_ctf_field_common_set_is_frozen_recursive(struct bt_ctf_field_common *fi BT_LOGD("Setting field object's frozen state: addr=%p, is-frozen=%d", field, is_frozen); - BT_ASSERT(field_type_common_has_known_id(field->type)); - BT_ASSERT(field->methods->set_is_frozen); + BT_ASSERT_DBG(field_type_common_has_known_id(field->type)); + BT_ASSERT_DBG(field->methods->set_is_frozen); field->methods->set_is_frozen(field, is_frozen); end: @@ -577,7 +577,7 @@ bt_ctf_bool bt_ctf_field_common_structure_is_set_recursive( size_t i; struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < structure->fields->len; i++) { is_set = bt_ctf_field_common_is_set_recursive( @@ -597,7 +597,7 @@ bt_ctf_bool bt_ctf_field_common_variant_is_set_recursive(struct bt_ctf_field_com struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field); bt_ctf_bool is_set = BT_CTF_FALSE; - BT_ASSERT(field); + BT_ASSERT_DBG(field); if (variant->current_field) { is_set = bt_ctf_field_common_is_set_recursive( @@ -614,7 +614,7 @@ bt_ctf_bool bt_ctf_field_common_array_is_set_recursive(struct bt_ctf_field_commo bt_ctf_bool is_set = BT_CTF_FALSE; struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < array->elements->len; i++) { is_set = bt_ctf_field_common_is_set_recursive(array->elements->pdata[i]); @@ -634,7 +634,7 @@ bt_ctf_bool bt_ctf_field_common_sequence_is_set_recursive(struct bt_ctf_field_co bt_ctf_bool is_set = BT_CTF_FALSE; struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); if (!sequence->elements) { goto end; @@ -865,9 +865,9 @@ int bt_ctf_field_serialize_recursive(struct bt_ctf_field *field, struct bt_ctf_field_common *field_common = (void *) field; bt_ctf_field_serialize_recursive_func serialize_func; - BT_ASSERT(ctfser); + BT_ASSERT_DBG(ctfser); BT_CTF_ASSERT_PRE_NON_NULL(field, "Field"); - BT_ASSERT(field_common->spec.writer.serialize_func); + BT_ASSERT_DBG(field_common->spec.writer.serialize_func); serialize_func = field_common->spec.writer.serialize_func; return serialize_func(field_common, ctfser, native_byte_order); @@ -1008,7 +1008,7 @@ int bt_ctf_field_structure_serialize_recursive(struct bt_ctf_field_common *field if (G_UNLIKELY(!member)) { ret = bt_ctf_field_type_common_structure_borrow_field_by_index( field->type, &field_name, NULL, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); BT_LOGW("Cannot serialize structure field's field: field is not set: " "struct-field-addr=%p, " "field-name=\"%s\", index=%" PRId64, @@ -1022,7 +1022,7 @@ int bt_ctf_field_structure_serialize_recursive(struct bt_ctf_field_common *field if (G_UNLIKELY(ret)) { ret = bt_ctf_field_type_common_structure_borrow_field_by_index( field->type, &field_name, NULL, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); BT_LOGW("Cannot serialize structure field's field: " "struct-field-addr=%p, field-addr=%p, " "field-name=\"%s\", index=%" PRId64, @@ -1144,7 +1144,7 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) enum bt_ctf_field_type_id type_id; BT_CTF_ASSERT_PRE_NON_NULL(type, "Field type"); - BT_ASSERT(field_type_common_has_known_id((void *) type)); + BT_ASSERT_DBG(field_type_common_has_known_id((void *) type)); BT_CTF_ASSERT_PRE(bt_ctf_field_type_common_validate((void *) type) == 0, "Field type is invalid: ft-addr=%p", type); type_id = bt_ctf_field_type_get_type_id(type); @@ -1194,7 +1194,7 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, } ret = bt_ctf_field_integer_unsigned_get_value(length_field, &length); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); return bt_ctf_field_common_sequence_set_length((void *) field, length, (bt_ctf_field_common_create_func) bt_ctf_field_create); } @@ -1271,7 +1271,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, (void *) enum_field->container, &tag_uval); } - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = bt_ctf_field_common_variant_set_tag((void *) field, tag_uval, is_signed); if (ret) { @@ -1281,7 +1281,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, bt_ctf_object_put_ref(variant_field->tag); variant_field->tag = bt_ctf_object_get_ref(tag_field); current_field = bt_ctf_field_variant_get_current_field(field); - BT_ASSERT(current_field); + BT_ASSERT_DBG(current_field); end: return current_field; @@ -1303,7 +1303,7 @@ struct bt_ctf_field *bt_ctf_field_enumeration_borrow_container( BT_CTF_ASSERT_PRE_NON_NULL(field, "Enumeration field"); BT_CTF_ASSERT_PRE_CTF_FIELD_COMMON_HAS_TYPE_ID((struct bt_ctf_field_common *) field, BT_CTF_FIELD_TYPE_ID_ENUM, "Field"); - BT_ASSERT(enumeration->container); + BT_ASSERT_DBG(enumeration->container); return (void *) enumeration->container; } @@ -1593,7 +1593,7 @@ struct bt_ctf_field *bt_ctf_field_array_create(struct bt_ctf_field_type *type) int ret; BT_LOGD("Creating CTF writer array field object: ft-addr=%p", type); - BT_ASSERT(type); + BT_ASSERT_DBG(type); if (!array) { BT_LOGE_STR("Failed to allocate one array field."); diff --git a/src/ctf-writer/fields.h b/src/ctf-writer/fields.h index ecf7e914..bab2e581 100644 --- a/src/ctf-writer/fields.h +++ b/src/ctf-writer/fields.h @@ -284,7 +284,7 @@ bt_ctf_bool bt_ctf_field_common_sequence_is_set_recursive(struct bt_ctf_field_co # define bt_ctf_field_common_set(_field, _val) #endif -BT_ASSERT_FUNC +BT_ASSERT_DBG_FUNC static inline bool field_type_common_has_known_id( struct bt_ctf_field_type_common *ft) { @@ -303,7 +303,7 @@ int _bt_ctf_field_common_validate_recursive(struct bt_ctf_field_common *field) goto end; } - BT_ASSERT(field_type_common_has_known_id(field->type)); + BT_ASSERT_DBG(field_type_common_has_known_id(field->type)); if (field->methods->validate) { ret = field->methods->validate(field); @@ -316,15 +316,15 @@ end: static inline void _bt_ctf_field_common_reset_recursive(struct bt_ctf_field_common *field) { - BT_ASSERT(field); - BT_ASSERT(field->methods->reset); + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(field->methods->reset); field->methods->reset(field); } static inline void _bt_ctf_field_common_set(struct bt_ctf_field_common *field, bool value) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); field->payload_set = value; } @@ -337,8 +337,8 @@ bt_ctf_bool _bt_ctf_field_common_is_set_recursive(struct bt_ctf_field_common *fi goto end; } - BT_ASSERT(field_type_common_has_known_id(field->type)); - BT_ASSERT(field->methods->is_set); + BT_ASSERT_DBG(field_type_common_has_known_id(field->type)); + BT_ASSERT_DBG(field->methods->is_set); is_set = field->methods->is_set(field); end: @@ -351,8 +351,8 @@ void bt_ctf_field_common_initialize(struct bt_ctf_field_common *field, bt_ctf_object_release_func release_func, struct bt_ctf_field_common_methods *methods) { - BT_ASSERT(field); - BT_ASSERT(ft); + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(ft); bt_ctf_object_init(&field->base, is_shared, release_func); field->methods = methods; field->type = (void *) bt_ctf_object_get_ref(ft); @@ -411,7 +411,7 @@ int bt_ctf_field_common_sequence_set_length(struct bt_ctf_field_common *field, goto end; } - BT_ASSERT(!sequence->elements->pdata[i]); + BT_ASSERT_DBG(!sequence->elements->pdata[i]); sequence->elements->pdata[i] = elem_field; } } @@ -450,7 +450,7 @@ struct bt_ctf_field_common *bt_ctf_field_common_structure_borrow_field_by_name( } ret = structure->fields->pdata[index]; - BT_ASSERT(ret); + BT_ASSERT_DBG(ret); error: return ret; @@ -525,7 +525,7 @@ int bt_ctf_field_common_variant_set_tag(struct bt_ctf_field_common *variant_fiel } /* Select corresponding field */ - BT_ASSERT(choice_index < variant->fields->len); + BT_ASSERT_DBG(choice_index < variant->fields->len); variant->current_field = variant->fields->pdata[choice_index]; variant->tag_value.u = tag_uval; @@ -694,7 +694,7 @@ int bt_ctf_field_common_string_set_value(struct bt_ctf_field_common *field, static inline void bt_ctf_field_common_finalize(struct bt_ctf_field_common *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD_STR("Putting field's type."); bt_ctf_object_put_ref(field->type); } @@ -702,7 +702,7 @@ void bt_ctf_field_common_finalize(struct bt_ctf_field_common *field) static inline void bt_ctf_field_common_integer_finalize(struct bt_ctf_field_common *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD("Finalizing common integer field object: addr=%p", field); bt_ctf_field_common_finalize(field); } @@ -710,7 +710,7 @@ void bt_ctf_field_common_integer_finalize(struct bt_ctf_field_common *field) static inline void bt_ctf_field_common_floating_point_finalize(struct bt_ctf_field_common *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD("Finalizing common floating point number field object: addr=%p", field); bt_ctf_field_common_finalize(field); } @@ -720,7 +720,7 @@ void bt_ctf_field_common_structure_finalize_recursive(struct bt_ctf_field_common { struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD("Finalizing common structure field object: addr=%p", field); bt_ctf_field_common_finalize(field); @@ -734,7 +734,7 @@ void bt_ctf_field_common_variant_finalize_recursive(struct bt_ctf_field_common * { struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD("Finalizing common variant field object: addr=%p", field); bt_ctf_field_common_finalize(field); @@ -748,7 +748,7 @@ void bt_ctf_field_common_array_finalize_recursive(struct bt_ctf_field_common *fi { struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD("Finalizing common array field object: addr=%p", field); bt_ctf_field_common_finalize(field); @@ -762,7 +762,7 @@ void bt_ctf_field_common_sequence_finalize_recursive(struct bt_ctf_field_common { struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD("Finalizing common sequence field object: addr=%p", field); bt_ctf_field_common_finalize(field); @@ -776,7 +776,7 @@ void bt_ctf_field_common_string_finalize(struct bt_ctf_field_common *field) { struct bt_ctf_field_common_string *string = BT_CTF_FROM_COMMON(field); - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LOGD("Finalizing common string field object: addr=%p", field); bt_ctf_field_common_finalize(field); diff --git a/src/ctf-writer/object-pool.c b/src/ctf-writer/object-pool.c index 16f2be95..02ba13d4 100644 --- a/src/ctf-writer/object-pool.c +++ b/src/ctf-writer/object-pool.c @@ -37,8 +37,8 @@ int bt_ctf_object_pool_initialize(struct bt_ctf_object_pool *pool, { int ret = 0; - BT_ASSERT(new_object_func); - BT_ASSERT(destroy_object_func); + BT_ASSERT_DBG(new_object_func); + BT_ASSERT_DBG(destroy_object_func); BT_LOGD("Initializing object pool: addr=%p, data-addr=%p", pool, data); pool->objects = g_ptr_array_new(); @@ -69,7 +69,7 @@ void bt_ctf_object_pool_finalize(struct bt_ctf_object_pool *pool) { uint64_t i; - BT_ASSERT(pool); + BT_ASSERT_DBG(pool); BT_LOGD("Finalizing object pool."); if (pool->objects) { diff --git a/src/ctf-writer/object-pool.h b/src/ctf-writer/object-pool.h index 0d1ef70e..64e8477b 100644 --- a/src/ctf-writer/object-pool.h +++ b/src/ctf-writer/object-pool.h @@ -108,7 +108,7 @@ void *bt_ctf_object_pool_create_object(struct bt_ctf_object_pool *pool) { struct bt_ctf_object *obj; - BT_ASSERT(pool); + BT_ASSERT_DBG(pool); #ifdef BT_LOGT BT_LOGT("Creating object from pool: pool-addr=%p, pool-size=%zu, pool-cap=%u", @@ -150,8 +150,8 @@ void bt_ctf_object_pool_recycle_object(struct bt_ctf_object_pool *pool, void *ob { struct bt_ctf_object *bt_obj = obj; - BT_ASSERT(pool); - BT_ASSERT(obj); + BT_ASSERT_DBG(pool); + BT_ASSERT_DBG(obj); #ifdef BT_LOGT BT_LOGT("Recycling object: pool-addr=%p, pool-size=%zu, pool-cap=%u, obj-addr=%p", diff --git a/src/ctf-writer/object.h b/src/ctf-writer/object.h index 1e1b7869..70032c23 100644 --- a/src/ctf-writer/object.h +++ b/src/ctf-writer/object.h @@ -91,16 +91,16 @@ struct bt_ctf_object { static inline unsigned long long bt_ctf_object_get_ref_count(struct bt_ctf_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); return obj->ref_count; } static inline struct bt_ctf_object *bt_ctf_object_borrow_parent(struct bt_ctf_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); return obj->parent; } @@ -119,8 +119,8 @@ struct bt_ctf_object *bt_ctf_object_get_parent(struct bt_ctf_object *obj) static inline void bt_ctf_object_set_parent(struct bt_ctf_object *child, struct bt_ctf_object *parent) { - BT_ASSERT(child); - BT_ASSERT(child->is_shared); + BT_ASSERT_DBG(child); + BT_ASSERT_DBG(child->is_shared); #ifdef BT_LOGT BT_LOGT("Setting object's parent: addr=%p, parent-addr=%p", @@ -134,7 +134,7 @@ void bt_ctf_object_set_parent(struct bt_ctf_object *child, struct bt_ctf_object * object's reference count falls to zero. */ if (parent) { - BT_ASSERT(!child->parent); + BT_ASSERT_DBG(!child->parent); child->parent = parent; bt_ctf_object_get_no_null_check(parent); } else { @@ -149,9 +149,9 @@ void bt_ctf_object_set_parent(struct bt_ctf_object *child, struct bt_ctf_object static inline void bt_ctf_object_try_spec_release(struct bt_ctf_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); - BT_ASSERT(obj->spec_release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); + BT_ASSERT_DBG(obj->spec_release_func); if (bt_ctf_object_get_ref_count(obj) == 0) { obj->spec_release_func(obj); @@ -197,8 +197,8 @@ static inline void bt_ctf_object_init(struct bt_ctf_object *obj, bool is_shared, bt_ctf_object_release_func release_func) { - BT_ASSERT(obj); - BT_ASSERT(!is_shared || release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(!is_shared || release_func); obj->is_shared = is_shared; obj->release_func = release_func; obj->parent_is_owner_listener_func = NULL; @@ -224,8 +224,8 @@ static inline void bt_ctf_object_init_shared_with_parent(struct bt_ctf_object *obj, bt_ctf_object_release_func spec_release_func) { - BT_ASSERT(obj); - BT_ASSERT(spec_release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(spec_release_func); bt_ctf_object_init_shared(obj, bt_ctf_object_with_parent_release_func); obj->spec_release_func = spec_release_func; } @@ -234,26 +234,26 @@ static inline void bt_ctf_object_set_parent_is_owner_listener_func(struct bt_ctf_object *obj, bt_ctf_object_parent_is_owner_listener_func func) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); - BT_ASSERT(obj->spec_release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); + BT_ASSERT_DBG(obj->spec_release_func); ((struct bt_ctf_object *) obj)->parent_is_owner_listener_func = func; } static inline void bt_ctf_object_inc_ref_count(struct bt_ctf_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); obj->ref_count++; - BT_ASSERT(obj->ref_count != 0); + BT_ASSERT_DBG(obj->ref_count != 0); } static inline void *bt_ctf_object_get_no_null_check_no_parent_check(struct bt_ctf_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); #ifdef BT_LOGT BT_LOGT("Incrementing object's reference count: %llu -> %llu: " @@ -269,8 +269,8 @@ void *bt_ctf_object_get_no_null_check_no_parent_check(struct bt_ctf_object *obj) static inline void *bt_ctf_object_get_no_null_check(struct bt_ctf_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); if (G_UNLIKELY(obj->parent && bt_ctf_object_get_ref_count(obj) == 0)) { #ifdef BT_LOGT @@ -295,9 +295,9 @@ void *bt_ctf_object_get_no_null_check(struct bt_ctf_object *obj) static inline void bt_ctf_object_put_no_null_check(struct bt_ctf_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); - BT_ASSERT(obj->ref_count > 0); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); + BT_ASSERT_DBG(obj->ref_count > 0); #ifdef BT_LOGT BT_LOGT("Decrementing object's reference count: %llu -> %llu: " @@ -309,7 +309,7 @@ void bt_ctf_object_put_no_null_check(struct bt_ctf_object *obj) obj->ref_count--; if (obj->ref_count == 0) { - BT_ASSERT(obj->release_func); + BT_ASSERT_DBG(obj->release_func); obj->release_func(obj); } } diff --git a/src/ctf-writer/resolve.c b/src/ctf-writer/resolve.c index ae5fe94f..7bcc924c 100644 --- a/src/ctf-writer/resolve.c +++ b/src/ctf-writer/resolve.c @@ -259,7 +259,7 @@ static struct bt_ctf_field_type_common *get_type_from_ctx(struct resolve_context *ctx, enum bt_ctf_scope scope) { - BT_ASSERT(scope >= BT_CTF_SCOPE_TRACE_PACKET_HEADER && + BT_ASSERT_DBG(scope >= BT_CTF_SCOPE_TRACE_PACKET_HEADER && scope <= BT_CTF_SCOPE_EVENT_FIELDS); return ctx->scopes[scope - BT_CTF_SCOPE_TRACE_PACKET_HEADER]; @@ -838,7 +838,7 @@ int get_field_paths_lca_index(struct bt_ctf_field_path *field_path1, /* * Start from both roots and find the first mismatch. */ - BT_ASSERT(field_path1->root == field_path2->root); + BT_ASSERT_DBG(field_path1->root == field_path2->root); field_path1_len = field_path1->indexes->len; field_path2_len = field_path2->indexes->len; @@ -1222,7 +1222,7 @@ int resolve_root_type(enum bt_ctf_scope root_scope, struct resolve_context *ctx) { int ret; - BT_ASSERT(type_stack_size(ctx->type_stack) == 0); + BT_ASSERT_DBG(type_stack_size(ctx->type_stack) == 0); ctx->root_scope = root_scope; ret = resolve_type(get_type_from_ctx(ctx, root_scope), ctx); ctx->root_scope = BT_CTF_SCOPE_UNKNOWN; diff --git a/src/ctf-writer/stream-class.c b/src/ctf-writer/stream-class.c index 2d3b2fba..55f3a09b 100644 --- a/src/ctf-writer/stream-class.c +++ b/src/ctf-writer/stream-class.c @@ -167,7 +167,7 @@ int bt_ctf_stream_class_common_add_event_class( BT_CTF_VALIDATION_FLAG_EVENT; struct bt_ctf_clock_class *expected_clock_class = NULL; - BT_ASSERT(copy_field_type_func); + BT_ASSERT_DBG(copy_field_type_func); if (!stream_class || !event_class) { BT_LOGW("Invalid parameter: stream class or event class is NULL: " @@ -271,8 +271,8 @@ int bt_ctf_stream_class_common_add_event_class( * The trace and stream class should be valid at this * point. */ - BT_ASSERT(trace->valid); - BT_ASSERT(stream_class->valid); + BT_ASSERT_DBG(trace->valid); + BT_ASSERT_DBG(stream_class->valid); packet_header_type = bt_ctf_trace_common_borrow_packet_header_field_type(trace); packet_context_type = @@ -371,7 +371,7 @@ int bt_ctf_stream_class_common_add_event_class( * now if the stream class is frozen. */ if (stream_class->frozen && expected_clock_class) { - BT_ASSERT(!stream_class->clock_class || + BT_ASSERT_DBG(!stream_class->clock_class || stream_class->clock_class == expected_clock_class); BT_CTF_OBJECT_MOVE_REF(stream_class->clock_class, expected_clock_class); } @@ -478,8 +478,8 @@ int bt_ctf_stream_class_common_validate_single_clock_class( int ret; uint64_t i; - BT_ASSERT(stream_class); - BT_ASSERT(expected_clock_class); + BT_ASSERT_DBG(stream_class); + BT_ASSERT_DBG(expected_clock_class); ret = bt_ctf_field_type_common_validate_single_clock_class( stream_class->packet_context_field_type, expected_clock_class); @@ -538,7 +538,7 @@ int bt_ctf_stream_class_common_validate_single_clock_class( struct bt_ctf_event_class_common *event_class = g_ptr_array_index(stream_class->event_classes, i); - BT_ASSERT(event_class); + BT_ASSERT_DBG(event_class); ret = bt_ctf_event_class_common_validate_single_clock_class( event_class, expected_clock_class); if (ret) { @@ -747,14 +747,14 @@ int try_map_clock_class(struct bt_ctf_stream_class *stream_class, bt_ctf_field_type_structure_get_field_type_by_name(parent_ft, field_name); - BT_ASSERT(stream_class->clock); + BT_ASSERT_DBG(stream_class->clock); if (!ft) { /* Field does not exist: not an error */ goto end; } - BT_ASSERT(((struct bt_ctf_field_type_common *) ft)->id == + BT_ASSERT_DBG(((struct bt_ctf_field_type_common *) ft)->id == BT_CTF_FIELD_TYPE_ID_INTEGER); mapped_clock_class = bt_ctf_field_type_integer_get_mapped_clock_class(ft); @@ -782,7 +782,7 @@ int try_map_clock_class(struct bt_ctf_stream_class *stream_class, ret = bt_ctf_field_type_common_integer_set_mapped_clock_class_no_check_frozen( (void *) ft_copy, stream_class->clock->clock_class); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = bt_ctf_field_type_common_structure_replace_field( (void *) parent_ft, field_name, (void *) ft_copy); @@ -810,7 +810,7 @@ int bt_ctf_stream_class_map_clock_class( { int ret = 0; - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); if (!stream_class->clock) { /* No clock class to map to */ @@ -946,7 +946,7 @@ int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, */ trace = BT_CTF_FROM_COMMON(bt_ctf_stream_class_common_borrow_trace( BT_CTF_TO_COMMON(stream_class))); - BT_ASSERT(trace); + BT_ASSERT_DBG(trace); packet_header_type = bt_ctf_trace_get_packet_header_field_type(trace); trace = NULL; if (packet_header_type) { diff --git a/src/ctf-writer/stream-class.h b/src/ctf-writer/stream-class.h index ca5a3075..8b31c46e 100644 --- a/src/ctf-writer/stream-class.h +++ b/src/ctf-writer/stream-class.h @@ -155,7 +155,7 @@ static inline struct bt_ctf_trace_common *bt_ctf_stream_class_common_borrow_trace( struct bt_ctf_stream_class_common *stream_class) { - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); return (void *) bt_ctf_object_borrow_parent(&stream_class->base); } @@ -205,7 +205,7 @@ static inline void _bt_ctf_stream_class_common_set_id( struct bt_ctf_stream_class_common *stream_class, int64_t id) { - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); stream_class->id = id; stream_class->id_set = 1; BT_LOGT("Set stream class's ID (internal): " diff --git a/src/ctf-writer/stream.c b/src/ctf-writer/stream.c index 3f5e6100..a564d58b 100644 --- a/src/ctf-writer/stream.c +++ b/src/ctf-writer/stream.c @@ -161,7 +161,7 @@ int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) } field_type = bt_ctf_field_get_type(field); - BT_ASSERT(field_type); + BT_ASSERT_DBG(field_type); if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { @@ -207,7 +207,7 @@ int set_packet_header_magic(struct bt_ctf_stream *stream) stream->packet_header, "magic"); const uint32_t magic_value = 0xc1fc1fc1; - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!magic_field) { /* No magic field found. Not an error, skip. */ @@ -245,7 +245,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) struct bt_ctf_field *uuid_field = bt_ctf_field_structure_get_field_by_name( stream->packet_header, "uuid"); - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!uuid_field) { /* No uuid field found. Not an error, skip. */ @@ -395,7 +395,7 @@ int set_packet_context_content_size(struct bt_ctf_stream *stream, struct bt_ctf_field *field = bt_ctf_field_structure_get_field_by_name( stream->packet_context, "content_size"); - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!field) { /* No content size field found. Not an error, skip. */ @@ -430,7 +430,7 @@ int set_packet_context_events_discarded(struct bt_ctf_stream *stream) struct bt_ctf_field *field = bt_ctf_field_structure_get_field_by_name( stream->packet_context, "events_discarded"); - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); if (!field) { /* No discarded events count field found. Not an error, skip. */ @@ -550,7 +550,7 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) bt_ctf_object_put_ref(cc); val_size = bt_ctf_field_type_integer_get_size( (void *) field_common->type); - BT_ASSERT(val_size >= 1); + BT_ASSERT_DBG(val_size >= 1); if (bt_ctf_field_type_integer_is_signed( (void *) field_common->type)) { @@ -575,7 +575,7 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) struct bt_ctf_field *int_field = bt_ctf_field_enumeration_get_container(field); - BT_ASSERT(int_field); + BT_ASSERT_DBG(int_field); ret = visit_field_update_clock_value(int_field, val); bt_ctf_object_put_ref(int_field); break; @@ -586,13 +586,13 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) int64_t len = bt_ctf_field_type_array_get_length( (void *) field_common->type); - BT_ASSERT(len >= 0); + BT_ASSERT_DBG(len >= 0); for (i = 0; i < len; i++) { struct bt_ctf_field *elem_field = bt_ctf_field_array_get_field(field, i); - BT_ASSERT(elem_field); + BT_ASSERT_DBG(elem_field); ret = visit_field_update_clock_value(elem_field, val); bt_ctf_object_put_ref(elem_field); if (ret) { @@ -616,7 +616,7 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) struct bt_ctf_field *elem_field = bt_ctf_field_sequence_get_field(field, i); - BT_ASSERT(elem_field); + BT_ASSERT_DBG(elem_field); ret = visit_field_update_clock_value(elem_field, val); bt_ctf_object_put_ref(elem_field); if (ret) { @@ -631,13 +631,13 @@ int visit_field_update_clock_value(struct bt_ctf_field *field, uint64_t *val) int64_t len = bt_ctf_field_type_structure_get_field_count( (void *) field_common->type); - BT_ASSERT(len >= 0); + BT_ASSERT_DBG(len >= 0); for (i = 0; i < len; i++) { struct bt_ctf_field *member_field = bt_ctf_field_structure_get_field_by_index(field, i); - BT_ASSERT(member_field); + BT_ASSERT_DBG(member_field); ret = visit_field_update_clock_value(member_field, val); bt_ctf_object_put_ref(member_field); if (ret) { @@ -732,7 +732,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) if (ts_begin_field && bt_ctf_field_is_set_recursive(ts_begin_field)) { /* Use provided `timestamp_begin` value as starting value */ ret = bt_ctf_field_integer_unsigned_get_value(ts_begin_field, &val); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); init_clock_value = val; } else if (stream->last_ts_end != -1ULL) { /* Use last packet's ending timestamp as starting value */ @@ -768,7 +768,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) */ len = bt_ctf_field_type_structure_get_field_count( (void *) packet_context->type); - BT_ASSERT(len >= 0); + BT_ASSERT_DBG(len >= 0); for (i = 0; i < len; i++) { const char *member_name; @@ -776,7 +776,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) ret = bt_ctf_field_type_structure_get_field_by_index( (void *) packet_context->type, &member_name, NULL, i); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); if (strcmp(member_name, "timestamp_begin") == 0 || strcmp(member_name, "timestamp_end") == 0) { @@ -785,7 +785,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) member_field = bt_ctf_field_structure_get_field_by_index( stream->packet_context, i); - BT_ASSERT(member_field); + BT_ASSERT_DBG(member_field); if (strcmp(member_name, "packet_size") == 0 && !bt_ctf_field_is_set_recursive(member_field)) { @@ -828,7 +828,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) for (i = 0; i < stream->events->len; i++) { struct bt_ctf_event *event = g_ptr_array_index(stream->events, i); - BT_ASSERT(event); + BT_ASSERT_DBG(event); ret = visit_event_update_clock_value(event, &cur_clock_value); if (ret) { BT_LOGW("Cannot automatically update clock value " @@ -853,7 +853,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) */ if (ts_end_field && bt_ctf_field_is_set_recursive(ts_end_field)) { ret = bt_ctf_field_integer_unsigned_get_value(ts_end_field, &val); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); if (val < cur_clock_value) { BT_LOGW("Packet's final timestamp is less than " @@ -872,7 +872,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) if (ts_end_field && !bt_ctf_field_is_set_recursive(ts_end_field)) { ret = set_integer_field_value(ts_end_field, cur_clock_value); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); stream->last_ts_end = cur_clock_value; } @@ -883,7 +883,7 @@ int set_packet_context_timestamps(struct bt_ctf_stream *stream) /* Set `timestamp_begin` field to initial clock value */ if (ts_begin_field && !bt_ctf_field_is_set_recursive(ts_begin_field)) { ret = set_integer_field_value(ts_begin_field, init_clock_value); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); } end: @@ -979,7 +979,7 @@ int create_stream_file(struct bt_ctf_writer *writer, /* Use stream name's base name as prefix */ gchar *basename = g_path_get_basename(stream->common.name->str); - BT_ASSERT(basename); + BT_ASSERT_DBG(basename); if (strcmp(basename, G_DIR_SEPARATOR_S) == 0) { g_string_assign(filename, "stream"); @@ -998,7 +998,7 @@ int create_stream_file(struct bt_ctf_writer *writer, g_path_get_basename( stream->common.stream_class->name->str); - BT_ASSERT(basename); + BT_ASSERT_DBG(basename); if (strcmp(basename, G_DIR_SEPARATOR_S) == 0) { g_string_assign(filename, "stream"); @@ -1015,8 +1015,8 @@ int create_stream_file(struct bt_ctf_writer *writer, append_ids: stream_class_id = bt_ctf_stream_class_common_get_id(stream->common.stream_class); - BT_ASSERT(stream_class_id >= 0); - BT_ASSERT(stream->common.id >= 0); + BT_ASSERT_DBG(stream_class_id >= 0); + BT_ASSERT_DBG(stream->common.id >= 0); g_string_append_printf(filename, "-%" PRId64 "-%" PRId64, stream_class_id, stream->common.id); @@ -1093,7 +1093,7 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id( stream->last_ts_end = -1ULL; BT_LOGD("CTF writer stream object belongs writer's trace: " "writer-addr=%p", writer); - BT_ASSERT(writer); + BT_ASSERT_DBG(writer); if (stream_class->common.packet_context_field_type) { BT_LOGD("Creating stream's packet context field: " @@ -1299,7 +1299,7 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, BT_CTF_TO_COMMON(stream))); int64_t event_class_id; - BT_ASSERT(event); + BT_ASSERT_DBG(event); if (!event->common.header_field) { goto end; @@ -1318,7 +1318,7 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, id_field = bt_ctf_field_structure_get_field_by_name( (void *) event->common.header_field->field, "id"); event_class_id = bt_ctf_event_class_common_get_id(event->common.class); - BT_ASSERT(event_class_id >= 0); + BT_ASSERT_DBG(event_class_id >= 0); if (id_field && bt_ctf_field_get_type_id(id_field) == BT_CTF_FIELD_TYPE_ID_INTEGER) { ret = set_integer_field_value(id_field, event_class_id); @@ -1350,12 +1350,12 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, if (mapped_clock_class) { uint64_t timestamp; - BT_ASSERT(mapped_clock_class == + BT_ASSERT_DBG(mapped_clock_class == stream_class->clock->clock_class); ret = bt_ctf_clock_get_value( stream_class->clock, ×tamp); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); ret = set_integer_field_value(timestamp_field, timestamp); if (ret) { @@ -1566,7 +1566,7 @@ int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, } field_type = bt_ctf_field_get_type(field); - BT_ASSERT(field_type); + BT_ASSERT_DBG(field_type); if (bt_ctf_field_type_common_compare((void *) field_type, trace->common.packet_header_field_type)) { @@ -1650,7 +1650,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) bt_ctf_stream_get_name(stream), stream->flushed_packet_count); trace = BT_CTF_FROM_COMMON(bt_ctf_stream_class_common_borrow_trace( stream->common.stream_class)); - BT_ASSERT(trace); + BT_ASSERT_DBG(trace); native_byte_order = bt_ctf_trace_get_native_byte_order(trace); ret = auto_populate_packet_header(stream); @@ -1878,8 +1878,8 @@ int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, struct bt_ctf_field_type *field_type = NULL; struct bt_ctf_field *integer; - BT_ASSERT(structure); - BT_ASSERT(name); + BT_ASSERT_DBG(structure); + BT_ASSERT_DBG(name); integer = bt_ctf_field_structure_get_field_by_name(structure, name); if (!integer) { @@ -1898,7 +1898,7 @@ int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, } field_type = bt_ctf_field_get_type(integer); - BT_ASSERT(field_type); + BT_ASSERT_DBG(field_type); if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { /* * The user most likely meant for us to populate this field diff --git a/src/ctf-writer/stream.h b/src/ctf-writer/stream.h index 5596e33d..7cf0e620 100644 --- a/src/ctf-writer/stream.h +++ b/src/ctf-writer/stream.h @@ -61,7 +61,7 @@ static inline struct bt_ctf_stream_class_common *bt_ctf_stream_common_borrow_class( struct bt_ctf_stream_common *stream) { - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); return stream->stream_class; } diff --git a/src/ctf-writer/trace.c b/src/ctf-writer/trace.c index e9a96247..c31042fe 100644 --- a/src/ctf-writer/trace.c +++ b/src/ctf-writer/trace.c @@ -473,7 +473,7 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace_common *trace, ret = bt_ctf_field_type_common_structure_borrow_field_by_index( packet_header_type, &field_name, NULL, 0); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); if (strcmp(field_name, "magic") != 0) { BT_LOGW("Invalid packet header field type: `magic` field must be the first field: " @@ -509,7 +509,7 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace_common *trace, } elem_ft = bt_ctf_field_type_common_array_borrow_element_field_type(field_type); - BT_ASSERT(elem_ft); + BT_ASSERT_DBG(elem_ft); if (elem_ft->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid packet header field type: `uuid` field's element field type must be an integer field type: " @@ -829,7 +829,7 @@ bool event_header_field_type_is_valid(struct bt_ctf_trace_common *trace, goto invalid; } - BT_ASSERT(int_ft); + BT_ASSERT_DBG(int_ft); if (bt_ctf_field_type_common_integer_is_signed(int_ft)) { BT_LOGW("Invalid event header field type: `id` field must be an unsigned integer or enumeration field type: " "id-ft-addr=%p", int_ft); @@ -904,7 +904,7 @@ int bt_ctf_trace_common_add_stream_class(struct bt_ctf_trace_common *trace, struct bt_ctf_clock_class *expected_clock_class = bt_ctf_object_get_ref(init_expected_clock_class); - BT_ASSERT(copy_field_type_func); + BT_ASSERT_DBG(copy_field_type_func); if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -940,7 +940,7 @@ int bt_ctf_trace_common_add_stream_class(struct bt_ctf_trace_common *trace, event_class_count = bt_ctf_stream_class_common_get_event_class_count(stream_class); - BT_ASSERT(event_class_count >= 0); + BT_ASSERT_DBG(event_class_count >= 0); if (!stream_class->frozen) { /* @@ -1261,8 +1261,8 @@ bt_ctf_bool bt_ctf_trace_common_has_clock_class(struct bt_ctf_trace_common *trac { struct bt_ctf_search_query query = { .value = clock_class, .found = 0 }; - BT_ASSERT(trace); - BT_ASSERT(clock_class); + BT_ASSERT_DBG(trace); + BT_ASSERT_DBG(clock_class); g_ptr_array_foreach(trace->clock_classes, value_exists, &query); return query.found; @@ -1685,7 +1685,7 @@ int append_trace_metadata(struct bt_ctf_trace *trace, g_string_append(context->string, "trace {\n"); g_string_append(context->string, "\tmajor = 1;\n"); g_string_append(context->string, "\tminor = 8;\n"); - BT_ASSERT(trace->common.native_byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN || + BT_ASSERT_DBG(trace->common.native_byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN || trace->common.native_byte_order == BT_CTF_BYTE_ORDER_BIG_ENDIAN || trace->common.native_byte_order == BT_CTF_BYTE_ORDER_NETWORK); @@ -1740,8 +1740,8 @@ void append_env_metadata(struct bt_ctf_trace *trace, env_field_value_obj = bt_ctf_attributes_borrow_field_value( trace->common.environment, i); - BT_ASSERT(entry_name); - BT_ASSERT(env_field_value_obj); + BT_ASSERT_DBG(entry_name); + BT_ASSERT_DBG(env_field_value_obj); switch (bt_ctf_value_get_type( bt_ctf_private_value_as_value(env_field_value_obj))) { diff --git a/src/ctf-writer/trace.h b/src/ctf-writer/trace.h index 1b426821..63c60798 100644 --- a/src/ctf-writer/trace.h +++ b/src/ctf-writer/trace.h @@ -117,7 +117,7 @@ int64_t bt_ctf_trace_common_get_environment_field_count( BT_CTF_ASSERT_PRE_NON_NULL(trace, "Trace"); ret = bt_ctf_attributes_get_count(trace->environment); - BT_ASSERT(ret >= 0); + BT_ASSERT_DBG(ret >= 0); return ret; } diff --git a/src/ctf-writer/utils.c b/src/ctf-writer/utils.c index 5c951ea9..5f03c92c 100644 --- a/src/ctf-writer/utils.c +++ b/src/ctf-writer/utils.c @@ -62,7 +62,7 @@ void try_init_reserved_keywords(void) } reserved_keywords_set = g_hash_table_new(g_direct_hash, g_direct_equal); - BT_ASSERT(reserved_keywords_set); + BT_ASSERT_DBG(reserved_keywords_set); for (i = 0; i < reserved_keywords_count; i++) { gpointer quark = GINT_TO_POINTER(g_quark_from_string( diff --git a/src/ctf-writer/utils.h b/src/ctf-writer/utils.h index f08d544b..68390580 100644 --- a/src/ctf-writer/utils.h +++ b/src/ctf-writer/utils.h @@ -200,7 +200,7 @@ GString *bt_ctf_field_path_string(struct bt_ctf_field_path *path) GString *str = g_string_new(NULL); size_t i; - BT_ASSERT(path); + BT_ASSERT_DBG(path); if (!str) { goto end; diff --git a/src/ctf-writer/values.c b/src/ctf-writer/values.c index 91fcbdd2..a78bd0ec 100644 --- a/src/ctf-writer/values.c +++ b/src/ctf-writer/values.c @@ -221,7 +221,7 @@ struct bt_ctf_private_value *bt_ctf_value_array_copy(const struct bt_ctf_value * bt_ctf_value_array_borrow_element_by_index( array_obj, i); - BT_ASSERT(element_obj); + BT_ASSERT_DBG(element_obj); BT_LOGD("Copying array value's element: element-addr=%p, " "index=%d", element_obj, i); ret = bt_ctf_value_copy(&element_obj_copy, element_obj); @@ -233,7 +233,7 @@ struct bt_ctf_private_value *bt_ctf_value_array_copy(const struct bt_ctf_value * goto end; } - BT_ASSERT(element_obj_copy); + BT_ASSERT_DBG(element_obj_copy); ret = bt_ctf_private_value_array_append_element(copy_obj, (void *) element_obj_copy); BT_CTF_OBJECT_PUT_REF_AND_RESET(element_obj_copy); @@ -274,7 +274,7 @@ struct bt_ctf_private_value *bt_ctf_value_map_copy(const struct bt_ctf_value *ma while (g_hash_table_iter_next(&iter, &key, &element_obj)) { const char *key_str = g_quark_to_string(GPOINTER_TO_UINT(key)); - BT_ASSERT(key_str); + BT_ASSERT_DBG(key_str); BT_LOGD("Copying map value's element: element-addr=%p, " "key=\"%s\"", element_obj, key_str); ret = bt_ctf_value_copy(&element_obj_copy, element_obj); @@ -286,7 +286,7 @@ struct bt_ctf_private_value *bt_ctf_value_map_copy(const struct bt_ctf_value *ma goto end; } - BT_ASSERT(element_obj_copy); + BT_ASSERT_DBG(element_obj_copy); ret = bt_ctf_private_value_map_insert_entry(copy_obj, key_str, (void *) element_obj_copy); BT_CTF_OBJECT_PUT_REF_AND_RESET(element_obj_copy); @@ -566,7 +566,7 @@ enum bt_ctf_value_status _bt_ctf_value_freeze(struct bt_ctf_value *object) { enum bt_ctf_value_status ret = BT_CTF_VALUE_STATUS_OK; - BT_ASSERT(object); + BT_ASSERT_DBG(object); if (object->frozen) { goto end; @@ -1212,7 +1212,7 @@ bt_ctf_bool extend_map_element(const char *key, goto error; } - BT_ASSERT(extension_obj_elem_copy); + BT_ASSERT_DBG(extension_obj_elem_copy); /* Replace in extended object */ extend_data->status = bt_ctf_private_value_map_insert_entry( @@ -1229,7 +1229,7 @@ bt_ctf_bool extend_map_element(const char *key, goto end; error: - BT_ASSERT(extend_data->status != BT_CTF_VALUE_STATUS_OK); + BT_ASSERT_DBG(extend_data->status != BT_CTF_VALUE_STATUS_OK); ret = BT_CTF_FALSE; end: @@ -1266,7 +1266,7 @@ enum bt_ctf_value_status bt_ctf_value_map_extend( goto error; } - BT_ASSERT(extended_map_obj); + BT_ASSERT_DBG(extended_map_obj); /* * For each key in the extension map object, replace this key diff --git a/src/ctf-writer/writer.c b/src/ctf-writer/writer.c index 1738b70c..246d4ca1 100644 --- a/src/ctf-writer/writer.c +++ b/src/ctf-writer/writer.c @@ -152,7 +152,7 @@ struct bt_ctf_writer *bt_ctf_writer_create(const char *path) /* Default to little-endian */ ret = bt_ctf_writer_set_byte_order(writer, BT_CTF_BYTE_ORDER_NATIVE); - BT_ASSERT(ret == 0); + BT_ASSERT_DBG(ret == 0); /* Create trace directory if necessary and open a metadata file */ if (g_mkdir_with_parents(path, S_IRWXU | S_IRWXG)) { diff --git a/src/ctfser/ctfser.h b/src/ctfser/ctfser.h index cf9941bc..5338353c 100644 --- a/src/ctfser/ctfser.h +++ b/src/ctfser/ctfser.h @@ -135,7 +135,7 @@ static inline uint8_t *_bt_ctfser_get_addr(struct bt_ctfser *ctfser) { /* Only makes sense to get the address after aligning on byte */ - BT_ASSERT(ctfser->offset_in_cur_packet_bits % 8 == 0); + BT_ASSERT_DBG(ctfser->offset_in_cur_packet_bits % 8 == 0); return ((uint8_t *) mmap_align_addr(ctfser->base_mma)) + ctfser->mmap_base_offset + _bt_ctfser_offset_bytes(ctfser); } @@ -163,7 +163,7 @@ end: static inline void _bt_ctfser_incr_offset(struct bt_ctfser *ctfser, uint64_t size_bits) { - BT_ASSERT(_bt_ctfser_has_space_left(ctfser, size_bits)); + BT_ASSERT_DBG(_bt_ctfser_has_space_left(ctfser, size_bits)); ctfser->offset_in_cur_packet_bits += size_bits; } @@ -178,7 +178,7 @@ int bt_ctfser_align_offset_in_current_packet(struct bt_ctfser *ctfser, int ret = 0; uint64_t align_size_bits; - BT_ASSERT(alignment_bits > 0); + BT_ASSERT_DBG(alignment_bits > 0); align_size_bits = ALIGN(ctfser->offset_in_cur_packet_bits, alignment_bits) - ctfser->offset_in_cur_packet_bits; @@ -205,8 +205,8 @@ int _bt_ctfser_write_byte_aligned_unsigned_int_no_align( /* Reverse byte order? */ bool rbo = byte_order != BYTE_ORDER; - BT_ASSERT(size_bits % 8 == 0); - BT_ASSERT(_bt_ctfser_has_space_left(ctfser, size_bits)); + BT_ASSERT_DBG(size_bits % 8 == 0); + BT_ASSERT_DBG(_bt_ctfser_has_space_left(ctfser, size_bits)); switch (size_bits) { case 8: @@ -267,8 +267,8 @@ int _bt_ctfser_write_byte_aligned_signed_int_no_align( /* Reverse byte order? */ bool rbo = byte_order != BYTE_ORDER; - BT_ASSERT(size_bits % 8 == 0); - BT_ASSERT(_bt_ctfser_has_space_left(ctfser, size_bits)); + BT_ASSERT_DBG(size_bits % 8 == 0); + BT_ASSERT_DBG(_bt_ctfser_has_space_left(ctfser, size_bits)); switch (size_bits) { case 8: @@ -331,7 +331,7 @@ int bt_ctfser_write_byte_aligned_unsigned_int(struct bt_ctfser *ctfser, { int ret; - BT_ASSERT(alignment_bits % 8 == 0); + BT_ASSERT_DBG(alignment_bits % 8 == 0); ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits); if (G_UNLIKELY(ret)) { goto end; @@ -366,7 +366,7 @@ int bt_ctfser_write_byte_aligned_signed_int(struct bt_ctfser *ctfser, { int ret; - BT_ASSERT(alignment_bits % 8 == 0); + BT_ASSERT_DBG(alignment_bits % 8 == 0); ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits); if (G_UNLIKELY(ret)) { goto end; @@ -568,7 +568,7 @@ static inline void bt_ctfser_set_offset_in_current_packet_bits(struct bt_ctfser *ctfser, uint64_t offset_bits) { - BT_ASSERT(offset_bits <= _bt_ctfser_cur_packet_size_bits(ctfser)); + BT_ASSERT_DBG(offset_bits <= _bt_ctfser_cur_packet_size_bits(ctfser)); ctfser->offset_in_cur_packet_bits = offset_bits; } diff --git a/src/lib/assert-post.h b/src/lib/assert-post.h index 2ed45a51..a5de1dc4 100644 --- a/src/lib/assert-post.h +++ b/src/lib/assert-post.h @@ -87,7 +87,7 @@ * the user), use BT_ASSERT_PRE(). * * To assert that an internal postcondition is satisfied, use - * BT_ASSERT(). + * BT_ASSERT() or BT_ASSERT_DBG(). */ #define BT_ASSERT_POST(_cond, _fmt, ...) \ do { \ diff --git a/src/lib/assert-pre.h b/src/lib/assert-pre.h index 39472a44..700341c6 100644 --- a/src/lib/assert-pre.h +++ b/src/lib/assert-pre.h @@ -86,7 +86,7 @@ * code), use BT_ASSERT_POST(). * * To assert that an internal postcondition is satisfied, use - * BT_ASSERT(). + * BT_ASSERT() or BT_ASSERT_DBG(). */ #define BT_ASSERT_PRE(_cond, _fmt, ...) \ do { \ diff --git a/src/lib/graph/component-class-sink-simple.c b/src/lib/graph/component-class-sink-simple.c index 27b32808..8a4aba53 100644 --- a/src/lib/graph/component-class-sink-simple.c +++ b/src/lib/graph/component-class-sink-simple.c @@ -171,9 +171,9 @@ enum bt_component_class_sink_consume_method_status simple_sink_consume( struct simple_sink_data *data = bt_self_component_get_data( bt_self_component_sink_as_self_component(self_comp)); - BT_ASSERT(data); - BT_ASSERT(data->init_method_data.consume_func); - BT_ASSERT(data->msg_iter); + BT_ASSERT_DBG(data); + BT_ASSERT_DBG(data->init_method_data.consume_func); + BT_ASSERT_DBG(data->msg_iter); /* Call user's "consume" function */ status = data->init_method_data.consume_func(data->msg_iter, diff --git a/src/lib/graph/component-filter.c b/src/lib/graph/component-filter.c index df617c68..010e8fe8 100644 --- a/src/lib/graph/component-filter.c +++ b/src/lib/graph/component-filter.c @@ -69,8 +69,8 @@ bt_component_filter_borrow_class_const( cls = component->parent.class; - BT_ASSERT(cls); - BT_ASSERT(cls->type == BT_COMPONENT_CLASS_TYPE_FILTER); + BT_ASSERT_DBG(cls); + BT_ASSERT_DBG(cls->type == BT_COMPONENT_CLASS_TYPE_FILTER); return (bt_component_class_filter *) cls; } diff --git a/src/lib/graph/component-sink.c b/src/lib/graph/component-sink.c index 9d4e11d4..b848a019 100644 --- a/src/lib/graph/component-sink.c +++ b/src/lib/graph/component-sink.c @@ -70,8 +70,8 @@ bt_component_sink_borrow_class_const( cls = component->parent.class; - BT_ASSERT(cls); - BT_ASSERT(cls->type == BT_COMPONENT_CLASS_TYPE_SINK); + BT_ASSERT_DBG(cls); + BT_ASSERT_DBG(cls->type == BT_COMPONENT_CLASS_TYPE_SINK); return (bt_component_class_sink *) cls; } diff --git a/src/lib/graph/component-source.c b/src/lib/graph/component-source.c index 7e8ceb56..aed5dafd 100644 --- a/src/lib/graph/component-source.c +++ b/src/lib/graph/component-source.c @@ -69,8 +69,8 @@ bt_component_source_borrow_class_const( cls = component->parent.class; - BT_ASSERT(cls); - BT_ASSERT(cls->type == BT_COMPONENT_CLASS_TYPE_SOURCE); + BT_ASSERT_DBG(cls); + BT_ASSERT_DBG(cls->type == BT_COMPONENT_CLASS_TYPE_SOURCE); return (bt_component_class_source *) cls; } diff --git a/src/lib/graph/component.h b/src/lib/graph/component.h index c993ce69..9ddd9c52 100644 --- a/src/lib/graph/component.h +++ b/src/lib/graph/component.h @@ -75,7 +75,7 @@ struct bt_component { static inline struct bt_graph *bt_component_borrow_graph(struct bt_component *comp) { - BT_ASSERT(comp); + BT_ASSERT_DBG(comp); return (void *) bt_object_borrow_parent(&comp->base); } diff --git a/src/lib/graph/connection.h b/src/lib/graph/connection.h index 530dfd9f..8f2c32ca 100644 --- a/src/lib/graph/connection.h +++ b/src/lib/graph/connection.h @@ -76,7 +76,7 @@ void bt_connection_remove_iterator(struct bt_connection *conn, static inline struct bt_graph *bt_connection_borrow_graph(struct bt_connection *conn) { - BT_ASSERT(conn); + BT_ASSERT_DBG(conn); return (void *) conn->base.parent; } diff --git a/src/lib/graph/graph.c b/src/lib/graph/graph.c index 3c9be9ef..32af1ef8 100644 --- a/src/lib/graph/graph.c +++ b/src/lib/graph/graph.c @@ -573,9 +573,9 @@ int consume_graph_sink(struct bt_component_sink *comp) enum bt_component_class_sink_consume_method_status consume_status; struct bt_component_class_sink *sink_class = NULL; - BT_ASSERT(comp); + BT_ASSERT_DBG(comp); sink_class = (void *) comp->parent.class; - BT_ASSERT(sink_class->methods.consume); + BT_ASSERT_DBG(sink_class->methods.consume); BT_LIB_LOGD("Calling user's consume method: %!+c", comp); consume_status = sink_class->methods.consume((void *) comp); BT_LOGD("User method returned: status=%s", @@ -648,7 +648,7 @@ int bt_graph_consume_sink_no_check(struct bt_graph *graph, int index; BT_LIB_LOGD("Making specific sink consume: %![comp-]+c", sink); - BT_ASSERT(bt_component_borrow_graph((void *) sink) == graph); + BT_ASSERT_DBG(bt_component_borrow_graph((void *) sink) == graph); if (g_queue_is_empty(graph->sinks_to_consume)) { BT_LOGD_STR("Graph's sink queue is empty: end of graph."); @@ -665,7 +665,7 @@ int bt_graph_consume_sink_no_check(struct bt_graph *graph, } sink_node = g_queue_pop_nth_link(graph->sinks_to_consume, index); - BT_ASSERT(sink_node); + BT_ASSERT_DBG(sink_node); status = consume_sink_node(graph, sink_node); end: @@ -1604,7 +1604,7 @@ void bt_graph_add_message(struct bt_graph *graph, BT_HIDDEN bool bt_graph_is_interrupted(const struct bt_graph *graph) { - BT_ASSERT(graph); + BT_ASSERT_DBG(graph); return bt_interrupter_array_any_is_set(graph->interrupters); } diff --git a/src/lib/graph/graph.h b/src/lib/graph/graph.h index 72cf121b..5fe6cb69 100644 --- a/src/lib/graph/graph.h +++ b/src/lib/graph/graph.h @@ -162,7 +162,7 @@ struct bt_graph { static inline void bt_graph_set_can_consume(struct bt_graph *graph, bool can_consume) { - BT_ASSERT(graph); + BT_ASSERT_DBG(graph); graph->can_consume = can_consume; } @@ -228,7 +228,8 @@ int bt_graph_configure(struct bt_graph *graph) int status = BT_FUNC_STATUS_OK; uint64_t i; - BT_ASSERT(graph->config_state != BT_GRAPH_CONFIGURATION_STATE_FAULTY); + BT_ASSERT_DBG(graph->config_state != + BT_GRAPH_CONFIGURATION_STATE_FAULTY); if (G_LIKELY(graph->config_state == BT_GRAPH_CONFIGURATION_STATE_CONFIGURED)) { diff --git a/src/lib/graph/interrupter.h b/src/lib/graph/interrupter.h index 149d0c11..85b14d8f 100644 --- a/src/lib/graph/interrupter.h +++ b/src/lib/graph/interrupter.h @@ -39,7 +39,7 @@ bool bt_interrupter_array_any_is_set(const GPtrArray *interrupters) bool is_set = false; uint64_t i; - BT_ASSERT(interrupters); + BT_ASSERT_DBG(interrupters); for (i = 0; i < interrupters->len; i++) { const struct bt_interrupter *intr = interrupters->pdata[i]; diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index 80de80ee..8d0f156d 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -95,7 +95,7 @@ void set_self_comp_port_input_msg_iterator_state( struct bt_self_component_port_input_message_iterator *iterator, enum bt_self_component_port_input_message_iterator_state state) { - BT_ASSERT(iterator); + BT_ASSERT_DBG(iterator); BT_LIB_LOGD("Updating message iterator's state: new-state=%s", bt_self_component_port_input_message_iterator_state_string(state)); iterator->state = state; @@ -848,7 +848,7 @@ call_iterator_next_method( { enum bt_component_class_message_iterator_next_method_status status; - BT_ASSERT(iterator->methods.next); + BT_ASSERT_DBG(iterator->methods.next); BT_LOGD_STR("Calling user's \"next\" method."); status = iterator->methods.next(iterator, msgs, capacity, user_count); BT_LOGD("User method returned: status=%s, msg-count=%" PRIu64, @@ -878,8 +878,8 @@ bt_self_component_port_input_message_iterator_next( BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE, "Message iterator's \"next\" called, but " "message iterator is in the wrong state: %!+i", iterator); - BT_ASSERT(iterator->upstream_component); - BT_ASSERT(iterator->upstream_component->class); + BT_ASSERT_DBG(iterator->upstream_component); + BT_ASSERT_DBG(iterator->upstream_component->class); BT_ASSERT_PRE_DEV( bt_component_borrow_graph(iterator->upstream_component)->config_state != BT_GRAPH_CONFIGURATION_STATE_CONFIGURING, @@ -916,7 +916,7 @@ bt_self_component_port_input_message_iterator_next( * For the same reason, there is no way that this iterator could * have seeked (cannot seek a self message iterator). */ - BT_ASSERT(iterator->state == + BT_ASSERT_DBG(iterator->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE); switch (status) { @@ -1275,8 +1275,8 @@ int auto_seek_handle_message( const struct bt_clock_snapshot *clk_snapshot = NULL; int ret; - BT_ASSERT(msg); - BT_ASSERT(got_first); + BT_ASSERT_DBG(msg); + BT_ASSERT_DBG(got_first); switch (msg->type) { case BT_MESSAGE_TYPE_EVENT: @@ -1296,7 +1296,7 @@ int auto_seek_handle_message( (const void *) msg; clk_snapshot = inactivity_msg->default_cs; - BT_ASSERT(clk_snapshot); + BT_ASSERT_DBG(clk_snapshot); break; } case BT_MESSAGE_TYPE_PACKET_BEGINNING: @@ -1395,7 +1395,7 @@ int auto_seek_handle_message( abort(); } - BT_ASSERT(clk_snapshot); + BT_ASSERT_DBG(clk_snapshot); ret = bt_clock_snapshot_get_ns_from_origin(clk_snapshot, &msg_ns_from_origin); if (ret) { @@ -1429,7 +1429,7 @@ skip_msg: stream_state->seen_clock_snapshot = true; } - BT_ASSERT(!bt_g_hash_table_contains(stream_states, stream_msg->stream)); + BT_ASSERT_DBG(!bt_g_hash_table_contains(stream_states, stream_msg->stream)); g_hash_table_insert(stream_states, stream_msg->stream, stream_state); break; } @@ -1441,11 +1441,10 @@ skip_msg: /* Update stream's state: packet began. */ stream_state = g_hash_table_lookup(stream_states, packet_msg->packet->stream); - BT_ASSERT(stream_state); - - BT_ASSERT(stream_state->state == AUTO_SEEK_STREAM_STATE_STREAM_BEGAN); + BT_ASSERT_DBG(stream_state); + BT_ASSERT_DBG(stream_state->state == AUTO_SEEK_STREAM_STATE_STREAM_BEGAN); stream_state->state = AUTO_SEEK_STREAM_STATE_PACKET_BEGAN; - BT_ASSERT(!stream_state->packet); + BT_ASSERT_DBG(!stream_state->packet); stream_state->packet = packet_msg->packet; if (packet_msg->packet->stream->class->packets_have_beginning_default_clock_snapshot) { @@ -1461,7 +1460,7 @@ skip_msg: stream_state = g_hash_table_lookup(stream_states, event_msg->event->packet->stream); - BT_ASSERT(stream_state); + BT_ASSERT_DBG(stream_state); // HELPME: are we sure that event messages have clock snapshots at this point? stream_state->seen_clock_snapshot = true; @@ -1476,11 +1475,10 @@ skip_msg: /* Update stream's state: packet ended. */ stream_state = g_hash_table_lookup(stream_states, packet_msg->packet->stream); - BT_ASSERT(stream_state); - - BT_ASSERT(stream_state->state == AUTO_SEEK_STREAM_STATE_PACKET_BEGAN); + BT_ASSERT_DBG(stream_state); + BT_ASSERT_DBG(stream_state->state == AUTO_SEEK_STREAM_STATE_PACKET_BEGAN); stream_state->state = AUTO_SEEK_STREAM_STATE_STREAM_BEGAN; - BT_ASSERT(stream_state->packet); + BT_ASSERT_DBG(stream_state->packet); stream_state->packet = NULL; if (packet_msg->packet->stream->class->packets_have_end_default_clock_snapshot) { @@ -1495,9 +1493,9 @@ skip_msg: struct auto_seek_stream_state *stream_state; stream_state = g_hash_table_lookup(stream_states, stream_msg->stream); - BT_ASSERT(stream_state); - BT_ASSERT(stream_state->state == AUTO_SEEK_STREAM_STATE_STREAM_BEGAN); - BT_ASSERT(!stream_state->packet); + BT_ASSERT_DBG(stream_state); + BT_ASSERT_DBG(stream_state->state == AUTO_SEEK_STREAM_STATE_STREAM_BEGAN); + BT_ASSERT_DBG(!stream_state->packet); /* Update stream's state: this stream doesn't exist anymore. */ g_hash_table_remove(stream_states, stream_msg->stream); @@ -1511,7 +1509,7 @@ skip_msg: struct auto_seek_stream_state *stream_state; stream_state = g_hash_table_lookup(stream_states, discarded_msg->stream); - BT_ASSERT(stream_state); + BT_ASSERT_DBG(stream_state); if ((msg->type == BT_MESSAGE_TYPE_DISCARDED_EVENTS && discarded_msg->stream->class->discarded_events_have_default_clock_snapshots) || (msg->type == BT_MESSAGE_TYPE_DISCARDED_PACKETS && discarded_msg->stream->class->discarded_packets_have_default_clock_snapshots)) { @@ -1533,7 +1531,7 @@ push_msg: msg = NULL; end: - BT_ASSERT(!msg || status != BT_FUNC_STATUS_OK); + BT_ASSERT_DBG(!msg || status != BT_FUNC_STATUS_OK); return status; } @@ -1550,7 +1548,7 @@ int find_message_ge_ns_from_origin( uint64_t i; bool got_first = false; - BT_ASSERT(iterator); + BT_ASSERT_DBG(iterator); memset(&messages[0], 0, sizeof(messages[0]) * MSG_BATCH_SIZE); /* @@ -1560,7 +1558,7 @@ int find_message_ge_ns_from_origin( set_self_comp_port_input_msg_iterator_state(iterator, BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE); - BT_ASSERT(iterator->methods.next); + BT_ASSERT_DBG(iterator->methods.next); while (!got_first) { /* @@ -1582,7 +1580,7 @@ int find_message_ge_ns_from_origin( * The user's "next" method must not do any action which * would change the iterator's state. */ - BT_ASSERT(iterator->state == + BT_ASSERT_DBG(iterator->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE); switch (status) { @@ -1781,7 +1779,6 @@ bt_self_component_port_input_message_iterator_seek_ns_from_origin( &can_seek_beginning); BT_ASSERT(can_seek_status == BT_FUNC_STATUS_OK); BT_ASSERT(can_seek_beginning); - BT_ASSERT(iterator->methods.seek_beginning); BT_LIB_LOGD("Calling user's \"seek beginning\" method: %!+i", iterator); diff --git a/src/lib/graph/message/discarded-items.c b/src/lib/graph/message/discarded-items.c index d83c8820..b62fbe49 100644 --- a/src/lib/graph/message/discarded-items.c +++ b/src/lib/graph/message/discarded-items.c @@ -162,7 +162,7 @@ struct bt_stream *borrow_discarded_items_message_stream( { struct bt_message_discarded_items *disc_items_msg = (void *) message; - BT_ASSERT(message); + BT_ASSERT_DBG(message); return disc_items_msg->stream; } @@ -184,7 +184,7 @@ enum bt_property_availability get_discarded_items_message_count( struct bt_message_discarded_items *disc_items_msg = (void *) message; BT_ASSERT_PRE_DEV_NON_NULL(count, "Count (output)"); - BT_ASSERT(message); + BT_ASSERT_DBG(message); *count = disc_items_msg->count.value; return disc_items_msg->count.base.avail; } @@ -196,7 +196,7 @@ borrow_discarded_items_message_beginning_default_clock_snapshot_const( { struct bt_message_discarded_items *disc_items_msg = (void *) message; - BT_ASSERT(message); + BT_ASSERT_DBG(message); BT_ASSERT_PRE_DEV(disc_items_msg->stream->class->default_clock_class, "Message's stream's class has no default clock class: " "%![msg-]+n, %![sc-]+S", @@ -211,7 +211,7 @@ borrow_discarded_items_message_end_default_clock_snapshot_const( { struct bt_message_discarded_items *disc_items_msg = (void *) message; - BT_ASSERT(message); + BT_ASSERT_DBG(message); BT_ASSERT_PRE_DEV(disc_items_msg->stream->class->default_clock_class, "Message's stream's class has no default clock class: " "%![msg-]+n, %![sc-]+S", @@ -369,7 +369,7 @@ borrow_discarded_items_message_stream_class_default_clock_class( { struct bt_message_discarded_items *disc_items_msg = (void *) msg; - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); return disc_items_msg->stream->class->default_clock_class; } diff --git a/src/lib/graph/message/event.c b/src/lib/graph/message/event.c index 4222a5a0..57625790 100644 --- a/src/lib/graph/message/event.c +++ b/src/lib/graph/message/event.c @@ -49,7 +49,7 @@ static inline bool event_class_has_trace(struct bt_event_class *event_class) struct bt_stream_class *stream_class; stream_class = bt_event_class_borrow_stream_class_inline(event_class); - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); return bt_stream_class_borrow_trace_class(stream_class); } @@ -94,13 +94,13 @@ struct bt_message *create_event_message( struct bt_stream *stream = (void *) c_stream; struct bt_event *event; - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator"); BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); BT_ASSERT_PRE(event_class_has_trace(event_class), "Event class is not part of a trace: %!+E", event_class); stream_class = bt_event_class_borrow_stream_class_inline(event_class); - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); BT_ASSERT_PRE((with_cs && stream_class->default_clock_class) || (!with_cs && !stream_class->default_clock_class), "Creating an event message with a default clock snapshot, but without " @@ -141,7 +141,7 @@ struct bt_message *create_event_message( } if (with_cs) { - BT_ASSERT(stream_class->default_clock_class); + BT_ASSERT_DBG(stream_class->default_clock_class); message->default_cs = bt_clock_snapshot_create( stream_class->default_clock_class); if (!message->default_cs) { @@ -151,7 +151,7 @@ struct bt_message *create_event_message( bt_clock_snapshot_set_raw_value(message->default_cs, raw_value); } - BT_ASSERT(!message->event); + BT_ASSERT_DBG(!message->event); message->event = event; if (packet) { @@ -241,7 +241,7 @@ void bt_message_event_recycle(struct bt_message *msg) struct bt_message_event *event_msg = (void *) msg; struct bt_graph *graph; - BT_ASSERT(event_msg); + BT_ASSERT_DBG(event_msg); if (G_UNLIKELY(!msg->graph)) { bt_message_event_destroy(msg); @@ -251,7 +251,7 @@ void bt_message_event_recycle(struct bt_message *msg) BT_LIB_LOGD("Recycling event message: %![msg-]+n, %![event-]+e", msg, event_msg->event); bt_message_reset(msg); - BT_ASSERT(event_msg->event); + BT_ASSERT_DBG(event_msg->event); bt_event_recycle(event_msg->event); event_msg->event = NULL; @@ -300,7 +300,7 @@ bt_message_event_borrow_default_clock_snapshot_const( BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_EVENT); stream_class = bt_event_class_borrow_stream_class_inline( event_msg->event->class); - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); BT_ASSERT_PRE_DEV(stream_class->default_clock_class, "Message's stream's class has no default clock class: " "%![msg-]+n, %![sc-]+S", msg, stream_class); @@ -318,6 +318,6 @@ bt_message_event_borrow_stream_class_default_clock_class_const( BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_EVENT); stream_class = bt_event_class_borrow_stream_class_inline( event_msg->event->class); - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); return stream_class->default_clock_class; } diff --git a/src/lib/graph/message/message.h b/src/lib/graph/message/message.h index 4c997164..f290e3fd 100644 --- a/src/lib/graph/message/message.h +++ b/src/lib/graph/message/message.h @@ -82,7 +82,7 @@ void bt_message_init(struct bt_message *message, static inline void bt_message_reset(struct bt_message *message) { - BT_ASSERT(message); + BT_ASSERT_DBG(message); #ifdef BT_DEV_MODE message->frozen = BT_FALSE; diff --git a/src/lib/graph/message/packet.c b/src/lib/graph/message/packet.c index d8134e82..637156d3 100644 --- a/src/lib/graph/message/packet.c +++ b/src/lib/graph/message/packet.c @@ -318,7 +318,7 @@ borrow_packet_message_default_clock_snapshot_const( { struct bt_message_packet *packet_msg = (void *) message; - BT_ASSERT(message); + BT_ASSERT_DBG(message); BT_ASSERT_PRE_DEV( packet_msg->packet->stream->class->default_clock_class, "Message's stream's class has no default clock class: " @@ -352,7 +352,7 @@ borrow_packet_message_stream_class_default_clock_class( { struct bt_message_packet *packet_msg = (void *) msg; - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); return packet_msg->packet->stream->class->default_clock_class; } diff --git a/src/lib/graph/message/stream.c b/src/lib/graph/message/stream.c index 8ff1937e..a110338a 100644 --- a/src/lib/graph/message/stream.c +++ b/src/lib/graph/message/stream.c @@ -130,7 +130,7 @@ struct bt_stream *borrow_stream_message_stream(struct bt_message *message) { struct bt_message_stream *stream_msg; - BT_ASSERT(message); + BT_ASSERT_DBG(message); stream_msg = (void *) message; return stream_msg->stream; } @@ -213,13 +213,13 @@ bt_message_stream_borrow_default_clock_snapshot_const( struct bt_message_stream *stream_msg = (void *) msg; struct bt_stream_class *sc; - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); sc = stream_msg->stream->class; - BT_ASSERT(sc); + BT_ASSERT_DBG(sc); BT_ASSERT_PRE_DEV(sc->default_clock_class, "Message's stream's class has no default clock class: " "%![msg-]+n, %![sc-]+S", msg, sc); - BT_ASSERT(stream_msg->default_cs); + BT_ASSERT_DBG(stream_msg->default_cs); *snapshot = stream_msg->default_cs; @@ -254,7 +254,7 @@ borrow_stream_message_stream_class_default_clock_class( { struct bt_message_stream *stream_msg = (void *) msg; - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); return stream_msg->stream->class->default_clock_class; } diff --git a/src/lib/graph/port.h b/src/lib/graph/port.h index fe9a64ef..5ab27774 100644 --- a/src/lib/graph/port.h +++ b/src/lib/graph/port.h @@ -48,7 +48,7 @@ void bt_port_set_connection(struct bt_port *port, static inline struct bt_component *bt_port_borrow_component_inline(const struct bt_port *port) { - BT_ASSERT(port); + BT_ASSERT_DBG(port); return (void *) bt_object_borrow_parent(&port->base); } diff --git a/src/lib/integer-range-set.c b/src/lib/integer-range-set.c index a422e4e4..d919cf72 100644 --- a/src/lib/integer-range-set.c +++ b/src/lib/integer-range-set.c @@ -310,8 +310,8 @@ bool compare_range_sets(const struct bt_integer_range_set *range_set_a, uint64_t a_i, b_i; bool is_equal = true; - BT_ASSERT(range_set_a); - BT_ASSERT(range_set_b); + BT_ASSERT_DBG(range_set_a); + BT_ASSERT_DBG(range_set_b); if (range_set_a == range_set_b) { goto end; diff --git a/src/lib/object-pool.h b/src/lib/object-pool.h index 02118999..1c69b8c7 100644 --- a/src/lib/object-pool.h +++ b/src/lib/object-pool.h @@ -111,7 +111,7 @@ void *bt_object_pool_create_object(struct bt_object_pool *pool) { struct bt_object *obj; - BT_ASSERT(pool); + BT_ASSERT_DBG(pool); BT_LOGT("Creating object from pool: pool-addr=%p, pool-size=%zu, pool-cap=%u", pool, pool->size, pool->objects->len); @@ -144,8 +144,8 @@ void bt_object_pool_recycle_object(struct bt_object_pool *pool, void *obj) { struct bt_object *bt_obj = obj; - BT_ASSERT(pool); - BT_ASSERT(obj); + BT_ASSERT_DBG(pool); + BT_ASSERT_DBG(obj); BT_LOGT("Recycling object: pool-addr=%p, pool-size=%zu, pool-cap=%u, obj-addr=%p", pool, pool->size, pool->objects->len, obj); diff --git a/src/lib/object.h b/src/lib/object.h index 25240b20..9d584c1b 100644 --- a/src/lib/object.h +++ b/src/lib/object.h @@ -104,8 +104,8 @@ unsigned long long bt_object_get_ref_count(const struct bt_object *c_obj) { struct bt_object *obj = (void *) c_obj; - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); return obj->ref_count; } @@ -114,8 +114,8 @@ struct bt_object *bt_object_borrow_parent(const struct bt_object *c_obj) { struct bt_object *obj = (void *) c_obj; - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); return obj->parent; } @@ -135,8 +135,8 @@ struct bt_object *bt_object_get_parent(const struct bt_object *c_obj) static inline void bt_object_set_parent(struct bt_object *child, struct bt_object *parent) { - BT_ASSERT(child); - BT_ASSERT(child->is_shared); + BT_ASSERT_DBG(child); + BT_ASSERT_DBG(child->is_shared); #ifdef _BT_OBJECT_LOGGING_ENABLED BT_LOGT("Setting object's parent: addr=%p, parent-addr=%p", @@ -150,7 +150,7 @@ void bt_object_set_parent(struct bt_object *child, struct bt_object *parent) * object's reference count falls to zero. */ if (parent) { - BT_ASSERT(!child->parent); + BT_ASSERT_DBG(!child->parent); child->parent = parent; bt_object_get_ref_no_null_check(parent); } else { @@ -165,9 +165,9 @@ void bt_object_set_parent(struct bt_object *child, struct bt_object *parent) static inline void bt_object_try_spec_release(struct bt_object *obj) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); - BT_ASSERT(obj->spec_release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); + BT_ASSERT_DBG(obj->spec_release_func); if (bt_object_get_ref_count(obj) == 0) { obj->spec_release_func(obj); @@ -213,8 +213,8 @@ static inline void bt_object_init(struct bt_object *obj, bool is_shared, bt_object_release_func release_func) { - BT_ASSERT(obj); - BT_ASSERT(!is_shared || release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(!is_shared || release_func); obj->is_shared = is_shared; obj->release_func = release_func; obj->parent_is_owner_listener_func = NULL; @@ -240,8 +240,8 @@ static inline void bt_object_init_shared_with_parent(struct bt_object *obj, bt_object_release_func spec_release_func) { - BT_ASSERT(obj); - BT_ASSERT(spec_release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(spec_release_func); bt_object_init_shared(obj, bt_object_with_parent_release_func); obj->spec_release_func = spec_release_func; } @@ -250,9 +250,9 @@ static inline void bt_object_set_parent_is_owner_listener_func(struct bt_object *obj, bt_object_parent_is_owner_listener_func func) { - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); - BT_ASSERT(obj->spec_release_func); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); + BT_ASSERT_DBG(obj->spec_release_func); ((struct bt_object *) obj)->parent_is_owner_listener_func = func; } @@ -261,10 +261,10 @@ void bt_object_inc_ref_count(const struct bt_object *c_obj) { struct bt_object *obj = (void *) c_obj; - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); obj->ref_count++; - BT_ASSERT(obj->ref_count != 0); + BT_ASSERT_DBG(obj->ref_count != 0); } static inline @@ -272,8 +272,8 @@ void bt_object_get_ref_no_null_check_no_parent_check(const struct bt_object *c_o { struct bt_object *obj = (void *) c_obj; - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); #ifdef _BT_OBJECT_LOGGING_ENABLED BT_LOGT("Incrementing object's reference count: %llu -> %llu: " @@ -290,8 +290,8 @@ void bt_object_get_ref_no_null_check(const void *c_obj) { struct bt_object *obj = (void *) c_obj; - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); if (G_UNLIKELY(obj->parent && bt_object_get_ref_count(obj) == 0)) { #ifdef _BT_OBJECT_LOGGING_ENABLED @@ -317,9 +317,9 @@ void bt_object_put_ref_no_null_check(const void *c_obj) { struct bt_object *obj = (void *) c_obj; - BT_ASSERT(obj); - BT_ASSERT(obj->is_shared); - BT_ASSERT(obj->ref_count > 0); + BT_ASSERT_DBG(obj); + BT_ASSERT_DBG(obj->is_shared); + BT_ASSERT_DBG(obj->ref_count > 0); #ifdef _BT_OBJECT_LOGGING_ENABLED BT_LOGT("Decrementing object's reference count: %llu -> %llu: " @@ -331,7 +331,7 @@ void bt_object_put_ref_no_null_check(const void *c_obj) obj->ref_count--; if (obj->ref_count == 0) { - BT_ASSERT(obj->release_func); + BT_ASSERT_DBG(obj->release_func); obj->release_func(obj); } } diff --git a/src/lib/plugin/plugin.c b/src/lib/plugin/plugin.c index 193adcaf..aec5ed68 100644 --- a/src/lib/plugin/plugin.c +++ b/src/lib/plugin/plugin.c @@ -845,7 +845,7 @@ struct bt_component_class *borrow_component_class_by_name( const char *comp_class_cand_name = bt_component_class_get_name(comp_class_candidate); - BT_ASSERT(comp_class_cand_name); + BT_ASSERT_DBG(comp_class_cand_name); if (strcmp(name, comp_class_cand_name) == 0) { comp_class = comp_class_candidate; diff --git a/src/lib/prio-heap/prio-heap.c b/src/lib/prio-heap/prio-heap.c index 952b3b86..78b9802c 100644 --- a/src/lib/prio-heap/prio-heap.c +++ b/src/lib/prio-heap/prio-heap.c @@ -40,7 +40,7 @@ void check_heap(const struct ptr_heap *heap) return; for (i = 1; i < heap->len; i++) - BT_ASSERT(!heap->gt(heap->ptrs[i], heap->ptrs[0])); + BT_ASSERT_DBG(!heap->gt(heap->ptrs[i], heap->ptrs[0])); } #endif diff --git a/src/lib/trace-ir/attributes.c b/src/lib/trace-ir/attributes.c index f228569b..ce58e289 100644 --- a/src/lib/trace-ir/attributes.c +++ b/src/lib/trace-ir/attributes.c @@ -90,8 +90,8 @@ const char *bt_attributes_get_field_name(const struct bt_value *attr_obj, const struct bt_value *attr_field_obj = NULL; const struct bt_value *attr_field_name_obj = NULL; - BT_ASSERT(attr_obj); - BT_ASSERT(index < bt_value_array_get_length(attr_obj)); + BT_ASSERT_DBG(attr_obj); + BT_ASSERT_DBG(index < bt_value_array_get_length(attr_obj)); attr_field_obj = bt_value_array_borrow_element_by_index_const( attr_obj, index); if (!attr_field_obj) { @@ -125,8 +125,8 @@ struct bt_value *bt_attributes_borrow_field_value( struct bt_value *value_obj = NULL; struct bt_value *attr_field_obj = NULL; - BT_ASSERT(attr_obj); - BT_ASSERT(index < bt_value_array_get_length(attr_obj)); + BT_ASSERT_DBG(attr_obj); + BT_ASSERT_DBG(index < bt_value_array_get_length(attr_obj)); attr_field_obj = bt_value_array_borrow_element_by_index(attr_obj, index); if (!attr_field_obj) { @@ -263,8 +263,8 @@ struct bt_value *bt_attributes_borrow_field_value_by_name( struct bt_value *value_obj = NULL; struct bt_value *attr_field_obj = NULL; - BT_ASSERT(attr_obj); - BT_ASSERT(name); + BT_ASSERT_DBG(attr_obj); + BT_ASSERT_DBG(name); attr_field_obj = bt_attributes_borrow_field_by_name(attr_obj, name); if (!attr_field_obj) { BT_LOGD("Cannot find attributes object's field by name: " diff --git a/src/lib/trace-ir/clock-class.h b/src/lib/trace-ir/clock-class.h index b3eb14ff..639cf90e 100644 --- a/src/lib/trace-ir/clock-class.h +++ b/src/lib/trace-ir/clock-class.h @@ -114,8 +114,7 @@ int bt_clock_class_clock_value_from_ns_from_origin( struct bt_clock_class *cc, int64_t ns_from_origin, uint64_t *raw_value) { - BT_ASSERT(cc); - + BT_ASSERT_DBG(cc); return bt_common_clock_value_from_ns_from_origin(cc->offset_seconds, cc->offset_cycles, cc->frequency, ns_from_origin, raw_value) ? BT_FUNC_STATUS_OVERFLOW_ERROR : BT_FUNC_STATUS_OK; diff --git a/src/lib/trace-ir/clock-snapshot-set.h b/src/lib/trace-ir/clock-snapshot-set.h index ec790aff..7c3e7eb2 100644 --- a/src/lib/trace-ir/clock-snapshot-set.h +++ b/src/lib/trace-ir/clock-snapshot-set.h @@ -71,13 +71,13 @@ void bt_clock_snapshot_set_reset(struct bt_clock_snapshot_set *cs_set) { uint64_t i; - BT_ASSERT(cs_set); - BT_ASSERT(cs_set->clock_snapshots); + BT_ASSERT_DBG(cs_set); + BT_ASSERT_DBG(cs_set->clock_snapshots); for (i = 0; i < cs_set->clock_snapshots->len; i++) { struct bt_clock_snapshot *cs = cs_set->clock_snapshots->pdata[i]; - BT_ASSERT(cs); + BT_ASSERT_DBG(cs); bt_clock_snapshot_reset(cs); } @@ -114,8 +114,8 @@ int bt_clock_snapshot_set_set_clock_snapshot(struct bt_clock_snapshot_set *cs_se struct bt_clock_snapshot *clock_snapshot = NULL; uint64_t i; - BT_ASSERT(cs_set); - BT_ASSERT(cc); + BT_ASSERT_DBG(cs_set); + BT_ASSERT_DBG(cc); /* * Check if we already have a value for this clock class. @@ -126,7 +126,7 @@ int bt_clock_snapshot_set_set_clock_snapshot(struct bt_clock_snapshot_set *cs_se for (i = 0; i < cs_set->clock_snapshots->len; i++) { struct bt_clock_snapshot *cs = cs_set->clock_snapshots->pdata[i]; - BT_ASSERT(cs); + BT_ASSERT_DBG(cs); if (cs->clock_class == cc) { clock_snapshot = cs; @@ -157,8 +157,8 @@ static inline void bt_clock_snapshot_set_set_default_clock_snapshot( struct bt_clock_snapshot_set *cs_set, uint64_t raw_value) { - BT_ASSERT(cs_set); - BT_ASSERT(cs_set->default_cs); + BT_ASSERT_DBG(cs_set); + BT_ASSERT_DBG(cs_set->default_cs); bt_clock_snapshot_set_raw_value(cs_set->default_cs, raw_value); } diff --git a/src/lib/trace-ir/clock-snapshot.c b/src/lib/trace-ir/clock-snapshot.c index 27623326..cbce39c1 100644 --- a/src/lib/trace-ir/clock-snapshot.c +++ b/src/lib/trace-ir/clock-snapshot.c @@ -77,7 +77,7 @@ struct bt_clock_snapshot *bt_clock_snapshot_create( { struct bt_clock_snapshot *clock_snapshot = NULL; - BT_ASSERT(clock_class); + BT_ASSERT_DBG(clock_class); clock_snapshot = bt_object_pool_create_object(&clock_class->cs_pool); if (!clock_snapshot) { BT_LIB_LOGE_APPEND_CAUSE( @@ -100,7 +100,7 @@ void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot) { struct bt_clock_class *clock_class; - BT_ASSERT(clock_snapshot); + BT_ASSERT_DBG(clock_snapshot); BT_LIB_LOGD("Recycling clock snapshot: %!+k", clock_snapshot); /* @@ -127,7 +127,7 @@ void bt_clock_snapshot_recycle(struct bt_clock_snapshot *clock_snapshot) */ bt_clock_snapshot_reset(clock_snapshot); clock_class = clock_snapshot->clock_class; - BT_ASSERT(clock_class); + BT_ASSERT_DBG(clock_class); clock_snapshot->clock_class = NULL; bt_object_pool_recycle_object(&clock_class->cs_pool, clock_snapshot); bt_object_put_ref(clock_class); diff --git a/src/lib/trace-ir/clock-snapshot.h b/src/lib/trace-ir/clock-snapshot.h index 20831baf..c4e7afd4 100644 --- a/src/lib/trace-ir/clock-snapshot.h +++ b/src/lib/trace-ir/clock-snapshot.h @@ -45,14 +45,14 @@ struct bt_clock_snapshot { static inline void bt_clock_snapshot_set(struct bt_clock_snapshot *clock_snapshot) { - BT_ASSERT(clock_snapshot); + BT_ASSERT_DBG(clock_snapshot); clock_snapshot->is_set = true; } static inline void bt_clock_snapshot_reset(struct bt_clock_snapshot *clock_snapshot) { - BT_ASSERT(clock_snapshot); + BT_ASSERT_DBG(clock_snapshot); clock_snapshot->is_set = false; } @@ -70,7 +70,7 @@ static inline void bt_clock_snapshot_set_raw_value(struct bt_clock_snapshot *clock_snapshot, uint64_t cycles) { - BT_ASSERT(clock_snapshot); + BT_ASSERT_DBG(clock_snapshot); clock_snapshot->value_cycles = cycles; set_ns_from_origin(clock_snapshot); bt_clock_snapshot_set(clock_snapshot); diff --git a/src/lib/trace-ir/event-class.h b/src/lib/trace-ir/event-class.h index 83734eed..1b9bfea3 100644 --- a/src/lib/trace-ir/event-class.h +++ b/src/lib/trace-ir/event-class.h @@ -85,7 +85,7 @@ static inline struct bt_stream_class *bt_event_class_borrow_stream_class_inline( const struct bt_event_class *event_class) { - BT_ASSERT(event_class); + BT_ASSERT_DBG(event_class); return (void *) bt_object_borrow_parent(&event_class->base); } diff --git a/src/lib/trace-ir/event.c b/src/lib/trace-ir/event.c index fe1489bb..9bf115c9 100644 --- a/src/lib/trace-ir/event.c +++ b/src/lib/trace-ir/event.c @@ -49,7 +49,7 @@ BT_HIDDEN void _bt_event_set_is_frozen(const struct bt_event *event, bool is_frozen) { - BT_ASSERT(event); + BT_ASSERT_DBG(event); BT_LIB_LOGD("Setting event's frozen state: %!+e, is-frozen=%d", event, is_frozen); diff --git a/src/lib/trace-ir/event.h b/src/lib/trace-ir/event.h index 55cdd007..75847528 100644 --- a/src/lib/trace-ir/event.h +++ b/src/lib/trace-ir/event.h @@ -87,7 +87,7 @@ __attribute__((unused)) static inline void _bt_event_reset_dev_mode(struct bt_event *event) { - BT_ASSERT(event); + BT_ASSERT_DBG(event); if (event->common_context_field) { bt_field_set_is_frozen( @@ -118,7 +118,7 @@ void _bt_event_reset_dev_mode(struct bt_event *event) static inline void bt_event_reset(struct bt_event *event) { - BT_ASSERT(event); + BT_ASSERT_DBG(event); BT_LIB_LOGD("Resetting event: %!+e", event); bt_event_set_is_frozen(event, false); bt_object_put_ref_no_null_check(&event->stream->base); @@ -135,7 +135,7 @@ void bt_event_recycle(struct bt_event *event) { struct bt_event_class *event_class; - BT_ASSERT(event); + BT_ASSERT_DBG(event); BT_LIB_LOGD("Recycling event: %!+e", event); /* @@ -162,7 +162,7 @@ void bt_event_recycle(struct bt_event *event) */ bt_event_reset(event); event_class = event->class; - BT_ASSERT(event_class); + BT_ASSERT_DBG(event_class); event->class = NULL; bt_object_pool_recycle_object(&event_class->event_pool, event); bt_object_put_ref_no_null_check(&event_class->base); @@ -178,8 +178,8 @@ void bt_event_set_packet(struct bt_event *event, struct bt_packet *packet) event->class) == packet->stream->class, "Packet's stream class and event's stream class differ: " "%![event-]+e, %![packet-]+a", event, packet); - BT_ASSERT(event->stream->class->supports_packets); - BT_ASSERT(!event->packet); + BT_ASSERT_DBG(event->stream->class->supports_packets); + BT_ASSERT_DBG(!event->packet); event->packet = packet; bt_object_get_ref_no_null_check_no_parent_check(&event->packet->base); BT_LIB_LOGD("Set event's packet: %![event-]+e, %![packet-]+a", @@ -196,7 +196,7 @@ void bt_event_set_stream(struct bt_event *event, struct bt_stream *stream) event->class) == stream->class, "Stream's class and event's stream class differ: " "%![event-]+e, %![stream-]+s", event, stream); - BT_ASSERT(!event->stream); + BT_ASSERT_DBG(!event->stream); event->stream = stream; bt_object_get_ref_no_null_check_no_parent_check(&event->stream->base); BT_LIB_LOGD("Set event's stream: %![event-]+e, %![stream-]+s", @@ -209,8 +209,8 @@ struct bt_event *bt_event_create(struct bt_event_class *event_class, { struct bt_event *event = NULL; - BT_ASSERT(event_class); - BT_ASSERT(stream); + BT_ASSERT_DBG(event_class); + BT_ASSERT_DBG(stream); event = bt_object_pool_create_object(&event_class->event_pool); if (G_UNLIKELY(!event)) { BT_LIB_LOGE_APPEND_CAUSE( @@ -227,7 +227,7 @@ struct bt_event *bt_event_create(struct bt_event_class *event_class, bt_event_set_stream(event, stream); if (packet) { - BT_ASSERT(packet); + BT_ASSERT_DBG(packet); bt_event_set_packet(event, packet); } diff --git a/src/lib/trace-ir/field-class.c b/src/lib/trace-ir/field-class.c index ee1037cb..84b2b8d5 100644 --- a/src/lib/trace-ir/field-class.c +++ b/src/lib/trace-ir/field-class.c @@ -454,7 +454,7 @@ borrow_enumeration_field_class_mapping_by_label( struct bt_field_class_enumeration_mapping *mapping = NULL; uint64_t i; - BT_ASSERT(fc); + BT_ASSERT_DBG(fc); BT_ASSERT_PRE_DEV_NON_NULL(label, "Label"); for (i = 0; i < fc->mappings->len; i++) { @@ -1038,7 +1038,7 @@ borrow_named_field_class_from_container_field_class_at_index( struct bt_field_class_named_field_class_container *fc, uint64_t index) { - BT_ASSERT(fc); + BT_ASSERT_DBG(fc); BT_ASSERT_PRE_DEV_VALID_INDEX(index, fc->named_fcs->len); return fc->named_fcs->pdata[index]; } @@ -1077,7 +1077,7 @@ borrow_named_field_class_from_container_field_class_by_name( gpointer orig_key; gpointer value; - BT_ASSERT(fc); + BT_ASSERT_DBG(fc); BT_ASSERT_PRE_DEV_NON_NULL(name, "Name"); if (!g_hash_table_lookup_extended(fc->name_to_index, name, &orig_key, &value)) { diff --git a/src/lib/trace-ir/field-path.h b/src/lib/trace-ir/field-path.h index df293162..99c8f958 100644 --- a/src/lib/trace-ir/field-path.h +++ b/src/lib/trace-ir/field-path.h @@ -52,8 +52,8 @@ static inline struct bt_field_path_item *bt_field_path_borrow_item_by_index_inline( const struct bt_field_path *field_path, uint64_t index) { - BT_ASSERT(field_path); - BT_ASSERT(index < field_path->items->len); + BT_ASSERT_DBG(field_path); + BT_ASSERT_DBG(index < field_path->items->len); return &g_array_index(field_path->items, struct bt_field_path_item, index); } diff --git a/src/lib/trace-ir/field-wrapper.c b/src/lib/trace-ir/field-wrapper.c index 81854c16..a570a2a3 100644 --- a/src/lib/trace-ir/field-wrapper.c +++ b/src/lib/trace-ir/field-wrapper.c @@ -73,8 +73,8 @@ struct bt_field_wrapper *bt_field_wrapper_create( { struct bt_field_wrapper *field_wrapper = NULL; - BT_ASSERT(pool); - BT_ASSERT(fc); + BT_ASSERT_DBG(pool); + BT_ASSERT_DBG(fc); field_wrapper = bt_object_pool_create_object(pool); if (!field_wrapper) { BT_LIB_LOGE_APPEND_CAUSE( diff --git a/src/lib/trace-ir/field.c b/src/lib/trace-ir/field.c index 0b8529b2..8177c171 100644 --- a/src/lib/trace-ir/field.c +++ b/src/lib/trace-ir/field.c @@ -853,7 +853,7 @@ void clear_string_field(struct bt_field *field) { struct bt_field_string *string_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); string_field->length = 0; bt_field_set_single(field, true); } @@ -961,7 +961,7 @@ enum bt_field_array_dynamic_set_length_status bt_field_array_dynamic_set_length( goto end; } - BT_ASSERT(!array_field->fields->pdata[i]); + BT_ASSERT_DBG(!array_field->fields->pdata[i]); array_field->fields->pdata[i] = elem_field; } } @@ -1047,7 +1047,7 @@ struct bt_field *borrow_structure_field_member_field_by_name( } ret_field = struct_field->fields->pdata[GPOINTER_TO_UINT(index)]; - BT_ASSERT(ret_field); + BT_ASSERT_DBG(ret_field); end: return ret_field; @@ -1128,7 +1128,7 @@ borrow_variant_field_selected_class_option(const struct bt_field *field) const struct bt_field_class_named_field_class_container *container_fc; const struct bt_field_variant *var_field = (const void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_ASSERT_PRE_DEV(var_field->selected_field, "Variant field has no selected field: %!+f", field); container_fc = (const void *) field->class; @@ -1371,7 +1371,7 @@ void bt_field_destroy(struct bt_field *field) static void reset_single_field(struct bt_field *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); field->is_set = false; } @@ -1381,7 +1381,7 @@ void reset_structure_field(struct bt_field *field) uint64_t i; struct bt_field_structure *struct_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < struct_field->fields->len; i++) { bt_field_reset(struct_field->fields->pdata[i]); @@ -1393,7 +1393,7 @@ void reset_option_field(struct bt_field *field) { struct bt_field_option *opt_field = (void *) field; - BT_ASSERT(opt_field); + BT_ASSERT_DBG(opt_field); bt_field_reset(opt_field->content_field); opt_field->selected_field = NULL; } @@ -1404,7 +1404,7 @@ void reset_variant_field(struct bt_field *field) uint64_t i; struct bt_field_variant *var_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < var_field->fields->len; i++) { bt_field_reset(var_field->fields->pdata[i]); @@ -1417,7 +1417,7 @@ void reset_array_field(struct bt_field *field) uint64_t i; struct bt_field_array *array_field = (void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < array_field->fields->len; i++) { bt_field_reset(array_field->fields->pdata[i]); @@ -1508,17 +1508,17 @@ BT_HIDDEN void _bt_field_set_is_frozen(const struct bt_field *field, bool is_frozen) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); BT_LIB_LOGD("Setting field object's frozen state: %!+f, is-frozen=%d", field, is_frozen); - BT_ASSERT(field->methods->set_is_frozen); + BT_ASSERT_DBG(field->methods->set_is_frozen); field->methods->set_is_frozen((void *) field, is_frozen); } static bool single_field_is_set(const struct bt_field *field) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); return field->is_set; } @@ -1529,7 +1529,7 @@ bool structure_field_is_set(const struct bt_field *field) uint64_t i; const struct bt_field_structure *struct_field = (const void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < struct_field->fields->len; i++) { is_set = bt_field_is_set(struct_field->fields->pdata[i]); @@ -1548,7 +1548,7 @@ bool option_field_is_set(const struct bt_field *field) const struct bt_field_option *opt_field = (const void *) field; bool is_set = false; - BT_ASSERT(field); + BT_ASSERT_DBG(field); if (opt_field->selected_field) { is_set = bt_field_is_set(opt_field->selected_field); @@ -1563,7 +1563,7 @@ bool variant_field_is_set(const struct bt_field *field) const struct bt_field_variant *var_field = (const void *) field; bool is_set = false; - BT_ASSERT(field); + BT_ASSERT_DBG(field); if (var_field->selected_field) { is_set = bt_field_is_set(var_field->selected_field); @@ -1579,7 +1579,7 @@ bool array_field_is_set(const struct bt_field *field) uint64_t i; const struct bt_field_array *array_field = (const void *) field; - BT_ASSERT(field); + BT_ASSERT_DBG(field); for (i = 0; i < array_field->length; i++) { is_set = bt_field_is_set(array_field->fields->pdata[i]); diff --git a/src/lib/trace-ir/field.h b/src/lib/trace-ir/field.h index 273d55d3..e56f0d2f 100644 --- a/src/lib/trace-ir/field.h +++ b/src/lib/trace-ir/field.h @@ -208,15 +208,15 @@ void _bt_field_set_is_frozen(const struct bt_field *field, bool is_frozen); static inline void _bt_field_reset(const struct bt_field *field) { - BT_ASSERT(field); - BT_ASSERT(field->methods->reset); + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(field->methods->reset); field->methods->reset((void *) field); } static inline void _bt_field_set_single(struct bt_field *field, bool value) { - BT_ASSERT(field); + BT_ASSERT_DBG(field); field->is_set = value; } @@ -229,7 +229,7 @@ bt_bool _bt_field_is_set(const struct bt_field *field) goto end; } - BT_ASSERT(field->methods->is_set); + BT_ASSERT_DBG(field->methods->is_set); is_set = field->methods->is_set(field); end: diff --git a/src/lib/trace-ir/stream-class.h b/src/lib/trace-ir/stream-class.h index 60bd5719..40a008ee 100644 --- a/src/lib/trace-ir/stream-class.h +++ b/src/lib/trace-ir/stream-class.h @@ -85,7 +85,7 @@ static inline struct bt_trace_class *bt_stream_class_borrow_trace_class_inline( const struct bt_stream_class *stream_class) { - BT_ASSERT(stream_class); + BT_ASSERT_DBG(stream_class); return (void *) bt_object_borrow_parent(&stream_class->base); } diff --git a/src/lib/trace-ir/stream.h b/src/lib/trace-ir/stream.h index 23f69c27..e0660efd 100644 --- a/src/lib/trace-ir/stream.h +++ b/src/lib/trace-ir/stream.h @@ -71,7 +71,7 @@ void _bt_stream_freeze(const struct bt_stream *stream); static inline struct bt_trace *bt_stream_borrow_trace_inline(const struct bt_stream *stream) { - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); return (void *) bt_object_borrow_parent(&stream->base); } diff --git a/src/lib/trace-ir/trace.c b/src/lib/trace-ir/trace.c index 184fc070..1536feaf 100644 --- a/src/lib/trace-ir/trace.c +++ b/src/lib/trace-ir/trace.c @@ -242,7 +242,6 @@ void bt_trace_set_uuid(struct bt_trace *trace, bt_uuid uuid) BT_LIB_LOGD("Set trace's UUID: %!+t", trace); } -BT_ASSERT_FUNC static bool trace_has_environment_entry(const struct bt_trace *trace, const char *name) { diff --git a/src/lib/trace-ir/utils.h b/src/lib/trace-ir/utils.h index a50fe55f..003655c3 100644 --- a/src/lib/trace-ir/utils.h +++ b/src/lib/trace-ir/utils.h @@ -62,7 +62,7 @@ bool bt_util_get_base_offset_ns(int64_t offset_seconds, uint64_t offset_cycles, bool overflows = false; uint64_t offset_cycles_ns; - BT_ASSERT(base_offset_ns); + BT_ASSERT_DBG(base_offset_ns); /* Initialize nanosecond timestamp to clock's offset in seconds */ if (offset_seconds <= (INT64_MIN / INT64_C(1000000000) - 1) || @@ -82,10 +82,10 @@ bool bt_util_get_base_offset_ns(int64_t offset_seconds, uint64_t offset_cycles, *base_offset_ns = offset_seconds * INT64_C(1000000000); /* Add offset in cycles */ - BT_ASSERT(offset_cycles < frequency); + BT_ASSERT_DBG(offset_cycles < frequency); offset_cycles_ns = bt_util_ns_from_value(frequency, offset_cycles); - BT_ASSERT(offset_cycles_ns < 1000000000); + BT_ASSERT_DBG(offset_cycles_ns < 1000000000); *base_offset_ns += (int64_t) offset_cycles_ns; end: @@ -120,7 +120,7 @@ int bt_util_ns_from_origin_inline(int64_t base_offset_ns, } value_ns_signed = (int64_t) value_ns_unsigned; - BT_ASSERT(value_ns_signed >= 0); + BT_ASSERT_DBG(value_ns_signed >= 0); if (*ns_from_origin <= 0) { goto add_value; diff --git a/src/plugins/ctf/common/bfcr/bfcr.c b/src/plugins/ctf/common/bfcr/bfcr.c index 89e83ca4..99245571 100644 --- a/src/plugins/ctf/common/bfcr/bfcr.c +++ b/src/plugins/ctf/common/bfcr/bfcr.c @@ -240,8 +240,8 @@ int stack_push(struct stack *stack, struct ctf_field_class *base_class, struct stack_entry *entry; struct bt_bfcr *bfcr; - BT_ASSERT(stack); - BT_ASSERT(base_class); + BT_ASSERT_DBG(stack); + BT_ASSERT_DBG(base_class); bfcr = stack->bfcr; BT_COMP_LOGT("Pushing field class on stack: stack-addr=%p, " "fc-addr=%p, fc-type=%d, base-length=%zu, " @@ -322,7 +322,7 @@ end: static inline unsigned int stack_size(struct stack *stack) { - BT_ASSERT(stack); + BT_ASSERT_DBG(stack); return stack->size; } @@ -331,8 +331,8 @@ void stack_pop(struct stack *stack) { struct bt_bfcr *bfcr; - BT_ASSERT(stack); - BT_ASSERT(stack_size(stack)); + BT_ASSERT_DBG(stack); + BT_ASSERT_DBG(stack_size(stack)); bfcr = stack->bfcr; BT_COMP_LOGT("Popping from stack: " "stack-addr=%p, stack-size-before=%u, stack-size-after=%u", @@ -349,15 +349,15 @@ bool stack_empty(struct stack *stack) static void stack_clear(struct stack *stack) { - BT_ASSERT(stack); + BT_ASSERT_DBG(stack); stack->size = 0; } static inline struct stack_entry *stack_top(struct stack *stack) { - BT_ASSERT(stack); - BT_ASSERT(stack_size(stack)); + BT_ASSERT_DBG(stack); + BT_ASSERT_DBG(stack_size(stack)); return &g_array_index(stack->entries, struct stack_entry, stack->size - 1); } @@ -562,7 +562,7 @@ enum bt_bfcr_status read_basic_float_and_call_cb(struct bt_bfcr *bfcr, enum bt_bfcr_status status = BT_BFCR_STATUS_OK; struct ctf_field_class_float *fc = (void *) bfcr->cur_basic_field_class; - BT_ASSERT(fc); + BT_ASSERT_DBG(fc); field_size = fc->base.size; bo = fc->base.byte_order; bfcr->cur_bo = bo; @@ -754,7 +754,7 @@ enum bt_bfcr_status read_bit_array_class_and_call_begin(struct bt_bfcr *bfcr, if (fc->size <= available) { /* We have all the bits; decode and set now */ - BT_ASSERT(bfcr->buf.addr); + BT_ASSERT_DBG(bfcr->buf.addr); status = read_basic_and_call_cb(bfcr, bfcr->buf.addr, buf_at_from_addr(bfcr)); if (status != BT_BFCR_STATUS_OK) { @@ -837,10 +837,10 @@ enum bt_bfcr_status read_basic_string_class_and_call( goto end; } - BT_ASSERT(buf_at_from_addr(bfcr) % 8 == 0); + BT_ASSERT_DBG(buf_at_from_addr(bfcr) % 8 == 0); available_bytes = BITS_TO_BYTES_FLOOR(available_bits(bfcr)); buf_at_bytes = BITS_TO_BYTES_FLOOR(buf_at_from_addr(bfcr)); - BT_ASSERT(bfcr->buf.addr); + BT_ASSERT_DBG(bfcr->buf.addr); first_chr = &bfcr->buf.addr[buf_at_bytes]; result = memchr(first_chr, '\0', available_bytes); @@ -934,7 +934,7 @@ enum bt_bfcr_status read_basic_begin_state(struct bt_bfcr *bfcr) { enum bt_bfcr_status status; - BT_ASSERT(bfcr->cur_basic_field_class); + BT_ASSERT_DBG(bfcr->cur_basic_field_class); switch (bfcr->cur_basic_field_class->type) { case CTF_FIELD_CLASS_TYPE_INT: @@ -959,7 +959,7 @@ enum bt_bfcr_status read_basic_continue_state(struct bt_bfcr *bfcr) { enum bt_bfcr_status status; - BT_ASSERT(bfcr->cur_basic_field_class); + BT_ASSERT_DBG(bfcr->cur_basic_field_class); switch (bfcr->cur_basic_field_class->type) { case CTF_FIELD_CLASS_TYPE_INT: @@ -1003,7 +1003,7 @@ enum bt_bfcr_status align_class_state(struct bt_bfcr *bfcr, * 0 means "undefined" for variants; what we really want is 1 * (always aligned) */ - BT_ASSERT(field_alignment >= 1); + BT_ASSERT_DBG(field_alignment >= 1); /* Compute how many bits we need to skip */ skip_bits = bits_to_skip_to_align_to(bfcr, (size_t) field_alignment); @@ -1260,8 +1260,8 @@ size_t bt_bfcr_start(struct bt_bfcr *bfcr, size_t offset, size_t packet_offset, size_t sz, enum bt_bfcr_status *status) { - BT_ASSERT(bfcr); - BT_ASSERT(BYTES_TO_BITS(sz) >= offset); + BT_ASSERT_DBG(bfcr); + BT_ASSERT_DBG(BYTES_TO_BITS(sz) >= offset); reset(bfcr); bfcr->buf.addr = buf; bfcr->buf.offset = offset; @@ -1330,9 +1330,9 @@ BT_HIDDEN size_t bt_bfcr_continue(struct bt_bfcr *bfcr, const uint8_t *buf, size_t sz, enum bt_bfcr_status *status) { - BT_ASSERT(bfcr); - BT_ASSERT(buf); - BT_ASSERT(sz > 0); + BT_ASSERT_DBG(bfcr); + BT_ASSERT_DBG(buf); + BT_ASSERT_DBG(sz > 0); bfcr->buf.addr = buf; bfcr->buf.offset = 0; bfcr->buf.at = 0; @@ -1363,7 +1363,7 @@ BT_HIDDEN void bt_bfcr_set_unsigned_int_cb(struct bt_bfcr *bfcr, bt_bfcr_unsigned_int_cb_func cb) { - BT_ASSERT(bfcr); - BT_ASSERT(cb); + BT_ASSERT_DBG(bfcr); + BT_ASSERT_DBG(cb); bfcr->user.cbs.classes.unsigned_int = cb; } diff --git a/src/plugins/ctf/common/metadata/ctf-meta.h b/src/plugins/ctf/common/metadata/ctf-meta.h index 823b53ef..929a39e1 100644 --- a/src/plugins/ctf/common/metadata/ctf-meta.h +++ b/src/plugins/ctf/common/metadata/ctf-meta.h @@ -691,8 +691,8 @@ static inline struct ctf_range *ctf_field_class_enum_mapping_borrow_range_by_index( struct ctf_field_class_enum_mapping *mapping, uint64_t index) { - BT_ASSERT(mapping); - BT_ASSERT(index < mapping->ranges->len); + BT_ASSERT_DBG(mapping); + BT_ASSERT_DBG(index < mapping->ranges->len); return &g_array_index(mapping->ranges, struct ctf_range, index); } @@ -700,8 +700,8 @@ static inline struct ctf_field_class_enum_mapping *ctf_field_class_enum_borrow_mapping_by_index( struct ctf_field_class_enum *fc, uint64_t index) { - BT_ASSERT(fc); - BT_ASSERT(index < fc->mappings->len); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(index < fc->mappings->len); return &g_array_index(fc->mappings, struct ctf_field_class_enum_mapping, index); } @@ -713,8 +713,8 @@ struct ctf_field_class_enum_mapping *ctf_field_class_enum_borrow_mapping_by_labe struct ctf_field_class_enum_mapping *ret_mapping = NULL; uint64_t i; - BT_ASSERT(fc); - BT_ASSERT(label); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(label); for (i = 0; i < fc->mappings->len; i++) { struct ctf_field_class_enum_mapping *mapping = @@ -772,8 +772,8 @@ static inline struct ctf_named_field_class *ctf_field_class_struct_borrow_member_by_index( struct ctf_field_class_struct *fc, uint64_t index) { - BT_ASSERT(fc); - BT_ASSERT(index < fc->members->len); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(index < fc->members->len); return &g_array_index(fc->members, struct ctf_named_field_class, index); } @@ -785,8 +785,8 @@ struct ctf_named_field_class *ctf_field_class_struct_borrow_member_by_name( uint64_t i; struct ctf_named_field_class *ret_named_fc = NULL; - BT_ASSERT(fc); - BT_ASSERT(name); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(name); for (i = 0; i < fc->members->len; i++) { struct ctf_named_field_class *named_fc = @@ -887,8 +887,8 @@ static inline struct ctf_named_field_class *ctf_field_class_variant_borrow_option_by_index( struct ctf_field_class_variant *fc, uint64_t index) { - BT_ASSERT(fc); - BT_ASSERT(index < fc->options->len); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(index < fc->options->len); return &g_array_index(fc->options, struct ctf_named_field_class, index); } @@ -900,8 +900,8 @@ struct ctf_named_field_class *ctf_field_class_variant_borrow_option_by_name( uint64_t i; struct ctf_named_field_class *ret_named_fc = NULL; - BT_ASSERT(fc); - BT_ASSERT(name); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(name); for (i = 0; i < fc->options->len; i++) { struct ctf_named_field_class *named_fc = @@ -922,8 +922,8 @@ struct ctf_field_class_variant_range * ctf_field_class_variant_borrow_range_by_index( struct ctf_field_class_variant *fc, uint64_t index) { - BT_ASSERT(fc); - BT_ASSERT(index < fc->ranges->len); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(index < fc->ranges->len); return &g_array_index(fc->ranges, struct ctf_field_class_variant_range, index); } @@ -997,7 +997,7 @@ struct ctf_field_class *ctf_field_class_compound_borrow_field_class_by_index( ctf_field_class_struct_borrow_member_by_index( (void *) comp_fc, index); - BT_ASSERT(named_fc); + BT_ASSERT_DBG(named_fc); fc = named_fc->fc; break; } @@ -1007,7 +1007,7 @@ struct ctf_field_class *ctf_field_class_compound_borrow_field_class_by_index( ctf_field_class_variant_borrow_option_by_index( (void *) comp_fc, index); - BT_ASSERT(named_fc); + BT_ASSERT_DBG(named_fc); fc = named_fc->fc; break; } @@ -1122,8 +1122,8 @@ static inline int64_t ctf_field_path_borrow_index_by_index(struct ctf_field_path *fp, uint64_t index) { - BT_ASSERT(fp); - BT_ASSERT(index < fp->path->len); + BT_ASSERT_DBG(fp); + BT_ASSERT_DBG(index < fp->path->len); return g_array_index(fp->path, int64_t, index); } @@ -1213,7 +1213,7 @@ struct ctf_field_class *ctf_field_path_borrow_field_class( abort(); } - BT_ASSERT(fc); + BT_ASSERT_DBG(fc); for (i = 0; i < field_path->path->len; i++) { int64_t child_index = @@ -1221,11 +1221,11 @@ struct ctf_field_class *ctf_field_path_borrow_field_class( struct ctf_field_class *child_fc = ctf_field_class_compound_borrow_field_class_by_index( fc, child_index); - BT_ASSERT(child_fc); + BT_ASSERT_DBG(child_fc); fc = child_fc; } - BT_ASSERT(fc); + BT_ASSERT_DBG(fc); return fc; } @@ -1576,7 +1576,7 @@ static inline struct ctf_event_class *ctf_stream_class_borrow_event_class_by_id( struct ctf_stream_class *sc, uint64_t type) { - BT_ASSERT(sc); + BT_ASSERT_DBG(sc); return g_hash_table_lookup(sc->event_classes_by_id, GUINT_TO_POINTER((guint) type)); } @@ -1720,7 +1720,7 @@ struct ctf_stream_class *ctf_trace_class_borrow_stream_class_by_id( uint64_t i; struct ctf_stream_class *ret_sc = NULL; - BT_ASSERT(tc); + BT_ASSERT_DBG(tc); for (i = 0; i < tc->stream_classes->len; i++) { struct ctf_stream_class *sc = tc->stream_classes->pdata[i]; @@ -1742,13 +1742,13 @@ struct ctf_clock_class *ctf_trace_class_borrow_clock_class_by_name( uint64_t i; struct ctf_clock_class *ret_cc = NULL; - BT_ASSERT(tc); - BT_ASSERT(name); + BT_ASSERT_DBG(tc); + BT_ASSERT_DBG(name); for (i = 0; i < tc->clock_classes->len; i++) { struct ctf_clock_class *cc = tc->clock_classes->pdata[i]; - BT_ASSERT(cc->name); + BT_ASSERT_DBG(cc->name); if (strcmp(cc->name->str, name) == 0) { ret_cc = cc; goto end; @@ -1763,8 +1763,8 @@ static inline struct ctf_trace_class_env_entry *ctf_trace_class_borrow_env_entry_by_index( struct ctf_trace_class *tc, uint64_t index) { - BT_ASSERT(tc); - BT_ASSERT(index < tc->env_entries->len); + BT_ASSERT_DBG(tc); + BT_ASSERT_DBG(index < tc->env_entries->len); return &g_array_index(tc->env_entries, struct ctf_trace_class_env_entry, index); } @@ -1776,8 +1776,8 @@ struct ctf_trace_class_env_entry *ctf_trace_class_borrow_env_entry_by_name( struct ctf_trace_class_env_entry *ret_entry = NULL; uint64_t i; - BT_ASSERT(tc); - BT_ASSERT(name); + BT_ASSERT_DBG(tc); + BT_ASSERT_DBG(name); for (i = 0; i < tc->env_entries->len; i++) { struct ctf_trace_class_env_entry *env_entry = diff --git a/src/plugins/ctf/common/metadata/decoder.c b/src/plugins/ctf/common/metadata/decoder.c index 7407ad33..cfa8ec17 100644 --- a/src/plugins/ctf/common/metadata/decoder.c +++ b/src/plugins/ctf/common/metadata/decoder.c @@ -359,8 +359,8 @@ BT_HIDDEN bt_trace_class *ctf_metadata_decoder_get_ir_trace_class( struct ctf_metadata_decoder *mdec) { - BT_ASSERT(mdec); - BT_ASSERT(mdec->config.create_trace_class); + BT_ASSERT_DBG(mdec); + BT_ASSERT_DBG(mdec->config.create_trace_class); return ctf_visitor_generate_ir_get_ir_trace_class(mdec->visitor); } @@ -368,23 +368,23 @@ BT_HIDDEN struct ctf_trace_class *ctf_metadata_decoder_borrow_ctf_trace_class( struct ctf_metadata_decoder *mdec) { - BT_ASSERT(mdec); - BT_ASSERT(mdec->config.create_trace_class); + BT_ASSERT_DBG(mdec); + BT_ASSERT_DBG(mdec->config.create_trace_class); return ctf_visitor_generate_ir_borrow_ctf_trace_class(mdec->visitor); } BT_HIDDEN const char *ctf_metadata_decoder_get_text(struct ctf_metadata_decoder *mdec) { - BT_ASSERT(mdec); - BT_ASSERT(mdec->config.keep_plain_text); + BT_ASSERT_DBG(mdec); + BT_ASSERT_DBG(mdec->config.keep_plain_text); return mdec->text->str; } BT_HIDDEN int ctf_metadata_decoder_get_byte_order(struct ctf_metadata_decoder *mdec) { - BT_ASSERT(mdec); + BT_ASSERT_DBG(mdec); return mdec->bo; } @@ -394,7 +394,7 @@ int ctf_metadata_decoder_get_uuid(struct ctf_metadata_decoder *mdec, { int ret = 0; - BT_ASSERT(mdec); + BT_ASSERT_DBG(mdec); if (!mdec->is_uuid_set) { ret = -1; diff --git a/src/plugins/ctf/common/metadata/parser.y b/src/plugins/ctf/common/metadata/parser.y index ae5a9f98..ef89fcf8 100644 --- a/src/plugins/ctf/common/metadata/parser.y +++ b/src/plugins/ctf/common/metadata/parser.y @@ -165,7 +165,7 @@ int parse_base_sequence(const char *src, size_t len, size_t pos, return -1; } } - BT_ASSERT(nr_char > 0); + BT_ASSERT_DBG(nr_char > 0); buffer[nr_char] = '\0'; *buf_len = nr_char; return 0; diff --git a/src/plugins/ctf/common/metadata/visitor-generate-ir.c b/src/plugins/ctf/common/metadata/visitor-generate-ir.c index 22379aa9..e702a980 100644 --- a/src/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/src/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -4674,7 +4674,7 @@ bt_trace_class *ctf_visitor_generate_ir_get_ir_trace_class( { struct ctx *ctx = (void *) visitor; - BT_ASSERT(ctx); + BT_ASSERT_DBG(ctx); if (ctx->trace_class) { bt_trace_class_get_ref(ctx->trace_class); @@ -4689,8 +4689,8 @@ struct ctf_trace_class *ctf_visitor_generate_ir_borrow_ctf_trace_class( { struct ctx *ctx = (void *) visitor; - BT_ASSERT(ctx); - BT_ASSERT(ctx->ctf_tc); + BT_ASSERT_DBG(ctx); + BT_ASSERT_DBG(ctx->ctf_tc); return ctx->ctf_tc; } diff --git a/src/plugins/ctf/common/msg-iter/msg-iter.c b/src/plugins/ctf/common/msg-iter/msg-iter.c index fff6cc30..de7e594f 100644 --- a/src/plugins/ctf/common/msg-iter/msg-iter.c +++ b/src/plugins/ctf/common/msg-iter/msg-iter.c @@ -369,7 +369,7 @@ void stack_destroy(struct stack *stack) { struct bt_msg_iter *notit; - BT_ASSERT(stack); + BT_ASSERT_DBG(stack); notit = stack->notit; BT_COMP_LOGD("Destroying stack: addr=%p", stack); @@ -386,9 +386,9 @@ void stack_push(struct stack *stack, bt_field *base) struct stack_entry *entry; struct bt_msg_iter *notit; - BT_ASSERT(stack); + BT_ASSERT_DBG(stack); notit = stack->notit; - BT_ASSERT(base); + BT_ASSERT_DBG(base); BT_COMP_LOGT("Pushing base field on stack: stack-addr=%p, " "stack-size-before=%zu, stack-size-after=%zu", stack, stack->size, stack->size + 1); @@ -406,7 +406,7 @@ void stack_push(struct stack *stack, bt_field *base) static inline unsigned int stack_size(struct stack *stack) { - BT_ASSERT(stack); + BT_ASSERT_DBG(stack); return stack->size; } @@ -415,8 +415,8 @@ void stack_pop(struct stack *stack) { struct bt_msg_iter *notit; - BT_ASSERT(stack); - BT_ASSERT(stack_size(stack)); + BT_ASSERT_DBG(stack); + BT_ASSERT_DBG(stack_size(stack)); notit = stack->notit; BT_COMP_LOGT("Popping from stack: " "stack-addr=%p, stack-size-before=%zu, stack-size-after=%zu", @@ -427,8 +427,8 @@ void stack_pop(struct stack *stack) static inline struct stack_entry *stack_top(struct stack *stack) { - BT_ASSERT(stack); - BT_ASSERT(stack_size(stack)); + BT_ASSERT_DBG(stack); + BT_ASSERT_DBG(stack_size(stack)); return &g_array_index(stack->entries, struct stack_entry, stack->size - 1); } @@ -442,7 +442,7 @@ bool stack_empty(struct stack *stack) static void stack_clear(struct stack *stack) { - BT_ASSERT(stack); + BT_ASSERT_DBG(stack); stack->size = 0; } @@ -1263,15 +1263,15 @@ enum bt_msg_iter_status set_current_event_message( enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK; bt_message *msg = NULL; - BT_ASSERT(notit->meta.ec); - BT_ASSERT(notit->packet); + BT_ASSERT_DBG(notit->meta.ec); + BT_ASSERT_DBG(notit->packet); BT_COMP_LOGD("Creating event message from event class and packet: " "notit-addr=%p, ec-addr=%p, ec-name=\"%s\", packet-addr=%p", notit, notit->meta.ec, notit->meta.ec->name->str, notit->packet); - BT_ASSERT(notit->msg_iter); - BT_ASSERT(notit->meta.sc); + BT_ASSERT_DBG(notit->msg_iter); + BT_ASSERT_DBG(notit->meta.sc); if (bt_stream_class_borrow_default_clock_class(notit->meta.sc->ir_sc)) { msg = bt_message_event_create_with_packet_and_default_clock_snapshot( @@ -1325,7 +1325,7 @@ enum bt_msg_iter_status after_event_header_state( notit->event = bt_message_event_borrow_event( notit->event_msg); - BT_ASSERT(notit->event); + BT_ASSERT_DBG(notit->event); next_state: notit->state = STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN; @@ -1348,11 +1348,11 @@ enum bt_msg_iter_status read_event_common_context_begin_state( } if (event_common_context_fc->in_ir && !notit->dry_run) { - BT_ASSERT(!notit->dscopes.event_common_context); + BT_ASSERT_DBG(!notit->dscopes.event_common_context); notit->dscopes.event_common_context = bt_event_borrow_common_context_field( notit->event); - BT_ASSERT(notit->dscopes.event_common_context); + BT_ASSERT_DBG(notit->dscopes.event_common_context); } BT_COMP_LOGT("Decoding event common context field: " @@ -1401,11 +1401,11 @@ enum bt_msg_iter_status read_event_spec_context_begin_state( } if (event_spec_context_fc->in_ir && !notit->dry_run) { - BT_ASSERT(!notit->dscopes.event_spec_context); + BT_ASSERT_DBG(!notit->dscopes.event_spec_context); notit->dscopes.event_spec_context = bt_event_borrow_specific_context_field( notit->event); - BT_ASSERT(notit->dscopes.event_spec_context); + BT_ASSERT_DBG(notit->dscopes.event_spec_context); } BT_COMP_LOGT("Decoding event specific context field: " @@ -1457,11 +1457,11 @@ enum bt_msg_iter_status read_event_payload_begin_state( } if (event_payload_fc->in_ir && !notit->dry_run) { - BT_ASSERT(!notit->dscopes.event_payload); + BT_ASSERT_DBG(!notit->dscopes.event_payload); notit->dscopes.event_payload = bt_event_borrow_payload_field( notit->event); - BT_ASSERT(notit->dscopes.event_payload); + BT_ASSERT_DBG(notit->dscopes.event_payload); } BT_COMP_LOGT("Decoding event payload field: " @@ -1838,16 +1838,16 @@ bt_field *borrow_next_field(struct bt_msg_iter *notit) bt_field_class_type base_fc_type; size_t index; - BT_ASSERT(!stack_empty(notit->stack)); + BT_ASSERT_DBG(!stack_empty(notit->stack)); index = stack_top(notit->stack)->index; base_field = stack_top(notit->stack)->base; - BT_ASSERT(base_field); + BT_ASSERT_DBG(base_field); base_fc = bt_field_borrow_class_const(base_field); - BT_ASSERT(base_fc); + BT_ASSERT_DBG(base_fc); base_fc_type = bt_field_class_get_type(base_fc); if (base_fc_type == BT_FIELD_CLASS_TYPE_STRUCTURE) { - BT_ASSERT(index < + BT_ASSERT_DBG(index < bt_field_class_structure_get_member_count( bt_field_borrow_class_const( base_field))); @@ -1856,19 +1856,19 @@ bt_field *borrow_next_field(struct bt_msg_iter *notit) base_field, index); } else if (bt_field_class_type_is(base_fc_type, BT_FIELD_CLASS_TYPE_ARRAY)) { - BT_ASSERT(index < bt_field_array_get_length(base_field)); + BT_ASSERT_DBG(index < bt_field_array_get_length(base_field)); next_field = bt_field_array_borrow_element_field_by_index( base_field, index); } else if (bt_field_class_type_is(base_fc_type, BT_FIELD_CLASS_TYPE_VARIANT)) { - BT_ASSERT(index == 0); + BT_ASSERT_DBG(index == 0); next_field = bt_field_variant_borrow_selected_option_field( base_field); } else { abort(); } - BT_ASSERT(next_field); + BT_ASSERT_DBG(next_field); return next_field; } @@ -1879,7 +1879,7 @@ void update_default_clock(struct bt_msg_iter *notit, uint64_t new_val, uint64_t new_val_mask; uint64_t cur_value_masked; - BT_ASSERT(new_val_size > 0); + BT_ASSERT_DBG(new_val_size > 0); /* * Special case for a 64-bit new value, which is the limit @@ -1988,9 +1988,9 @@ update_def_clock: } field = borrow_next_field(notit); - BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc); - BT_ASSERT(bt_field_class_type_is(bt_field_get_class_type(field), + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(bt_field_borrow_class_const(field) == fc->ir_fc); + BT_ASSERT_DBG(bt_field_class_type_is(bt_field_get_class_type(field), BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER)); bt_field_integer_unsigned_set_value(field, value); stack_top(notit->stack)->index++; @@ -2014,9 +2014,9 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value, "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, " "fc-type=%d, fc-in-ir=%d, value=%" PRIu64, notit, notit->bfcr, fc, fc->type, fc->in_ir, value); - BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE); - BT_ASSERT(!int_fc->mapped_clock_class); - BT_ASSERT(int_fc->storing_index < 0); + BT_ASSERT_DBG(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE); + BT_ASSERT_DBG(!int_fc->mapped_clock_class); + BT_ASSERT_DBG(int_fc->storing_index < 0); if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) { goto end; @@ -2032,7 +2032,7 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value, } string_field = stack_top(notit->stack)->base; - BT_ASSERT(bt_field_get_class_type(string_field) == + BT_ASSERT_DBG(bt_field_get_class_type(string_field) == BT_FIELD_CLASS_TYPE_STRING); /* Append character */ @@ -2063,7 +2063,7 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value, "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, " "fc-type=%d, fc-in-ir=%d, value=%" PRId64, notit, notit->bfcr, fc, fc->type, fc->in_ir, value); - BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE); + BT_ASSERT_DBG(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE); if (G_UNLIKELY(int_fc->storing_index >= 0)) { g_array_index(notit->stored_values, uint64_t, @@ -2075,9 +2075,9 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value, } field = borrow_next_field(notit); - BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc); - BT_ASSERT(bt_field_class_type_is(bt_field_get_class_type(field), + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(bt_field_borrow_class_const(field) == fc->ir_fc); + BT_ASSERT_DBG(bt_field_class_type_is(bt_field_get_class_type(field), BT_FIELD_CLASS_TYPE_SIGNED_INTEGER)); bt_field_integer_signed_set_value(field, value); stack_top(notit->stack)->index++; @@ -2105,9 +2105,9 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value, field = borrow_next_field(notit); bt_field_class_type type = bt_field_get_class_type(field); - BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc); - BT_ASSERT(bt_field_class_type_is(type, BT_FIELD_CLASS_TYPE_REAL)); + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(bt_field_borrow_class_const(field) == fc->ir_fc); + BT_ASSERT_DBG(bt_field_class_type_is(type, BT_FIELD_CLASS_TYPE_REAL)); if (type == BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL) { bt_field_real_single_precision_set_value(field, (float) value); @@ -2137,9 +2137,9 @@ enum bt_bfcr_status bfcr_string_begin_cb( } field = borrow_next_field(notit); - BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc); - BT_ASSERT(bt_field_get_class_type(field) == + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(bt_field_borrow_class_const(field) == fc->ir_fc); + BT_ASSERT_DBG(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_STRING); bt_field_string_clear(field); @@ -2174,7 +2174,7 @@ enum bt_bfcr_status bfcr_string_cb(const char *value, } field = stack_top(notit->stack)->base; - BT_ASSERT(field); + BT_ASSERT_DBG(field); /* Append current substring */ ret = bt_field_string_append_with_length(field, value, len); @@ -2236,12 +2236,12 @@ enum bt_bfcr_status bfcr_compound_begin_cb( field = notit->cur_dscope_field; } else { field = borrow_next_field(notit); - BT_ASSERT(field); + BT_ASSERT_DBG(field); } /* Push field */ - BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc); + BT_ASSERT_DBG(field); + BT_ASSERT_DBG(bt_field_borrow_class_const(field) == fc->ir_fc); stack_push(notit->stack, field); /* @@ -2253,7 +2253,7 @@ enum bt_bfcr_status bfcr_compound_begin_cb( struct ctf_field_class_array_base *array_fc = (void *) fc; if (array_fc->is_text) { - BT_ASSERT(bt_field_get_class_type(field) == + BT_ASSERT_DBG(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_STRING); notit->done_filling_string = false; bt_field_string_clear(field); @@ -2280,8 +2280,8 @@ enum bt_bfcr_status bfcr_compound_end_cb( goto end; } - BT_ASSERT(!stack_empty(notit->stack)); - BT_ASSERT(bt_field_borrow_class_const(stack_top(notit->stack)->base) == + BT_ASSERT_DBG(!stack_empty(notit->stack)); + BT_ASSERT_DBG(bt_field_borrow_class_const(stack_top(notit->stack)->base) == fc->ir_fc); /* @@ -2293,7 +2293,7 @@ enum bt_bfcr_status bfcr_compound_end_cb( struct ctf_field_class_array_base *array_fc = (void *) fc; if (array_fc->is_text) { - BT_ASSERT(bt_field_get_class_type( + BT_ASSERT_DBG(bt_field_get_class_type( stack_top(notit->stack)->base) == BT_FIELD_CLASS_TYPE_STRING); bt_bfcr_set_unsigned_int_cb(notit->bfcr, @@ -2330,7 +2330,7 @@ int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data) } seq_field = stack_top(notit->stack)->base; - BT_ASSERT(seq_field); + BT_ASSERT_DBG(seq_field); /* * bfcr_get_sequence_length_cb() also gets called back for a @@ -2339,7 +2339,7 @@ int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data) * is a sequence field. */ if (!seq_fc->base.is_text) { - BT_ASSERT(bt_field_class_type_is( + BT_ASSERT_DBG(bt_field_class_type_is( bt_field_get_class_type(seq_field), BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY)); ret = bt_field_array_dynamic_set_length(seq_field, @@ -2848,8 +2848,8 @@ enum bt_msg_iter_status bt_msg_iter_get_next_message( { enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK; - BT_ASSERT(notit); - BT_ASSERT(message); + BT_ASSERT_DBG(notit); + BT_ASSERT_DBG(message); notit->msg_iter = msg_iter; notit->set_stream = true; BT_COMP_LOGD("Getting next message: notit-addr=%p", notit); @@ -2867,7 +2867,7 @@ enum bt_msg_iter_status bt_msg_iter_get_next_message( switch (notit->state) { case STATE_EMIT_MSG_EVENT: - BT_ASSERT(notit->event_msg); + BT_ASSERT_DBG(notit->event_msg); /* * Check if we need to emit the delayed packet @@ -2979,7 +2979,7 @@ enum bt_msg_iter_status decode_until_state( struct bt_msg_iter *notit, { enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK; - BT_ASSERT(notit); + BT_ASSERT_DBG(notit); notit->set_stream = false; do { @@ -3125,8 +3125,8 @@ enum bt_msg_iter_status clock_snapshot_at_msg_iter_state( { enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK; - BT_ASSERT(notit); - BT_ASSERT(clock_snapshot); + BT_ASSERT_DBG(notit); + BT_ASSERT_DBG(clock_snapshot); status = decode_until_state(notit, target_state_1, target_state_2); if (status != BT_MSG_ITER_STATUS_OK) { goto end; @@ -3161,8 +3161,8 @@ enum bt_msg_iter_status bt_msg_iter_get_packet_properties( { enum bt_msg_iter_status status; - BT_ASSERT(notit); - BT_ASSERT(props); + BT_ASSERT_DBG(notit); + BT_ASSERT_DBG(props); status = read_packet_header_context_fields(notit); if (status != BT_MSG_ITER_STATUS_OK) { goto end; diff --git a/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h b/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h index d6db67d9..063fb03a 100644 --- a/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h +++ b/src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h @@ -630,8 +630,8 @@ struct fs_sink_ctf_named_field_class * fs_sink_ctf_field_class_struct_borrow_member_by_index( struct fs_sink_ctf_field_class_struct *fc, uint64_t index) { - BT_ASSERT(fc); - BT_ASSERT(index < fc->members->len); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(index < fc->members->len); return &g_array_index(fc->members, struct fs_sink_ctf_named_field_class, index); } @@ -644,8 +644,8 @@ fs_sink_ctf_field_class_struct_borrow_member_by_name( uint64_t i; struct fs_sink_ctf_named_field_class *ret_named_fc = NULL; - BT_ASSERT(fc); - BT_ASSERT(name); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(name); for (i = 0; i < fc->members->len; i++) { struct fs_sink_ctf_named_field_class *named_fc = @@ -744,8 +744,8 @@ struct fs_sink_ctf_named_field_class * fs_sink_ctf_field_class_variant_borrow_option_by_index( struct fs_sink_ctf_field_class_variant *fc, uint64_t index) { - BT_ASSERT(fc); - BT_ASSERT(index < fc->options->len); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(index < fc->options->len); return &g_array_index(fc->options, struct fs_sink_ctf_named_field_class, index); } @@ -758,8 +758,8 @@ fs_sink_ctf_field_class_variant_borrow_option_by_name( uint64_t i; struct fs_sink_ctf_named_field_class *ret_named_fc = NULL; - BT_ASSERT(fc); - BT_ASSERT(name); + BT_ASSERT_DBG(fc); + BT_ASSERT_DBG(name); for (i = 0; i < fc->options->len; i++) { struct fs_sink_ctf_named_field_class *named_fc = diff --git a/src/plugins/ctf/fs-sink/fs-sink-stream.c b/src/plugins/ctf/fs-sink/fs-sink-stream.c index ca61d10f..64aecd47 100644 --- a/src/plugins/ctf/fs-sink/fs-sink-stream.c +++ b/src/plugins/ctf/fs-sink/fs-sink-stream.c @@ -470,7 +470,7 @@ int write_event_header(struct fs_sink_stream *stream, /* Time */ if (stream->sc->default_clock_class) { - BT_ASSERT(cs); + BT_ASSERT_DBG(cs); ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser, bt_clock_snapshot_get_value(cs), 8, 64, BYTE_ORDER); if (G_UNLIKELY(ret)) { @@ -499,7 +499,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream, /* Common context */ if (stream->sc->event_common_context_fc) { field = bt_event_borrow_common_context_field_const(event); - BT_ASSERT(field); + BT_ASSERT_DBG(field); ret = write_struct_field(stream, (void *) stream->sc->event_common_context_fc, field, true); @@ -511,7 +511,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream, /* Specific context */ if (ec->spec_context_fc) { field = bt_event_borrow_specific_context_field_const(event); - BT_ASSERT(field); + BT_ASSERT_DBG(field); ret = write_struct_field(stream, (void *) ec->spec_context_fc, field, true); if (G_UNLIKELY(ret)) { @@ -522,7 +522,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream, /* Specific context */ if (ec->payload_fc) { field = bt_event_borrow_payload_field_const(event); - BT_ASSERT(field); + BT_ASSERT_DBG(field); ret = write_struct_field(stream, (void *) ec->payload_fc, field, true); if (G_UNLIKELY(ret)) { diff --git a/src/plugins/ctf/fs-sink/fs-sink.c b/src/plugins/ctf/fs-sink/fs-sink.c index e19624e0..532e542c 100644 --- a/src/plugins/ctf/fs-sink/fs-sink.c +++ b/src/plugins/ctf/fs-sink/fs-sink.c @@ -296,7 +296,7 @@ bt_component_class_sink_consume_method_status handle_event_msg( goto end; } - BT_ASSERT(ec); + BT_ASSERT_DBG(ec); if (stream->sc->default_clock_class) { cs = bt_message_event_borrow_default_clock_snapshot_const( @@ -338,7 +338,7 @@ bt_component_class_sink_consume_method_status handle_event_msg( } } - BT_ASSERT(stream->packet_state.is_open); + BT_ASSERT_DBG(stream->packet_state.is_open); ret = fs_sink_stream_write_event(stream, cs, ir_event, ec); if (G_UNLIKELY(ret)) { status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR; @@ -987,8 +987,8 @@ bt_component_class_sink_consume_method_status ctf_fs_sink_consume( fs_sink = bt_self_component_get_data( bt_self_component_sink_as_self_component(self_comp)); - BT_ASSERT(fs_sink); - BT_ASSERT(fs_sink->upstream_iter); + BT_ASSERT_DBG(fs_sink); + BT_ASSERT_DBG(fs_sink->upstream_iter); /* Consume messages */ next_status = bt_self_component_port_input_message_iterator_next( @@ -1006,7 +1006,7 @@ bt_component_class_sink_consume_method_status ctf_fs_sink_consume( for (i = 0; i < msg_count; i++) { const bt_message *msg = msgs[i]; - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); switch (bt_message_get_type(msg)) { case BT_MESSAGE_TYPE_EVENT: diff --git a/src/plugins/ctf/fs-src/data-stream-file.c b/src/plugins/ctf/fs-src/data-stream-file.c index 5f811214..c0a8754e 100644 --- a/src/plugins/ctf/fs-src/data-stream-file.c +++ b/src/plugins/ctf/fs-src/data-stream-file.c @@ -48,7 +48,7 @@ static inline size_t remaining_mmap_bytes(struct ctf_fs_ds_file *ds_file) { - BT_ASSERT(ds_file->mmap_len >= ds_file->request_offset); + BT_ASSERT_DBG(ds_file->mmap_len >= ds_file->request_offset); return ds_file->mmap_len - ds_file->request_offset; } diff --git a/src/plugins/ctf/fs-src/fs.c b/src/plugins/ctf/fs-src/fs.c index 09730401..e92de4bc 100644 --- a/src/plugins/ctf/fs-src/fs.c +++ b/src/plugins/ctf/fs-src/fs.c @@ -118,7 +118,7 @@ bt_component_class_message_iterator_next_method_status ctf_fs_iterator_next_one( { bt_component_class_message_iterator_next_method_status status; - BT_ASSERT(msg_iter_data->ds_file); + BT_ASSERT_DBG(msg_iter_data->ds_file); while (true) { bt_message *msg; diff --git a/src/plugins/ctf/lttng-live/lttng-live.c b/src/plugins/ctf/lttng-live/lttng-live.c index 4586d9cc..f787ea75 100644 --- a/src/plugins/ctf/lttng-live/lttng-live.c +++ b/src/plugins/ctf/lttng-live/lttng-live.c @@ -399,7 +399,7 @@ enum lttng_live_iterator_status lttng_live_iterator_next_handle_one_no_data_stre if (ret != LTTNG_LIVE_ITERATOR_STATUS_OK) { goto end; } - BT_ASSERT(lttng_live_stream->state != LTTNG_LIVE_STREAM_EOF); + BT_ASSERT_DBG(lttng_live_stream->state != LTTNG_LIVE_STREAM_EOF); if (lttng_live_stream->state == LTTNG_LIVE_STREAM_QUIESCENT) { uint64_t last_inact_ts = lttng_live_stream->last_inactivity_ts, curr_inact_ts = lttng_live_stream->current_inactivity_ts; @@ -633,8 +633,8 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter, bt_logging_level log_level = lttng_live_msg_iter->log_level; bt_self_component *self_comp = lttng_live_msg_iter->self_comp; - BT_ASSERT(msg); - BT_ASSERT(ts_ns); + BT_ASSERT_DBG(msg); + BT_ASSERT_DBG(ts_ns); BT_COMP_LOGD("Getting message's timestamp: iter-data-addr=%p, msg-addr=%p, " "last-msg-ts=%" PRId64, lttng_live_msg_iter, msg, @@ -644,7 +644,7 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter, case BT_MESSAGE_TYPE_EVENT: clock_class = bt_message_event_borrow_stream_class_default_clock_class_const( msg); - BT_ASSERT(clock_class); + BT_ASSERT_DBG(clock_class); clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const( msg); @@ -693,7 +693,7 @@ int live_get_msg_ts_ns(struct lttng_live_stream_iterator *stream_iter, } clock_class = bt_clock_snapshot_borrow_clock_class_const(clock_snapshot); - BT_ASSERT(clock_class); + BT_ASSERT_DBG(clock_class); ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot, ts_ns); if (ret) { @@ -940,8 +940,8 @@ enum lttng_live_iterator_status next_stream_iterator_for_trace( int64_t youngest_candidate_msg_ts = INT64_MAX; uint64_t stream_iter_idx; - BT_ASSERT(live_trace); - BT_ASSERT(live_trace->stream_iterators); + BT_ASSERT_DBG(live_trace); + BT_ASSERT_DBG(live_trace->stream_iterators); /* * Update the current message of every stream iterators of this trace. * The current msg of every stream must have a timestamp equal or @@ -986,7 +986,7 @@ enum lttng_live_iterator_status next_stream_iterator_for_trace( goto end; } - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); /* * Get the timestamp in nanoseconds from origin of this @@ -1022,7 +1022,7 @@ enum lttng_live_iterator_status next_stream_iterator_for_trace( } } - BT_ASSERT(stream_iter != youngest_candidate_stream_iter); + BT_ASSERT_DBG(stream_iter != youngest_candidate_stream_iter); if (!stream_iter_is_ended) { if (G_UNLIKELY(youngest_candidate_stream_iter == NULL) || @@ -1039,7 +1039,7 @@ enum lttng_live_iterator_status next_stream_iterator_for_trace( * Order the messages in an arbitrary but * deterministic way. */ - BT_ASSERT(stream_iter != youngest_candidate_stream_iter); + BT_ASSERT_DBG(stream_iter != youngest_candidate_stream_iter); int ret = common_muxing_compare_messages( stream_iter->current_msg, youngest_candidate_stream_iter->current_msg); @@ -1118,7 +1118,7 @@ enum lttng_live_iterator_status next_stream_iterator_for_session( goto end; } - BT_ASSERT(session->traces); + BT_ASSERT_DBG(session->traces); /* * Use while loops here rather then for loops so we can restart the @@ -1144,7 +1144,7 @@ enum lttng_live_iterator_status next_stream_iterator_for_session( } if (!trace_is_ended) { - BT_ASSERT(stream_iter); + BT_ASSERT_DBG(stream_iter); if (G_UNLIKELY(youngest_candidate_stream_iter == NULL) || stream_iter->current_msg_ts_ns < youngest_candidate_msg_ts) { @@ -1227,7 +1227,7 @@ bt_component_class_message_iterator_next_method_status lttng_live_msg_iter_next( *count = 0; - BT_ASSERT(lttng_live_msg_iter); + BT_ASSERT_DBG(lttng_live_msg_iter); /* * Clear all the invalid message reference that might be left over in @@ -1286,7 +1286,7 @@ bt_component_class_message_iterator_next_method_status lttng_live_msg_iter_next( *candidate_stream_iter = NULL; int64_t youngest_msg_ts_ns = INT64_MAX; - BT_ASSERT(lttng_live_msg_iter->sessions); + BT_ASSERT_DBG(lttng_live_msg_iter->sessions); session_idx = 0; /* * Use a while loop instead of a for loop so we can restart the @@ -1376,9 +1376,9 @@ bt_component_class_message_iterator_next_method_status lttng_live_msg_iter_next( goto end; } - BT_ASSERT(youngest_stream_iter->current_msg); + BT_ASSERT_DBG(youngest_stream_iter->current_msg); /* Ensure monotonicity. */ - BT_ASSERT(lttng_live_msg_iter->last_msg_ts_ns <= + BT_ASSERT_DBG(lttng_live_msg_iter->last_msg_ts_ns <= youngest_stream_iter->current_msg_ts_ns); /* diff --git a/src/plugins/ctf/lttng-live/metadata.c b/src/plugins/ctf/lttng-live/metadata.c index 87458ca6..f77d62f8 100644 --- a/src/plugins/ctf/lttng-live/metadata.c +++ b/src/plugins/ctf/lttng-live/metadata.c @@ -102,7 +102,7 @@ const bt_clock_class *borrow_any_clock_class(bt_trace_class *tc) sc_count = bt_trace_class_get_stream_class_count(tc); for (i = 0; i < sc_count; i++) { sc = bt_trace_class_borrow_stream_class_by_index_const(tc, i); - BT_ASSERT(sc); + BT_ASSERT_DBG(sc); cc = bt_stream_class_borrow_default_clock_class_const(sc); if (cc) { @@ -110,7 +110,7 @@ const bt_clock_class *borrow_any_clock_class(bt_trace_class *tc) } } end: - BT_ASSERT(cc); + BT_ASSERT_DBG(cc); return cc; } diff --git a/src/plugins/lttng-utils/debug-info/debug-info.c b/src/plugins/lttng-utils/debug-info/debug-info.c index 98cf2ebb..71bb4c1a 100644 --- a/src/plugins/lttng-utils/debug-info/debug-info.c +++ b/src/plugins/lttng-utils/debug-info/debug-info.c @@ -335,7 +335,7 @@ const bt_field *event_borrow_payload_field(const bt_event *event, const bt_field *event_payload, *field; event_payload = bt_event_borrow_payload_field_const(event); - BT_ASSERT(event_payload); + BT_ASSERT_DBG(event_payload); field = bt_field_structure_borrow_member_field_by_name_const( event_payload, field_name); @@ -950,7 +950,7 @@ void fill_debug_info_bin_field(struct debug_info_source *dbg_info_src, bt_field_string_set_value_status set_status; bt_field_string_append_status append_status; - BT_ASSERT(bt_field_get_class_type(curr_field) == + BT_ASSERT_DBG(bt_field_get_class_type(curr_field) == BT_FIELD_CLASS_TYPE_STRING); if (dbg_info_src) { @@ -993,7 +993,7 @@ void fill_debug_info_func_field(struct debug_info_source *dbg_info_src, { bt_field_string_set_value_status status; - BT_ASSERT(bt_field_get_class_type(curr_field) == + BT_ASSERT_DBG(bt_field_get_class_type(curr_field) == BT_FIELD_CLASS_TYPE_STRING); if (dbg_info_src && dbg_info_src->func) { status = bt_field_string_set_value(curr_field, @@ -1017,7 +1017,7 @@ void fill_debug_info_src_field(struct debug_info_source *dbg_info_src, bt_field_string_set_value_status set_status; bt_field_string_append_status append_status; - BT_ASSERT(bt_field_get_class_type(curr_field) == + BT_ASSERT_DBG(bt_field_get_class_type(curr_field) == BT_FIELD_CLASS_TYPE_STRING); if (dbg_info_src && dbg_info_src->src_path) { @@ -1068,7 +1068,7 @@ void fill_debug_info_field_empty(bt_field *debug_info_field, bt_field_string_set_value_status status; bt_field *bin_field, *func_field, *src_field; - BT_ASSERT(bt_field_get_class_type(debug_info_field) == + BT_ASSERT_DBG(bt_field_get_class_type(debug_info_field) == BT_FIELD_CLASS_TYPE_STRUCTURE); bin_field = bt_field_structure_borrow_member_field_by_name( @@ -1078,11 +1078,11 @@ void fill_debug_info_field_empty(bt_field *debug_info_field, src_field = bt_field_structure_borrow_member_field_by_name( debug_info_field, "src"); - BT_ASSERT(bt_field_get_class_type(bin_field) == + BT_ASSERT_DBG(bt_field_get_class_type(bin_field) == BT_FIELD_CLASS_TYPE_STRING); - BT_ASSERT(bt_field_get_class_type(func_field) == + BT_ASSERT_DBG(bt_field_get_class_type(func_field) == BT_FIELD_CLASS_TYPE_STRING); - BT_ASSERT(bt_field_get_class_type(src_field) == + BT_ASSERT_DBG(bt_field_get_class_type(src_field) == BT_FIELD_CLASS_TYPE_STRING); status = bt_field_string_set_value(bin_field, ""); @@ -1113,12 +1113,13 @@ void fill_debug_info_field(struct debug_info *debug_info, int64_t vpid, struct debug_info_source *dbg_info_src; const bt_field_class *debug_info_fc; - BT_ASSERT(bt_field_get_class_type(debug_info_field) == + BT_ASSERT_DBG(bt_field_get_class_type(debug_info_field) == BT_FIELD_CLASS_TYPE_STRUCTURE); debug_info_fc = bt_field_borrow_class_const(debug_info_field); - BT_ASSERT(bt_field_class_structure_get_member_count(debug_info_fc) == 3); + BT_ASSERT_DBG(bt_field_class_structure_get_member_count( + debug_info_fc) == 3); dbg_info_src = debug_info_query(debug_info, vpid, ip); @@ -1277,14 +1278,14 @@ bt_message *handle_event_message(struct debug_info_msg_iter *debug_it, out_event_class = trace_ir_mapping_create_new_mapped_event_class( debug_it->ir_maps, in_event_class); } - BT_ASSERT(out_event_class); + BT_ASSERT_DBG(out_event_class); /* Borrow the input stream. */ in_stream = bt_event_borrow_stream_const(in_event); - BT_ASSERT(in_stream); + BT_ASSERT_DBG(in_stream); out_stream = trace_ir_mapping_borrow_mapped_stream(debug_it->ir_maps, in_stream); - BT_ASSERT(in_stream); + BT_ASSERT_DBG(in_stream); /* Borrow the input and output packets. */ in_packet = bt_event_borrow_packet_const(in_event); @@ -1851,16 +1852,16 @@ bt_component_class_message_iterator_next_method_status debug_info_msg_iter_next( status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; self_comp = bt_self_message_iterator_borrow_component(self_msg_iter); - BT_ASSERT(self_comp); + BT_ASSERT_DBG(self_comp); debug_info = bt_self_component_get_data(self_comp); - BT_ASSERT(debug_info); + BT_ASSERT_DBG(debug_info); debug_info_msg_iter = bt_self_message_iterator_get_data(self_msg_iter); - BT_ASSERT(debug_info_msg_iter); + BT_ASSERT_DBG(debug_info_msg_iter); upstream_iterator = debug_info_msg_iter->msg_iter; - BT_ASSERT(upstream_iterator); + BT_ASSERT_DBG(upstream_iterator); upstream_iterator_ret_status = bt_self_component_port_input_message_iterator_next( @@ -1880,7 +1881,7 @@ bt_component_class_message_iterator_next_method_status debug_info_msg_iter_next( * There should never be more received messages than the capacity we * provided. */ - BT_ASSERT(*count <= capacity); + BT_ASSERT_DBG(*count <= capacity); for (curr_msg_idx = 0; curr_msg_idx < *count; curr_msg_idx++) { out_message = handle_message(debug_info_msg_iter, diff --git a/src/plugins/lttng-utils/debug-info/trace-ir-data-copy.c b/src/plugins/lttng-utils/debug-info/trace-ir-data-copy.c index 45d8b02e..42395904 100644 --- a/src/plugins/lttng-utils/debug-info/trace-ir-data-copy.c +++ b/src/plugins/lttng-utils/debug-info/trace-ir-data-copy.c @@ -188,7 +188,7 @@ void copy_event_content(const bt_event *in_event, bt_event *out_event, if (in_common_ctx_field) { out_common_ctx_field = bt_event_borrow_common_context_field(out_event); - BT_ASSERT(out_common_ctx_field); + BT_ASSERT_DBG(out_common_ctx_field); copy_field_content(in_common_ctx_field, out_common_ctx_field, log_level, self_comp); } @@ -198,7 +198,7 @@ void copy_event_content(const bt_event *in_event, bt_event *out_event, if (in_specific_ctx_field) { out_specific_ctx_field = bt_event_borrow_specific_context_field(out_event); - BT_ASSERT(out_specific_ctx_field); + BT_ASSERT_DBG(out_specific_ctx_field); copy_field_content(in_specific_ctx_field, out_specific_ctx_field, log_level, self_comp); } @@ -206,7 +206,7 @@ void copy_event_content(const bt_event *in_event, bt_event *out_event, in_payload_field = bt_event_borrow_payload_field_const(in_event); if (in_payload_field) { out_payload_field = bt_event_borrow_payload_field(out_event); - BT_ASSERT(out_payload_field); + BT_ASSERT_DBG(out_payload_field); copy_field_content(in_payload_field, out_payload_field, log_level, self_comp); } @@ -223,7 +223,7 @@ void copy_field_content(const bt_field *in_field, bt_field *out_field, in_fc_type = bt_field_get_class_type(in_field); out_fc_type = bt_field_get_class_type(out_field); - BT_ASSERT(in_fc_type == out_fc_type); + BT_ASSERT_DBG(in_fc_type == out_fc_type); BT_COMP_LOGT("Copying content of field: in-f-addr=%p, out-f-addr=%p", in_field, out_field); @@ -336,7 +336,7 @@ void copy_field_content(const bt_field *in_field, bt_field *out_field, bt_field_option_set_has_field(out_field, BT_TRUE); out_option_field = bt_field_option_borrow_field( out_field); - BT_ASSERT(out_option_field); + BT_ASSERT_DBG(out_option_field); copy_field_content(in_option_field, out_option_field, log_level, self_comp); } else { diff --git a/src/plugins/lttng-utils/debug-info/trace-ir-mapping.c b/src/plugins/lttng-utils/debug-info/trace-ir-mapping.c index dbd46ae6..3b694d3b 100644 --- a/src/plugins/lttng-utils/debug-info/trace-ir-mapping.c +++ b/src/plugins/lttng-utils/debug-info/trace-ir-mapping.c @@ -127,8 +127,8 @@ static bt_stream_class *borrow_mapped_stream_class(struct trace_ir_metadata_maps *md_maps, const bt_stream_class *in_stream_class) { - BT_ASSERT(md_maps); - BT_ASSERT(in_stream_class); + BT_ASSERT_DBG(md_maps); + BT_ASSERT_DBG(in_stream_class); return g_hash_table_lookup(md_maps->stream_class_map, (gpointer) in_stream_class); @@ -187,8 +187,8 @@ static bt_stream *borrow_mapped_stream(struct trace_ir_data_maps *d_maps, const bt_stream *in_stream) { - BT_ASSERT(d_maps); - BT_ASSERT(in_stream); + BT_ASSERT_DBG(d_maps); + BT_ASSERT_DBG(in_stream); return g_hash_table_lookup(d_maps->stream_map, (gpointer) in_stream); } @@ -264,8 +264,8 @@ bt_stream *trace_ir_mapping_borrow_mapped_stream(struct trace_ir_maps *ir_maps, { struct trace_ir_data_maps *d_maps; - BT_ASSERT(ir_maps); - BT_ASSERT(in_stream); + BT_ASSERT_DBG(ir_maps); + BT_ASSERT_DBG(in_stream); d_maps = borrow_data_maps_from_input_stream(ir_maps, in_stream); /* Return the mapped stream. */ @@ -346,8 +346,8 @@ bt_event_class *trace_ir_mapping_borrow_mapped_event_class( { struct trace_ir_metadata_maps *md_maps; - BT_ASSERT(ir_maps); - BT_ASSERT(in_event_class); + BT_ASSERT_DBG(ir_maps); + BT_ASSERT_DBG(in_event_class); md_maps = borrow_metadata_maps_from_input_event_class(ir_maps, in_event_class); @@ -360,8 +360,8 @@ static inline bt_packet *borrow_mapped_packet(struct trace_ir_data_maps *d_maps, const bt_packet *in_packet) { - BT_ASSERT(d_maps); - BT_ASSERT(in_packet); + BT_ASSERT_DBG(d_maps); + BT_ASSERT_DBG(in_packet); return g_hash_table_lookup(d_maps->packet_map, (gpointer) in_packet); } @@ -418,8 +418,8 @@ bt_packet *trace_ir_mapping_borrow_mapped_packet(struct trace_ir_maps *ir_maps, const bt_packet *in_packet) { struct trace_ir_data_maps *d_maps; - BT_ASSERT(ir_maps); - BT_ASSERT(in_packet); + BT_ASSERT_DBG(ir_maps); + BT_ASSERT_DBG(in_packet); d_maps = borrow_data_maps_from_input_packet(ir_maps, in_packet); diff --git a/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c b/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c index 3fd46539..e1aa3cad 100644 --- a/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c +++ b/src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.c @@ -135,8 +135,8 @@ bt_clock_class *borrow_mapped_clock_class( struct trace_ir_metadata_maps *md_maps, const bt_clock_class *in_clock_class) { - BT_ASSERT(md_maps); - BT_ASSERT(in_clock_class); + BT_ASSERT_DBG(md_maps); + BT_ASSERT_DBG(in_clock_class); return g_hash_table_lookup(md_maps->clock_class_map, (gpointer) in_clock_class); diff --git a/src/plugins/text/details/details.c b/src/plugins/text/details/details.c index 88b7fe32..585f97b2 100644 --- a/src/plugins/text/details/details.c +++ b/src/plugins/text/details/details.c @@ -467,8 +467,8 @@ details_consume(bt_self_component_sink *comp) details_comp = bt_self_component_get_data( bt_self_component_sink_as_self_component(comp)); - BT_ASSERT(details_comp); - BT_ASSERT(details_comp->msg_iter); + BT_ASSERT_DBG(details_comp); + BT_ASSERT_DBG(details_comp->msg_iter); /* Consume messages */ next_status = bt_self_component_port_input_message_iterator_next( diff --git a/src/plugins/text/details/obj-lifetime-mgmt.c b/src/plugins/text/details/obj-lifetime-mgmt.c index 8da5cf16..41a2a31e 100644 --- a/src/plugins/text/details/obj-lifetime-mgmt.c +++ b/src/plugins/text/details/obj-lifetime-mgmt.c @@ -48,8 +48,8 @@ struct details_trace_class_meta *borrow_trace_class_meta( { struct details_trace_class_meta *details_tc_meta; - BT_ASSERT(ctx->details_comp->cfg.with_meta); - BT_ASSERT(ctx->details_comp->meta); + BT_ASSERT_DBG(ctx->details_comp->cfg.with_meta); + BT_ASSERT_DBG(ctx->details_comp->meta); details_tc_meta = g_hash_table_lookup(ctx->details_comp->meta, tc); if (!details_tc_meta) { /* Not found: create one */ @@ -93,9 +93,9 @@ bool details_need_to_write_meta_object(struct details_write_ctx *ctx, goto end; } - BT_ASSERT(ctx->details_comp->meta); + BT_ASSERT_DBG(ctx->details_comp->meta); details_tc_meta = g_hash_table_lookup(ctx->details_comp->meta, tc); - BT_ASSERT(details_tc_meta); + BT_ASSERT_DBG(details_tc_meta); need_to_write = !g_hash_table_lookup(details_tc_meta->objects, obj); @@ -128,7 +128,7 @@ bool details_need_to_write_trace_class(struct details_write_ctx *ctx, goto end; } - BT_ASSERT(ctx->details_comp->meta); + BT_ASSERT_DBG(ctx->details_comp->meta); details_tc_meta = g_hash_table_lookup(ctx->details_comp->meta, tc); need_to_write = !details_tc_meta; @@ -190,8 +190,8 @@ int details_trace_unique_id(struct details_write_ctx *ctx, int ret = 0; struct details_trace *details_trace = NULL; - BT_ASSERT(unique_id); - BT_ASSERT(ctx->details_comp->traces); + BT_ASSERT_DBG(unique_id); + BT_ASSERT_DBG(ctx->details_comp->traces); if (!bt_g_hash_table_contains(ctx->details_comp->traces, trace)) { /* Not found: create one */ diff --git a/src/plugins/text/details/write.c b/src/plugins/text/details/write.c index 0d9f0f7a..4eb4f9f8 100644 --- a/src/plugins/text/details/write.c +++ b/src/plugins/text/details/write.c @@ -41,7 +41,7 @@ const char *plural(uint64_t value) static inline void incr_indent_by(struct details_write_ctx *ctx, unsigned int value) { - BT_ASSERT(ctx); + BT_ASSERT_DBG(ctx); ctx->indent_level += value; } @@ -54,8 +54,8 @@ void incr_indent(struct details_write_ctx *ctx) static inline void decr_indent_by(struct details_write_ctx *ctx, unsigned int value) { - BT_ASSERT(ctx); - BT_ASSERT(ctx->indent_level >= value); + BT_ASSERT_DBG(ctx); + BT_ASSERT_DBG(ctx->indent_level >= value); ctx->indent_level -= value; } @@ -167,14 +167,14 @@ void format_int(char *buf, int64_t value, unsigned int base) static inline void write_nl(struct details_write_ctx *ctx) { - BT_ASSERT(ctx); + BT_ASSERT_DBG(ctx); g_string_append_c(ctx->str, '\n'); } static inline void write_sp(struct details_write_ctx *ctx) { - BT_ASSERT(ctx); + BT_ASSERT_DBG(ctx); g_string_append_c(ctx->str, ' '); } @@ -183,7 +183,7 @@ void write_indent(struct details_write_ctx *ctx) { uint64_t i; - BT_ASSERT(ctx); + BT_ASSERT_DBG(ctx); for (i = 0; i < ctx->indent_level; i++) { write_sp(ctx); @@ -282,7 +282,7 @@ static inline void write_str_prop_line(struct details_write_ctx *ctx, const char *prop_name, const char *prop_value) { - BT_ASSERT(prop_value); + BT_ASSERT_DBG(prop_value); write_indent(ctx); write_prop_name(ctx, prop_name); g_string_append(ctx->str, ": "); @@ -351,7 +351,7 @@ static inline void write_uuid_prop_line(struct details_write_ctx *ctx, const char *prop_name, bt_uuid uuid) { - BT_ASSERT(uuid); + BT_ASSERT_DBG(uuid); write_indent(ctx); write_prop_name(ctx, prop_name); g_string_append_printf(ctx->str, @@ -373,7 +373,7 @@ bt_bool map_value_foreach_add_key_to_array(const char *key, { GPtrArray *keys = data; - BT_ASSERT(keys); + BT_ASSERT_DBG(keys); g_ptr_array_add(keys, (void *) key); return BT_TRUE; } @@ -387,7 +387,7 @@ void write_value(struct details_write_ctx *ctx, const bt_value *value, GPtrArray *keys = g_ptr_array_new(); char buf[64]; - BT_ASSERT(keys); + BT_ASSERT_DBG(keys); /* Write field's name */ if (name) { @@ -456,7 +456,7 @@ void write_value(struct details_write_ctx *ctx, const bt_value *value, bt_value_map_foreach_entry_const(value, map_value_foreach_add_key_to_array, keys); - BT_ASSERT(foreach_status == + BT_ASSERT_DBG(foreach_status == BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_OK); g_ptr_array_sort(keys, (GCompareFunc) compare_strings); @@ -492,7 +492,7 @@ static void write_user_attributes(struct details_write_ctx *ctx, const bt_value *user_attrs, bool write_newline, bool *written) { - BT_ASSERT(user_attrs); + BT_ASSERT_DBG(user_attrs); if (!bt_value_map_is_empty(user_attrs)) { write_value(ctx, user_attrs, "User attributes"); @@ -708,7 +708,7 @@ void write_enum_field_class_mappings(struct details_write_ctx *ctx, mappings = g_ptr_array_new_with_free_func( (GDestroyNotify) destroy_enum_field_class_mapping); - BT_ASSERT(mappings); + BT_ASSERT_DBG(mappings); /* * Copy field class's mappings to our own arrays and structures @@ -720,7 +720,7 @@ void write_enum_field_class_mappings(struct details_write_ctx *ctx, struct enum_field_class_mapping *mapping = g_new0( struct enum_field_class_mapping, 1); - BT_ASSERT(mapping); + BT_ASSERT_DBG(mapping); if (is_signed) { fc_mapping = bt_field_class_enumeration_signed_borrow_mapping_by_index_const( @@ -739,7 +739,7 @@ void write_enum_field_class_mappings(struct details_write_ctx *ctx, fc_mapping)); mapping->ranges = range_set_to_int_ranges(fc_range_set, is_signed); - BT_ASSERT(mapping->ranges); + BT_ASSERT_DBG(mapping->ranges); g_ptr_array_add(mappings, mapping); } @@ -864,7 +864,7 @@ void write_variant_field_class_option(struct details_write_ctx *ctx, uint64_t i; int_ranges = range_set_to_int_ranges(orig_ranges, is_signed); - BT_ASSERT(int_ranges); + BT_ASSERT_DBG(int_ranges); for (i = 0; i < int_ranges->len; i++) { struct int_range *range = int_range_at(int_ranges, i); @@ -1036,7 +1036,7 @@ void write_field_class(struct details_write_ctx *ctx, const bt_field_class *fc) sel_field_path = bt_field_class_variant_with_selector_field_borrow_selector_field_path_const( fc); - BT_ASSERT(sel_field_path); + BT_ASSERT_DBG(sel_field_path); } g_string_append(ctx->str, " ("); @@ -1175,8 +1175,8 @@ void write_field_class(struct details_write_ctx *ctx, const bt_field_class *fc) ranges, selector_is_signed); uint64_t i; - BT_ASSERT(sorted_ranges); - BT_ASSERT(sorted_ranges->len > 0); + BT_ASSERT_DBG(sorted_ranges); + BT_ASSERT_DBG(sorted_ranges->len > 0); write_prop_name_line(ctx, "Selector ranges"); for (i = 0; i < sorted_ranges->len; i++) { @@ -1228,8 +1228,8 @@ static void write_root_field_class(struct details_write_ctx *ctx, const char *name, const bt_field_class *fc) { - BT_ASSERT(name); - BT_ASSERT(fc); + BT_ASSERT_DBG(name); + BT_ASSERT_DBG(fc); write_indent(ctx); write_prop_name(ctx, name); g_string_append(ctx->str, ": "); @@ -1570,7 +1570,7 @@ int try_write_meta(struct details_write_ctx *ctx, const bt_trace_class *tc, { int ret = 0; - BT_ASSERT(tc); + BT_ASSERT_DBG(tc); if (details_need_to_write_trace_class(ctx, tc)) { uint64_t sc_i; @@ -1625,7 +1625,7 @@ int try_write_meta(struct details_write_ctx *ctx, const bt_trace_class *tc, if (sc && details_need_to_write_meta_object(ctx, tc, sc)) { uint64_t ec_i; - BT_ASSERT(tc); + BT_ASSERT_DBG(tc); if (ctx->details_comp->cfg.compact && ctx->details_comp->printed_something) { @@ -1661,7 +1661,7 @@ int try_write_meta(struct details_write_ctx *ctx, const bt_trace_class *tc, } if (ec && details_need_to_write_meta_object(ctx, tc, ec)) { - BT_ASSERT(sc); + BT_ASSERT_DBG(sc); if (ctx->details_comp->cfg.compact && ctx->details_comp->printed_something) { @@ -1926,8 +1926,8 @@ static void write_root_field(struct details_write_ctx *ctx, const char *name, const bt_field *field) { - BT_ASSERT(name); - BT_ASSERT(field); + BT_ASSERT_DBG(name); + BT_ASSERT_DBG(field); write_indent(ctx); write_prop_name(ctx, name); g_string_append(ctx->str, ":"); @@ -2124,7 +2124,7 @@ void write_trace(struct details_write_ctx *ctx, const bt_trace *trace) bt_trace_borrow_environment_entry_value_by_name_const( trace, name); - BT_ASSERT(value); + BT_ASSERT_DBG(value); write_compound_member_name(ctx, name); write_sp(ctx); @@ -2367,7 +2367,7 @@ int write_discarded_items_message(struct details_write_ctx *ctx, /* Write times */ if (beginning_cs) { write_time(ctx, beginning_cs); - BT_ASSERT(end_cs); + BT_ASSERT_DBG(end_cs); write_time(ctx, end_cs); } diff --git a/src/plugins/text/dmesg/dmesg.c b/src/plugins/text/dmesg/dmesg.c index 252a831c..6031c9ae 100644 --- a/src/plugins/text/dmesg/dmesg.c +++ b/src/plugins/text/dmesg/dmesg.c @@ -509,7 +509,7 @@ bt_message *create_init_event_msg_from_line( if (has_timestamp) { /* Set new start for the message portion of the line */ *new_start = strchr(line, ']'); - BT_ASSERT(*new_start); + BT_ASSERT_DBG(*new_start); (*new_start)++; if ((*new_start)[0] == ' ') { @@ -545,7 +545,7 @@ skip_ts: } event = bt_message_event_borrow_event(msg); - BT_ASSERT(event); + BT_ASSERT_DBG(event); goto end; error: @@ -565,7 +565,7 @@ int fill_event_payload_from_line(struct dmesg_component *dmesg_comp, int ret; ep_field = bt_event_borrow_payload_field(event); - BT_ASSERT(ep_field); + BT_ASSERT_DBG(ep_field); str_field = bt_field_structure_borrow_member_field_by_index( ep_field, 0); if (!str_field) { @@ -614,7 +614,7 @@ bt_message *create_msg_from_line( } event = bt_message_event_borrow_event(msg); - BT_ASSERT(event); + BT_ASSERT_DBG(event); ret = fill_event_payload_from_line(dmesg_comp, new_start, event); if (ret) { BT_COMP_LOGE("Cannot fill event payload field from line: " @@ -722,9 +722,9 @@ bt_component_class_message_iterator_next_method_status dmesg_msg_iter_next_one( bt_component_class_message_iterator_next_method_status status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; - BT_ASSERT(dmesg_msg_iter); + BT_ASSERT_DBG(dmesg_msg_iter); dmesg_comp = dmesg_msg_iter->dmesg_comp; - BT_ASSERT(dmesg_comp); + BT_ASSERT_DBG(dmesg_comp); if (dmesg_msg_iter->state == STATE_DONE) { status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END; @@ -763,7 +763,7 @@ bt_component_class_message_iterator_next_method_status dmesg_msg_iter_next_one( goto end; } - BT_ASSERT(dmesg_msg_iter->linebuf); + BT_ASSERT_DBG(dmesg_msg_iter->linebuf); /* Ignore empty lines, once trimmed */ for (ch = dmesg_msg_iter->linebuf; *ch != '\0'; ch++) { @@ -788,17 +788,17 @@ bt_component_class_message_iterator_next_method_status dmesg_msg_iter_next_one( } handle_state: - BT_ASSERT(dmesg_comp->trace); + BT_ASSERT_DBG(dmesg_comp->trace); switch (dmesg_msg_iter->state) { case STATE_EMIT_STREAM_BEGINNING: - BT_ASSERT(dmesg_msg_iter->tmp_event_msg); + BT_ASSERT_DBG(dmesg_msg_iter->tmp_event_msg); *msg = bt_message_stream_beginning_create( dmesg_msg_iter->pc_msg_iter, dmesg_comp->stream); dmesg_msg_iter->state = STATE_EMIT_EVENT; break; case STATE_EMIT_EVENT: - BT_ASSERT(dmesg_msg_iter->tmp_event_msg); + BT_ASSERT_DBG(dmesg_msg_iter->tmp_event_msg); *msg = dmesg_msg_iter->tmp_event_msg; dmesg_msg_iter->tmp_event_msg = NULL; break; diff --git a/src/plugins/text/pretty/pretty.c b/src/plugins/text/pretty/pretty.c index 3ea6c54a..d496734f 100644 --- a/src/plugins/text/pretty/pretty.c +++ b/src/plugins/text/pretty/pretty.c @@ -116,7 +116,7 @@ bt_component_class_message_iterator_next_method_status handle_message( bt_component_class_message_iterator_next_method_status ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; - BT_ASSERT(pretty); + BT_ASSERT_DBG(pretty); switch (bt_message_get_type(message)) { case BT_MESSAGE_TYPE_EVENT: @@ -199,7 +199,7 @@ bt_component_class_sink_consume_method_status pretty_consume( goto end; } - BT_ASSERT(next_status == BT_MESSAGE_ITERATOR_NEXT_STATUS_OK); + BT_ASSERT_DBG(next_status == BT_MESSAGE_ITERATOR_NEXT_STATUS_OK); for (i = 0; i < count; i++) { ret = (int) handle_message(pretty, msgs[i]); diff --git a/src/plugins/text/pretty/print.c b/src/plugins/text/pretty/print.c index b4800f3c..7aa46106 100644 --- a/src/plugins/text/pretty/print.c +++ b/src/plugins/text/pretty/print.c @@ -440,7 +440,7 @@ int print_event_header(struct pretty_component *pretty, &log_level); if (prop_avail == BT_PROPERTY_AVAILABILITY_AVAILABLE) { log_level_str = log_level_names[log_level]; - BT_ASSERT(log_level_str); + BT_ASSERT_DBG(log_level_str); if (!pretty->start_line) { bt_common_g_string_append(pretty->string, ", "); @@ -528,7 +528,7 @@ int print_integer(struct pretty_component *pretty, bt_field_class_type ft_type; int_fc = bt_field_borrow_class_const(field); - BT_ASSERT(int_fc); + BT_ASSERT_DBG(int_fc); ft_type = bt_field_get_class_type(field); if (bt_field_class_type_is(ft_type, BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER)) { @@ -569,7 +569,7 @@ int print_integer(struct pretty_component *pretty, if (len < 64) { size_t rounded_len; - BT_ASSERT(len != 0); + BT_ASSERT_DBG(len != 0); /* Round length to the nearest 3-bit */ rounded_len = (((len - 1) / 3) + 1) * 3; v.u &= ((uint64_t) 1 << rounded_len) - 1; @@ -836,7 +836,7 @@ int print_array_field(struct pretty_component *pretty, } field = bt_field_array_borrow_element_field_by_index_const(array, i); - BT_ASSERT(field); + BT_ASSERT_DBG(field); return print_field(pretty, field, print_names); } @@ -886,7 +886,7 @@ int print_sequence_field(struct pretty_component *pretty, } field = bt_field_array_borrow_element_field_by_index_const(seq, i); - BT_ASSERT(field); + BT_ASSERT_DBG(field); return print_field(pretty, field, print_names); } @@ -952,7 +952,7 @@ int print_variant(struct pretty_component *pretty, const bt_field *field = NULL; field = bt_field_variant_borrow_selected_option_field_const(variant); - BT_ASSERT(field); + BT_ASSERT_DBG(field); bt_common_g_string_append(pretty->string, "{ "); pretty->depth++; if (print_names) { @@ -1198,7 +1198,7 @@ int pretty_print_event(struct pretty_component *pretty, const bt_event *event = bt_message_event_borrow_event_const(event_msg); - BT_ASSERT(event); + BT_ASSERT_DBG(event); pretty->start_line = true; g_string_assign(pretty->string, ""); ret = print_event_header(pretty, event_msg); diff --git a/src/plugins/utils/counter/counter.c b/src/plugins/utils/counter/counter.c index 82d1b907..18ec6055 100644 --- a/src/plugins/utils/counter/counter.c +++ b/src/plugins/utils/counter/counter.c @@ -256,7 +256,7 @@ bt_component_class_sink_consume_method_status counter_consume( counter = bt_self_component_get_data( bt_self_component_sink_as_self_component(comp)); - BT_ASSERT(counter); + BT_ASSERT_DBG(counter); if (G_UNLIKELY(!counter->msg_iter)) { try_print_last(counter); @@ -280,7 +280,7 @@ bt_component_class_sink_consume_method_status counter_consume( for (i = 0; i < msg_count; i++) { const bt_message *msg = msgs[i]; - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); switch (bt_message_get_type(msg)) { case BT_MESSAGE_TYPE_EVENT: counter->count.event++; diff --git a/src/plugins/utils/dummy/dummy.c b/src/plugins/utils/dummy/dummy.c index 703535e7..f9718808 100644 --- a/src/plugins/utils/dummy/dummy.c +++ b/src/plugins/utils/dummy/dummy.c @@ -155,7 +155,7 @@ bt_component_class_sink_consume_method_status dummy_consume( dummy = bt_self_component_get_data( bt_self_component_sink_as_self_component(component)); - BT_ASSERT(dummy); + BT_ASSERT_DBG(dummy); if (G_UNLIKELY(!dummy->msg_iter)) { status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END; diff --git a/src/plugins/utils/muxer/muxer.c b/src/plugins/utils/muxer/muxer.c index 002cd629..18e716bd 100644 --- a/src/plugins/utils/muxer/muxer.c +++ b/src/plugins/utils/muxer/muxer.c @@ -407,7 +407,7 @@ bt_component_class_message_iterator_next_method_status muxer_upstream_msg_iter_n * valid: it must be considered for muxing operations. */ BT_COMP_LOGD_STR("Validated upstream message iterator wrapper."); - BT_ASSERT(count > 0); + BT_ASSERT_DBG(count > 0); /* Move messages to our queue */ for (i = 0; i < count; i++) { @@ -460,8 +460,8 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp, const bt_stream_class *stream_class = NULL; bt_message_type msg_type; - BT_ASSERT(msg); - BT_ASSERT(ts_ns); + BT_ASSERT_DBG(msg); + BT_ASSERT_DBG(ts_ns); BT_COMP_LOGD("Getting message's timestamp: " "muxer-msg-iter-addr=%p, msg-addr=%p, " "last-returned-ts=%" PRId64, @@ -495,7 +495,7 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp, switch (msg_type) { case BT_MESSAGE_TYPE_EVENT: - BT_ASSERT(bt_message_event_borrow_stream_class_default_clock_class_const( + BT_ASSERT_DBG(bt_message_event_borrow_stream_class_default_clock_class_const( msg)); clock_snapshot = bt_message_event_borrow_default_clock_snapshot_const( msg); @@ -612,7 +612,7 @@ int validate_clock_class(struct muxer_msg_iter *muxer_msg_iter, const uint8_t *cc_uuid; const char *cc_name; - BT_ASSERT(clock_class); + BT_ASSERT_DBG(clock_class); cc_uuid = bt_clock_class_get_uuid(clock_class); cc_name = bt_clock_class_get_name(clock_class); @@ -791,9 +791,9 @@ muxer_msg_iter_youngest_upstream_msg_iter( bt_component_class_message_iterator_next_method_status status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; - BT_ASSERT(muxer_comp); - BT_ASSERT(muxer_msg_iter); - BT_ASSERT(muxer_upstream_msg_iter); + BT_ASSERT_DBG(muxer_comp); + BT_ASSERT_DBG(muxer_msg_iter); + BT_ASSERT_DBG(muxer_upstream_msg_iter); *muxer_upstream_msg_iter = NULL; for (i = 0; i < muxer_msg_iter->active_muxer_upstream_msg_iters->len; @@ -813,9 +813,9 @@ muxer_msg_iter_youngest_upstream_msg_iter( continue; } - BT_ASSERT(cur_muxer_upstream_msg_iter->msgs->length > 0); + BT_ASSERT_DBG(cur_muxer_upstream_msg_iter->msgs->length > 0); msg = g_queue_peek_head(cur_muxer_upstream_msg_iter->msgs); - BT_ASSERT(msg); + BT_ASSERT_DBG(msg); if (G_UNLIKELY(bt_message_get_type(msg) == BT_MESSAGE_TYPE_STREAM_BEGINNING)) { @@ -1067,15 +1067,16 @@ bt_component_class_message_iterator_next_method_status muxer_msg_iter_do_next_on "muxer-upstream-msg-iter-wrap-addr=%p, " "ts=%" PRId64, muxer_msg_iter, muxer_upstream_msg_iter, next_return_ts); - BT_ASSERT(status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK); - BT_ASSERT(muxer_upstream_msg_iter); + BT_ASSERT_DBG(status == + BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK); + BT_ASSERT_DBG(muxer_upstream_msg_iter); /* * Consume from the queue's head: other side * (muxer_upstream_msg_iter_next()) writes to the tail. */ *msg = g_queue_pop_head(muxer_upstream_msg_iter->msgs); - BT_ASSERT(*msg); + BT_ASSERT_DBG(*msg); muxer_msg_iter->last_returned_ts_ns = next_return_ts; end: @@ -1349,12 +1350,12 @@ bt_component_class_message_iterator_next_method_status muxer_msg_iter_next( bt_self_component *self_comp = NULL; struct muxer_comp *muxer_comp = NULL; - BT_ASSERT(muxer_msg_iter); + BT_ASSERT_DBG(muxer_msg_iter); self_comp = bt_self_message_iterator_borrow_component( self_msg_iter); - BT_ASSERT(self_comp); + BT_ASSERT_DBG(self_comp); muxer_comp = bt_self_component_get_data(self_comp); - BT_ASSERT(muxer_comp); + BT_ASSERT_DBG(muxer_comp); BT_COMP_LOGT("Muxer component's message iterator's \"next\" method called: " "comp-addr=%p, muxer-comp-addr=%p, muxer-msg-iter-addr=%p, " "msg-iter-addr=%p", diff --git a/src/plugins/utils/trimmer/trimmer.c b/src/plugins/utils/trimmer/trimmer.c index dc707008..889845a1 100644 --- a/src/plugins/utils/trimmer/trimmer.c +++ b/src/plugins/utils/trimmer/trimmer.c @@ -776,9 +776,9 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin, const bt_clock_snapshot *clock_snapshot = NULL; int ret = 0; - BT_ASSERT(msg); - BT_ASSERT(ns_from_origin); - BT_ASSERT(has_clock_snapshot); + BT_ASSERT_DBG(msg); + BT_ASSERT_DBG(ns_from_origin); + BT_ASSERT_DBG(has_clock_snapshot); switch (bt_message_get_type(msg)) { case BT_MESSAGE_TYPE_EVENT: @@ -986,7 +986,7 @@ state_set_trimmer_iterator_bounds( continue; } - BT_ASSERT(ns_from_origin != INT64_MIN && + BT_ASSERT_DBG(ns_from_origin != INT64_MIN && ns_from_origin != INT64_MAX); put_messages(msgs, count); goto found; @@ -1377,9 +1377,9 @@ struct trimmer_iterator_stream_state *get_stream_state_entry( { struct trimmer_iterator_stream_state *sstate; - BT_ASSERT(stream); + BT_ASSERT_DBG(stream); sstate = g_hash_table_lookup(trimmer_it->stream_states, stream); - BT_ASSERT(sstate); + BT_ASSERT_DBG(sstate); return sstate; } @@ -1428,7 +1428,7 @@ handle_message_with_stream( * class has a clock class. And we know it has, otherwise we * couldn't be using the trimmer component. */ - BT_ASSERT(ns_from_origin); + BT_ASSERT_DBG(ns_from_origin); if (G_UNLIKELY(!trimmer_it->end.is_infinite && *ns_from_origin > trimmer_it->end.ns_from_origin)) { @@ -1766,7 +1766,7 @@ void fill_message_array_from_output_messages( (*count)++; } - BT_ASSERT(*count > 0); + BT_ASSERT_DBG(*count > 0); } static inline @@ -1823,7 +1823,7 @@ state_trim(struct trimmer_iterator *trimmer_it, goto end; } - BT_ASSERT(my_count > 0); + BT_ASSERT_DBG(my_count > 0); for (i = 0; i < my_count; i++) { status = handle_message(trimmer_it, my_msgs[i], @@ -1866,7 +1866,7 @@ state_trim(struct trimmer_iterator *trimmer_it, * There's at least one message in the output message queue: * move the messages to the output message array. */ - BT_ASSERT(!g_queue_is_empty(trimmer_it->output_messages)); + BT_ASSERT_DBG(!g_queue_is_empty(trimmer_it->output_messages)); fill_message_array_from_output_messages(trimmer_it, msgs, capacity, count); @@ -1885,7 +1885,7 @@ bt_component_class_message_iterator_next_method_status trimmer_msg_iter_next( bt_component_class_message_iterator_next_method_status status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; - BT_ASSERT(trimmer_it); + BT_ASSERT_DBG(trimmer_it); if (G_LIKELY(trimmer_it->state == TRIMMER_ITERATOR_STATE_TRIM)) { status = state_trim(trimmer_it, msgs, capacity, count);