4 * Babeltrace Trace Converter
6 * Copyright 2010-2011 EfficiOS Inc. and Linux Foundation
8 * Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this software and associated documentation files (the "Software"), to deal
12 * in the Software without restriction, including without limitation the rights
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 #include <babeltrace/babeltrace.h>
30 #include <babeltrace/format.h>
31 #include <babeltrace/context.h>
32 #include <babeltrace/context-internal.h>
33 #include <babeltrace/ctf/types.h>
34 #include <babeltrace/ctf/events.h>
35 /* TODO: fix object model for format-agnostic callbacks */
36 #include <babeltrace/ctf/events-internal.h>
37 #include <babeltrace/ctf/iterator.h>
38 #include <babeltrace/ctf-text/types.h>
39 #include <babeltrace/iterator.h>
45 #include <sys/types.h>
52 #include <babeltrace/ctf-ir/metadata.h> /* for clocks */
54 #define PARTIAL_ERROR_SLEEP 3 /* 3 seconds */
56 #define DEFAULT_FILE_ARRAY_SIZE 1
58 #define NET_URL_PREFIX "net://"
59 #define NET4_URL_PREFIX "net4://"
60 #define NET6_URL_PREFIX "net6://"
62 static char *opt_input_format
, *opt_output_format
;
65 * We are not freeing opt_input_paths ipath elements when exiting from
66 * main() for backward compatibility with libpop 0.13, which does not
67 * allocate copies for arguments returned by poptGetArg(), and for
68 * general compatibility with the documented behavior. This is known to
69 * cause a small memory leak with libpop 0.16.
71 static GPtrArray
*opt_input_paths
;
72 static char *opt_output_path
;
73 int opt_stream_intersection
;
75 static struct bt_format
*fmt_read
;
78 void strlower(char *str
)
81 *str
= tolower((int) *str
);
104 OPT_CLOCK_FORCE_CORRELATE
,
105 OPT_STREAM_INTERSECTION
,
109 * We are _not_ using POPT_ARG_STRING ability to store directly into
110 * variables, because we want to cast the return to non-const, which is
111 * not possible without using poptGetOptArg explicitly. This helps us
112 * controlling memory allocation correctly without making assumptions
113 * about undocumented behaviors. poptGetOptArg is documented as
114 * requiring the returned const char * to be freed by the caller.
116 static struct poptOption long_options
[] = {
117 /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
118 { "output", 'w', POPT_ARG_STRING
, NULL
, OPT_OUTPUT_PATH
, NULL
, NULL
},
119 { "input-format", 'i', POPT_ARG_STRING
, NULL
, OPT_INPUT_FORMAT
, NULL
, NULL
},
120 { "output-format", 'o', POPT_ARG_STRING
, NULL
, OPT_OUTPUT_FORMAT
, NULL
, NULL
},
121 { "help", 'h', POPT_ARG_NONE
, NULL
, OPT_HELP
, NULL
, NULL
},
122 { "list", 'l', POPT_ARG_NONE
, NULL
, OPT_LIST
, NULL
, NULL
},
123 { "verbose", 'v', POPT_ARG_NONE
, NULL
, OPT_VERBOSE
, NULL
, NULL
},
124 { "debug", 'd', POPT_ARG_NONE
, NULL
, OPT_DEBUG
, NULL
, NULL
},
125 { "names", 'n', POPT_ARG_STRING
, NULL
, OPT_NAMES
, NULL
, NULL
},
126 { "fields", 'f', POPT_ARG_STRING
, NULL
, OPT_FIELDS
, NULL
, NULL
},
127 { "no-delta", 0, POPT_ARG_NONE
, NULL
, OPT_NO_DELTA
, NULL
, NULL
},
128 { "clock-offset", 0, POPT_ARG_STRING
, NULL
, OPT_CLOCK_OFFSET
, NULL
, NULL
},
129 { "clock-offset-ns", 0, POPT_ARG_STRING
, NULL
, OPT_CLOCK_OFFSET_NS
, NULL
, NULL
},
130 { "clock-cycles", 0, POPT_ARG_NONE
, NULL
, OPT_CLOCK_CYCLES
, NULL
, NULL
},
131 { "clock-seconds", 0, POPT_ARG_NONE
, NULL
, OPT_CLOCK_SECONDS
, NULL
, NULL
},
132 { "clock-date", 0, POPT_ARG_NONE
, NULL
, OPT_CLOCK_DATE
, NULL
, NULL
},
133 { "clock-gmt", 0, POPT_ARG_NONE
, NULL
, OPT_CLOCK_GMT
, NULL
, NULL
},
134 { "clock-force-correlate", 0, POPT_ARG_NONE
, NULL
, OPT_CLOCK_FORCE_CORRELATE
, NULL
, NULL
},
135 { "stream-intersection", 0, POPT_ARG_NONE
, NULL
, OPT_STREAM_INTERSECTION
, NULL
, NULL
},
136 { NULL
, 0, 0, NULL
, 0, NULL
, NULL
},
139 static void list_formats(FILE *fp
)
142 bt_fprintf_format_list(fp
);
145 static void usage(FILE *fp
)
147 fprintf(fp
, "BabelTrace Trace Viewer and Converter %s\n\n", VERSION
);
148 fprintf(fp
, "usage : babeltrace [OPTIONS] FILE...\n");
150 fprintf(fp
, " FILE Input trace file(s) and/or directory(ies)\n");
151 fprintf(fp
, " (space-separated)\n");
152 fprintf(fp
, " -w, --output OUTPUT Output trace path (default: stdout)\n");
154 fprintf(fp
, " -i, --input-format FORMAT Input trace format (default: ctf)\n");
155 fprintf(fp
, " -o, --output-format FORMAT Output trace format (default: text)\n");
157 fprintf(fp
, " -h, --help This help message\n");
158 fprintf(fp
, " -l, --list List available formats\n");
159 fprintf(fp
, " -v, --verbose Verbose mode\n");
160 fprintf(fp
, " (or set BABELTRACE_VERBOSE environment variable)\n");
161 fprintf(fp
, " -d, --debug Debug mode\n");
162 fprintf(fp
, " (or set BABELTRACE_DEBUG environment variable)\n");
163 fprintf(fp
, " --no-delta Do not print time delta between consecutive events\n");
164 fprintf(fp
, " -n, --names name1<,name2,...> Print field names:\n");
165 fprintf(fp
, " (payload OR args OR arg)\n");
166 fprintf(fp
, " none, all, scope, header, (context OR ctx)\n");
167 fprintf(fp
, " (default: payload,context)\n");
168 fprintf(fp
, " -f, --fields name1<,name2,...> Print additional fields:\n");
169 fprintf(fp
, " all, trace, trace:hostname, trace:domain,\n");
170 fprintf(fp
, " trace:procname, trace:vpid, loglevel, emf, callsite.\n");
171 fprintf(fp
, " (default: trace:hostname,trace:procname,trace:vpid)\n");
172 fprintf(fp
, " --clock-cycles Timestamp in cycles\n");
173 fprintf(fp
, " --clock-offset seconds Clock offset in seconds\n");
174 fprintf(fp
, " --clock-offset-ns ns Clock offset in nanoseconds\n");
175 fprintf(fp
, " --clock-seconds Print the timestamps as [sec.ns]\n");
176 fprintf(fp
, " (default is: [hh:mm:ss.ns])\n");
177 fprintf(fp
, " --clock-date Print clock date\n");
178 fprintf(fp
, " --clock-gmt Print clock in GMT time zone (default: local time zone)\n");
179 fprintf(fp
, " --clock-force-correlate Assume that clocks are inherently correlated\n");
180 fprintf(fp
, " across traces.\n");
181 fprintf(fp
, " --stream-intersection Only print events when all streams are active.\n");
186 static int get_names_args(poptContext
*pc
)
188 char *str
, *strlist
, *strctx
;
191 opt_payload_field_names
= 0;
192 opt_context_field_names
= 0;
193 strlist
= (char *) poptGetOptArg(*pc
);
197 str
= strtok_r(strlist
, ",", &strctx
);
199 if (!strcmp(str
, "all"))
200 opt_all_field_names
= 1;
201 else if (!strcmp(str
, "scope"))
202 opt_scope_field_names
= 1;
203 else if (!strcmp(str
, "context") || !strcmp(str
, "ctx"))
204 opt_context_field_names
= 1;
205 else if (!strcmp(str
, "header"))
206 opt_header_field_names
= 1;
207 else if (!strcmp(str
, "payload") || !strcmp(str
, "args") || !strcmp(str
, "arg"))
208 opt_payload_field_names
= 1;
209 else if (!strcmp(str
, "none")) {
210 opt_all_field_names
= 0;
211 opt_scope_field_names
= 0;
212 opt_context_field_names
= 0;
213 opt_header_field_names
= 0;
214 opt_payload_field_names
= 0;
216 fprintf(stderr
, "[error] unknown field name type %s\n", str
);
220 } while ((str
= strtok_r(NULL
, ",", &strctx
)));
226 static int get_fields_args(poptContext
*pc
)
228 char *str
, *strlist
, *strctx
;
231 strlist
= (char *) poptGetOptArg(*pc
);
235 str
= strtok_r(strlist
, ",", &strctx
);
237 opt_trace_default_fields
= 0;
238 if (!strcmp(str
, "all"))
240 else if (!strcmp(str
, "trace"))
242 else if (!strcmp(str
, "trace:hostname"))
243 opt_trace_hostname_field
= 1;
244 else if (!strcmp(str
, "trace:domain"))
245 opt_trace_domain_field
= 1;
246 else if (!strcmp(str
, "trace:procname"))
247 opt_trace_procname_field
= 1;
248 else if (!strcmp(str
, "trace:vpid"))
249 opt_trace_vpid_field
= 1;
250 else if (!strcmp(str
, "loglevel"))
251 opt_loglevel_field
= 1;
252 else if (!strcmp(str
, "emf"))
254 else if (!strcmp(str
, "callsite"))
255 opt_callsite_field
= 1;
257 fprintf(stderr
, "[error] unknown field type %s\n", str
);
261 } while ((str
= strtok_r(NULL
, ",", &strctx
)));
268 * Return 0 if caller should continue, < 0 if caller should return
269 * error, > 0 if caller should exit without reporting error.
271 static int parse_options(int argc
, char **argv
)
279 return 1; /* exit cleanly */
282 pc
= poptGetContext(NULL
, argc
, (const char **) argv
, long_options
, 0);
283 poptReadDefaultConfig(pc
, 0);
286 opt_context_field_names
= 1;
287 opt_payload_field_names
= 1;
289 while ((opt
= poptGetNextOpt(pc
)) != -1) {
291 case OPT_OUTPUT_PATH
:
292 opt_output_path
= (char *) poptGetOptArg(pc
);
293 if (!opt_output_path
) {
298 case OPT_INPUT_FORMAT
:
299 opt_input_format
= (char *) poptGetOptArg(pc
);
300 if (!opt_input_format
) {
305 case OPT_OUTPUT_FORMAT
:
306 opt_output_format
= (char *) poptGetOptArg(pc
);
307 if (!opt_output_format
) {
314 ret
= 1; /* exit cleanly */
317 list_formats(stdout
);
321 babeltrace_verbose
= 1;
324 if (get_names_args(&pc
)) {
330 if (get_fields_args(&pc
)) {
336 babeltrace_debug
= 1;
341 case OPT_CLOCK_CYCLES
:
342 opt_clock_cycles
= 1;
344 case OPT_CLOCK_OFFSET
:
349 str
= (char *) poptGetOptArg(pc
);
351 fprintf(stderr
, "[error] Missing --clock-offset argument\n");
356 opt_clock_offset
= strtoull(str
, &endptr
, 0);
357 if (*endptr
!= '\0' || str
== endptr
|| errno
!= 0) {
358 fprintf(stderr
, "[error] Incorrect --clock-offset argument: %s\n", str
);
366 case OPT_CLOCK_SECONDS
:
367 opt_clock_seconds
= 1;
369 case OPT_CLOCK_OFFSET_NS
:
374 str
= (char *) poptGetOptArg(pc
);
376 fprintf(stderr
, "[error] Missing --clock-offset-ns argument\n");
381 opt_clock_offset_ns
= strtoull(str
, &endptr
, 0);
382 if (*endptr
!= '\0' || str
== endptr
|| errno
!= 0) {
383 fprintf(stderr
, "[error] Incorrect --clock-offset-ns argument: %s\n", str
);
398 case OPT_CLOCK_FORCE_CORRELATE
:
399 opt_clock_force_correlate
= 1;
401 case OPT_STREAM_INTERSECTION
:
402 opt_stream_intersection
= 1;
412 ipath
= poptGetArg(pc
);
414 g_ptr_array_add(opt_input_paths
, (gpointer
) ipath
);
416 if (opt_input_paths
->len
== 0) {
428 static GPtrArray
*traversed_paths
= 0;
431 * traverse_trace_dir() is the callback function for File Tree Walk (nftw).
432 * it receives the path of the current entry (file, dir, link..etc) with
433 * a flag to indicate the type of the entry.
434 * if the entry being visited is a directory and contains a metadata file,
435 * then add the path to a global list to be processed later in
436 * add_traces_recursive.
438 static int traverse_trace_dir(const char *fpath
, const struct stat
*sb
,
439 int tflag
, struct FTW
*ftwbuf
)
447 dirfd
= open(fpath
, 0);
449 fprintf(stderr
, "[error] [Context] Unable to open trace "
450 "directory file descriptor.\n");
451 return 0; /* partial error */
453 metafd
= openat(dirfd
, "metadata", O_RDONLY
);
455 closeret
= close(dirfd
);
460 /* No meta data, just return */
465 closeret
= close(metafd
);
470 closeret
= close(dirfd
);
479 /* Add path to the global list */
480 if (traversed_paths
== NULL
) {
481 fprintf(stderr
, "[error] [Context] Invalid open path array.\n");
484 g_ptr_array_add(traversed_paths
, g_string_new(fpath
));
491 * bt_context_add_traces_recursive: Open a trace recursively
493 * Find each trace present in the subdirectory starting from the given
494 * path, and add them to the context. The packet_seek parameter can be
495 * NULL: this specify to use the default format packet_seek.
497 * Return: 0 on success, < 0 on failure, > 0 on partial failure.
498 * Unable to open toplevel: failure.
499 * Unable to open some subdirectory or file: warn and continue (partial
502 int bt_context_add_traces_recursive(struct bt_context
*ctx
, const char *path
,
503 const char *format_str
,
504 void (*packet_seek
)(struct bt_stream_pos
*pos
,
505 size_t offset
, int whence
))
507 int ret
= 0, trace_ids
= 0;
509 if ((strncmp(path
, NET4_URL_PREFIX
, sizeof(NET4_URL_PREFIX
) - 1)) == 0 ||
510 (strncmp(path
, NET6_URL_PREFIX
, sizeof(NET6_URL_PREFIX
) - 1)) == 0 ||
511 (strncmp(path
, NET_URL_PREFIX
, sizeof(NET_URL_PREFIX
) - 1)) == 0) {
512 ret
= bt_context_add_trace(ctx
,
513 path
, format_str
, packet_seek
, NULL
, NULL
);
515 fprintf(stderr
, "[warning] [Context] cannot open trace \"%s\" "
516 "for reading.\n", path
);
520 /* Should lock traversed_paths mutex here if used in multithread */
522 traversed_paths
= g_ptr_array_new();
523 ret
= nftw(path
, traverse_trace_dir
, 10, 0);
525 /* Process the array if ntfw did not return a fatal error */
529 for (i
= 0; i
< traversed_paths
->len
; i
++) {
530 GString
*trace_path
= g_ptr_array_index(traversed_paths
,
532 int trace_id
= bt_context_add_trace(ctx
,
539 fprintf(stderr
, "[warning] [Context] cannot open trace \"%s\" from %s "
540 "for reading.\n", trace_path
->str
, path
);
541 /* Allow to skip erroneous traces. */
542 ret
= 1; /* partial error */
546 g_string_free(trace_path
, TRUE
);
550 g_ptr_array_free(traversed_paths
, TRUE
);
551 traversed_paths
= NULL
;
553 /* Should unlock traversed paths mutex here if used in multithread */
556 * Return an error if no trace can be opened.
558 if (trace_ids
== 0) {
559 fprintf(stderr
, "[error] Cannot open any trace for reading.\n\n");
560 ret
= -ENOENT
; /* failure */
566 int trace_pre_handler(struct bt_trace_descriptor
*td_write
,
567 struct bt_context
*ctx
)
569 struct ctf_text_stream_pos
*sout
;
570 struct trace_collection
*tc
;
573 sout
= container_of(td_write
, struct ctf_text_stream_pos
,
576 if (!sout
->parent
.pre_trace_cb
)
580 for (i
= 0; i
< tc
->array
->len
; i
++) {
581 struct bt_trace_descriptor
*td
=
582 g_ptr_array_index(tc
->array
, i
);
584 ret
= sout
->parent
.pre_trace_cb(&sout
->parent
, td
);
586 fprintf(stderr
, "[error] Writing to trace pre handler failed.\n");
596 int trace_post_handler(struct bt_trace_descriptor
*td_write
,
597 struct bt_context
*ctx
)
599 struct ctf_text_stream_pos
*sout
;
600 struct trace_collection
*tc
;
603 sout
= container_of(td_write
, struct ctf_text_stream_pos
,
606 if (!sout
->parent
.post_trace_cb
)
610 for (i
= 0; i
< tc
->array
->len
; i
++) {
611 struct bt_trace_descriptor
*td
=
612 g_ptr_array_index(tc
->array
, i
);
614 ret
= sout
->parent
.post_trace_cb(&sout
->parent
, td
);
616 fprintf(stderr
, "[error] Writing to trace post handler failed.\n");
626 struct bt_ctf_iter
*iter_create_intersect(struct bt_context
*ctx
,
627 struct bt_iter_pos
*inter_begin_pos
,
628 struct bt_iter_pos
*inter_end_pos
)
630 uint64_t begin
= 0, end
= ULLONG_MAX
;
631 /* Useless but needed for bt_iter_create_time_pos. */
632 struct bt_iter bt_iter
;
635 ret
= ctf_find_packets_intersection(ctx
, &begin
, &end
);
637 fprintf(stderr
, "[error] No intersection found between trace files.\n");
640 } else if (ret
!= 0) {
643 inter_begin_pos
= bt_iter_create_time_pos(&bt_iter
, begin
);
644 if (!inter_begin_pos
) {
647 inter_end_pos
= bt_iter_create_time_pos(&bt_iter
, end
);
648 if (!inter_end_pos
) {
652 return bt_ctf_iter_create(ctx
, inter_begin_pos
,
659 int convert_trace(struct bt_trace_descriptor
*td_write
,
660 struct bt_context
*ctx
)
662 struct bt_ctf_iter
*iter
;
663 struct ctf_text_stream_pos
*sout
;
664 struct bt_iter_pos begin_pos
;
665 struct bt_iter_pos
*inter_begin_pos
= NULL
, *inter_end_pos
= NULL
;
666 struct bt_ctf_event
*ctf_event
;
669 sout
= container_of(td_write
, struct ctf_text_stream_pos
,
672 if (!sout
->parent
.event_cb
) {
676 if (opt_stream_intersection
) {
677 iter
= iter_create_intersect(ctx
, inter_begin_pos
, inter_end_pos
);
679 begin_pos
.type
= BT_SEEK_BEGIN
;
680 iter
= bt_ctf_iter_create(ctx
, &begin_pos
, NULL
);
686 while ((ctf_event
= bt_ctf_iter_read_event(iter
))) {
687 ret
= sout
->parent
.event_cb(&sout
->parent
, ctf_event
->parent
->stream
);
689 fprintf(stderr
, "[error] Writing event failed.\n");
692 ret
= bt_iter_next(bt_ctf_get_iter(iter
));
700 bt_ctf_iter_destroy(iter
);
702 if (inter_begin_pos
) {
703 bt_iter_free_pos(inter_begin_pos
);
706 bt_iter_free_pos(inter_end_pos
);
711 int main(int argc
, char **argv
)
713 int ret
, partial_error
= 0, open_success
= 0;
714 struct bt_format
*fmt_write
;
715 struct bt_trace_descriptor
*td_write
;
716 struct bt_context
*ctx
;
719 opt_input_paths
= g_ptr_array_new();
721 ret
= parse_options(argc
, argv
);
723 fprintf(stderr
, "Error parsing options.\n\n");
725 g_ptr_array_free(opt_input_paths
, TRUE
);
727 } else if (ret
> 0) {
728 g_ptr_array_free(opt_input_paths
, TRUE
);
731 printf_verbose("Verbose mode active.\n");
732 printf_debug("Debug mode active.\n");
734 if (opt_input_format
)
735 strlower(opt_input_format
);
736 if (opt_output_format
)
737 strlower(opt_output_format
);
739 printf_verbose("Converting from directory(ies):\n");
740 for (i
= 0; i
< opt_input_paths
->len
; i
++) {
741 const char *ipath
= g_ptr_array_index(opt_input_paths
, i
);
742 printf_verbose(" %s\n", ipath
);
744 printf_verbose("Converting from format: %s\n",
745 opt_input_format
? : "ctf <default>");
746 printf_verbose("Converting to target: %s\n",
747 opt_output_path
? : "<stdout>");
748 printf_verbose("Converting to format: %s\n",
749 opt_output_format
? : "text <default>");
751 if (!opt_input_format
) {
752 opt_input_format
= strdup("ctf");
753 if (!opt_input_format
) {
758 if (!opt_output_format
) {
759 opt_output_format
= strdup("text");
760 if (!opt_output_format
) {
765 fmt_read
= bt_lookup_format(g_quark_from_static_string(opt_input_format
));
767 fprintf(stderr
, "[error] Format \"%s\" is not supported.\n\n",
772 fmt_write
= bt_lookup_format(g_quark_from_static_string(opt_output_format
));
774 fprintf(stderr
, "[error] format \"%s\" is not supported.\n\n",
780 ctx
= bt_context_create();
785 for (i
= 0; i
< opt_input_paths
->len
; i
++) {
786 const char *ipath
= g_ptr_array_index(opt_input_paths
, i
);
787 ret
= bt_context_add_traces_recursive(ctx
, ipath
,
788 opt_input_format
, NULL
);
790 fprintf(stderr
, "[error] opening trace \"%s\" for reading.\n\n",
792 } else if (ret
> 0) {
793 fprintf(stderr
, "[warning] errors occurred when opening trace \"%s\" for reading, continuing anyway.\n\n",
795 open_success
= 1; /* some traces were OK */
798 open_success
= 1; /* all traces were OK */
802 fprintf(stderr
, "[error] none of the specified trace paths could be opened.\n\n");
806 td_write
= fmt_write
->open_trace(opt_output_path
, O_RDWR
, NULL
, NULL
);
808 fprintf(stderr
, "Error opening trace \"%s\" for writing.\n\n",
809 opt_output_path
? : "<none>");
814 * Errors happened when opening traces, but we continue anyway.
815 * sleep to let user see the stderr output before stdout.
818 sleep(PARTIAL_ERROR_SLEEP
);
820 ret
= trace_pre_handler(td_write
, ctx
);
822 fprintf(stderr
, "Error in trace pre handle.\n\n");
823 goto error_copy_trace
;
826 /* For now, we support only CTF iterators */
827 if (fmt_read
->name
== g_quark_from_static_string("ctf")) {
828 ret
= convert_trace(td_write
, ctx
);
830 fprintf(stderr
, "Error printing trace.\n\n");
831 goto error_copy_trace
;
835 ret
= trace_post_handler(td_write
, ctx
);
837 fprintf(stderr
, "Error in trace post handle.\n\n");
838 goto error_copy_trace
;
841 fmt_write
->close_trace(td_write
);
844 printf_verbose("finished converting. Output written to:\n%s\n",
845 opt_output_path
? : "<stdout>");
850 fmt_write
->close_trace(td_write
);
856 /* teardown and exit */
858 free(opt_input_format
);
859 free(opt_output_format
);
860 free(opt_output_path
);
861 g_ptr_array_free(opt_input_paths
, TRUE
);