Commit Graph

685 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 03a653048e [DWARVES]: Check if type was found for members in union__fprintf
As we already do in class__fprintf.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-03-04 12:44:40 -03:00
Arnaldo Carvalho de Melo b3489e14eb [DWARVES]: Move all the DWARF specific loading routines to dwarf_loader.c
In libdwarves.so well continue using DW_TAG_ entries and types for now, but its
becoming non-DWARF specific as will be demonstrated with the introduction of
ctf_loader.c in the upcoming csets.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-03-03 13:50:44 -03:00
Felipe Kellermann 414595651d [DWARVES] Fixes a FIXME relating to a missing elf (libdw) symbol check.
Signed-off-by: Felipe Kellermann <felipek@socksarmor.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-12 21:08:49 -02:00
Hagen Paul Pfeifer 030f1871aa [DWARVES]: define memdup() static
memdup() is only referenced from dwarves.c. This patch defines them
static. Further symbol hiding can be accomplished via GCC attributes:

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-11 22:08:29 -02:00
Arnaldo Carvalho de Melo 833ac2782c [RPM]: 1.6 release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-11 12:04:14 -02:00
Arnaldo Carvalho de Melo c83d935a4f [DWARVES]: Use a hash table for the tags in a CU
Almost halves the time spent on processing a x86_64 vmlinux. Good, we
have features, now lets have performance ;-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-11 11:47:17 -02:00
Arnaldo Carvalho de Melo d2a3a13e84 [RPM]: 1.5 release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-07 11:48:10 -02:00
Arnaldo Carvalho de Melo c4e49add9e [PAHOLE]: Introduce --defined_in
This will print which object files have a struct definition, i.e. not just a
forward declaration.

There are many cases in the Linux kernel where just a fwd decl would suffice or outright
unneeded includes that end up bloating the DWARF sessions and consequently making everybody
suffer with humongous kernel-debuginfo packages.

More automation is needed here, this time something like sparse seems to be
needed to check what is that a header file "provides" and what is that the C
files "requires", doing some depsolving to discover unneeded Requires, i.e.
include directives and some that are required but are only satisfied
indirectly, which is a recipe for problems down the line.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-07 09:16:22 -02:00
Arnaldo Carvalho de Melo 11282eafb4 [DWARVES]: Another fix for DW_TAG_base_type entries without DW_AT_name
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-01 20:00:07 -02:00
Arnaldo Carvalho de Melo 7eeb0368a8 [PAHOLE]: Cope with DW_TAG_basic_type entries without DW_AT_name
Found in at least a file (tcp_ipv6.c in the Linux kernel) built with gcc
version 4.3.0 20080130 (Red Hat 4.3.0-0.7).

Which seems to be in violation with DWARF3, but better be defensive and handle
that.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-02-01 19:53:47 -02:00
Arnaldo Carvalho de Melo ac6a9a6745 [CODIFF]: Allow passing /dev/null as one of the files to compare
If passed as the old file, all functions in the new file will appear as being
new, etc.

Suggested by Ilpo Järvinen.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-31 10:05:02 -02:00
Arnaldo Carvalho de Melo 0a9cbf6ef6 [DWARVES]: Allow passing NULL as self to cu__find_
It will return NULL, this will be useful for codiff to use /dev/null as one of
the files being compared. And if you look for something in NULL, you better
get NULL, seems like a useful convention, huh?

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-31 10:03:54 -02:00
Arnaldo Carvalho de Melo 46d63102eb [DWARVES]: Fixup usage messages
Thanks to Ilpo Järvinen for getting this to my attention.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-31 09:30:55 -02:00
Arnaldo Carvalho de Melo 9a47906767 [DWARVES]: Find holes in inner, nameless structs
Long standing bug, fixed!

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-14 21:46:25 -02:00
Arnaldo Carvalho de Melo a1abd424a5 [DWARVES]: Adopt tag__follow_typedef from pahole
Useful for other cases, such as class__fixup_alignment in dwarves_reorganize.c.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-14 21:36:30 -02:00
Arnaldo Carvalho de Melo a2eb3ea774 [DWARVES]: Add some destructors: tag, cu, namespace
To be used later.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-14 20:04:57 -02:00
Arnaldo Carvalho de Melo 0a7fabf304 [CODIFF]: Check if the objects are the same when we have build-id
Speeding up the process, no need to check for changes in the same object file,
be it standalone or part of a multi-cu file.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-14 15:48:03 -02:00
Arnaldo Carvalho de Melo 48f5b0d824 [DWARVES]: Introduce cu__same_build_id
So that we can speed up codiff when just some object files changed in a
multi-cu file.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-14 15:39:41 -02:00
Arnaldo Carvalho de Melo 8aa8c0b571 [DWARVES_REORGANIZE]: Proper tail padding fixup
Using type__find_first_biggest_size_base_type_member in class__fixup_alignment.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-13 16:04:59 -02:00
Arnaldo Carvalho de Melo 0e09769bb4 [DWARVES]: Don't search in empty structs
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-13 16:04:09 -02:00
Arnaldo Carvalho de Melo b32024f7f6 [DWARVES]: Follow const and volatile tags to its ultimate types
In type__find_first_biggest_size_base_type_member.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-01-13 15:42:33 -02:00
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