Commit Graph

1064 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo e9fbc24b13 [PAHOLE]: Add a newline after the --class_dwarf_offset output
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-13 15:34:59 -02:00
Arnaldo Carvalho de Melo 0a6cf28e7a [PAHOLE]: Expose type__find_first_biggest_size_base_type_member
Thru -l command line option:

struct e1000_host_mng_command_header {
	uint8_t                    command_id;           /*     0     1 */
	uint8_t                    checksum;             /*     1     1 */
	uint16_t                   reserved1;            /*     2     2 */
	uint16_t                   reserved2;            /*     4     2 */
	uint16_t                   command_length;       /*     6     2 */

	/* size: 8, cachelines: 1 */
	/* last cacheline: 8 bytes */
	/* first biggest size base type member: reserved1 2 2 */
};	/* definitions: 1 */

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-13 15:20:06 -02:00
Arnaldo Carvalho de Melo 2a6382f143 [DWARVES]: Introduce type__find_first_biggest_size_base_type_member
What a mouthful ;-) To be used in finding the most aligned member in a non-packed
type, i.e. one that originally wasn't __attribute__((packed)).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-13 15:18:39 -02:00
Arnaldo Carvalho de Melo 7b0b391cca [PAHOLE]: Account arrays properly when changing word-size
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-12 20:06:46 -02:00
Arnaldo Carvalho de Melo 8007f34dd4 [PAHOLE]: Follow typedefs too when resizing unions
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-12 19:40:10 -02:00
Arnaldo Carvalho de Melo 3ed0620d40 [PAHOLE]: Follow typedefs to find if they are resized structs/unions
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-12 19:21:46 -02:00
Arnaldo Carvalho de Melo 2c58da36fa [PAHOLE]: Check if types of struct and union members were already resized
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-12 15:25:12 -02:00
Arnaldo Carvalho de Melo f086201b9e [DWARVES_REORGANIZE]: Fixup class__fixup_alingment
Subtracting offsets to fill holes in previous fields.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-12 14:25:28 -02:00
Arnaldo Carvalho de Melo f6eb9ed92d [PAHOLE]: Allow changing the architecture word-size
Using a x86_64 binary:

[acme@doppio pahole]$ build/pahole -C restart_block /usr/lib/debug/lib/modules/2.6.21-65.el5rt/kernel/drivers/net/e1000/e1000.ko.debug
struct restart_block {
	long int          (*fn)(struct restart_block *); /*     0     8 */
	union {
		struct {
			long unsigned int arg0;          /*     8     8 */
			long unsigned int arg1;          /*    16     8 */
			long unsigned int arg2;          /*    24     8 */
			long unsigned int arg3;          /*    32     8 */
		};                                       /*          32 */
		struct {
			u32 *      uaddr;                /*     8     8 */
			u32        val;                  /*    16     4 */
			u32        flags;                /*    20     4 */
			u64        time;                 /*    24     8 */
		} fu;                                    /*          24 */
	};                                               /*     8    32 */

	/* size: 40, cachelines: 1 */
	/* last cacheline: 40 bytes */
};

Changing the word-size from 8 to 4 bytes:

[acme@doppio pahole]$ build/pahole -w 4 -C restart_block /usr/lib/debug/lib/modules/2.6.21-65.el5rt/kernel/drivers/net/e1000/e1000.ko.debug
struct restart_block {
	long int       (*fn)(struct restart_block *); /*     0     4 */
	union {
		struct {
			long unsigned int arg0;          /*     4     4 */
			long unsigned int arg1;          /*     8     4 */
			long unsigned int arg2;          /*    12     4 */
			long unsigned int arg3;          /*    16     4 */
		};                                       /*          16 */
		struct {
			u32 *      uaddr;                /*     4     4 */
			u32        val;                  /*     8     4 */
			u32        flags;                /*    12     4 */
			u64        time;                 /*    16     8 */
		} fu;                                    /*          20 */
	};                                               /*     4    20 */

	/* size: 24, cachelines: 1 */
	/* last cacheline: 24 bytes */
};

And from 8 to 16:

