diff options
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/util/header.c | 9 | ||||
-rw-r--r-- | tools/perf/util/parse-options.c | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index dc2b62565aa1..4db6e1ba54e3 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -844,8 +844,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
844 | struct perf_record *rec = &record; | 844 | struct perf_record *rec = &record; |
845 | char errbuf[BUFSIZ]; | 845 | char errbuf[BUFSIZ]; |
846 | 846 | ||
847 | perf_header__set_cmdline(argc, argv); | ||
848 | |||
849 | evsel_list = perf_evlist__new(NULL, NULL); | 847 | evsel_list = perf_evlist__new(NULL, NULL); |
850 | if (evsel_list == NULL) | 848 | if (evsel_list == NULL) |
851 | return -ENOMEM; | 849 | return -ENOMEM; |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 3a6d20443330..74ea3c2f8138 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -174,6 +174,15 @@ perf_header__set_cmdline(int argc, const char **argv) | |||
174 | { | 174 | { |
175 | int i; | 175 | int i; |
176 | 176 | ||
177 | /* | ||
178 | * If header_argv has already been set, do not override it. | ||
179 | * This allows a command to set the cmdline, parse args and | ||
180 | * then call another builtin function that implements a | ||
181 | * command -- e.g, cmd_kvm calling cmd_record. | ||
182 | */ | ||
183 | if (header_argv) | ||
184 | return 0; | ||
185 | |||
177 | header_argc = (u32)argc; | 186 | header_argc = (u32)argc; |
178 | 187 | ||
179 | /* do not include NULL termination */ | 188 | /* do not include NULL termination */ |
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c index 99d02aa57dbf..594f8fad5ecd 100644 --- a/tools/perf/util/parse-options.c +++ b/tools/perf/util/parse-options.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "util.h" | 1 | #include "util.h" |
2 | #include "parse-options.h" | 2 | #include "parse-options.h" |
3 | #include "cache.h" | 3 | #include "cache.h" |
4 | #include "header.h" | ||
4 | 5 | ||
5 | #define OPT_SHORT 1 | 6 | #define OPT_SHORT 1 |
6 | #define OPT_UNSET 2 | 7 | #define OPT_UNSET 2 |
@@ -413,6 +414,8 @@ int parse_options(int argc, const char **argv, const struct option *options, | |||
413 | { | 414 | { |
414 | struct parse_opt_ctx_t ctx; | 415 | struct parse_opt_ctx_t ctx; |
415 | 416 | ||
417 | perf_header__set_cmdline(argc, argv); | ||
418 | |||
416 | parse_options_start(&ctx, argc, argv, flags); | 419 | parse_options_start(&ctx, argc, argv, flags); |
417 | switch (parse_options_step(&ctx, options, usagestr)) { | 420 | switch (parse_options_step(&ctx, options, usagestr)) { |
418 | case PARSE_OPT_HELP: | 421 | case PARSE_OPT_HELP: |