#define BT_COMP_LOG_SELF_COMP (bfcr->self_comp)
#define BT_LOG_OUTPUT_LEVEL (bfcr->log_level)
#define BT_LOG_TAG "PLUGIN/CTF/BFCR"
-#include "plugins/comp-logging.h"
+#include "logging/comp-logging.h"
#include <stdlib.h>
#include <stdint.h>
* classes for which the common boundary is not the boundary of
* a byte cannot have different byte orders.
*
- * This is set to -1 on reset and when the last basic field class
- * was a string class.
+ * This is set to CTF_BYTE_ORDER_UNKNOWN on reset and when the last
+ * basic field class was a string class.
*/
enum ctf_byte_order last_bo;
{
switch (state) {
case BFCR_STATE_NEXT_FIELD:
- return "BFCR_STATE_NEXT_FIELD";
+ return "NEXT_FIELD";
case BFCR_STATE_ALIGN_BASIC:
- return "BFCR_STATE_ALIGN_BASIC";
+ return "ALIGN_BASIC";
case BFCR_STATE_ALIGN_COMPOUND:
- return "BFCR_STATE_ALIGN_COMPOUND";
+ return "ALIGN_COMPOUND";
case BFCR_STATE_READ_BASIC_BEGIN:
- return "BFCR_STATE_READ_BASIC_BEGIN";
+ return "READ_BASIC_BEGIN";
case BFCR_STATE_READ_BASIC_CONTINUE:
- return "BFCR_STATE_READ_BASIC_CONTINUE";
+ return "READ_BASIC_CONTINUE";
case BFCR_STATE_DONE:
- return "BFCR_STATE_DONE";
+ return "DONE";
default:
return "(unknown)";
}
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, "
bfcr->user.data);
break;
default:
- abort();
+ bt_common_abort();
}
return length;
static inline
unsigned int stack_size(struct stack *stack)
{
- BT_ASSERT(stack);
+ BT_ASSERT_DBG(stack);
return stack->size;
}
{
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",
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);
}
bt_bitfield_read_le(buf, uint8_t, at, field_size, v);
break;
default:
- abort();
+ bt_common_abort();
}
BT_COMP_LOGT("Read unsigned bit array: cur=%zu, size=%u, "
bt_bitfield_read_le(buf, uint8_t, at, field_size, v);
break;
default:
- abort();
+ bt_common_abort();
}
BT_COMP_LOGT("Read signed bit array: cur=%zu, size=%u, "
}
/* Always valid if last byte order is unknown */
- if (bfcr->last_bo == -1) {
+ if (bfcr->last_bo == CTF_BYTE_ORDER_UNKNOWN) {
goto end;
}
/* Always valid if next byte order is unknown */
- if (next_bo == -1) {
+ if (next_bo == CTF_BYTE_ORDER_UNKNOWN) {
goto end;
}
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;
}
default:
/* Only 32-bit and 64-bit fields are supported currently */
- abort();
+ bt_common_abort();
}
BT_COMP_LOGT("Read floating point number value: bfcr=%p, cur=%zu, val=%f",
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) {
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);
{
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:
status = read_basic_string_class_and_call(bfcr, true);
break;
default:
- abort();
+ bt_common_abort();
}
return status;
{
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:
status = read_basic_string_class_and_call(bfcr, false);
break;
default:
- abort();
+ bt_common_abort();
}
return status;
* 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);
stack_clear(bfcr->stack);
stitch_reset(bfcr);
bfcr->buf.addr = NULL;
- bfcr->last_bo = -1;
+ bfcr->last_bo = CTF_BYTE_ORDER_UNKNOWN;
}
static
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;
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;
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;
}