Commit Graph

205 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo c3f6f8b79f dwarves_emit: Introduce type_emissions
We may want to work on just one object file, not on a multi cu.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-01 11:26:51 -03:00
Arnaldo Carvalho de Melo 0614c1d53e dwarves: Introduce tag__is_typedef()
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-09-30 14:21:03 -03:00
Arnaldo Carvalho de Melo 51bcb5f9e5 dwarves: Introduce function__prototype
Basically a wrapper for ftype__fprintf(&function__proto, ...) for the
cases we want the prototype rendered to a buffer, not to a file.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-07-30 18:33:33 -04:00
Arnaldo Carvalho de Melo 33ba723280 dwarves: handle the empty base optimization trick
Thanks to Dennis Lubert for bringing this to my attention, now tons of BRAIN
FART ALERTs are gone.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-07-04 12:09:28 -03:00
Arnaldo Carvalho de Melo ad635812a0 dwarves: Print the number of members in class__fprintf
Example:

struct foo {
	void xxx(class foo *); /* linkage=_ZN4tonk3foo3xxxEv */

	/* size: 1, cachelines: 1, members: 0 */
	/* padding: 1 */
	/* last cacheline: 1 bytes */
};

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-07-03 14:44:03 -03:00
Arnaldo Carvalho de Melo 5488b1dbde [DWARVES]: Check if any cu was found
Reported-by: Diego 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-05-12 15:25:45 -03:00
Arnaldo Carvalho de Melo f71ee6d306 [DWARVES]: Add support to DW_TAG_ptr_to_member_type
Another C++ism:

- regtest/before/libQtGui.so.4.3.4.debug.pahole -A.c  2008-04-21 16:09:30.000000000 -0300
+ regtest/after/libQtGui.so.4.3.4.debug.pahole -A.c   2008-04-21 17:25:17.000000000 -0300
@@ -115443,7 +115443,7 @@

        void init(classQGridLayoutPrivate *); /* linkage=_ZN18QGridLayoutPrivate4initEv */

-       class QSize findSize(const classQGridLayoutPrivate  *, <ERROR>, int, int); /* linkage=_ZNK18QGridLayoutPrivate8findSizeEM13QLayoutStructiii */
+       class QSize findSize(const classQGridLayoutPrivate  *, int QLayoutStruct::*, int, int); /* linkage=_ZNK18QGridLayoutPrivate8findSizeEM13QLayoutStructiii */

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-21 17:28:06 -03:00
Arnaldo Carvalho de Melo 23a8c85ae8 [DWARVES]: Normalise the reporting of IDs not found
By inlining them in the output when possible, that way we get context on where
the problem is, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-21 15:57:34 -03:00
Arnaldo Carvalho de Melo 0dc85894dd [DWARVES]: Fix ftype__fprintf_parms goto label
If we don't find the type it should spill an <ERROR>, not print 'void'.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-21 13:09:26 -03:00
Arnaldo Carvalho de Melo 4ab5153b8a [DWARVES]: Handle DW_TAG_class_type
Basically the same as DW_TAG_structure_type.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-20 22:12:03 -03:00
Arnaldo Carvalho de Melo fb809733cc [DWARVES]: Introduce tag__assert_search_result
For correctly created and completely parsed debugging information the type will
always be found, but as we still need to parse more tags and expecting
debugging information to be always correctly built is not sane... sprinkle some
asserts.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-20 18:56:36 -03:00
Arnaldo Carvalho de Melo e288817933 [DWARVES]: Check if ancestor classes were found in class__fprintf
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-19 12:12:13 -03:00
Arnaldo Carvalho de Melo f8c943bfe5 [DWARVES] base_type: store the size in bits
This is trying to get CTF friendly, where bitfields are not stored in the
equivalent to the DW_TAG_member dwarf TAG, but on "base types" with bit sizes
different than the real in the DWARF sense, base types (char, long, etc).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-03-04 18:38:21 -03:00
Arnaldo Carvalho de Melo 2dfa5fe6ea [DWARVES]: Initial CTF support
Using a library written by David S. Miller.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-03-04 15:37:02 -03:00
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
Arnaldo Carvalho de Melo 0284699d63 [DWARVES]: Add missing semicolon to anonymous struct union members
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-11 17:30:43 -02:00
Arnaldo Carvalho de Melo bb9bb96c5b [DWARVES]: Replace misplaced putchar with fputc in class__fprintf
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-11-10 16:27:24 -02:00
Arnaldo Carvalho de Melo 09b28d519e [DWARVES]: Cast Dwarf_Off to unsigned long long
To kill compiler warnings.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-11-10 15:56:30 -02:00
Eduardo Habkost 15c6f261b6 [CMAKE] Define _GNU_SOURCE on CMakeLists.txt
The latest elfutils-libelf headers won't compile without _LARGEFILE64_SOURCE
(that is implied by _GNU_SOURCE).

