Commit Graph

560 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo d37f41df58 [LIB]: Pass a FILE pointer to the cus__emit routines
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-02 12:52:46 -02:00
Arnaldo Carvalho de Melo b7cad1782d [RPM]: Release 13
Adding pglobal and the latest advancements in pahole --reorganize.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-02 12:30:56 -02:00
Davi Arnaut 4ab3403e3b [LIB]: Add initial support for DW_AT_location, in variables
And use it in a new tool, pglobal, that shows global variables and functions.

Signed-off-by: Davi Arnaut <davi@haxent.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-02 11:56:53 -02:00
Arnaldo Carvalho de Melo dfccef66dd [LIB]: Use list_for_each_entry_safe in class__delete
As we're deleting the members.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-01 15:54:42 -02:00
Arnaldo Carvalho de Melo e4ad9bb2e8 [LIB]: Optionally pass a new name for the class in class__clone
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-01 14:09:48 -02:00
Arnaldo Carvalho de Melo aab506fdcc [LIB]: Pass a FILE pointer to the __print routines
So that in tools like ctracer we can print to a file, most of the tools just
pass stdout, keeping the previous behaviour.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-01 13:50:28 -02:00
Arnaldo Carvalho de Melo 67119ea1a3 [LIB]: Move class__reorganize and friends from pahole to libdwarves
Will be used in ctracer to create a struct subset with just the types for which
we have "collectors", i.e. functions that reduce complex types to base types
that will be put in the mini-struct, that will be as tightly packed as it can
be.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-01 13:17:41 -02:00
Arnaldo Carvalho de Melo f221465b68 [PAHOLE]: Introduce --show_reorg_steps
To show how the struct looks like after each member reorganization, should help
with debugging when something looks like a bad decision.

An example is provided at:

http://oops.ghostprotocols.net:81/acme/dwarves/pahole--reorganize--verbose--show_reorg_steps_example.txt

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-01 12:27:43 -02:00
Arnaldo Carvalho de Melo 5d300c135e [LIB]: Export class__print
Will be used by pahole --show_reorg_steps

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-01 11:51:38 -02:00
Arnaldo Carvalho de Melo d105a5eb6c [PAHOLE]: Reorganize bitfields
This cset also does a fixup for cases where the compiler keeps the type
specified by the programmer for a bitfield but uses less space to combine with
the next, non-bitfield member, these cases can be caught using plain pahole and
will appear with this comment:

        /* --- cacheline 1 boundary (64 bytes) --- */
        int          bitfield1:1;   /* 64 4 */
        int          bitfield2:1;   /* 64 4 */

        /* XXX 14 bits hole, try to pack */
        /* Bitfield WARNING: DWARF size=4, real size=2 */

        short int    d;             /* 66 2 */

The fixup is done prior to reorganizing the fields.

Now an example of this code in action:

[acme@filo examples]$ cat swiss_cheese.c
<SNIP>
struct cheese {
        char  id;
        short number;
        char  name[52];
        int   a:1;
        int   b;
        int   bitfield1:1;
        int   bitfield2:1;
        short d;
        short e;
        short last:5;
};
<SNIP>
[acme@filo examples]$

Lets look at the layout:

[acme@filo examples]$ pahole swiss_cheese cheese
/* <11b> /home/acme/git/pahole/examples/swiss_cheese.c:3 */
struct cheese {
        char        id;             /*  0  1 */

        /* XXX 1 byte hole, try to pack */

        short int   number;         /*  2  2 */
        char        name[52];       /*  4 52 */
        int         a:1;            /* 56  4 */

        /* XXX 31 bits hole, try to pack */

        int         b;              /* 60  4 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        int         bitfield1:1;    /* 64  4 */
        int         bitfield2:1;    /* 64  4 */

        /* XXX 14 bits hole, try to pack */
        /* Bitfield WARNING: DWARF size=4, real size=2 */

