1 // SPDX-License-Identifier: GPL-2.0
4 #include "util/debug.h"
5 #include <subcmd/parse-options.h>
6 #include "util/parse-regs-options.h"
9 parse_regs(const struct option *opt, const char *str, int unset)
11 uint64_t *mode = (uint64_t *)opt->value;
12 const struct sample_reg *r;
13 char *s, *os = NULL, *p;
25 /* str may be NULL in case no arg is passed to -I */
27 /* because str is read-only */
37 if (!strcmp(s, "?")) {
38 fprintf(stderr, "available registers: ");
39 for (r = sample_reg_masks; r->name; r++) {
40 fprintf(stderr, "%s ", r->name);
43 /* just printing available regs */
46 for (r = sample_reg_masks; r->name; r++) {
47 if (!strcasecmp(s, r->name))
51 ui__warning("unknown register %s,"
52 " check man page\n", s);
66 /* default to all possible regs */
68 *mode = PERF_REGS_MASK;