[PAHOLE]: Look for a typedef pointing to anonymous structs in --packable

Problem reported by Diego 'Flameeyes' Pettenò. Thanks!

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-04-04 13:59:54 -03:00
parent 786ef46234
commit a62ebae88b
1 changed files with 11 additions and 1 deletions

View File

@ -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);
}