Commit Graph

167 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo 02b0f811b1 pahole: speed up structure lookup by name
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-28 18:56:47 -02:00
Arnaldo Carvalho de Melo d4812cadd6 ctf_loader: hack to minimally use the argp passed
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-08 10:46:34 -03:00
Arnaldo Carvalho de Melo 19704cf67e pahole: Add new structures to the end of the list
So that they appear on the output in the same order as they
come from the original debugging info.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-08 10:03:58 -03:00
Arnaldo Carvalho de Melo 212b994ab5 strings: Introduce the strings class
And make the dwarves use it, so that we can remove duplicate strings in
a multi-CU file (vmlinux anyone?) and have it ready for insertion in a
compressed DWARF format with just the types, or better, CTF or some new
compressed debugging info format.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-02 14:34:42 -03:00
Arnaldo Carvalho de Melo efa997ed40 dwarves: Remove type_emissions fields from cus
Now only when one wants to emit this struct is needed.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-10-01 12:47:42 -03:00
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 515c87c72a dwarves: Use tag__is_{struct,union} where applicable
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-09-30 14:43:22 -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
Dave Rigby de393c4670 [PAHOLE]: Add support for filtering classes based on name
While pahole allows you to exclude classes with a specified prefix (using
--exclude), it doesn't appear to be able to do the opposite - only show classes
with a specific prefix. I found I needed this for my own use of it, so here is
a patch to add this functionality.

Signed-off-by: Dave Rigby <davidr@transitive.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2008-04-21 12:41:44 -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 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 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 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 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 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 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 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 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 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 7631b1869b [PAHOLE]: Order the options processing
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-16 16:01:26 -02:00
Arnaldo Carvalho de Melo fc6799e6ea [PAHOLE]: Fix Dwarf_Off printf warning using cast to unsigned long long
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-11-11 15:01:30 -02:00
Arnaldo Carvalho de Melo 10d68c1101 [PAHOLE]: Add missing newline when --class_name is used
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-07 15:27:49 -03:00
Arnaldo Carvalho de Melo ef3d5d4ab5 [PAHOLE]: Make --quiet set conf.suppress_offset_comment
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-07 14:44:40 -03:00
Arnaldo Carvalho de Melo d653039ef4 [LIB]: Add conf->expand_pointers
So that we can expand pointer types, useful for ABI signature checking. And to
fully browse a type, when using --expand_types is also of interest.

I have yet to disable printing the offsets when expanding pointers, where the
information is not useful at all, for now just ignore it, it gets back to a
sane state in the next field, after the pointer type expansion.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-04 20:36:28 -03:00
Arnaldo Carvalho de Melo cd944529d8 [PAHOLE]: Make --quiet use conf_fprintf.suppress_comments
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-06-22 16:52:00 -03:00
Arnaldo Carvalho de Melo 949e8c4f14 [PAHOLE]: Implement --quiet
For now it just suppresses the struct statistics at the end of the output, but
will also suppress the comments about holes.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-06-22 16:43:29 -03:00
Arnaldo Carvalho de Melo cf124f1636 [LIB]: Introduce tag__is_struct() for a common idiom
And also to get this less, ho-hum, DWARF specific.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-31 01:53:01 -03:00
Arnaldo Carvalho de Melo 48a1d89ec0 [LIB]: Introduce conf_fprintf.no_semicolon
To indicate wheter the semicolon should be supressed. Useful for
prototype/function emission, etc.

Also move the struct stats to be inside its body, to simplify tag__fprintf,
that now looks at conf.no_semicolon after calling the tag type specific
__fprintf method.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-31 01:39:44 -03:00
Arnaldo Carvalho de Melo 281955d800 [LIB]: Add the show_only_data_members field to struct conf_fprintf
So that tools can specify if they are interested in printing just the members
that use space in the class layout (DW_TAG_inheritance, DW_TAG_member) and not
things like constructors, private type definitions, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-30 11:36:54 -03:00
Arnaldo Carvalho de Melo cd1e2a7a2d [PAHOLE]: Introduce --show_decl_info/-I
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-30 11:28:16 -03:00
Arnaldo Carvalho de Melo decf4e0f2e [PAHOLE]: puts(";") after -O output
The special casing for structs with stats is really annoying, will fix.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 14:51:32 -03:00
Arnaldo Carvalho de Melo e59b1ebb05 [LIB]: Support DW_AT_specification in DW_TAG_structure_type tags
C++ uses this, and to cache the result of the lookup at type__name time we need
to pass the cu to class__name and type__name. Big fallout because of that :-\

But now the output is mucho embelished by the humongous strings representing
C++ templates.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 18:45:34 -03:00
Arnaldo Carvalho de Melo ad24e0a00c [LIB]: Introduce cus__find_tag_by_id
Using it in the --dwarf_offset/-O new pahole command line option, useful in
debugging. Prints the tag in the dwarf offset supplied.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 17:41:16 -03:00
Arnaldo Carvalho de Melo de9aa81358 [PAHOLE]: Consolidate conf_fprintf code
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 17:18:32 -03:00
Arnaldo Carvalho de Melo 80454cb7fd [PAHOLE]: Set show_decl_info if --verbose is passed
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 12:47:11 -03:00
Arnaldo Carvalho de Melo 9bf0fda9b0 [LIB]: Introduce struct namespace
For now its just the direct ancestor of struct type. But it will exists by
itself, to represent the DW_TAG_namespace DWARF tag, that is how the C++
'namespace' (and other languages too, heck, I'd love to get my hands on a
binary with DWARF info built from, say, ADA source code, objectiveC... COBOL!
:-P).

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 12:16:59 -03:00
Arnaldo Carvalho de Melo 230d9310aa [LIB]: Introduce type__name()
This is in preparation for the introduction of struct namespace, that will be
struct type ancestor.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 11:56:12 -03:00
Arnaldo Carvalho de Melo 3377190195 [PAHOLE]: Introduce --separator/-t
[acme@filo pahole]$ pahole -t, --packable examples/ipv6.ko.debug.x86-64 | sort -t, -k2 -n | tail
inode,1008,1000,8
hh_cache,256,128,128
proto,8512,8504,8
super_block,1184,1168,16
task_struct,3776,3704,72
module,8832,8800,32
pglist_data,10752,10744,8
zone,1536,1352,184
net_device,1664,1208,456
softnet_data,1920,1792,128
[acme@filo pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-23 16:26:39 -03:00
Arnaldo Carvalho de Melo 776f5a6418 [PAHOLE]: Use a common separator in the formatters
For now its a tab, will be configurable in the next cset.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-23 16:15:21 -03:00
Arnaldo Carvalho de Melo 7401af38db [LIB]: Introduce class__has_hole_ge()
That returns if the class has a hole greater or equal to the size specified.

Pahole now has a --hole_size_ge command line option to use it.

Example on a linux kernel built for x86_64 where we list the structs that have
holes bigger than 32 bytes, that provides an approximation of structs with
____cacheline_aligned_in_smp annotated members:

[acme@filo pahole]$ pahole --hole_size_ge 32 examples/vmlinux-x86_64
inet_hashinfo
rcu_ctrlblk
hh_cache
net_device
files_struct
module
zone

For instance, look at struct zone clever use of such construct:

_pad1_ is defined with ZONE_PADDING(_pad1_), that is:

/* <40e> /home/acme/git/net-2.6.22/include/linux/mmzone.h:179 */
struct zone {
	long unsigned int          pages_min;            /*     0     8 */
	long unsigned int          pages_low;            /*     8     8 */
	long unsigned int          pages_high;           /*    16     8 */
	long unsigned int          lowmem_reserve[3];    /*    24    24 */
	int                        node;                 /*    48     4 */

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

	long unsigned int          min_unmapped_pages;   /*    56     8 */
	/* --- cacheline 1 boundary (64 bytes) --- */
	long unsigned int          min_slab_pages;       /*    64     8 */
	struct per_cpu_pageset *   pageset[255];         /*    72  2040 */
	/* --- cacheline 33 boundary (2112 bytes) --- */
	spinlock_t                 lock;                 /*  2112     4 */

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

	struct free_area           free_area[11];        /*  2120   264 */

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

	/* --- cacheline 38 boundary (2432 bytes) --- */
	struct zone_padding        _pad1_;               /*  2432     0 */
	spinlock_t                 lru_lock;             /*  2432     4 */

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

	struct list_head           active_list;          /*  2440    16 */
	struct list_head           inactive_list;        /*  2456    16 */
	long unsigned int          nr_scan_active;       /*  2472     8 */
	long unsigned int          nr_scan_inactive;     /*  2480     8 */
	long unsigned int          pages_scanned;        /*  2488     8 */
	/* --- cacheline 39 boundary (2496 bytes) --- */
	int                        all_unreclaimable;    /*  2496     4 */
	atomic_t                   reclaim_in_progress;  /*  2500     4 */
	atomic_long_t              vm_stat[20];          /*  2504   160 */
	/* --- cacheline 41 boundary (2624 bytes) was 40 bytes ago --- */
	int                        prev_priority;        /*  2664     4 */

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

	/* --- cacheline 42 boundary (2688 bytes) --- */
	struct zone_padding        _pad2_;               /*  2688     0 */
	wait_queue_head_t *        wait_table;           /*  2688     8 */
	long unsigned int          wait_table_hash_nr_entries; /*  2696     8 */
	long unsigned int          wait_table_bits;      /*  2704     8 */
	struct pglist_data *       zone_pgdat;           /*  2712     8 */
	long unsigned int          zone_start_pfn;       /*  2720     8 */
	long unsigned int          spanned_pages;        /*  2728     8 */
	long unsigned int          present_pages;        /*  2736     8 */
	const char  *              name;                 /*  2744     8 */
	/* --- cacheline 43 boundary (2752 bytes) --- */
}; /* size: 2752, cachelines: 43 */
   /* sum members: 2672, holes: 5, sum holes: 80 */
   /* definitions: 933 */

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-11 13:32:53 -03:00
Arnaldo Carvalho de Melo f314f4f896 [PAHOLE]: Introduce --recursive
For now only affects the --contains output.

Example showing the structs that include struct list_head in a linux kernel module:

[acme@filo pahole]$ pahole --recursive --contains list_head examples/ipv6.ko.debug.x86-64
inet_protosw
proto
sock_iocb
key_type
msg_queue
msg_msg
nf_hook_ops
softnet_data
net_device
  softnet_data
dma_device
dma_client
dma_chan
class_device
  net_device
    softnet_data
  dma_chan
class
klist_node
  device_driver
  device
klist
  device_driver
  bus_type
  device
file_system_type
nfs_lock_info
file_lock
block_device
address_space
  inode
dquot
mem_dqinfo
super_block
inode
signal_struct
page
kioctx
file
kiocb
work_struct
  delayed_work
    kioctx
timer_list
  ifmcaddr6
  inet6_dev
  inet6_ifaddr
  neigh_table
  neighbour
  net_device
    softnet_data
  sock
    inet_sock
  delayed_work
    kioctx
plist_head
  task_struct
sigpending
  signal_struct
  task_struct
user_struct
device
dev_pm_info
  device
mutex_waiter
mutex
  seq_file
  block_device
  quota_info
    super_block
  dquot
  super_block
  inode
zone
per_cpu_pages
free_area
kset
  bus_type
  subsystem
    class
    bus_type
__wait_queue_head
__wait_queue
rw_semaphore
  quota_info
    super_block
  super_block
  inode
  key
  blocking_notifier_head
    bus_type
  subsystem
    class
    bus_type
  mm_struct
dentry
vm_area_struct
kobject
  class_device
    net_device
      softnet_data
    dma_chan
  device_driver
  module_kobject
    module
  device
  kset
    bus_type
    subsystem
      class
      bus_type
lock_class
module
mm_struct
task_struct

Handling in multi-cu objects is not very precise, as the same struct has
different dwarf offsets (id) in each CU. A mitigation for this problem will be
provided with the --cu_list and --cu_name upcoming options, where one will be
able to get a list of the object files in a, for instance, linux kernel .ko
module and also to specify a cu name to be the only to be considered when
processing multi-cu files (again, such as .ko linux kernel modules).

This ends up being also useful to generate a reverse class hierarchy :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-10 19:11:51 -03:00
Arnaldo Carvalho de Melo eaf77f1e5a [LIB]: Introduce type__nr_members_of_type
First user is pahole, that now has a --contains CLASS_NAME option, that will
show which classes contains CLASS_NAME, i.e.:

struct foo {
	struct bar baz;
	int i;
};

on an object file called with '--contains bar' will produce:

foo

if --verbose is used it will tell the number of CLASS_NAME members, so, in the
above example:

foo:1

Next thing will be a --recursive flag, that will show all the structs that
contains CLASS_NAME and the ones that contains the ones which contains and...
:-)

Useful to evaluate the impact that increasing or decreasing the size of some
important struct will have on the whole project that uses the struct.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-10 15:28:00 -03:00
Arnaldo Carvalho de Melo fbb50fc851 [LIB]: Move class__reorganize & friends to a new lib: libdwarves_reorganize
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-07 00:30:02 -03:00
Eugene Teo 93183ec9ee [PAHOLE]: Added an option -r to use rel_offset when printing inner structs
By default, pahole will display the offsets of the inner struct members from
the top level struct. If the user wants to focus on some inner structs, just
call the tool with the -r option to use relative offset instead of the base
offset.

Signed-off-by: Eugene Teo <eteo@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-02 16:14:20 -03:00