diff options
| author | 2019-04-09 17:03:54 -0300 | |
|---|---|---|
| committer | 2019-04-09 17:03:54 -0300 | |
| commit | b42d77b0bbdab78c1eaae16a85617efc32251a09 (patch) | |
| tree | e01f3a0106191e01097045ed4cd9818fbaa0421b | |
| parent | 1c9c1d6bbd452babb66cbfd111a8171c6174929f (diff) | |
| download | pahole-b42d77b0bbdab78c1eaae16a85617efc32251a09.tar.gz | |
fprintf: Print __attribute__((__aligned__(N))) for structs/classes
For instance:
$ pahole -C kern_ipc_perm /home/acme/git/build/v5.0-rc2+/ipc/util.o
struct kern_ipc_perm {
spinlock_t lock; /* 0 4 */
bool deleted; /* 4 1 */
/* XXX 3 bytes hole, try to pack */
int id; /* 8 4 */
key_t key; /* 12 4 */
kuid_t uid; /* 16 4 */
kgid_t gid; /* 20 4 */
kuid_t cuid; /* 24 4 */
kgid_t cgid; /* 28 4 */
umode_t mode; /* 32 2 */
/* XXX 6 bytes hole, try to pack */
long unsigned int seq; /* 40 8 */
void * security; /* 48 8 */
struct rhash_head khtnode; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
struct callback_head rcu __attribute__((__aligned__(8))); /* 64 16 */
refcount_t refcount; /* 80 4 */
/* size: 128, cachelines: 2, members: 14 */
/* sum members: 75, holes: 2, sum holes: 9 */
/* padding: 44 */
/* forced alignments: 1 */
} __attribute__((__aligned__(64)));
$
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | dwarves_fprintf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c index c7334ec..61c9453 100644 --- a/dwarves_fprintf.c +++ b/dwarves_fprintf.c @@ -1608,8 +1608,13 @@ static size_t __class__fprintf(struct class *class, const struct cu *cu, cconf.indent, tabs, type->size, sum_bytes, sum_bits, sum_holes, sum_bit_holes, size_diff); out: - return printed + fprintf(fp, "%.*s}%s%s", indent, tabs, - cconf.suffix ? " ": "", cconf.suffix ?: ""); + + printed += fprintf(fp, "%.*s}%s%s", indent, tabs, cconf.suffix ? " ": "", cconf.suffix ?: ""); + + if (type->alignment != 0) + printed += fprintf(fp, " __attribute__((__aligned__(%u)))", type->alignment); + + return printed; } size_t class__fprintf(struct class *class, const struct cu *cu, FILE *fp) |