        short int   d;              /* 66  2 */
        short int   e;              /* 68  2 */
        short int   last:5;         /* 70  2 */
}; /* size: 72, cachelines: 2 */
   /* sum members: 71, holes: 1, sum holes: 1 */
   /* bit holes: 2, sum bit holes: 45 bits */
   /* bit_padding: 11 bits */
   /* last cacheline: 8 bytes */
[acme@filo examples]$

Full of holes, has bit padding and uses more than one 64 bytes cacheline.

Now lets ask pahole to reorganize it:

[acme@filo examples]$ pahole --reorganize --verbose swiss_cheese cheese
/* Demoting bitfield ('a' ... 'a') from 'int' to 'unsigned char' */
/* Demoting bitfield ('bitfield1' ... 'bitfield2') from 'short unsigned int' to 'unsigned char' */
/* Demoting bitfield ('last') from 'short int' to 'unsigned char' */
/* Moving 'bitfield2:1' from after 'bitfield1' to after 'a:1' */
/* Moving 'bitfield1:1' from after 'b' to after 'bitfield2:1' */
/* Moving 'last:5' from after 'e' to after 'bitfield1:1' */
/* Moving bitfield('a' ... 'last') from after 'name' to after 'id' */
/* Moving 'e' from after 'd' to after 'b' */

/* <11b> /home/acme/git/pahole/examples/swiss_cheese.c:3 */
struct cheese {
        char                       id;                   /*     0     1 */
        unsigned char              a:1;                  /*     1     1 */
        unsigned char              bitfield2:1;          /*     1     1 */
        unsigned char              bitfield1:1;          /*     1     1 */
        unsigned char              last:5;               /*     1     1 */
        short int                  number;               /*     2     2 */
        char                       name[52];             /*     4    52 */
        int                        b;                    /*    56     4 */
        short int                  e;                    /*    60     2 */
        short int                  d;                    /*    62     2 */
        /* --- cacheline 1 boundary (64 bytes) --- */
}; /* size: 64, cachelines: 1 */
   /* saved 8 bytes and 1 cacheline! */
[acme@filo examples]$

Instant karma, it gets completely packed, and look ma, no
__attribute__((packed)) :-)

With this struct task_struct in the linux kernel is shrunk by 12 bytes, there
is more 4 bytes to save with another technique that involves not combining
holes, but using the last single hole to fill it with members at the tail of
the struct.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-02-01 10:51:16 -02:00
Arnaldo Carvalho de Melo 26c1474b61 [CMAKE/RPM]: Fix build for x86-64
RPMS for FC6 x86-64 are available at:

http://oops.ghostprotocols.net:81/acme/dwarves/rpm/x86-64/

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-30 19:07:28 -02:00
Arnaldo Carvalho de Melo 8e236f4ca3 [PAHOLE]: Combine bitfields and demote the ones that have more bits than needed
This allows us to save 4 more bytes in struct task_struct, for instance, now we
need to combine whole bitfields with other fields if some bitfield has a size
less than sizeof(void *) and there is a suitable hole.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-30 16:55:19 -02:00
Arnaldo Carvalho de Melo ac4fe37f72 [LIB]: Introduce cu__find_base_type_by_name
Will be used by the bitfield reorganizer in pahole.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-30 16:53:01 -02:00
Arnaldo Carvalho de Melo 4a4b75e75a [PAHOLE]: Introduce --reorganize
Reorganizes structs with holes as non disruptively as possible to combine
holes, possibly reducing the struct size.

It doesn't yet combines bit holes, but will.

And will suggest type demotion in the bitfields case i.e. if there is a integer
(4) bytes bitfield that could fit on an short int bitfield or on a char
bitfield, it'll do just that 8)

Examples are available at:

http://oops.ghostprotocols.net:81/acme/dwarves/pahole--reorganize-ide-core-struct-hwif_s.pahole.txt
http://oops.ghostprotocols.net:81/acme/dwarves/pahole--reorganize-sched-struct-task_struct.pahole.txt
http://oops.ghostprotocols.net:81/acme/dwarves/pahole--reorganize-serial-struct-jsm_channel.pahole.txt

Also look at a more detailed description at my blog:

http://oops.ghostprotocols.net:81/blog/?p=49

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-30 13:32:55 -02:00
Arnaldo Carvalho de Melo 2de67fcaf4 [PAHOLE]: Implement type expansion
What is in a struct...

[acme@filo pahole]$ pahole net/ipv6/tcp_ipv6.o delayed_work
/* <2bc9> /home/acme/git/linux-2.6/include/linux/workqueue.h:37 */
struct delayed_work {
        struct work_struct         work;                 /*     0    16 */
        struct timer_list          timer;                /*    16    24 */
}; /* size: 40, cachelines: 1 */
   /* last cacheline: 40 bytes */
[acme@filo pahole]$

Oh, but what if we want to unfold all the structs?

lo pahole]$ pahole --expand_types /home/acme/git/OUTPUT/qemu/linux-2.6/net/ipv6/tcp_ipv6.o delayed_work
/* <2bc9> /home/acme/git/linux-2.6/include/linux/workqueue.h:37 */
struct delayed_work {
        struct work_struct {
                atomic_long_t      data;                 /*   0   4 */
                struct list_head {
                        struct list_head * next;         /*   0   4 */
                        struct list_head * prev;         /*   4   4 */
                } entry;				 /*   4   8 */
                work_func_t        func;                 /*  12   4 */
        } work;						 /*   0  16 */
        struct timer_list {
                struct list_head {
                        struct list_head * next;         /*   0   4 */
                        struct list_head * prev;         /*   4   4 */
                } entry; /*     0     8 */
                long unsigned int  expires;              /*   8   4 */
                void               (*function)(long unsigned int); /*    12     4 */
                long unsigned int  data;                 /*  16   4 */
                struct tvec_t_base_s * base;             /*  20   4 */
        } timer; /*    16    24 */
}; /* size: 40, cachelines: 1 */
   /* last cacheline: 40 bytes */
[acme@filo pahole]$

Quick hack, as we already had all the needed infrastructure due to anonymous struct
printing inside structs/unions, now for the curious, if you have the kernel-debuginfo
package installed in your FC6 machine:

[acme@filo pahole]$ pahole --expand_types /usr/lib/debug/lib/modules/2.6.19-1.2895.fc6/kernel/net/ipv6/ipv6.ko.debug tcp6_sock

Try struct task_struct too 8-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 13:12:23 -02:00
Arnaldo Carvalho de Melo f426dc12f2 [LIB]: Print a comment after struct members with padding
/* <9fec83> /home/acme/git/linux-2.6/include/linux/sysdev.h:40 */
struct sysdev_class_attribute {
        struct attribute attr;                 /*     0    12 */

        /* XXX last struct has 2 bytes of padding */

        ssize_t          (*show)(struct sysdev_class *, char *); /*    12     4 */
        ssize_t          (*store)(struct sysdev_class *, const char  *, size_t); /*    16     4 */
}; /* size: 20, cachelines: 1 */
   /* paddings: 1, sum paddings: 2 */
   /* last cacheline: 20 bytes */
   /* definitions: 1 */

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 12:43:49 -02:00
Arnaldo Carvalho de Melo 01b8a495c4 [LIB]: Show the number of paddings as well, not just the sum
In the Linux kernel there were no cases of more than one member
struct with paddings.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 12:01:15 -02:00
Arnaldo Carvalho de Melo 9b0edcc982 [PAHOLE]: Fix alignment of options descriptions in --help
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 11:18:46 -02:00
Arnaldo Carvalho de Melo cdd8f5bf1e [PFUNCT]: Fix alignment of options descriptions in --help
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 11:15:33 -02:00
Davi Arnaut eecaaae16e [PFUNCT]: Fix --function_name_len description
Signed-off-by: Davi Arnaut <davi@haxent.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 11:11:10 -02:00
Arnaldo Carvalho de Melo b5baabcd16 [ALL]: Fixup warnings
Using export CFLAGS="-Wall -Wfatal-errors -Wformat=2 -Wsequence-point -Wextra
-Wno-parentheses -g", suggested by Davi Arnault, amazing how cruft piles up
when one is not looking ;)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 10:42:03 -02:00
Davi Arnaut a7b22b8f2c [LIB]: Show the sum of paddings in structs within a struct
Commiter note:

Idea and initial patch by Davi Arnaut, I fixed it to do the right thing,
to understand why this is useful, nothing better than an example:

/* <bd92a0> /home/acme/git/linux-2.6/include/net/xfrm.h:242 */
struct xfrm_tmpl {
        struct xfrm_id             id;                   /*     0    24 */
        xfrm_address_t             saddr;                /*    24    16 */
        short unsigned int         encap_family;         /*    40     2 */

        /* XXX 2 bytes hole, try to pack */

        __u32                      reqid;                /*    44     4 */
        __u8                       mode;                 /*    48     1 */
        __u8                       share;                /*    49     1 */
        __u8                       optional;             /*    50     1 */

        /* XXX 1 byte hole, try to pack */

        __u32                      aalgos;               /*    52     4 */
        __u32                      ealgos;               /*    56     4 */
        __u32                      calgos;               /*    60     4 */
        /* --- cacheline 1 boundary (64 bytes) --- */
}; /* size: 64, cachelines: 1 */
   /* sum members: 61, holes: 2, sum holes: 3 */
   /* sum padding: 3 */
   /* definitions: 22 */

"sum padding" here means there is some member that is a struct and this struct
has paddings: struct xfrm_id:

/* <bd78b6> /home/acme/git/linux-2.6/include/linux/xfrm.h:24 */
struct xfrm_id {
	xfrm_address_t             daddr;                /*     0    16 */
	__be32                     spi;                  /*    16     4 */
	__u8                       proto;                /*    20     1 */
}; /* size: 24, cachelines: 1 */
   /* padding: 3 */
   /* last cacheline: 24 bytes */
   /* definitions: 22 */

Signed-off-by: Davi Arnaut <davi@haxent.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-29 00:16:33 -02:00
Davi Arnaut c9bd654d3b [PAHOLE]: Handle anonymous structs
Some are just typedefs, others are inside structs and in some cases its
useful to see the statistics for them, so add two new cmd line options:

-a, --anon_include        include anonymous classes\
-A, --nested_anon_include include nested (inside other structs) anonymous classes

Commiter note: I've reworked several aspects of the patch, but mostly to
give better names for the new find_first_typedef_of_type function, adding
a clarifying comment and introducing --nested_anon_include so that we
can select just the typedef'ed anonymous structs.

Damn, I had commited just dwarves.c, here is the dwarves.h and pahole.c bits.

Signed-off-by: Davi Arnaut <davi@haxent.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-28 11:07:22 -02:00
Davi Arnaut 9241301511 [PAHOLE]: Handle anonymous structs
Some are just typedefs, others are inside structs and in some cases its
useful to see the statistics for them, so add two new cmd line options:

-a, --anon_include        include anonymous classes\
-A, --nested_anon_include include nested (inside other structs) anonymous classes

Commiter note: I've reworked several aspects of the patch, but mostly to
give better names for the new find_first_typedef_of_type function, adding
a clarifying comment and introducing --nested_anon_include so that we
can select just the typedef'ed anonymous structs.

Signed-off-by: Davi Arnaut <davi@haxent.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-28 02:18:34 -02:00
Arnaldo Carvalho de Melo 2705bba815 [PAHOLE]: Fix the usage info, its a class name not a function name
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 19:46:35 -02:00
Arnaldo Carvalho de Melo 9555603666 [RPM]: 9th release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 19:42:54 -02:00
Arnaldo Carvalho de Melo 6bf2d2d770 [CTRACER]: Move the jprobes init code to lib/ctracer_jprobes.c
So that we don't have to do all the code emission inside ctracer.c, add
a Makefile too that uses the kernel rpm files shipped by your distro to
easily build a module for your workstation, see README.ctracer, that was
updated to describe the steps needed to have ctracer running in your
machine.

Now to polish the relay code.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 18:38:07 -02:00
Arnaldo Carvalho de Melo ddbf5f0013 [CTRACER]: Cosmetic, add a missing newline
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 09:10:30 -02:00
Arnaldo Carvalho de Melo 4a7a4f256a [CTRACER]: At module exit check if we missed any probe
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 09:09:04 -02:00
Arnaldo Carvalho de Melo 7465f3c2f0 [CTRACER]: Check if the specified class exists
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 09:03:40 -02:00
Arnaldo Carvalho de Melo 8b8166f0a8 [RPM]: 8th release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-27 08:57:52 -02:00
Arnaldo Carvalho de Melo c49f2c9634 [LIB]: Add orphan DW_TAG_formal_parameter tags to the lexblock where it appears
Previously it was being added to the CU tag list.

This also fixes a problem in cu__find_parameter_by_id where the second test in
the loop was actually outside the loop due to lack of {}.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-26 00:29:53 -02:00
Arnaldo Carvalho de Melo 2aa6ef9a0f [LIB]: Use dwarf_dieoffset where we were using dwarf_cuoffset
Better, to match the readelf (binutils) and eu-readelf (elfutils) tools,
that on multi CU blobs is the way to go.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-25 16:24:09 -02:00
Davi Arnaut 4e93019433 [LIB]: Add missing { in typedef__print
That was preventing the correct printing of anonymous struct typedefs.

Signed-off-by: Davi Arnaut <davi@haxent.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-25 10:31:36 -02:00
Arnaldo Carvalho de Melo a4856181a7 [LIB]: Emit typedefs of typedef arrays
Such as this one, when using ctracer to trace struct task_struct methods:

  --- ctracer_methods.c.before	2007-01-24 09:20:30.000000000 -0200
  +++ ctracer_methods.c	2007-01-24 09:38:35.000000000 -0200
  @@ -759,7 +759,8 @@
   	.entry = (kprobe_opcode_t *)jprobe_entry__release_thread,
   };

  -typedef elf_greg_t elf_gregset_t;
  +typedef long unsigned int elf_greg_t;
  +typedef elf_greg_t elf_gregset_t[17];

   static int jprobe_entry__dump_task_regs(struct task_struct * tsk, elf_gregset_t * regs)
   {

Code impact:

[acme@filo pahole]$ codiff build/libdwarves.so.before build/libdwarves.so
/home/acme/git/pahole/dwarves.c:
  typedef__print                | +154
    cus__emit_typedef_definitions |  +27
     2 functions changed, 181 bytes added
     [acme@filo pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-24 09:41:46 -02:00
Arnaldo Carvalho de Melo 68d64b2930 [LIB]: Detect typedef loops
Recheck if the typedef was emitted as part of the emission of its target, as
there are cases, like wait_queue_t in the Linux kernel, that is against struct
__wait_queue, that has a wait_queue_func_t member, a function typedef that has
as one of its parameters a... wait_queue_t, that will thus be emitted before
the function typedef, making a no go to redefine the typedef after struct
__wait_queue.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-24 09:10:26 -02:00
Arnaldo Carvalho de Melo 4c2ef6007f [LIB]: Fix emission of arrays of structs, unions, etc
And it even shrinks the lib a bit :-)

[acme@filo pahole]$ codiff build/libdwarves.so.before build/libdwarves.so
/home/acme/git/pahole/dwarves.c:
  cus__emit_tag_definitions |  -68
   1 function changed, 68 bytes removed
   [acme@filo pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-24 08:58:50 -02:00
Arnaldo Carvalho de Melo 30165f5c63 [LIB]: Don't return struct declarations in cu__find_struct_by_name
Find the real thing instead.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-01-23 16:25:24 -02:00
Arnaldo Carvalho de Melo 4038bf3c4c [CTRACER]: Comment the code
I should have done this since day one, but was lazy, now somebody complained
on my blog and I thought it was time to bite this bullet, hopefully will be
helpful for people interested in helping improve these tools, as the comments
are useful for understanding the other dwarves too.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-01-20 11:25:50 -02:00
Arnaldo Carvalho de Melo 812406d9fb [LIB]: Use sysconf to get the L1 cacheline size
As suggested by Ulrich Drepper.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-01-18 21:41:25 -02:00
Arnaldo Carvalho de Melo 46884e3d4f [LIB]: Make the default cacheline be 64
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-01-18 21:18:44 -02:00
Arnaldo Carvalho de Melo 4138db6ebe [RPM]: New release with pdwtags
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-01-18 21:15:54 -02:00
Arnaldo Carvalho de Melo fab0db03ea [PDWTAGS]: New tool
Pretty prints all of the tags, still needs a bit more work.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-01-18 21:13:56 -02:00
Arnaldo Carvalho de Melo feb2e08c36 [RPM]: First fedora native build
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-01-18 17:28:35 -02:00
Arnaldo Carvalho de Melo e3786105c0 [LIB]: Handle void typedefs
Oh the horror, found in a proprietary kernel module:

typedef void * PVOID;

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-16 12:19:06 -02:00
Arnaldo Carvalho de Melo 1750958111 [LIB]: Separate emission of definitions in a type from the emission of the type itself
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-16 12:11:35 -02:00
Arnaldo Carvalho de Melo 14863f943e [LIB]: Remove the prefix tag for enum functions
Now the functions that call cus__emit_enumeration_definitions should call
tag__print_decl_info, so that if it is a typedef we can just print "typedef ",
then call the enum printing routines.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-15 12:15:59 -02:00
Arnaldo Carvalho de Melo 36c4c5a386 [LIB]: Handle union typedefs
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-15 11:21:39 -02:00
Arnaldo Carvalho de Melo 8f8a691a6a [LIB]: Handle enum typedefs
Using 'ctracer vmlinux pci_dev' without and with this cset:

  --- ctracer.c.old 2007-01-15 10:45:45.000000000 -0200
  +++ ctracer.c	  2007-01-15 10:45:57.000000000 -0200
  @@ -2175,7 +2175,28 @@
   struct hwgroup_s;
   struct proc_dir_entry;
   typedef int (ide_ack_intr_t)(struct hwif_s *);
  -typedef enum  hwif_chipset_t;
  +/* <a710> /pub/scm/linux/kernel/git/acme/linux-2.6/include/linux/ide.h:199 */
  +typedef enum {
  +	ide_unknown = 0,
  +	ide_generic = 1,
  +	ide_pci = 2,
  +	ide_cmd640 = 3,
  +	ide_dtc2278 = 4,
  +	ide_ali14xx = 5,
  +	ide_qd65xx = 6,
  +	ide_umc8672 = 7,
  +	ide_ht6560b = 8,
  +	ide_rz1000 = 9,
  +	ide_trm290 = 10,
  +	ide_cmd646 = 11,
  +	ide_cy82c693 = 12,
  +	ide_4drives = 13,
  +	ide_pmac = 14,
  +	ide_etrax100 = 15,
  +	ide_acorn = 16,
  +	ide_au1xxx = 17,
  +	ide_forced = 18,
  +} hwif_chipset_t;
   struct device;

 /* <a796> /pub/scm/linux/kernel/git/acme/linux-2.6/include/linux/ide.h:211 */

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-15 10:51:07 -02:00
Arnaldo Carvalho de Melo 37d19a9320 [LIB]: Emit definitions for structs in typedefs
I.e. things like

typedef struct foo bar;

will emit the definition for struct foo before emitting the above line.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2007-01-15 10:39:23 -02:00