[acme@doppio pahole]$ build/pahole -w 16 -C restart_block /usr/lib/debug/lib/modules/2.6.21-65.el5rt/kernel/drivers/net/e1000/e1000.ko.debug
struct restart_block {
	long int          (*fn)(struct restart_block *); /*     0    16 */
	union {
		struct {
			long unsigned int arg0;          /*    16    16 */
			long unsigned int arg1;          /*    32    16 */
			long unsigned int arg2;          /*    48    16 */
			long unsigned int arg3;          /*    64    16 */
			/* --- cacheline 1 boundary (64 bytes) --- */
		};                                       /*          64 */
		struct {
			u32 *      uaddr;                /*    16    16 */
			u32        val;                  /*    32     4 */
			u32        flags;                /*    36     4 */
			u64        time;                 /*    40     8 */
		} fu;                                    /*          32 */
	};                                               /*    16    64 */
	/* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */

	/* size: 80, cachelines: 2 */
	/* last cacheline: 16 bytes */
};

More work is required to specify different alignment rules.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-12 13:14:40 -02:00
Arnaldo Carvalho de Melo c383a868ca [DWARVES_REORGANIZE]: Adopt class__add_offsets_from and class__fixup_alignment from ctracer
Will be used in pahole when changing the word-size.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-12 12:26:06 -02:00
Arnaldo Carvalho de Melo 5d4405bf90 [DWARVES]: build id support requires a recent elfutils package
That is not present in stable distros, where people trying the dwarves, for
now, should just disable build id support in this awkward way till I find out
how to do it properly using cmake.

Or you can get so annoyed to the point of submitting a patch to fix this ;-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-10 12:10:51 -02:00
Arnaldo Carvalho de Melo 7e865ba5b4 [RPM]: 1.4 release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-05 20:27:50 -02:00
Arnaldo Carvalho de Melo 8e099cf5d1 [CODIFF]: Ignore DW_TAG_subprogram tags with DW_AT_abstract_origin
We're not interested in aliases, where we don't have the DW_AT_inline
information we need.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-03 23:34:51 -02:00
Ilpo Järvinen f9fd585591 [CODIFF]: Be even more consistent on the summary lines
Forgotten change similar to the previous patch.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-03 21:33:02 -02:00
Arnaldo Carvalho de Melo aebb6313c0 [CODIFF]: Be consistent on the summary lines
I.e. always print "diff: N", e.g.:

 2 functions changed, 78 bytes removed, diff: -78

/home/acme/git/net-2.6.25/net/ipv4/tcp_input.c:
tcp_sack_extend |  +34
 1 function changed, 34 bytes added, diff: +34

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-03 14:55:20 -02:00
Arnaldo Carvalho de Melo 2d5c5b7438 [CODIFF]: Handle (un)inlining of functions
Thanks to Ilpo Järvinen for reporting that codiff was not reporting such changes.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-03 13:03:32 -02:00
Arnaldo Carvalho de Melo 5444ebab1b [CMAKE]: Remove last reference to dwdb
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-27 23:00:07 -02:00
Arnaldo Carvalho de Melo 8ca5113571 [CMAKEFILE]: Remove references to sqlite3
Not yet ready, thanks to Otavio for pointing out my mistake.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-26 15:43:07 -02:00
Arnaldo Carvalho de Melo 559995be96 [OSTRA]: Change ostra-cg license to GPLv2
And add copyright and license information in ostra.py. Thanks to Thomas Girard
for the suggestions.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-24 12:25:17 -02:00
Arnaldo Carvalho de Melo b4d6de9b6f [LICENSE]: Add COPYING file and add missing license info on some files
Thanks to Otavio Salvador for bringing up this issue.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-17 14:15:42 -02:00
Arnaldo Carvalho de Melo f7b1128d6f [CODIFF]: Show changes to a struct only on the first object file it appears
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-17 11:27:24 -02:00
Arnaldo Carvalho de Melo 66b7191c18 [DUTIL]: Generalise fstrlist
Now at creation time we specify if the strings must be allocated or if using
the pointer directly.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-16 14:55:50 -02:00
Arnaldo Carvalho de Melo 5bc698ab1b [DUTIL]: Move __unused definition to dutil.h
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-16 14:47:59 -02:00
Arnaldo Carvalho de Melo de92e59342 [RPM]: spec file adjustments to follow the Fedora cmake guidelines
http://fedoraproject.org/wiki/Packaging/cmake

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-09 20:47:23 -02:00
Arnaldo Carvalho de Melo c6c71398cd [RPM]: 1.3 release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-08 02:24:01 -02:00
Arnaldo Carvalho de Melo c4ee21aa12 [DWARVES]: Kill some warnings by turning ident variables to int
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-08 01:56:03 -02:00
Arnaldo Carvalho de Melo 27fd61cae4 [CTRACER]: Remove unused variable
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-08 01:53:51 -02:00
Arnaldo Carvalho de Melo bd4d998ea2 [CODIFF]: Remove unused goto label
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-08 01:50:25 -02:00
Arnaldo Carvalho de Melo 114b534f32 [DWARVES]: Check if a bitfield that was combined with a previous field is at the end of the struct
This was found on an old openbsd kernel image that Leonardo Chiquito built
enabling DWARF instead of the default, STABS debugging format 8)

Just this struct has this characteristic:

struct ricoh_is410_window_data {
        struct scsi_window_data    window_data;          /*     0    48 */
        u_int8_t                   res1;                 /*    48     1 */
        u_int8_t                   res2;                 /*    49     1 */

        /* Bitfield combined with previous fields */

        u_int                      mrif:1;               /*    48:15  4 */
        u_int                      filtering:3;          /*    48:12  4 */
        u_int                      gamma_id:4;           /*    48: 8  4 */

        /* size: 52, cachelines: 1 */
        /* bit_padding: 24 bits */
        /* last cacheline: 52 bytes */
};

Now there are no BRAIN FART ALERT!s when paholing openbsd, yay!

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-08 01:46:53 -02:00
Arnaldo Carvalho de Melo b55ede8af2 [DWARVES]: Handle having a bitfield starting at the same offset as a non-bitfield
One more BRAIN FART ALERT! hits the dust.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-08 01:39:29 -02:00
Arnaldo Carvalho de Melo dcb2563bfe [DWARVES]: Fix class__fprintf wrt bitfields combined with previous/next small fields
Lots of BRAIN FART ALERT!s removed!

There is still a problem in class__find_holes where we don't catch bitfields
that are combined with previous fields where the byte offset for the bitfield
is the same as the previous field. This happens when the compiler combines a
bitfield with real byte size > 1 just after a one or two bytes field that is at
an alignment boundary.

Will fix later.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-07 19:27:52 -02:00
Arnaldo Carvalho de Melo 7953ff3ed3 [DWARVES]: Mark the end of bitfields in class__find_holes
To ease some algorithms where we have to find the transition from
one bitfield to another.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-07 19:24:59 -02:00
Arnaldo Carvalho de Melo 68be38bddd [DWARVES]: Properly find holes in bitfields
Make class__find_holes understand that when a byte offset goes backward it is
because the compiler is "combining" small bitfields with previous fields, and
using from the end of the combined bitfield + small fields. This made your
head hurt, huh? One example:

struct usb_bus {
	struct device *            controller;           /*     0     8 */
	int                        busnum;               /*     8     4 */

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

	char *                     bus_name;             /*    16     8 */
	u8                         uses_dma;             /*    24     1 */
	u8                         otg_port;             /*    25     1 */

	/* Bitfield combined with previous fields */

	unsigned int               is_b_host:1;          /*    24:15  4 */
	unsigned int               b_hnp_enable:1;       /*    24:14  4 */

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

	int                        devnum_next;          /*    28     4 */
	struct usb_devmap          devmap;               /*    32    16 */
<SNIP>
};

See? is_b_host:1 .. b_hnp_enable:1 makes a bitfield of just two bits.

The programmer decided to make this a 'unsigned int' bitfield, so taking 4 bytes.

And placed this "4" bytes bitfield just after two fields of one byte.

The compiler put the "4" bytes bitfield "in the same place" as the "uses_dma"
field, but its really not clobbering it neither "otg_port", as it allocates it
from (offset 24 + sizeof(unsigned int) - 1), backwards.

So at the end there is a, now correctly calculated, 14 bits hole, and that
matches the bit offset used for the last field, that is "14", as offsets for
bits and bytes starts at zero, all is explained now.

One last thing is that since we actually have 14 bits we in fact have a one
byte hole + a 6 bits hole, but that should be clear (haha) for those looking
for holes :-)