Some .c files don't have a #define _GNU_SOURCE line. Instead of adding the line
to all .c files, define it globally on CMakeLists.txt.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-10-26 13:21:31 -02:00
Arnaldo Carvalho de Melo ef45383d22 [LIB] lexblock: Show the lexblock low_pc info as offsets from the function where they appear
__wsum csum_partial_copy_to_user(const void  * src, void * dst, int len, __wsum isum, int * errp);
{ /* low_pc=0xffffffff8128ed37 */
        { /* csum_partial_copy_to_user+0x11 */
                long unsigned int flag;                               //    76
                long unsigned int roksum;                             //    76
                current_thread_info(void); /* size=9, low_pc=0xffffffff8128ed4b */ //    76
        } /* lexblock size=32 */
        { /* csum_partial_copy_to_user+0x49 */
                __u16 val16;                                          //    83
                add32_with_carry(unsigned int a,
                                unsigned int b); /* size=8, low_pc=0xffffffff8128ed83 */ //    84
                { /* csum_partial_copy_to_user+0x54 */
                        int __pu_err;                                 //    86
                } /* lexblock size=5 */
        } /* lexblock size=35 */
}/* size: 149 */
/* definitions: 1 */

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-31 14:00:44 -03:00
Arnaldo Carvalho de Melo 86bf6e680b [LIB] lexblock: make lexblock__fprintf show non zero high/low pcs
pfunct -TVi on a x86_64 vmlinux:

__wsum csum_partial_copy_to_user(const void  * src, void * dst, int len, __wsum isum, int * errp);
{ /* low_pc=0xffffffff8128ed37 */
        { /* low_pc=0xffffffff8128ed48 */
                long unsigned int flag;                               //    76
                long unsigned int roksum;                             //    76
                current_thread_info(void); /* size=9, low_pc=0xffffffff8128ed4b */ //    76
        } /* high_pc=0xffffffff8128ed68 */
        { /* low_pc=0xffffffff8128ed80 */
                __u16 val16;                                          //    83
                add32_with_carry(unsigned int a,
                                unsigned int b); /* size=8, low_pc=0xffffffff8128ed83 */ //    84
                { /* low_pc=0xffffffff8128ed8b */
                        int __pu_err;                                 //    86
                } /* high_pc=0xffffffff8128ed90 */
        } /* high_pc=0xffffffff8128eda3 */
} /* high_pc=0xffffffff8128edcc *//* size: 149 */

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-31 13:25:22 -03:00
Arnaldo Carvalho de Melo f4f8e0e16d [LIB]: First stab at supporting vtables
Will just print the vtable as a comment on classes with vtables.

But we have to support multiple vtables when multiple inheritance exists.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-08 20:57:23 -03:00
Arnaldo Carvalho de Melo 9c92fc59fb [LIB]: Add vtable_entry to struct function
To support the DW_AT_vtable_elem_location attribute.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-08 20:35:49 -03:00