diff options
Diffstat (limited to 'parse-events.c')
-rw-r--r-- | parse-events.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/parse-events.c b/parse-events.c index 42f1e3f..5795c09 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -625,7 +625,7 @@ enum event_type read_token_item(char **tok) | |||
625 | int test_type(enum event_type type, enum event_type expect) | 625 | int test_type(enum event_type type, enum event_type expect) |
626 | { | 626 | { |
627 | if (type != expect) { | 627 | if (type != expect) { |
628 | die("Error: expected type %d but read %d", | 628 | warn("Error: expected type %d but read %d", |
629 | expect, type); | 629 | expect, type); |
630 | return -1; | 630 | return -1; |
631 | } | 631 | } |
@@ -636,13 +636,13 @@ int test_type_token(enum event_type type, char *token, | |||
636 | enum event_type expect, char *expect_tok) | 636 | enum event_type expect, char *expect_tok) |
637 | { | 637 | { |
638 | if (type != expect) { | 638 | if (type != expect) { |
639 | die("Error: expected type %d but read %d", | 639 | warn("Error: expected type %d but read %d", |
640 | expect, type); | 640 | expect, type); |
641 | return -1; | 641 | return -1; |
642 | } | 642 | } |
643 | 643 | ||
644 | if (strcmp(token, expect_tok) != 0) { | 644 | if (strcmp(token, expect_tok) != 0) { |
645 | die("Error: expected '%s' but read '%s'", | 645 | warn("Error: expected '%s' but read '%s'", |
646 | expect_tok, token); | 646 | expect_tok, token); |
647 | return -1; | 647 | return -1; |
648 | } | 648 | } |
@@ -685,7 +685,7 @@ int __read_expected(enum event_type expect, char *str, int newline_ok) | |||
685 | 685 | ||
686 | free_token(token); | 686 | free_token(token); |
687 | 687 | ||
688 | return 0; | 688 | return ret; |
689 | } | 689 | } |
690 | 690 | ||
691 | int read_expected(enum event_type expect, char *str) | 691 | int read_expected(enum event_type expect, char *str) |
@@ -1226,7 +1226,8 @@ process_op(struct event *event, struct print_arg *arg, char **tok) | |||
1226 | type = process_array(event, arg, tok); | 1226 | type = process_array(event, arg, tok); |
1227 | 1227 | ||
1228 | } else { | 1228 | } else { |
1229 | die("unknown op '%s'", token); | 1229 | warn("unknown op '%s'", token); |
1230 | event->flags |= EVENT_FL_FAILED; | ||
1230 | /* the arg is now the left side */ | 1231 | /* the arg is now the left side */ |
1231 | return EVENT_NONE; | 1232 | return EVENT_NONE; |
1232 | } | 1233 | } |
@@ -2749,6 +2750,12 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs) | |||
2749 | comm, pid, cpu, | 2750 | comm, pid, cpu, |
2750 | secs, usecs, event->name); | 2751 | secs, usecs, event->name); |
2751 | 2752 | ||
2753 | if (event->flags & EVENT_FL_FAILED) { | ||
2754 | printf("EVENT '%s' FAILED TO PARSE\n", | ||
2755 | event->name); | ||
2756 | return; | ||
2757 | } | ||
2758 | |||
2752 | pretty_print(data, size, event); | 2759 | pretty_print(data, size, event); |
2753 | printf("\n"); | 2760 | printf("\n"); |
2754 | } | 2761 | } |
@@ -2955,12 +2962,16 @@ int parse_event_file(char *buf, unsigned long size, char *system) | |||
2955 | die("failed to read event id"); | 2962 | die("failed to read event id"); |
2956 | 2963 | ||
2957 | ret = event_read_format(event); | 2964 | ret = event_read_format(event); |
2958 | if (ret < 0) | 2965 | if (ret < 0) { |
2959 | die("failed to read event format"); | 2966 | warn("failed to read event format for %s", event->name); |
2967 | goto event_failed; | ||
2968 | } | ||
2960 | 2969 | ||
2961 | ret = event_read_print(event); | 2970 | ret = event_read_print(event); |
2962 | if (ret < 0) | 2971 | if (ret < 0) { |
2963 | die("failed to read event print fmt"); | 2972 | warn("failed to read event print fmt for %s", event->name); |
2973 | goto event_failed; | ||
2974 | } | ||
2964 | 2975 | ||
2965 | #define PRINT_ARGS 0 | 2976 | #define PRINT_ARGS 0 |
2966 | if (PRINT_ARGS && event->print_fmt.args) | 2977 | if (PRINT_ARGS && event->print_fmt.args) |
@@ -2968,6 +2979,12 @@ int parse_event_file(char *buf, unsigned long size, char *system) | |||
2968 | 2979 | ||
2969 | add_event(event); | 2980 | add_event(event); |
2970 | return 0; | 2981 | return 0; |
2982 | |||
2983 | event_failed: | ||
2984 | event->flags |= EVENT_FL_FAILED; | ||
2985 | /* still add it even if it failed */ | ||
2986 | add_event(event); | ||
2987 | return -1; | ||
2971 | } | 2988 | } |
2972 | 2989 | ||
2973 | void parse_set_info(int nr_cpus, int long_sz) | 2990 | void parse_set_info(int nr_cpus, int long_sz) |