[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:
parent
786ef46234
commit
a62ebae88b
12
pahole.c
12
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue