Fix: POPT_ARG_LONGLONG does not exist in popt 1.13
[babeltrace.git] / cli / babeltrace-cfg-cli-args.c
index 394e9e65e318d216acb5611e6ff8ba5cec4c7d5e..bd1bcc530ed07d3c4b8fc9b167dffb4158a1bcb0 100644 (file)
@@ -22,6 +22,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "CLI-CFG-CLI-ARGS"
+#include "logging.h"
+
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -39,9 +42,6 @@
 #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
@@ -593,8 +593,8 @@ end:
  * component class name.
  *
  * On success, both *plugin and *component are not NULL. *plugin
- * and *component are owned by the caller. On success, *name can be NULL
- * if no component name was found, and *comp_cls_type is set.
+ * and *comp_cls are owned by the caller. On success, *name can be NULL
+ * if no component class name was found, and *comp_cls_type is set.
  */
 static
 void plugin_comp_cls_names(const char *arg, char **name, char **plugin,
@@ -656,7 +656,7 @@ void plugin_comp_cls_names(const char *arg, char **name, char **plugin,
        /* Parse the plugin name */
        gs_plugin = bt_common_string_until(at, ".:\\", ".", &end_pos);
        if (!gs_plugin || gs_plugin->len == 0 || at[end_pos] == '\0') {
-               printf_err("Missing plugin name\n");
+               printf_err("Missing plugin or component class name\n");
                goto error;
        }
 
@@ -909,6 +909,9 @@ void bt_config_destroy(struct bt_object *obj)
                if (cfg->cmd_data.print_ctf_metadata.path) {
                        g_string_free(cfg->cmd_data.print_ctf_metadata.path,
                                TRUE);
+                       g_string_free(
+                               cfg->cmd_data.print_ctf_metadata.output_path,
+                               TRUE);
                }
                break;
        case BT_CONFIG_COMMAND_PRINT_LTTNG_LIVE_SESSIONS:
@@ -916,6 +919,9 @@ void bt_config_destroy(struct bt_object *obj)
                        g_string_free(
                                cfg->cmd_data.print_lttng_live_sessions.url,
                                TRUE);
+                       g_string_free(
+                               cfg->cmd_data.print_lttng_live_sessions.output_path,
+                               TRUE);
                }
                break;
        default:
@@ -1305,6 +1311,7 @@ enum {
        OPT_COMPONENT,
        OPT_CONNECT,
        OPT_DEBUG,
+       OPT_DEBUG_INFO,
        OPT_DEBUG_INFO_DIR,
        OPT_DEBUG_INFO_FULL_PATH,
        OPT_DEBUG_INFO_TARGET_PREFIX,
@@ -1316,7 +1323,6 @@ enum {
        OPT_LIST,
        OPT_NAME,
        OPT_NAMES,
-       OPT_NO_DEBUG_INFO,
        OPT_NO_DELTA,
        OPT_OMIT_HOME_PLUGIN_PATH,
        OPT_OMIT_SYSTEM_PLUGIN_PATH,
@@ -1410,7 +1416,7 @@ int append_env_var_plugin_paths(struct bt_value *plugin_paths)
        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;
        }
 
@@ -1437,7 +1443,7 @@ int append_home_and_system_plugin_paths(struct bt_value *plugin_paths,
 
        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();
@@ -1659,6 +1665,12 @@ struct bt_config *bt_config_print_ctf_metadata_create(
                goto error;
        }
 
+       cfg->cmd_data.print_ctf_metadata.output_path = g_string_new(NULL);
+       if (!cfg->cmd_data.print_ctf_metadata.output_path) {
+               print_err_oom();
+               goto error;
+       }
+
        goto end;
 
 error:
@@ -1687,6 +1699,13 @@ struct bt_config *bt_config_print_lttng_live_sessions_create(
                goto error;
        }
 
+       cfg->cmd_data.print_lttng_live_sessions.output_path =
+               g_string_new(NULL);
+       if (!cfg->cmd_data.print_lttng_live_sessions.output_path) {
+               print_err_oom();
+               goto error;
+       }
+
        goto end;
 
 error:
@@ -1703,7 +1722,7 @@ int bt_config_append_plugin_paths_check_setuid_setgid(
        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;
        }
 
@@ -1763,13 +1782,10 @@ static
 void print_help_usage(FILE *fp)
 {
        fprintf(fp, "Usage: babeltrace [GENERAL OPTIONS] help [OPTIONS] PLUGIN\n");
-       fprintf(fp, "       babeltrace [GENERAL OPTIONS] help [OPTIONS] --component=TYPE.PLUGIN.CLS\n");
+       fprintf(fp, "       babeltrace [GENERAL OPTIONS] help [OPTIONS] TYPE.PLUGIN.CLS\n");
        fprintf(fp, "\n");
        fprintf(fp, "Options:\n");
        fprintf(fp, "\n");
-       fprintf(fp, "  -c, --component=TYPE.PLUGIN.CLS   Get help for the component class CLS of\n");
-       fprintf(fp, "                                    type TYPE (`source`, `filter`, or `sink`)\n");
-       fprintf(fp, "                                    found in the plugin PLUGIN\n");
        fprintf(fp, "      --omit-home-plugin-path       Omit home plugins from plugin search path\n");
        fprintf(fp, "                                    (~/.local/lib/babeltrace/plugins)\n");
        fprintf(fp, "      --omit-system-plugin-path     Omit system plugins from plugin search path\n");
@@ -1785,7 +1801,6 @@ void print_help_usage(FILE *fp)
 static
 struct poptOption help_long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "component", 'c', POPT_ARG_STRING, NULL, OPT_COMPONENT, NULL, NULL },
        { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
        { "omit-home-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_HOME_PLUGIN_PATH, NULL, NULL },
        { "omit-system-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_SYSTEM_PLUGIN_PATH, NULL, NULL },
@@ -1812,7 +1827,6 @@ struct bt_config *bt_config_help_from_args(int argc, const char *argv[],
        struct bt_config *cfg = NULL;
        const char *leftover;
        char *plugin_name = NULL, *comp_cls_name = NULL;
-       char *plug_comp_cls_names = NULL;
 
        *retcode = 0;
        cfg = bt_config_help_create(initial_plugin_paths);
@@ -1853,19 +1867,6 @@ struct bt_config *bt_config_help_from_args(int argc, const char *argv[],
                case OPT_OMIT_HOME_PLUGIN_PATH:
                        cfg->omit_home_plugin_path = true;
                        break;
-               case OPT_COMPONENT:
-                       if (plug_comp_cls_names) {
-                               printf_err("Cannot specify more than one plugin and component class:\n    %s\n",
-                                       arg);
-                               goto error;
-                       }
-
-                       plug_comp_cls_names = strdup(arg);
-                       if (!plug_comp_cls_names) {
-                               print_err_oom();
-                               goto error;
-                       }
-                       break;
                case OPT_HELP:
                        print_help_usage(stdout);
                        *retcode = -1;
@@ -1890,35 +1891,30 @@ struct bt_config *bt_config_help_from_args(int argc, const char *argv[],
 
        leftover = poptGetArg(pc);
        if (leftover) {
-               if (!plug_comp_cls_names) {
-                       printf_err("Cannot specify plugin name and --component component class:\n    %s\n",
-                               leftover);
-                       goto error;
-               }
-
-               g_string_assign(cfg->cmd_data.help.cfg_component->plugin_name,
-                       leftover);
-       } else {
-               if (!plug_comp_cls_names) {
-                       print_help_usage(stdout);
-                       *retcode = -1;
-                       BT_PUT(cfg);
-                       goto end;
-               }
-
-               plugin_comp_cls_names(plug_comp_cls_names, NULL,
+               plugin_comp_cls_names(leftover, NULL,
                        &plugin_name, &comp_cls_name,
                        &cfg->cmd_data.help.cfg_component->type);
                if (plugin_name && comp_cls_name) {
-                       g_string_assign(cfg->cmd_data.help.cfg_component->plugin_name,
+                       /* Component class help */
+                       g_string_assign(
+                               cfg->cmd_data.help.cfg_component->plugin_name,
                                plugin_name);
-                       g_string_assign(cfg->cmd_data.help.cfg_component->comp_cls_name,
+                       g_string_assign(
+                               cfg->cmd_data.help.cfg_component->comp_cls_name,
                                comp_cls_name);
                } else {
-                       printf_err("Invalid --component option's argument:\n    %s\n",
-                               plug_comp_cls_names);
-                       goto error;
+                       /* Fall back to plugin help */
+                       cfg->cmd_data.help.cfg_component->type =
+                               BT_COMPONENT_CLASS_TYPE_UNKNOWN;
+                       g_string_assign(
+                               cfg->cmd_data.help.cfg_component->plugin_name,
+                               leftover);
                }
+       } else {
+               print_help_usage(stdout);
+               *retcode = -1;
+               BT_PUT(cfg);
+               goto end;
        }
 
        if (append_home_and_system_plugin_paths_cfg(cfg)) {
@@ -1932,7 +1928,6 @@ error:
        BT_PUT(cfg);
 
 end:
-       free(plug_comp_cls_names);
        g_free(plugin_name);
        g_free(comp_cls_name);
 
@@ -1950,13 +1945,10 @@ end:
 static
 void print_query_usage(FILE *fp)
 {
-       fprintf(fp, "Usage: babeltrace [GEN OPTS] query [OPTS] OBJECT --component=TYPE.PLUGIN.CLS\n");
+       fprintf(fp, "Usage: babeltrace [GEN OPTS] query [OPTS] TYPE.PLUGIN.CLS OBJECT\n");
        fprintf(fp, "\n");
        fprintf(fp, "Options:\n");
        fprintf(fp, "\n");
-       fprintf(fp, "  -c, --component=TYPE.PLUGIN.CLS   Query the component class CLS of type TYPE\n");
-       fprintf(fp, "                                    (`source`, `filter`, or `sink`) found in\n");
-       fprintf(fp, "                                    the plugin PLUGIN\n");
        fprintf(fp, "      --omit-home-plugin-path       Omit home plugins from plugin search path\n");
        fprintf(fp, "                                    (~/.local/lib/babeltrace/plugins)\n");
        fprintf(fp, "      --omit-system-plugin-path     Omit system plugins from plugin search path\n");
@@ -1972,7 +1964,6 @@ void print_query_usage(FILE *fp)
 static
 struct poptOption query_long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
-       { "component", 'c', POPT_ARG_STRING, NULL, OPT_COMPONENT, NULL, NULL },
        { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
        { "omit-home-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_HOME_PLUGIN_PATH, NULL, NULL },
        { "omit-system-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_SYSTEM_PLUGIN_PATH, NULL, NULL },
@@ -2040,28 +2031,9 @@ struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
                case OPT_OMIT_HOME_PLUGIN_PATH:
                        cfg->omit_home_plugin_path = true;
                        break;
-               case OPT_COMPONENT:
-                       if (cfg->cmd_data.query.cfg_component) {
-                               printf_err("Cannot specify more than one plugin and component class:\n    %s\n",
-                                       arg);
-                               goto error;
-                       }
-
-                       cfg->cmd_data.query.cfg_component =
-                               bt_config_component_from_arg(arg);
-                       if (!cfg->cmd_data.query.cfg_component) {
-                               printf_err("Invalid format for --component option's argument:\n    %s\n",
-                                       arg);
-                               goto error;
-                       }
-
-                       /* Default parameters: null */
-                       bt_put(cfg->cmd_data.query.cfg_component->params);
-                       cfg->cmd_data.query.cfg_component->params =
-                               bt_value_null;
-                       break;
                case OPT_PARAMS:
                {
+                       bt_put(params);
                        params = bt_value_from_arg(arg);
                        if (!params) {
                                printf_err("Invalid format for --params option's argument:\n    %s\n",
@@ -2085,14 +2057,6 @@ struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
                arg = NULL;
        }
 
-       if (!cfg->cmd_data.query.cfg_component) {
-               printf_err("No target component class specified with --component option\n");
-               goto error;
-       }
-
-       assert(params);
-       BT_MOVE(cfg->cmd_data.query.cfg_component->params, params);
-
        /* Check for option parsing error */
        if (opt < -1) {
                printf_err("While parsing command-line options, at option %s: %s\n",
@@ -2101,9 +2065,28 @@ struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
        }
 
        /*
-        * We need exactly one leftover argument which is the
-        * mandatory object.
+        * We need exactly two leftover arguments which are the
+        * mandatory component class specification and query object.
         */
+       leftover = poptGetArg(pc);
+       if (leftover) {
+               cfg->cmd_data.query.cfg_component =
+                       bt_config_component_from_arg(leftover);
+               if (!cfg->cmd_data.query.cfg_component) {
+                       printf_err("Invalid format for component class specification:\n    %s\n",
+                               leftover);
+                       goto error;
+               }
+
+               assert(params);
+               BT_MOVE(cfg->cmd_data.query.cfg_component->params, params);
+       } else {
+               print_query_usage(stdout);
+               *retcode = -1;
+               BT_PUT(cfg);
+               goto end;
+       }
+
        leftover = poptGetArg(pc);
        if (leftover) {
                if (strlen(leftover) == 0) {
@@ -2140,7 +2123,7 @@ end:
                poptFreeContext(pc);
        }
 
-       BT_PUT(params);
+       bt_put(params);
        free(arg);
        return cfg;
 }
@@ -2391,7 +2374,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
        struct bt_value *connection_args = NULL;
        GString *cur_param_key = NULL;
        char error_buf[256] = { 0 };
-       long long retry_duration = -1;
+       long retry_duration = -1;
        struct poptOption run_long_options[] = {
                { "base-params", 'b', POPT_ARG_STRING, NULL, OPT_BASE_PARAMS, NULL, NULL },
                { "component", 'c', POPT_ARG_STRING, NULL, OPT_COMPONENT, NULL, NULL },
@@ -2404,7 +2387,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                { "params", 'p', POPT_ARG_STRING, NULL, OPT_PARAMS, NULL, NULL },
                { "plugin-path", '\0', POPT_ARG_STRING, NULL, OPT_PLUGIN_PATH, NULL, NULL },
                { "reset-base-params", 'r', POPT_ARG_NONE, NULL, OPT_RESET_BASE_PARAMS, NULL, NULL },
-               { "retry-duration", '\0', POPT_ARG_LONGLONG, &retry_duration, OPT_RETRY_DURATION, NULL, NULL },
+               { "retry-duration", '\0', POPT_ARG_LONG, &retry_duration, OPT_RETRY_DURATION, NULL, NULL },
                { "value", '\0', POPT_ARG_STRING, NULL, OPT_VALUE, NULL, NULL },
                { NULL, 0, '\0', NULL, 0, NULL, NULL },
        };
@@ -2719,7 +2702,7 @@ struct bt_config *bt_config_run_from_args_array(struct bt_value *run_args,
 {
        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));
@@ -2730,7 +2713,12 @@ struct bt_config *bt_config_run_from_args_array(struct bt_value *run_args,
 
        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;
@@ -2791,6 +2779,8 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "      --run-args-0                  Print the equivalent arguments for the\n");
        fprintf(fp, "                                    `run` command to the standard output,\n");
        fprintf(fp, "                                    formatted for `xargs -0`, and quit\n");
+       fprintf(fp, "      --stream-intersection         Only process events when all streams\n");
+       fprintf(fp, "                                    are active\n");
        fprintf(fp, "  -u, --url=URL                     Set the `url` string parameter of the\n");
        fprintf(fp, "                                    current component to URL\n");
        fprintf(fp, "  -h, --help                        Show this help and quit\n");
@@ -2799,8 +2789,6 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "\n");
        fprintf(fp, "      --clock-offset=SEC            Set clock offset to SEC seconds\n");
        fprintf(fp, "      --clock-offset-ns=NS          Set clock offset to NS ns\n");
-       fprintf(fp, "      --stream-intersection         Only process events when all streams\n");
-       fprintf(fp, "                                    are active\n");
        fprintf(fp, "\n");
        fprintf(fp, "Implicit `sink.text.pretty` component options:\n");
        fprintf(fp, "\n");
@@ -2844,6 +2832,8 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "\n");
        fprintf(fp, "Implicit `filter.lttng-utils.debug-info` component options:\n");
        fprintf(fp, "\n");
+       fprintf(fp, "      --debug-info                  Create an implicit\n");
+       fprintf(fp, "                                    `filter.lttng-utils.debug-info` component\n");
        fprintf(fp, "      --debug-info-dir=DIR          Search for debug info in directory DIR\n");
        fprintf(fp, "                                    instead of `/usr/lib/debug`\n");
        fprintf(fp, "      --debug-info-full-path        Show full debug info source and\n");
@@ -2852,8 +2842,6 @@ void print_convert_usage(FILE *fp)
        fprintf(fp, "                                    Use directory DIR as a prefix when\n");
        fprintf(fp, "                                    looking up executables during debug\n");
        fprintf(fp, "                                    info analysis\n");
-       fprintf(fp, "      --no-debug-info               Do not create an implicit\n");
-       fprintf(fp, "                                    `lttng-utils.debug-info` filter component\n");
        fprintf(fp, "\n");
        fprintf(fp, "Legacy options that still work:\n");
        fprintf(fp, "\n");
@@ -2868,7 +2856,7 @@ void print_convert_usage(FILE *fp)
        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");
@@ -2911,7 +2899,7 @@ struct poptOption convert_long_options[] = {
        { "input-format", 'i', POPT_ARG_STRING, NULL, OPT_INPUT_FORMAT, NULL, NULL },
        { "name", '\0', POPT_ARG_STRING, NULL, OPT_NAME, NULL, NULL },
        { "names", 'n', POPT_ARG_STRING, NULL, OPT_NAMES, NULL, NULL },
-       { "no-debug-info", '\0', POPT_ARG_NONE, NULL, OPT_NO_DEBUG_INFO, NULL, NULL },
+       { "debug-info", '\0', POPT_ARG_NONE, NULL, OPT_DEBUG_INFO, NULL, NULL },
        { "no-delta", '\0', POPT_ARG_NONE, NULL, OPT_NO_DELTA, NULL, NULL },
        { "omit-home-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_HOME_PLUGIN_PATH, NULL, NULL },
        { "omit-system-plugin-path", '\0', POPT_ARG_NONE, NULL, OPT_OMIT_SYSTEM_PLUGIN_PATH, NULL, NULL },
@@ -3548,7 +3536,7 @@ int fill_implicit_ctf_inputs_args(GPtrArray *implicit_ctf_inputs_args,
                BT_PUT(impl_args->extra_params);
                impl_args->extra_params =
                        bt_value_copy(base_implicit_ctf_input_args->extra_params);
-               if (!impl_args) {
+               if (!impl_args->extra_params) {
                        print_err_oom();
                        destroy_implicit_component_args(impl_args);
                        goto error;
@@ -3583,7 +3571,7 @@ end:
 static
 struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
-               bool force_omit_home_plugin_path, bool force_no_debug_info,
+               bool force_omit_home_plugin_path,
                struct bt_value *initial_plugin_paths, char *log_level)
 {
        poptContext pc = NULL;
@@ -3596,6 +3584,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
        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;
@@ -3657,7 +3646,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
        }
 
        if (init_implicit_component_args(&implicit_debug_info_args,
-                       "filter.lttng-utils.debug-info", !force_no_debug_info)) {
+                       "filter.lttng-utils.debug-info", false)) {
                goto error;
        }
 
@@ -3956,6 +3945,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                case OPT_CLOCK_SECONDS:
                case OPT_COLOR:
                case OPT_DEBUG:
+               case OPT_DEBUG_INFO:
                case OPT_DEBUG_INFO_DIR:
                case OPT_DEBUG_INFO_FULL_PATH:
                case OPT_DEBUG_INFO_TARGET_PREFIX:
@@ -3963,7 +3953,6 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                case OPT_FIELDS:
                case OPT_INPUT_FORMAT:
                case OPT_NAMES:
-               case OPT_NO_DEBUG_INFO:
                case OPT_NO_DELTA:
                case OPT_OUTPUT_FORMAT:
                case OPT_OUTPUT:
@@ -4093,29 +4082,27 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        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(
@@ -4130,13 +4117,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                                goto error;
                        }
                        break;
-               case OPT_NO_DEBUG_INFO:
-                       implicit_debug_info_args.exists = false;
+               case OPT_DEBUG_INFO:
+                       implicit_debug_info_args.exists = true;
                        break;
                case OPT_DEBUG_INFO_DIR:
                        implicit_debug_info_args.exists = true;
                        ret = append_implicit_component_extra_param(
-                               &implicit_debug_info_args, "dir", arg);
+                               &implicit_debug_info_args, "debug-info-dir", arg);
                        if (ret) {
                                goto error;
                        }
@@ -4265,10 +4252,11 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        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') {
@@ -4350,6 +4338,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                gs_leftover = leftovers->data;
                g_string_assign(cfg->cmd_data.print_ctf_metadata.path,
                        gs_leftover->str);
+
+               if (output) {
+                       g_string_assign(
+                               cfg->cmd_data.print_ctf_metadata.output_path,
+                               output);
+               }
+
                goto end;
        }
 
@@ -4437,6 +4432,13 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
 
                                g_string_assign(cfg->cmd_data.print_lttng_live_sessions.url,
                                        gs_leftover->str);
+
+                               if (output) {
+                                       g_string_assign(
+                                               cfg->cmd_data.print_lttng_live_sessions.output_path,
+                                               output);
+                               }
+
                                goto end;
                        }
 
@@ -4654,6 +4656,11 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
         * 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);
@@ -4704,6 +4711,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                goto error;
        }
 
+       cfg->cmd_data.run.stream_intersection_mode = stream_intersection_mode;
        goto end;
 
 error:
@@ -4811,7 +4819,7 @@ char log_level_from_arg(const char *arg)
 
 struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                int *retcode, bool force_omit_system_plugin_path,
-               bool force_omit_home_plugin_path, bool force_no_debug_info,
+               bool force_omit_home_plugin_path,
                struct bt_value *initial_plugin_paths)
 {
        struct bt_config *config = NULL;
@@ -4843,6 +4851,8 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        }
 
        if (argc <= 1) {
+               print_version();
+               puts("");
                print_gen_usage(stdout);
                goto end;
        }
@@ -4956,7 +4966,7 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        case COMMAND_TYPE_CONVERT:
                config = bt_config_convert_from_args(command_argc, command_argv,
                        retcode, force_omit_system_plugin_path,
-                       force_omit_home_plugin_path, force_no_debug_info,
+                       force_omit_home_plugin_path,
                        initial_plugin_paths, &log_level);
                break;
        case COMMAND_TYPE_LIST_PLUGINS:
This page took 0.032654 seconds and 4 git commands to generate.