diff --git a/dwarves.c b/dwarves.c index 2698fae..05b28f7 100644 --- a/dwarves.c +++ b/dwarves.c @@ -319,6 +319,16 @@ static void tag__delete(struct tag *self) free(self); } +struct tag *tag__follow_typedef(struct tag *tag, const struct cu *cu) +{ + struct tag *type = cu__find_tag_by_id(cu, tag->type); + + if (type->tag == DW_TAG_typedef) + return tag__follow_typedef(type, cu); + + return type; +} + static const char *tag__accessibility(const struct tag *self) { int a; diff --git a/dwarves.h b/dwarves.h index c9d7820..d4efa10 100644 --- a/dwarves.h +++ b/dwarves.h @@ -555,6 +555,7 @@ extern const char *tag__name(const struct tag *self, const struct cu *cu, char *bf, size_t len); extern size_t tag__size(const struct tag *self, const struct cu *cu); extern size_t tag__nr_cachelines(const struct tag *self, const struct cu *cu); +extern struct tag *tag__follow_typedef(struct tag *tag, const struct cu *cu); extern struct class_member *type__find_member_by_name(const struct type *self, const char *name); diff --git a/pahole.c b/pahole.c index d2035f6..657eb1c 100644 --- a/pahole.c +++ b/pahole.c @@ -388,16 +388,6 @@ static int cu_unique_iterator(struct cu *cu, void *cookie) return cu__for_each_tag(cu, unique_iterator, cookie, tag__filter); } -static struct tag *tag__follow_typedef(struct tag *tag, struct cu *cu) -{ - struct tag *type = cu__find_tag_by_id(cu, tag->type); - - if (type->tag == DW_TAG_typedef) - return tag__follow_typedef(type, cu); - - return type; -} - static void union__find_new_size(struct tag *tag, struct cu *cu); static void class__resize_LP(struct tag *tag, struct cu *cu)