Nah, just run pahole reorganize on this beast and you'll have (for the complete
structure, with the <SNIP> part back in:

struct usb_bus {
	struct device *            controller;           /*     0     8 */
	int                        busnum;               /*     8     4 */
	unsigned char              is_b_host:1;          /*    12:247  1 */
	unsigned char              b_hnp_enable:1;       /*    12:246  1 */

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

	u8                         otg_port;             /*    13     1 */
	u8                         uses_dma;             /*    14     1 */

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

	char *                     bus_name;             /*    16     8 */
	int                        bandwidth_isoc_reqs;  /*    24     4 */
	int                        devnum_next;          /*    28     4 */
	struct usb_devmap          devmap;               /*    32    16 */
	struct usb_device *        root_hub;             /*    48     8 */
	struct list_head           bus_list;             /*    56    16 */
	/* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
	int                        bandwidth_allocated;  /*    72     4 */
	int                        bandwidth_int_reqs;   /*    76     4 */
	struct dentry *            usbfs_dentry;         /*    80     8 */
	struct class_device *      class_dev;            /*    88     8 */
	struct mon_bus *           mon_bus;              /*    96     8 */
	int                        monitored;            /*   104     4 */

	/* size: 112, cachelines: 2 */
	/* sum members: 107, holes: 1, sum holes: 1 */
	/* bit holes: 1, sum bit holes: 6 bits */
	/* padding: 4 */
	/* last cacheline: 48 bytes */
};   /* saved 8 bytes! */

And we save 8 bytes and reduce the previous complexity. Hey, but look at those
bit offsets at is_b_host and b_hnp_enable... damn, exposing the bit offsets I
just exposed another bug, that is: the reorganization code is not fixing up the
bit offsets, one more for the TODO list, nah, just compile it and pass the
results back to the dwarves and we get:

struct usb_bus {
	struct device *            controller;           /*     0     8 */
	int                        busnum;               /*     8     4 */
	unsigned char              is_b_host:1;          /*    12: 7  1 */
	unsigned char              b_hnp_enable:1;       /*    12: 6  1 */

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

	u8                         otg_port;             /*    13     1 */
	u8                         uses_dma;             /*    14     1 */

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

	char *                     bus_name;             /*    16     8 */
	int                        bandwidth_isoc_reqs;  /*    24     4 */
	int                        devnum_next;          /*    28     4 */
	struct usb_devmap          devmap;               /*    32    16 */
	struct usb_device *        root_hub;             /*    48     8 */
	struct list_head           bus_list;             /*    56    16 */
	/* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
	int                        bandwidth_allocated;  /*    72     4 */
	int                        bandwidth_int_reqs;   /*    76     4 */
	struct dentry *            usbfs_dentry;         /*    80     8 */
	struct class_device *      class_dev;            /*    88     8 */
	struct mon_bus *           mon_bus;              /*    96     8 */
	int                        monitored;            /*   104     4 */

	/* size: 112, cachelines: 2 */
	/* sum members: 107, holes: 1, sum holes: 1 */
	/* bit holes: 1, sum bit holes: 6 bits */
	/* padding: 4 */
	/* last cacheline: 48 bytes */
};

See? this time gcc fixed up things for us and even agreed on the reorganization
the dwarves did! 8-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-07 15:03:27 -02:00
Arnaldo Carvalho de Melo 31d20380cc [DWARVES]: Print the bit offset too
Helps understanding how bitfields really work, and after all it is just
confusing, not wrong.

See this one:

struct usb_bus {
	struct device *      controller;       /*   0     8 */
	int                  busnum;           /*   8     4 */

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

	char *               bus_name;         /*  16     8 */
	u8                   uses_dma;         /*  24     1 */
	u8                   otg_port;         /*  25     1 */

	/* WARNING: DWARF offset=24, real offset=26 */

	unsigned int         is_b_host:1;      /*  24:15  4 */
	unsigned int         b_hnp_enable:1;   /*  24:14  4 */

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

	int                  devnum_next;      /*  28     4 */
<SNIP>
};

