From a62ebae88bcc2f373823b7b76e8dc5230674e1fd Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 4 Apr 2007 13:59:54 -0300 Subject: [PATCH] [PAHOLE]: Look for a typedef pointing to anonymous structs in --packable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reported by Diego 'Flameeyes' Pettenò. Thanks! Signed-off-by: Arnaldo Carvalho de Melo --- pahole.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pahole.c b/pahole.c index b6fb2da..3630988 100644 --- a/pahole.c +++ b/pahole.c @@ -163,8 +163,18 @@ static void print_classes(void (*formatter)(const struct structure *s)) const size_t orig_size = class__size(c); const size_t new_size = class__size(c->priv); const size_t savings = orig_size - new_size; + const char *name = class__name(c); + + /* Anonymous struct? Try finding a typedef */ + if (name == NULL) { + const struct tag *tdef = + cu__find_first_typedef_of_type(pos->cu, + class__tag(pos->class)->id); + if (tdef != NULL) + name = class__name(tag__class(tdef)); + } printf("%-32s %5zd %5zd %5zd\n", - class__name(c), orig_size, new_size, savings); + name, orig_size, new_size, savings); } else formatter(pos); }