event->event_class = bt_get(event_class);
event->clock_values = g_hash_table_new_full(g_direct_hash,
g_direct_equal, bt_put, bt_put);
- event_header =
- bt_ctf_field_create(validation_output.event_header_type);
- if (!event_header) {
- BT_LOGE_STR("Cannot create initial event header field object.");
- goto error;
+
+ if (validation_output.event_header_type) {
+ BT_LOGD("Creating initial event header field: ft-addr=%p",
+ validation_output.event_header_type);
+ event_header =
+ bt_ctf_field_create(validation_output.event_header_type);
+ if (!event_header) {
+ BT_LOGE_STR("Cannot create initial event header field object.");
+ goto error;
+ }
}
if (validation_output.stream_event_ctx_type) {
+ BT_LOGD("Creating initial stream event context field: ft-addr=%p",
+ validation_output.stream_event_ctx_type);
stream_event_context = bt_ctf_field_create(
validation_output.stream_event_ctx_type);
if (!stream_event_context) {
}
if (validation_output.event_context_type) {
+ BT_LOGD("Creating initial event context field: ft-addr=%p",
+ validation_output.event_context_type);
event_context = bt_ctf_field_create(
validation_output.event_context_type);
if (!event_context) {
}
if (validation_output.event_payload_type) {
+ BT_LOGD("Creating initial event payload field: ft-addr=%p",
+ validation_output.event_payload_type);
event_payload = bt_ctf_field_create(
validation_output.event_payload_type);
if (!event_payload) {
*/
#define BT_LOG_TAG "PACKET"
+#include <babeltrace/lib-logging-internal.h>
#include <babeltrace/ctf-ir/fields-internal.h>
#include <babeltrace/ctf-ir/packet.h>
#include <babeltrace/ctf-ir/stream.h>
#include <babeltrace/ctf-ir/stream-internal.h>
#include <babeltrace/ctf-ir/trace-internal.h>
-#include <babeltrace/lib-logging-internal.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/ref.h>
+#include <inttypes.h>
struct bt_ctf_stream *bt_ctf_packet_get_stream(struct bt_ctf_packet *packet)
{
struct bt_ctf_stream_class *stream_class = NULL;
struct bt_ctf_trace *trace = NULL;
- BT_LOGD("Creating packet object: stream-addr=%p", stream);
-
if (!stream) {
BT_LOGW_STR("Invalid parameter: stream is NULL.");
goto end;
}
+ BT_LOGD("Creating packet object: stream-addr=%p, "
+ "stream-name=\"%s\", stream-class-addr=%p, "
+ "stream-class-name=\"%s\", stream-class-id=%" PRId64,
+ stream, bt_ctf_stream_get_name(stream),
+ stream->stream_class,
+ bt_ctf_stream_class_get_name(stream->stream_class),
+ bt_ctf_stream_class_get_id(stream->stream_class));
+
if (stream->pos.fd >= 0) {
BT_LOGW_STR("Invalid parameter: stream is a CTF writer stream.");
goto end;
bt_object_init(packet, bt_ctf_packet_destroy);
packet->stream = bt_get(stream);
- packet->header = bt_ctf_field_create(trace->packet_header_type);
- if (!packet->header && trace->packet_header_type) {
- BT_LOGE_STR("Cannot create initial packet header field object.");
- BT_PUT(packet);
- goto end;
+
+ if (trace->packet_header_type) {
+ BT_LOGD("Creating initial packet header field: ft-addr=%p",
+ trace->packet_header_type);
+ packet->header = bt_ctf_field_create(trace->packet_header_type);
+ if (!packet->header) {
+ BT_LOGE_STR("Cannot create initial packet header field object.");
+ BT_PUT(packet);
+ goto end;
+ }
}
- packet->context = bt_ctf_field_create(
- stream->stream_class->packet_context_type);
- if (!packet->context && stream->stream_class->packet_context_type) {
- BT_LOGE_STR("Cannot create initial packet header field object.");
- BT_PUT(packet);
- goto end;
+ if (stream->stream_class->packet_context_type) {
+ BT_LOGD("Creating initial packet context field: ft-addr=%p",
+ stream->stream_class->packet_context_type);
+ packet->context = bt_ctf_field_create(
+ stream->stream_class->packet_context_type);
+ if (!packet->context) {
+ BT_LOGE_STR("Cannot create initial packet header field object.");
+ BT_PUT(packet);
+ goto end;
+ }
}
BT_LOGD("Created packet object: addr=%p", packet);