So the bitfield _really_ is at offset 24 and the "WARNING:" above is just
pahole not understanding how it works, i.e. it starts at 24 and since the
bitfield has a 'unsigned int' as its base type it goes from 24 to 27, the
offsets start at the end, i.e. from byte 27 back to byte 27, but as only two
bits are used, it puts bit padding at the end, at bit offset 0, that is the
last bit in byte 27 and uses the first bits of byte 26 at bit offset 14 and 15.

Now to make libdwarves finally understand this convention.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-07 14:12:35 -02:00
Arnaldo Carvalho de Melo 6f40c17161 [RPM]: 1.2 release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-07 11:38:06 -02:00
Arnaldo Carvalho de Melo 07e0974f2c [DWARVES]: Add sanity check when calculating size from DWARF offsets
This struct, from the linux kernel:

struct usb_bus {
        struct device *            controller;           /*     0     8 */
        int                        busnum;               /*     8     4 */
        char *                     bus_name;             /*    16     8 */
        u8                         uses_dma;             /*    24     1 */
        u8                         otg_port;             /*    25     1 */
        unsigned int               is_b_host:1;          /*    24     4 */
        unsigned int               b_hnp_enable:1;       /*    24     4 */
        int                        devnum_next;          /*    28     4 */
        struct usb_devmap          devmap;               /*    32    16 */
        struct usb_device *        root_hub;             /*    48     8 */
        struct list_head           bus_list;             /*    56    16 */
        int                        bandwidth_allocated;  /*    72     4 */
        int                        bandwidth_int_reqs;   /*    76     4 */
        int                        bandwidth_isoc_reqs;  /*    80     4 */
        struct dentry *            usbfs_dentry;         /*    88     8 */
        struct class_device *      class_dev;            /*    96     8 */
        struct mon_bus *           mon_bus;              /*   104     8 */
        int                        monitored;            /*   112     4 */
};

Generates seemingly wrong DWARF when compiled with GCC:

struct usb_bus {
	struct device *            controller;           /*     0     8 */
	int                        busnum;               /*     8     4 */

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

	char *                     bus_name;             /*    16     8 */
	u8                         uses_dma;             /*    24     1 */
	u8                         otg_port;             /*    25     1 */

	/* WARNING: DWARF offset=24, real offset=26 */

	unsigned int               is_b_host:1;          /*    24     4 */
	unsigned int               b_hnp_enable:1;       /*    24     4 */

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

	int                        devnum_next;          /*    28     4 */
	struct usb_devmap          devmap;               /*    32    16 */
	struct usb_device *        root_hub;             /*    48     8 */
	struct list_head           bus_list;             /*    56    16 */
	/* --- cacheline 1 boundary (64 bytes) was 10 bytes ago --- */
	int                        bandwidth_allocated;  /*    72     4 */
	int                        bandwidth_int_reqs;   /*    76     4 */
	int                        bandwidth_isoc_reqs;  /*    80     4 */

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

	struct dentry *            usbfs_dentry;         /*    88     8 */
	struct class_device *      class_dev;            /*    96     8 */
	struct mon_bus *           mon_bus;              /*   104     8 */
	int                        monitored;            /*   112     4 */

	/* size: 120, cachelines: 2 */
	/* sum members: 110, holes: 2, sum holes: 8 */
	/* bit holes: 1, sum bit holes: 30 bits */
	/* padding: 4 */
	/* last cacheline: 56 bytes */

	/* BRAIN FART ALERT! 120 != 110 + 8(holes), diff = 2 */

};

Look at the offset for the first entry in the bitfield (is_b_host), the
compiler said in the DWARF info that it was at offset 25, when in fact it is at
offset 26 as can be seen when looking at the generated assembly code.

This previously was confusing libdwarves, as it uses subtracts the last offset
from the current offset to see what was the size the compiler really allocated
to then check if it is equal to the size of the previous entry, so as to detect
alignment holes.

The offsets are uint32_t, so cast both to int64_t when doing the calculation,
the existing code already deals with negative numbers that result in this
patologic case.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-06 21:59:42 -02:00
Arnaldo Carvalho de Melo be79835bf3 [RPM]: 1.1 release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-06 18:23:21 -02:00
Arnaldo Carvalho de Melo 2c01420b51 [CMAKE]: Add linux.blacklist.cu to the install targets
Also updating the manifest and lib/Makefile to find it in
/usr/share/dwarves/runtime.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-06 17:43:20 -02:00
Daniel Gollub 023733eb39 [CMAKE]: CMake Build Env patches for pahole/dwarves
This is used to let cmake know that's only C project, and it shouldn't check
for C++ compiler - shrinks the build requirements ;)

