diff options
| -rw-r--r-- | tools/perf/util/probe-finder.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 526ba56e720b..1daf5c14e751 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
| @@ -525,8 +525,10 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname, | |||
| 525 | return -ENOENT; | 525 | return -ENOENT; |
| 526 | } | 526 | } |
| 527 | /* Verify it is a data structure */ | 527 | /* Verify it is a data structure */ |
| 528 | if (dwarf_tag(&type) != DW_TAG_structure_type) { | 528 | tag = dwarf_tag(&type); |
| 529 | pr_warning("%s is not a data structure.\n", varname); | 529 | if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) { |
| 530 | pr_warning("%s is not a data structure nor an union.\n", | ||
| 531 | varname); | ||
| 530 | return -EINVAL; | 532 | return -EINVAL; |
| 531 | } | 533 | } |
| 532 | 534 | ||
| @@ -539,8 +541,9 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname, | |||
| 539 | *ref_ptr = ref; | 541 | *ref_ptr = ref; |
| 540 | } else { | 542 | } else { |
| 541 | /* Verify it is a data structure */ | 543 | /* Verify it is a data structure */ |
| 542 | if (tag != DW_TAG_structure_type) { | 544 | if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) { |
| 543 | pr_warning("%s is not a data structure.\n", varname); | 545 | pr_warning("%s is not a data structure nor an union.\n", |
| 546 | varname); | ||
| 544 | return -EINVAL; | 547 | return -EINVAL; |
| 545 | } | 548 | } |
| 546 | if (field->name[0] == '[') { | 549 | if (field->name[0] == '[') { |
| @@ -567,10 +570,15 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname, | |||
| 567 | } | 570 | } |
| 568 | 571 | ||
| 569 | /* Get the offset of the field */ | 572 | /* Get the offset of the field */ |
| 570 | ret = die_get_data_member_location(die_mem, &offs); | 573 | if (tag == DW_TAG_union_type) { |
| 571 | if (ret < 0) { | 574 | offs = 0; |
| 572 | pr_warning("Failed to get the offset of %s.\n", field->name); | 575 | } else { |
| 573 | return ret; | 576 | ret = die_get_data_member_location(die_mem, &offs); |
| 577 | if (ret < 0) { | ||
| 578 | pr_warning("Failed to get the offset of %s.\n", | ||
| 579 | field->name); | ||
| 580 | return ret; | ||
| 581 | } | ||
| 574 | } | 582 | } |
| 575 | ref->offset += (long)offs; | 583 | ref->offset += (long)offs; |
| 576 | 584 | ||
