Commit 6c191289 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf parse-events: Rename parse_events_error functions

Group error functions and name after the data type they manipulate.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20211107090002.3784612-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e4e29079
...@@ -116,7 +116,7 @@ static int is_tracepoint_available(const char *str, struct evlist *evlist) ...@@ -116,7 +116,7 @@ static int is_tracepoint_available(const char *str, struct evlist *evlist)
bzero(&err, sizeof(err)); bzero(&err, sizeof(err));
ret = parse_events(evlist, str, &err); ret = parse_events(evlist, str, &err);
if (err.str) if (err.str)
parse_events_print_error(&err, "tracepoint"); parse_events_error__print(&err, "tracepoint");
return ret; return ret;
} }
......
...@@ -89,7 +89,7 @@ static struct evlist *bench__create_evlist(char *evstr) ...@@ -89,7 +89,7 @@ static struct evlist *bench__create_evlist(char *evstr)
ret = parse_events(evlist, evstr, &err); ret = parse_events(evlist, evstr, &err);
if (ret) { if (ret) {
parse_events_print_error(&err, evstr); parse_events_error__print(&err, evstr);
pr_err("Run 'perf list' for a list of valid events\n"); pr_err("Run 'perf list' for a list of valid events\n");
ret = 1; ret = 1;
goto out_delete_evlist; goto out_delete_evlist;
......
...@@ -1782,7 +1782,7 @@ static int add_default_attributes(void) ...@@ -1782,7 +1782,7 @@ static int add_default_attributes(void)
&errinfo); &errinfo);
if (err) { if (err) {
fprintf(stderr, "Cannot set up transaction events\n"); fprintf(stderr, "Cannot set up transaction events\n");
parse_events_print_error(&errinfo, transaction_attrs); parse_events_error__print(&errinfo, transaction_attrs);
return -1; return -1;
} }
return 0; return 0;
...@@ -1812,11 +1812,11 @@ static int add_default_attributes(void) ...@@ -1812,11 +1812,11 @@ static int add_default_attributes(void)
} else { } else {
fprintf(stderr, "To measure SMI cost, it needs " fprintf(stderr, "To measure SMI cost, it needs "
"msr/aperf/, msr/smi/ and cpu/cycles/ support\n"); "msr/aperf/, msr/smi/ and cpu/cycles/ support\n");
parse_events_print_error(&errinfo, smi_cost_attrs); parse_events_error__print(&errinfo, smi_cost_attrs);
return -1; return -1;
} }
if (err) { if (err) {
parse_events_print_error(&errinfo, smi_cost_attrs); parse_events_error__print(&errinfo, smi_cost_attrs);
fprintf(stderr, "Cannot set up SMI cost events\n"); fprintf(stderr, "Cannot set up SMI cost events\n");
return -1; return -1;
} }
...@@ -1883,7 +1883,7 @@ static int add_default_attributes(void) ...@@ -1883,7 +1883,7 @@ static int add_default_attributes(void)
fprintf(stderr, fprintf(stderr,
"Cannot set up top down events %s: %d\n", "Cannot set up top down events %s: %d\n",
str, err); str, err);
parse_events_print_error(&errinfo, str); parse_events_error__print(&errinfo, str);
free(str); free(str);
return -1; return -1;
} }
...@@ -1911,7 +1911,7 @@ static int add_default_attributes(void) ...@@ -1911,7 +1911,7 @@ static int add_default_attributes(void)
fprintf(stderr, fprintf(stderr,
"Cannot set up hybrid events %s: %d\n", "Cannot set up hybrid events %s: %d\n",
hybrid_str, err); hybrid_str, err);
parse_events_print_error(&errinfo, hybrid_str); parse_events_error__print(&errinfo, hybrid_str);
return -1; return -1;
} }
return err; return err;
......
...@@ -4928,7 +4928,7 @@ int cmd_trace(int argc, const char **argv) ...@@ -4928,7 +4928,7 @@ int cmd_trace(int argc, const char **argv)
bzero(&parse_err, sizeof(parse_err)); bzero(&parse_err, sizeof(parse_err));
err = parse_events(trace.evlist, trace.perfconfig_events, &parse_err); err = parse_events(trace.evlist, trace.perfconfig_events, &parse_err);
if (err) { if (err) {
parse_events_print_error(&parse_err, trace.perfconfig_events); parse_events_error__print(&parse_err, trace.perfconfig_events);
goto out; goto out;
} }
} }
......
...@@ -128,7 +128,7 @@ static int expand_group_events(void) ...@@ -128,7 +128,7 @@ static int expand_group_events(void)
if (ret < 0) { if (ret < 0) {
pr_debug("failed to parse event '%s', err %d, str '%s'\n", pr_debug("failed to parse event '%s', err %d, str '%s'\n",
event_str, ret, err.str); event_str, ret, err.str);
parse_events_print_error(&err, event_str); parse_events_error__print(&err, event_str);
goto out; goto out;
} }
......
...@@ -2059,7 +2059,7 @@ static int test_event(struct evlist_test *e) ...@@ -2059,7 +2059,7 @@ static int test_event(struct evlist_test *e)
if (ret) { if (ret) {
pr_debug("failed to parse event '%s', err %d, str '%s'\n", pr_debug("failed to parse event '%s', err %d, str '%s'\n",
e->name, ret, err.str); e->name, ret, err.str);
parse_events_print_error(&err, e->name); parse_events_error__print(&err, e->name);
} else { } else {
ret = e->check(evlist); ret = e->check(evlist);
} }
......
...@@ -1342,7 +1342,7 @@ static int parse_ids(struct perf_pmu *fake_pmu, struct expr_parse_ctx *ids, ...@@ -1342,7 +1342,7 @@ static int parse_ids(struct perf_pmu *fake_pmu, struct expr_parse_ctx *ids,
bzero(&parse_error, sizeof(parse_error)); bzero(&parse_error, sizeof(parse_error));
ret = __parse_events(parsed_evlist, events.buf, &parse_error, fake_pmu); ret = __parse_events(parsed_evlist, events.buf, &parse_error, fake_pmu);
if (ret) { if (ret) {
parse_events_print_error(&parse_error, events.buf); parse_events_error__print(&parse_error, events.buf);
goto err_out; goto err_out;
} }
ret = decode_all_metric_ids(parsed_evlist, modifier); ret = decode_all_metric_ids(parsed_evlist, modifier);
......
...@@ -191,39 +191,6 @@ static int tp_event_has_id(const char *dir_path, struct dirent *evt_dir) ...@@ -191,39 +191,6 @@ static int tp_event_has_id(const char *dir_path, struct dirent *evt_dir)
#define MAX_EVENT_LENGTH 512 #define MAX_EVENT_LENGTH 512
void parse_events__handle_error(struct parse_events_error *err, int idx,
char *str, char *help)
{
if (WARN(!str, "WARNING: failed to provide error string\n")) {
free(help);
return;
}
switch (err->num_errors) {
case 0:
err->idx = idx;
err->str = str;
err->help = help;
break;
case 1:
err->first_idx = err->idx;
err->idx = idx;
err->first_str = err->str;
err->str = str;
err->first_help = err->help;
err->help = help;
break;
default:
pr_debug("Multiple errors dropping message: %s (%s)\n",
err->str, err->help);
free(err->str);
err->str = str;
free(err->help);
err->help = help;
break;
}
err->num_errors++;
}
struct tracepoint_path *tracepoint_id_to_path(u64 config) struct tracepoint_path *tracepoint_id_to_path(u64 config)
{ {
struct tracepoint_path *path = NULL; struct tracepoint_path *path = NULL;
...@@ -587,7 +554,7 @@ static void tracepoint_error(struct parse_events_error *e, int err, ...@@ -587,7 +554,7 @@ static void tracepoint_error(struct parse_events_error *e, int err,
} }
tracing_path__strerror_open_tp(err, help, sizeof(help), sys, name); tracing_path__strerror_open_tp(err, help, sizeof(help), sys, name);
parse_events__handle_error(e, 0, strdup(str), strdup(help)); parse_events_error__handle(e, 0, strdup(str), strdup(help));
} }
static int add_tracepoint(struct list_head *list, int *idx, static int add_tracepoint(struct list_head *list, int *idx,
...@@ -811,7 +778,7 @@ int parse_events_load_bpf_obj(struct parse_events_state *parse_state, ...@@ -811,7 +778,7 @@ int parse_events_load_bpf_obj(struct parse_events_state *parse_state,
return 0; return 0;
errout: errout:
parse_events__handle_error(parse_state->error, 0, parse_events_error__handle(parse_state->error, 0,
strdup(errbuf), strdup("(add -v to see detail)")); strdup(errbuf), strdup("(add -v to see detail)"));
return err; return err;
} }
...@@ -831,7 +798,7 @@ parse_events_config_bpf(struct parse_events_state *parse_state, ...@@ -831,7 +798,7 @@ parse_events_config_bpf(struct parse_events_state *parse_state,
int err; int err;
if (term->type_term != PARSE_EVENTS__TERM_TYPE_USER) { if (term->type_term != PARSE_EVENTS__TERM_TYPE_USER) {
parse_events__handle_error(parse_state->error, term->err_term, parse_events_error__handle(parse_state->error, term->err_term,
strdup("Invalid config term for BPF object"), strdup("Invalid config term for BPF object"),
NULL); NULL);
return -EINVAL; return -EINVAL;
...@@ -851,7 +818,7 @@ parse_events_config_bpf(struct parse_events_state *parse_state, ...@@ -851,7 +818,7 @@ parse_events_config_bpf(struct parse_events_state *parse_state,
else else
idx = term->err_term + error_pos; idx = term->err_term + error_pos;
parse_events__handle_error(parse_state->error, idx, parse_events_error__handle(parse_state->error, idx,
strdup(errbuf), strdup(errbuf),
strdup( strdup(
"Hint:\tValid config terms:\n" "Hint:\tValid config terms:\n"
...@@ -923,7 +890,7 @@ int parse_events_load_bpf(struct parse_events_state *parse_state, ...@@ -923,7 +890,7 @@ int parse_events_load_bpf(struct parse_events_state *parse_state,
-err, errbuf, -err, errbuf,
sizeof(errbuf)); sizeof(errbuf));
parse_events__handle_error(parse_state->error, 0, parse_events_error__handle(parse_state->error, 0,
strdup(errbuf), strdup("(add -v to see detail)")); strdup(errbuf), strdup("(add -v to see detail)"));
return err; return err;
} }
...@@ -947,7 +914,7 @@ int parse_events_load_bpf_obj(struct parse_events_state *parse_state, ...@@ -947,7 +914,7 @@ int parse_events_load_bpf_obj(struct parse_events_state *parse_state,
struct bpf_object *obj __maybe_unused, struct bpf_object *obj __maybe_unused,
struct list_head *head_config __maybe_unused) struct list_head *head_config __maybe_unused)
{ {
parse_events__handle_error(parse_state->error, 0, parse_events_error__handle(parse_state->error, 0,
strdup("BPF support is not compiled"), strdup("BPF support is not compiled"),
strdup("Make sure libbpf-devel is available at build time.")); strdup("Make sure libbpf-devel is available at build time."));
return -ENOTSUP; return -ENOTSUP;
...@@ -959,7 +926,7 @@ int parse_events_load_bpf(struct parse_events_state *parse_state, ...@@ -959,7 +926,7 @@ int parse_events_load_bpf(struct parse_events_state *parse_state,
bool source __maybe_unused, bool source __maybe_unused,
struct list_head *head_config __maybe_unused) struct list_head *head_config __maybe_unused)
{ {
parse_events__handle_error(parse_state->error, 0, parse_events_error__handle(parse_state->error, 0,
strdup("BPF support is not compiled"), strdup("BPF support is not compiled"),
strdup("Make sure libbpf-devel is available at build time.")); strdup("Make sure libbpf-devel is available at build time."));
return -ENOTSUP; return -ENOTSUP;
...@@ -1042,7 +1009,7 @@ static int check_type_val(struct parse_events_term *term, ...@@ -1042,7 +1009,7 @@ static int check_type_val(struct parse_events_term *term,
return 0; return 0;
if (err) { if (err) {
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
type == PARSE_EVENTS__TERM_TYPE_NUM type == PARSE_EVENTS__TERM_TYPE_NUM
? strdup("expected numeric value") ? strdup("expected numeric value")
: strdup("expected string value"), : strdup("expected string value"),
...@@ -1087,7 +1054,7 @@ config_term_avail(int term_type, struct parse_events_error *err) ...@@ -1087,7 +1054,7 @@ config_term_avail(int term_type, struct parse_events_error *err)
char *err_str; char *err_str;
if (term_type < 0 || term_type >= __PARSE_EVENTS__TERM_TYPE_NR) { if (term_type < 0 || term_type >= __PARSE_EVENTS__TERM_TYPE_NR) {
parse_events__handle_error(err, -1, parse_events_error__handle(err, -1,
strdup("Invalid term_type"), NULL); strdup("Invalid term_type"), NULL);
return false; return false;
} }
...@@ -1110,7 +1077,7 @@ config_term_avail(int term_type, struct parse_events_error *err) ...@@ -1110,7 +1077,7 @@ config_term_avail(int term_type, struct parse_events_error *err)
/* term_type is validated so indexing is safe */ /* term_type is validated so indexing is safe */
if (asprintf(&err_str, "'%s' is not usable in 'perf stat'", if (asprintf(&err_str, "'%s' is not usable in 'perf stat'",
config_term_names[term_type]) >= 0) config_term_names[term_type]) >= 0)
parse_events__handle_error(err, -1, err_str, NULL); parse_events_error__handle(err, -1, err_str, NULL);
return false; return false;
} }
} }
...@@ -1154,7 +1121,7 @@ do { \ ...@@ -1154,7 +1121,7 @@ do { \
if (strcmp(term->val.str, "no") && if (strcmp(term->val.str, "no") &&
parse_branch_str(term->val.str, parse_branch_str(term->val.str,
&attr->branch_sample_type)) { &attr->branch_sample_type)) {
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
strdup("invalid branch sample type"), strdup("invalid branch sample type"),
NULL); NULL);
return -EINVAL; return -EINVAL;
...@@ -1163,7 +1130,7 @@ do { \ ...@@ -1163,7 +1130,7 @@ do { \
case PARSE_EVENTS__TERM_TYPE_TIME: case PARSE_EVENTS__TERM_TYPE_TIME:
CHECK_TYPE_VAL(NUM); CHECK_TYPE_VAL(NUM);
if (term->val.num > 1) { if (term->val.num > 1) {
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
strdup("expected 0 or 1"), strdup("expected 0 or 1"),
NULL); NULL);
return -EINVAL; return -EINVAL;
...@@ -1202,7 +1169,7 @@ do { \ ...@@ -1202,7 +1169,7 @@ do { \
case PARSE_EVENTS__TERM_TYPE_PERCORE: case PARSE_EVENTS__TERM_TYPE_PERCORE:
CHECK_TYPE_VAL(NUM); CHECK_TYPE_VAL(NUM);
if ((unsigned int)term->val.num > 1) { if ((unsigned int)term->val.num > 1) {
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
strdup("expected 0 or 1"), strdup("expected 0 or 1"),
NULL); NULL);
return -EINVAL; return -EINVAL;
...@@ -1214,14 +1181,14 @@ do { \ ...@@ -1214,14 +1181,14 @@ do { \
case PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE: case PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE:
CHECK_TYPE_VAL(NUM); CHECK_TYPE_VAL(NUM);
if (term->val.num > UINT_MAX) { if (term->val.num > UINT_MAX) {
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
strdup("too big"), strdup("too big"),
NULL); NULL);
return -EINVAL; return -EINVAL;
} }
break; break;
default: default:
parse_events__handle_error(err, term->err_term, parse_events_error__handle(err, term->err_term,
strdup("unknown term"), strdup("unknown term"),
parse_events_formats_error_string(NULL)); parse_events_formats_error_string(NULL));
return -EINVAL; return -EINVAL;
...@@ -1275,7 +1242,7 @@ static int config_term_tracepoint(struct perf_event_attr *attr, ...@@ -1275,7 +1242,7 @@ static int config_term_tracepoint(struct perf_event_attr *attr,
return config_term_common(attr, term, err); return config_term_common(attr, term, err);
default: default:
if (err) { if (err) {
parse_events__handle_error(err, term->err_term, parse_events_error__handle(err, term->err_term,
strdup("unknown term"), strdup("unknown term"),
strdup("valid terms: call-graph,stack-size\n")); strdup("valid terms: call-graph,stack-size\n"));
} }
...@@ -1574,7 +1541,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, ...@@ -1574,7 +1541,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
if (asprintf(&err_str, if (asprintf(&err_str,
"Cannot find PMU `%s'. Missing kernel support?", "Cannot find PMU `%s'. Missing kernel support?",
name) >= 0) name) >= 0)
parse_events__handle_error(err, 0, err_str, NULL); parse_events_error__handle(err, 0, err_str, NULL);
return -EINVAL; return -EINVAL;
} }
...@@ -2334,6 +2301,39 @@ int __parse_events(struct evlist *evlist, const char *str, ...@@ -2334,6 +2301,39 @@ int __parse_events(struct evlist *evlist, const char *str,
return ret; return ret;
} }
void parse_events_error__handle(struct parse_events_error *err, int idx,
char *str, char *help)
{
if (WARN(!str, "WARNING: failed to provide error string\n")) {
free(help);
return;
}
switch (err->num_errors) {
case 0:
err->idx = idx;
err->str = str;
err->help = help;
break;
case 1:
err->first_idx = err->idx;
err->idx = idx;
err->first_str = err->str;
err->str = str;
err->first_help = err->help;
err->help = help;
break;
default:
pr_debug("Multiple errors dropping message: %s (%s)\n",
err->str, err->help);
free(err->str);
err->str = str;
free(err->help);
err->help = help;
break;
}
err->num_errors++;
}
#define MAX_WIDTH 1000 #define MAX_WIDTH 1000
static int get_term_width(void) static int get_term_width(void)
{ {
...@@ -2343,7 +2343,7 @@ static int get_term_width(void) ...@@ -2343,7 +2343,7 @@ static int get_term_width(void)
return ws.ws_col > MAX_WIDTH ? MAX_WIDTH : ws.ws_col; return ws.ws_col > MAX_WIDTH ? MAX_WIDTH : ws.ws_col;
} }
static void __parse_events_print_error(int err_idx, const char *err_str, static void __parse_events_error__print(int err_idx, const char *err_str,
const char *err_help, const char *event) const char *err_help, const char *event)
{ {
const char *str = "invalid or unsupported event: "; const char *str = "invalid or unsupported event: ";
...@@ -2398,19 +2398,19 @@ static void __parse_events_print_error(int err_idx, const char *err_str, ...@@ -2398,19 +2398,19 @@ static void __parse_events_print_error(int err_idx, const char *err_str,
} }
} }
void parse_events_print_error(struct parse_events_error *err, void parse_events_error__print(struct parse_events_error *err,
const char *event) const char *event)
{ {
if (!err->num_errors) if (!err->num_errors)
return; return;
__parse_events_print_error(err->idx, err->str, err->help, event); __parse_events_error__print(err->idx, err->str, err->help, event);
zfree(&err->str); zfree(&err->str);
zfree(&err->help); zfree(&err->help);
if (err->num_errors > 1) { if (err->num_errors > 1) {
fputs("\nInitial error:\n", stderr); fputs("\nInitial error:\n", stderr);
__parse_events_print_error(err->first_idx, err->first_str, __parse_events_error__print(err->first_idx, err->first_str,
err->first_help, event); err->first_help, event);
zfree(&err->first_str); zfree(&err->first_str);
zfree(&err->first_help); zfree(&err->first_help);
...@@ -2430,7 +2430,7 @@ int parse_events_option(const struct option *opt, const char *str, ...@@ -2430,7 +2430,7 @@ int parse_events_option(const struct option *opt, const char *str,
ret = parse_events(evlist, str, &err); ret = parse_events(evlist, str, &err);
if (ret) { if (ret) {
parse_events_print_error(&err, str); parse_events_error__print(&err, str);
fprintf(stderr, "Run 'perf list' for a list of valid events\n"); fprintf(stderr, "Run 'perf list' for a list of valid events\n");
} }
...@@ -3324,7 +3324,7 @@ void parse_events_evlist_error(struct parse_events_state *parse_state, ...@@ -3324,7 +3324,7 @@ void parse_events_evlist_error(struct parse_events_state *parse_state,
if (!parse_state->error) if (!parse_state->error)
return; return;
parse_events__handle_error(parse_state->error, idx, strdup(str), NULL); parse_events_error__handle(parse_state->error, idx, strdup(str), NULL);
} }
static void config_terms_list(char *buf, size_t buf_sz) static void config_terms_list(char *buf, size_t buf_sz)
......
...@@ -142,8 +142,6 @@ struct parse_events_state { ...@@ -142,8 +142,6 @@ struct parse_events_state {
char *hybrid_pmu_name; char *hybrid_pmu_name;
}; };
void parse_events__handle_error(struct parse_events_error *err, int idx,
char *str, char *help);
void parse_events__shrink_config_terms(void); void parse_events__shrink_config_terms(void);
int parse_events__is_hardcoded_term(struct parse_events_term *term); int parse_events__is_hardcoded_term(struct parse_events_term *term);
int parse_events_term__num(struct parse_events_term **term, int parse_events_term__num(struct parse_events_term **term,
...@@ -244,7 +242,9 @@ int is_valid_tracepoint(const char *event_string); ...@@ -244,7 +242,9 @@ int is_valid_tracepoint(const char *event_string);
int valid_event_mount(const char *eventfs); int valid_event_mount(const char *eventfs);
char *parse_events_formats_error_string(char *additional_terms); char *parse_events_formats_error_string(char *additional_terms);
void parse_events_print_error(struct parse_events_error *err, void parse_events_error__handle(struct parse_events_error *err, int idx,
char *str, char *help);
void parse_events_error__print(struct parse_events_error *err,
const char *event); const char *event);
#ifdef HAVE_LIBELF_SUPPORT #ifdef HAVE_LIBELF_SUPPORT
......
...@@ -186,7 +186,7 @@ group_def ':' PE_MODIFIER_EVENT ...@@ -186,7 +186,7 @@ group_def ':' PE_MODIFIER_EVENT
struct parse_events_state *parse_state = _parse_state; struct parse_events_state *parse_state = _parse_state;
struct parse_events_error *error = parse_state->error; struct parse_events_error *error = parse_state->error;
parse_events__handle_error(error, @3.first_column, parse_events_error__handle(error, @3.first_column,
strdup("Bad modifier"), NULL); strdup("Bad modifier"), NULL);
free_list_evsel(list); free_list_evsel(list);
YYABORT; YYABORT;
...@@ -248,7 +248,7 @@ event_name PE_MODIFIER_EVENT ...@@ -248,7 +248,7 @@ event_name PE_MODIFIER_EVENT
struct parse_events_state *parse_state = _parse_state; struct parse_events_state *parse_state = _parse_state;
struct parse_events_error *error = parse_state->error; struct parse_events_error *error = parse_state->error;
parse_events__handle_error(error, @2.first_column, parse_events_error__handle(error, @2.first_column,
strdup("Bad modifier"), NULL); strdup("Bad modifier"), NULL);
free_list_evsel(list); free_list_evsel(list);
YYABORT; YYABORT;
......
...@@ -1283,7 +1283,7 @@ static int pmu_config_term(const char *pmu_name, ...@@ -1283,7 +1283,7 @@ static int pmu_config_term(const char *pmu_name,
unknown_term = NULL; unknown_term = NULL;
help_msg = parse_events_formats_error_string(pmu_term); help_msg = parse_events_formats_error_string(pmu_term);
if (err) { if (err) {
parse_events__handle_error(err, term->err_term, parse_events_error__handle(err, term->err_term,
unknown_term, unknown_term,
help_msg); help_msg);
} else { } else {
...@@ -1316,7 +1316,7 @@ static int pmu_config_term(const char *pmu_name, ...@@ -1316,7 +1316,7 @@ static int pmu_config_term(const char *pmu_name,
if (term->no_value && if (term->no_value &&
bitmap_weight(format->bits, PERF_PMU_FORMAT_BITS) > 1) { bitmap_weight(format->bits, PERF_PMU_FORMAT_BITS) > 1) {
if (err) { if (err) {
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
strdup("no value assigned for term"), strdup("no value assigned for term"),
NULL); NULL);
} }
...@@ -1331,7 +1331,7 @@ static int pmu_config_term(const char *pmu_name, ...@@ -1331,7 +1331,7 @@ static int pmu_config_term(const char *pmu_name,
term->config, term->val.str); term->config, term->val.str);
} }
if (err) { if (err) {
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
strdup("expected numeric value"), strdup("expected numeric value"),
NULL); NULL);
} }
...@@ -1348,7 +1348,7 @@ static int pmu_config_term(const char *pmu_name, ...@@ -1348,7 +1348,7 @@ static int pmu_config_term(const char *pmu_name,
if (err) { if (err) {
char *err_str; char *err_str;
parse_events__handle_error(err, term->err_val, parse_events_error__handle(err, term->err_val,
asprintf(&err_str, asprintf(&err_str,
"value too big for format, maximum is %llu", "value too big for format, maximum is %llu",
(unsigned long long)max_val) < 0 (unsigned long long)max_val) < 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment