[PATCH 1/2] fprintf: Take inherited types' sizes into account when printing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously, any struct/class that inherited a type had a BRAIN FART with
a size difference of exactly the size of the inherited types.

Example:

struct S
{
    unsigned long a;
};

struct S2 : public S
{
    unsigned long b;
};

pahole output:

struct S {
        long unsigned int          a;                    /*     0     8 */

        /* size: 8, cachelines: 1, members: 1 */
        /* last cacheline: 8 bytes */
};
struct S2 : S {
        /* struct S                   <ancestor>; */     /*     0     8 */
        long unsigned int          b;                    /*     8     8 */

        /* size: 16, cachelines: 1, members: 2 */
        /* last cacheline: 16 bytes */

        /* BRAIN FART ALERT! 16 bytes != 8 (member bytes) + 0 (member bits) + 0 (byte holes) + 0 (bit holes), diff = 64 bits */
};

Take those into account.

Signed-off-by: Pedro Falcato <pedro.falcato@xxxxxxxxx>
---
 dwarves_fprintf.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c
index ef8b82b..5c2d14d 100644
--- a/dwarves_fprintf.c
+++ b/dwarves_fprintf.c
@@ -1735,9 +1735,6 @@ static size_t __class__fprintf(struct class *class, const struct cu *cu,
 		fputc('\n', fp);
 		++printed;
 
-		/* XXX for now just skip these */
-		if (tag_pos->tag == DW_TAG_inheritance)
-			continue;
 #if 0
 		/*
  		 * This one was being skipped but caused problems with:
-- 
2.42.0





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux