diff options
| -rw-r--r-- | tools/perf/util/trace-event-parse.c | 24 | ||||
| -rw-r--r-- | tools/perf/util/trace-event.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index de3fc8bf8bfe..6f851f98b5b4 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
| @@ -721,6 +721,24 @@ static int event_read_id(void) | |||
| 721 | return -1; | 721 | return -1; |
| 722 | } | 722 | } |
| 723 | 723 | ||
| 724 | static int field_is_string(struct format_field *field) | ||
| 725 | { | ||
| 726 | if ((field->flags & FIELD_IS_ARRAY) && | ||
| 727 | (!strstr(field->type, "char") || !strstr(field->type, "u8") || | ||
| 728 | !strstr(field->type, "s8"))) | ||
| 729 | return 1; | ||
| 730 | |||
| 731 | return 0; | ||
| 732 | } | ||
| 733 | |||
| 734 | static int field_is_dynamic(struct format_field *field) | ||
| 735 | { | ||
| 736 | if (!strcmp(field->type, "__data_loc")) | ||
| 737 | return 1; | ||
| 738 | |||
| 739 | return 0; | ||
| 740 | } | ||
| 741 | |||
| 724 | static int event_read_fields(struct event *event, struct format_field **fields) | 742 | static int event_read_fields(struct event *event, struct format_field **fields) |
| 725 | { | 743 | { |
| 726 | struct format_field *field = NULL; | 744 | struct format_field *field = NULL; |
| @@ -865,6 +883,12 @@ static int event_read_fields(struct event *event, struct format_field **fields) | |||
| 865 | free(brackets); | 883 | free(brackets); |
| 866 | } | 884 | } |
| 867 | 885 | ||
| 886 | if (field_is_string(field)) { | ||
| 887 | field->flags |= FIELD_IS_STRING; | ||
| 888 | if (field_is_dynamic(field)) | ||
| 889 | field->flags |= FIELD_IS_DYNAMIC; | ||
| 890 | } | ||
| 891 | |||
| 868 | if (test_type_token(type, token, EVENT_OP, (char *)";")) | 892 | if (test_type_token(type, token, EVENT_OP, (char *)";")) |
| 869 | goto fail; | 893 | goto fail; |
| 870 | free_token(token); | 894 | free_token(token); |
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index cb92978be300..5f59a39fb88b 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h | |||
| @@ -27,6 +27,8 @@ enum format_flags { | |||
| 27 | FIELD_IS_ARRAY = 1, | 27 | FIELD_IS_ARRAY = 1, |
| 28 | FIELD_IS_POINTER = 2, | 28 | FIELD_IS_POINTER = 2, |
| 29 | FIELD_IS_SIGNED = 4, | 29 | FIELD_IS_SIGNED = 4, |
| 30 | FIELD_IS_STRING = 8, | ||
| 31 | FIELD_IS_DYNAMIC = 16, | ||
| 30 | }; | 32 | }; |
| 31 | 33 | ||
| 32 | struct format_field { | 34 | struct format_field { |