+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} )

This one allows to make out of sourcetree builds...

Signed-off-by: Daniel Gollub <dgollub@suse.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-12-03 14:43:49 -02:00
Arnaldo Carvalho de Melo 5a58b1dfef [DWARVES]: Use dwfl_getdwarf in cus__loadfl to get the buildid
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-24 00:28:15 -02:00
Arnaldo Carvalho de Melo b0a2942cde [SYSCSE]: Fix printf format specifier
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-24 00:20:15 -02:00
Arnaldo Carvalho de Melo 948addc787 [CTRACER]: Remove ctracer_jprobes.c, not used anymore
Now that ctracer generates systemtap scripts lets drop this file, its
misleading for casual readers.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-23 23:04:47 -02:00
Arnaldo Carvalho de Melo 80d6e56e1d [DWARVES_REORGANIZE]: Add a sanity check on class__demote_bitfields
In fact a BRAIN FART ALERT! 8-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-20 17:55:18 -02:00
Arnaldo Carvalho de Melo 390e2c64f4 [CTRACER]: Implement support for blacklisting CUs
In the Linux kernel, currently the only target, we can't probe the
functions in kernel/{kprobe,relay}.c.

When systemtap starts supporting uprobes, there may be other cases that
require blacklisting CUs.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-17 18:10:58 -02:00
Arnaldo Carvalho de Melo 4e406446d0 [CTRACER]: Fully qualify the probe by using the CU name
I.e. now we use this systemtap syntax:

probe mtrr_write = kernel.function("mtrr_write@arch/i386/kernel/cpu/mtrr/if.c")

mtrr_write is the function, followed by @ and then the CU, i.e. the source for
the object file (CU) where the function is.

This way we can support global namespace clashes.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-17 18:10:37 -02:00
Arnaldo Carvalho de Melo 06b3a1073e [DUTIL]: utilities for the dwarves
Can be used in other projects too.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-17 18:05:40 -02:00
Arnaldo Carvalho de Melo 232b8b2684 [CTRACER]: Add support for "pointer classes"
A pointer class is one that has as one of its members a pointer to the target class,
example:

target class: sock
pointer classes: sk_buff, socket

Because struct sk_buff and struct socket has members that are pointers to a struct sock.

This way we can follow all the struct socket and struct sk_buff methods and pass to
the struct sock collector as $skb->sk, for instance.

With this we now go all the way from the socket layer to the sk_buff layer, passing thru
the sock layer.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-17 11:49:20 -02:00
Arnaldo Carvalho de Melo 515738edee [DWARVES]: Initialize tool_node on function__new
In ctracer we can find a function that receives as one of its arguments a
pointer to the target class and also a pointer to an alias or pointer class,
so we have to check if the function was already added to one of these lists:

class methods list
class aliases list
class pointer list

To avoid corrupting one of them by trying to add the function to multiple
lists.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-17 11:11:33 -02:00
Arnaldo Carvalho de Melo c10930d7e9 [PAHOLE]: Implement --find_pointers_to
To find members that are pointers to the specified class:

[acme@tab pahole]$ pahole -f sock /usr/lib/debug/lib/modules/2.6.23.1-49.fc8/vmlinux
tcp_iter_state: syn_wait_sk
ip_ra_chain: sk
netlink_set_err_data: exclude_sk
netlink_broadcast_data: exclude_sk
cn_dev: nls
cn_callback_entry: nls
cn_queue_dev: nls
sk_security_struct: sk
unix_sock: peer
unix_sock: other
request_sock: sk
mqueue_inode_info: notify_sock
sock_iocb: sk
socket: sk
sk_buff: sk

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-16 18:18:08 -02:00
Arnaldo Carvalho de Melo 6c7a1721ec [DWARVES]: Tell cu__find_struct_by_name if struct declarations are wanted
When we are looking for members of some type in all CUs it may be that in
some CU we don't have the full type, but just a declaration.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-16 18:16:56 -02:00