* SOFTWARE.
*/
+#define BT_LOG_TAG "CLI-CFG-CLI-ARGS"
+#include "logging.h"
+
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "babeltrace-cfg-cli-args.h"
#include "babeltrace-cfg-cli-args-connect.h"
-#define BT_LOG_TAG "CLI-CFG-ARGS"
-#include "logging.h"
-
/*
* Error printf() macro which prepends "Error: " the first time it's
* called. This gives a nicer feel than having a bunch of error prefixes
const char *envvar;
if (bt_common_is_setuid_setgid()) {
- printf_debug("Skipping non-system plugin paths for setuid/setgid binary\n");
+ BT_LOGI_STR("Skipping non-system plugin paths for setuid/setgid binary.");
goto end;
}
if (!omit_home_plugin_path) {
if (bt_common_is_setuid_setgid()) {
- printf_debug("Skipping non-system plugin paths for setuid/setgid binary\n");
+ BT_LOGI_STR("Skipping non-system plugin paths for setuid/setgid binary.");
} else {
char *home_plugin_dir =
bt_common_get_home_plugin_path();
int ret = 0;
if (bt_common_is_setuid_setgid()) {
- printf_debug("Skipping non-system plugin paths for setuid/setgid binary\n");
+ BT_LOGI_STR("Skipping non-system plugin paths for setuid/setgid binary.");
goto end;
}
leftover = poptGetArg(pc);
if (leftover) {
- if (!plug_comp_cls_names) {
+ if (plug_comp_cls_names) {
printf_err("Cannot specify plugin name and --component component class:\n %s\n",
leftover);
goto error;
{
struct bt_config *cfg = NULL;
const char **argv;
- size_t i;
+ int64_t i, len;
const size_t argc = bt_value_array_size(run_args) + 1;
argv = calloc(argc, sizeof(*argv));
argv[0] = "run";
- for (i = 0; i < bt_value_array_size(run_args); i++) {
+ len = bt_value_array_size(run_args);
+ if (len < 0) {
+ printf_err("Invalid executable arguments\n");
+ goto end;
+ }
+ for (i = 0; i < len; i++) {
int ret;
struct bt_value *arg_value = bt_value_array_get(run_args, i);
const char *arg;
fprintf(fp, " `text`:\n");
fprintf(fp, " Create an implicit `sink.text.pretty`\n");
fprintf(fp, " component\n");
- fprintf(fp, " `text`:\n");
+ fprintf(fp, " `ctf`:\n");
fprintf(fp, " Create an implicit `sink.ctf.fs`\n");
fprintf(fp, " component\n");
fprintf(fp, " `dummy`:\n");
bool got_output_format_opt = false;
bool trimmer_has_begin = false;
bool trimmer_has_end = false;
+ bool stream_intersection_mode = false;
GString *cur_name = NULL;
GString *cur_name_prefix = NULL;
const char *leftover = NULL;
break;
case OPT_CLOCK_FORCE_CORRELATE:
append_implicit_component_param(
- &implicit_muxer_args, "assume-absolute-clock-classes", "yes");
+ &implicit_muxer_args,
+ "assume-absolute-clock-classes", "yes");
break;
case OPT_CLOCK_GMT:
append_implicit_component_param(
&implicit_text_args, "clock-gmt", "yes");
+ append_implicit_component_param(
+ &implicit_trimmer_args, "clock-gmt", "yes");
implicit_text_args.exists = true;
break;
case OPT_CLOCK_OFFSET:
base_implicit_ctf_input_args.exists = true;
- ret = append_implicit_component_extra_param(
- &base_implicit_ctf_input_args, "clock-offset-cycles", arg);
- if (ret) {
- goto error;
- }
+ append_implicit_component_param(
+ &base_implicit_ctf_input_args,
+ "clock-class-offset-s", arg);
break;
case OPT_CLOCK_OFFSET_NS:
base_implicit_ctf_input_args.exists = true;
- ret = append_implicit_component_extra_param(
- &base_implicit_ctf_input_args,
- "clock-offset-ns", arg);
- if (ret) {
- goto error;
- }
+ append_implicit_component_param(
+ &base_implicit_ctf_input_args,
+ "clock-class-offset-ns", arg);
break;
case OPT_CLOCK_SECONDS:
append_implicit_component_param(
print_run_args_0 = true;
break;
case OPT_STREAM_INTERSECTION:
- append_implicit_component_param(
- &base_implicit_ctf_input_args,
- "stream-intersection", "yes");
- base_implicit_ctf_input_args.exists = true;
+ /*
+ * Applies to all traces implementing the trace-info
+ * query.
+ */
+ stream_intersection_mode = true;
break;
case OPT_VERBOSE:
if (*log_level != 'V' && *log_level != 'D') {
* here.
*/
if (print_run_args || print_run_args_0) {
+ if (stream_intersection_mode) {
+ printf_err("Cannot specify --stream-intersection with --run-args or --run-args-0\n");
+ goto error;
+ }
+
for (i = 0; i < bt_value_array_size(run_args); i++) {
struct bt_value *arg_value =
bt_value_array_get(run_args, i);
goto error;
}
+ cfg->cmd_data.run.stream_intersection_mode = stream_intersection_mode;
goto end;
error: