projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: text output missing separator when printing the domain
[babeltrace.git]
/
formats
/
ctf-text
/
ctf-text.c
diff --git
a/formats/ctf-text/ctf-text.c
b/formats/ctf-text/ctf-text.c
index f60fde62f5fa794b749f91e0201fc92672f0a389..16f156de6929d3d5aedd68a77e89f24725120f98 100644
(file)
--- a/
formats/ctf-text/ctf-text.c
+++ b/
formats/ctf-text/ctf-text.c
@@
-31,6
+31,7
@@
#include <babeltrace/ctf/metadata.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/ctf/events-internal.h>
#include <babeltrace/ctf/metadata.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/ctf/events-internal.h>
+#include <babeltrace/trace-debug-info.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <errno.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <errno.h>
@@
-59,7
+60,8
@@
int opt_all_field_names,
opt_loglevel_field,
opt_emf_field,
opt_callsite_field,
opt_loglevel_field,
opt_emf_field,
opt_callsite_field,
- opt_delta_field = 1;
+ opt_delta_field = 1,
+ opt_debug_info_full_path;
enum field_item {
ITEM_SCOPE,
enum field_item {
ITEM_SCOPE,
@@
-115,7
+117,8
@@
static GQuark Q_STREAM_PACKET_CONTEXT_TIMESTAMP_BEGIN,
Q_STREAM_PACKET_CONTEXT_TIMESTAMP_END,
Q_STREAM_PACKET_CONTEXT_EVENTS_DISCARDED,
Q_STREAM_PACKET_CONTEXT_CONTENT_SIZE,
Q_STREAM_PACKET_CONTEXT_TIMESTAMP_END,
Q_STREAM_PACKET_CONTEXT_EVENTS_DISCARDED,
Q_STREAM_PACKET_CONTEXT_CONTENT_SIZE,
- Q_STREAM_PACKET_CONTEXT_PACKET_SIZE;
+ Q_STREAM_PACKET_CONTEXT_PACKET_SIZE,
+ Q_STREAM_PACKET_CONTEXT_PACKET_SEQ_NUM;
static
void __attribute__((constructor)) init_quarks(void)
static
void __attribute__((constructor)) init_quarks(void)
@@
-125,6
+128,7
@@
void __attribute__((constructor)) init_quarks(void)
Q_STREAM_PACKET_CONTEXT_EVENTS_DISCARDED = g_quark_from_static_string("stream.packet.context.events_discarded");
Q_STREAM_PACKET_CONTEXT_CONTENT_SIZE = g_quark_from_static_string("stream.packet.context.content_size");
Q_STREAM_PACKET_CONTEXT_PACKET_SIZE = g_quark_from_static_string("stream.packet.context.packet_size");
Q_STREAM_PACKET_CONTEXT_EVENTS_DISCARDED = g_quark_from_static_string("stream.packet.context.events_discarded");
Q_STREAM_PACKET_CONTEXT_CONTENT_SIZE = g_quark_from_static_string("stream.packet.context.content_size");
Q_STREAM_PACKET_CONTEXT_PACKET_SIZE = g_quark_from_static_string("stream.packet.context.packet_size");
+ Q_STREAM_PACKET_CONTEXT_PACKET_SEQ_NUM = g_quark_from_static_string("stream.packet.context.packet_seq_num");
}
static
}
static
@@
-135,6
+139,14
@@
struct ctf_callsite_dups *ctf_trace_callsite_lookup(struct ctf_trace *trace,
(gpointer) (unsigned long) callsite_name);
}
(gpointer) (unsigned long) callsite_name);
}
+void bt_ctf_text_hook(void)
+{
+ /*
+ * Dummy function to prevent the linker from discarding this format as
+ * "unused" in static builds.
+ */
+}
+
int print_field(struct bt_definition *definition)
{
/* Print all fields in verbose mode */
int print_field(struct bt_definition *definition)
{
/* Print all fields in verbose mode */
@@
-152,6
+164,8
@@
int print_field(struct bt_definition *definition)
return 0;
if (definition->path == Q_STREAM_PACKET_CONTEXT_PACKET_SIZE)
return 0;
return 0;
if (definition->path == Q_STREAM_PACKET_CONTEXT_PACKET_SIZE)
return 0;
+ if (definition->path == Q_STREAM_PACKET_CONTEXT_PACKET_SEQ_NUM)
+ return 0;
return 1;
}
return 1;
}
@@
-233,7
+247,6
@@
const char *print_loglevel(int value)
static
int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *stream)
static
int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *stream)
-
{
struct ctf_text_stream_pos *pos =
container_of(ppos, struct ctf_text_stream_pos, parent);
{
struct ctf_text_stream_pos *pos =
container_of(ppos, struct ctf_text_stream_pos, parent);
@@
-262,12
+275,7
@@
int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definitio
return -EINVAL;
}
return -EINVAL;
}
- /* Print events discarded */
- if (stream->events_discarded) {
- fflush(pos->fp);
- ctf_print_discarded(stderr, stream);
- stream->events_discarded = 0;
- }
+ handle_debug_info_event(stream_class, event);
if (stream->has_timestamp) {
set_field_names_print(pos, ITEM_HEADER);
if (stream->has_timestamp) {
set_field_names_print(pos, ITEM_HEADER);
@@
-316,12
+324,12
@@
int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definitio
pos->last_cycles_timestamp = stream->cycles_timestamp;
}
pos->last_cycles_timestamp = stream->cycles_timestamp;
}
- if ((opt_trace_field || opt_all_fields) && stream_class->trace->path[0] != '\0') {
+ if ((opt_trace_field || opt_all_fields) && stream_class->trace->pa
rent.pa
th[0] != '\0') {
set_field_names_print(pos, ITEM_HEADER);
if (pos->print_names) {
fprintf(pos->fp, "trace = ");
}
set_field_names_print(pos, ITEM_HEADER);
if (pos->print_names) {
fprintf(pos->fp, "trace = ");
}
- fprintf(pos->fp, "%s", stream_class->trace->path);
+ fprintf(pos->fp, "%s", stream_class->trace->pa
rent.pa
th);
if (pos->print_names)
fprintf(pos->fp, ", ");
else
if (pos->print_names)
fprintf(pos->fp, ", ");
else
@@
-342,6
+350,8
@@
int ctf_text_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definitio
set_field_names_print(pos, ITEM_HEADER);
if (pos->print_names) {
fprintf(pos->fp, "trace:domain = ");
set_field_names_print(pos, ITEM_HEADER);
if (pos->print_names) {
fprintf(pos->fp, "trace:domain = ");
+ } else if (dom_print) {
+ fprintf(pos->fp, ":");
}
fprintf(pos->fp, "%s", stream_class->trace->env.domain);
if (pos->print_names)
}
fprintf(pos->fp, "%s", stream_class->trace->env.domain);
if (pos->print_names)
@@
-547,6
+557,10
@@
struct bt_trace_descriptor *ctf_text_open_trace(const char *path, int flags,
FILE *fp;
pos = g_new0(struct ctf_text_stream_pos, 1);
FILE *fp;
pos = g_new0(struct ctf_text_stream_pos, 1);
+ if (!pos) {
+ goto error;
+ }
+ init_trace_descriptor(&pos->trace_descriptor);
pos->last_real_timestamp = -1ULL;
pos->last_cycles_timestamp = -1ULL;
pos->last_real_timestamp = -1ULL;
pos->last_cycles_timestamp = -1ULL;
@@
-561,7
+575,9
@@
struct bt_trace_descriptor *ctf_text_open_trace(const char *path, int flags,
pos->fp = fp;
pos->parent.rw_table = write_dispatch_table;
pos->parent.event_cb = ctf_text_write_event;
pos->fp = fp;
pos->parent.rw_table = write_dispatch_table;
pos->parent.event_cb = ctf_text_write_event;
+ pos->parent.trace = &pos->trace_descriptor;
pos->print_names = 0;
pos->print_names = 0;
+ babeltrace_ctf_console_output++;
break;
case O_RDONLY:
default:
break;
case O_RDONLY:
default:
@@
-581,6
+597,8
@@
int ctf_text_close_trace(struct bt_trace_descriptor *td)
int ret;
struct ctf_text_stream_pos *pos =
container_of(td, struct ctf_text_stream_pos, trace_descriptor);
int ret;
struct ctf_text_stream_pos *pos =
container_of(td, struct ctf_text_stream_pos, trace_descriptor);
+
+ babeltrace_ctf_console_output--;
if (pos->fp != stdout) {
ret = fclose(pos->fp);
if (ret) {
if (pos->fp != stdout) {
ret = fclose(pos->fp);
if (ret) {
This page took
0.024696 seconds
and
4
git commands to generate.