Commit Graph

584 Commits

Author SHA1 Message Date
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
Arnaldo Carvalho de Melo c7f3b5d812 [LIB]: attr_offset should receive the attr name to search for
So that we can also look for offset expressions other than DW_AT_data_member_location.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-08 20:33:56 -03:00
Arnaldo Carvalho de Melo 0883a936d5 [LIB]: Support DW_OP_constu in dwarf_expr
So that we can handle DW_AT_vtable_elem_location, that is also an offset expression.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-08 20:32:34 -03:00
Arnaldo Carvalho de Melo ce516fb0cf [LIB]: Support DW_AT_MIPS_linkage_name
Another C++ specific case:

-       class TypeTemplate ByName(const string  &, size_t);
+       class TypeTemplate ByName(const string  &, size_t); /* linkage=_ZN4ROOT6Reflex12TypeTemplate6ByNameERKSsj */

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-08 19:47:26 -03:00
Arnaldo Carvalho de Melo d6471b435b [LIB]: Make function__fprintf handle the member virtuality
More C++ support. Now we print "virtual" before DW_TAG_subprogram DW_TAG_member
tags that have a DW_AT_virtuality attribute of and DW_VIRTUALITY_pure_virtual or
DW_VIRTUALITY_virtual and " = 0" after the DW_VIRTUALITY_pure_virtual ones.

vtables are next.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-08 14:55:15 -03: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 84fac64313 [LIB]: Honor conf.suppress_comments in one more case
class__fprintf_cacheline_boundary should only be called if
conf_suppress_comments is not set.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-07 14:48:40 -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 39a6eba82a [LIB]: Introduce suppress_offset_comment in conf_fprintf
And use it when expandind pointer types (using --expand_pointer).

This has to be done because the offset comments make no sense when expanding a
pointer.

Will be used as well in pahole --quiet.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-07 14:41:41 -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 ad5390df84 [PGLOBAL]: Deconstify it a bit
tag__fprintf is about to change the now const struct tag parameter.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-01 21:00:21 -03:00
Arnaldo Carvalho de Melo 96fe1bf804 [LIB]: Reorganize type__fprintf to have just one exit point
Will be used by the upcoming expand_pointer algorithm.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-01 20:46:59 -03:00
Arnaldo Carvalho de Melo 59099b3481 [LIB]: Make array_type__fprintf use type__fprintf
This way it can handle arrays of anonymous structs.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-07-01 20:04:19 -03:00
Arnaldo Carvalho de Melo 8237ab7a73 [PFUNCT]: Fix --total_inline_stats printf format
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-06-26 20:31:24 -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 0b3969bdb4 [LIB]: Introduce conf_fprintf.suppress_comments
pahole will use it in the --quiet mode.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-06-22 16:51:31 -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 1d53d3640f [CMAKE]: Remove the Sqlite requirement
It'll only be needed when szhist gets merged.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-06-13 09:12:44 -03:00
Arnaldo Carvalho de Melo bcc9c3b842 [SYSCSE]: Calculate prefix_len when --prefix is used
Ah, forgot to mention in the last commit that this is an exercise being done
with Ralf Baechle, that needs this to cope with some MIPSisms, but the point
here is to see if the lib is approachable enough, and the best ways is to write
more and more dwarves :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-12 16:02:04 -03:00
Arnaldo Carvalho de Melo 1382ee83da [SYSCSE]: System Call Sign Extender
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-12 15:53:46 -03:00
Arnaldo Carvalho de Melo 3d010109c8 [LIB]: Add missing prototype for parameter__name
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-12 15:40:22 -03:00
Arnaldo Carvalho de Melo 59e957f8f9 [LIB]: Introduce {function,ftype}__for_each_parameter
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-12 15:01:23 -03:00
Arnaldo Carvalho de Melo 9cc29c8181 [LIB]: conf_fprintf.indent needs more than one bit...
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-07 16:15:03 -03:00
Arnaldo Carvalho de Melo 8ca9c293f1 [LIB]: tag__is_union should check if its a DW_TAG_union_type
Stupid cut'n'paste error.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-07 15:58:33 -03:00
Arnaldo Carvalho de Melo 3c48a2aeb6 [RPM]: Fix URL in the Source tag
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2007-06-07 13:30:08 -03:00
Arnaldo Carvalho de Melo 9486197977 [LIB]: Introduce tag__is_{enumeration,union,namespace}
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-31 02:21:36 -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 1554f95d81 [LIB]: Check for unhandled DW_OP_ operations in the DW_AT_data_member_location attr
So far we only handle DW_OP_plus_uconst, the simplest of them all, but now
'public virtual' base classes are appearing in these tools radar, so, to make
it clear that we don't support it spit a warning message to stderr and return
UINT64_MAX so that in the report it is clearly seen. C++ support still needs
more work, simple as that :)

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-29 18:11:45 -03:00
Arnaldo Carvalho de Melo 493ce2132f [LIB]: Look at inheritance entries in class__find_holes
We need to, if not when there is no data members the padding will be
miscalculated.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-29 14:24:50 -03:00
Arnaldo Carvalho de Melo 911375f5c5 [LIB]: Introduce type__for_each_data_member
So that we traverse just the data members, mostly in the reorganize code, where
we can't care less where is that the compiler put the base classes in the
layout since we can't influence how the compiler does this, it has only to
respect the layout we specify for the data members.

Well, it may well be the case that the order of the ancestor classes in the
class declaration can influence this, but I haven't checked.

Yes, another C++ism :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-29 14:06:33 -03:00
Arnaldo Carvalho de Melo 4c5dfb4ba7 [REORGANIZE_LIB]: class__reorganize should return void
In the past it was always cloning and doing the reorganization steps on the
clone, now this is done by the caller, so no need to return self.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-29 13:37:52 -03:00
Arnaldo Carvalho de Melo a915e5d50e [REORGANIZE_LIB]: Don't try to reorganize classes without data members
Another chapter in the C++ saga :-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-29 13:32:14 -03:00
Arnaldo Carvalho de Melo 3b869e96f8 [LIB]: list__find_tag_by_id should look in union's namespace too
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-29 12:41:25 -03:00
Arnaldo Carvalho de Melo aa91264ea0 [LIB]: cu__find_parameter_by_id should look inside namespaces too
This is simplified by introducing list__find_tag_by_id. I guess in the end the
right thing is to use a hashtable to find the ids. Trying to have specialized
find_foo_by_id functions instead of having just one that traverses _all_ the
tags is becoming less of a performance advantage as struct class now has
namespaces, i.e. functions can be inside structs and to find abstract_origin,
specification, etc references we have to traverse most of the tree anyway...

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 17:53:40 -03:00
Arnaldo Carvalho de Melo 5824b679d5 [LIB]: Make cu__find_parameter_by_id return a struct tag
For consistency with the other find_foo_by_id routines.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 16:15:27 -03:00
Arnaldo Carvalho de Melo 904b882c62 [LIB]: Fix breakage introduced when supporting DW_AT_specification in structs
Heck, anonymous structs are nothing new, things like:

typedef struct {
	int bar;
} baz;

Are ugly, but valid. So if ->name is NULL and ->specification is 0, its an
anonymous struct, don't go looking for dwarf offset 0, that is "void", not
something a DW_AT_specification is supposed to point to 8)

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 15:47:39 -03:00
Arnaldo Carvalho de Melo c15d8d700c [LIB]: Introduce tag__id_not_found
tag__type_not_found was incorrectly being used for cases where we were
searching things like abstract_origin and specification, not tag->type, so add
this variant, make tag__type_not_found use id and fix the callers.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 15:40:52 -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 fdcd10fa3f [LIB]: Handle void in typedef__fprintf
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 14:50:51 -03:00
Arnaldo Carvalho de Melo 90d6202e3c [LIB]: Support DW_TAG_imported_declaration
Basic support, as according to the DWARF3 standard there are other cases that
we don't support yet, such as "using ::foo" with an alias, i.e. in the
namespace that is importing the imported declaration is aliased to some other
name.

But for the test cases, common case, its enough.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 12:39:16 -03:00
Arnaldo Carvalho de Melo 33b92cbd4f [LIB]: Support DW_TAG_imported_module
The "using namespace" line in:

namespace __gnu_debug {
	using namespace __gnu_debug_def;
};

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 10:54:27 -03:00
Arnaldo Carvalho de Melo c0c76ca287 [PDWTAGS]: Use argp, for now just to select if the decl info is to be shown
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-26 10:29:02 -03:00
Arnaldo Carvalho de Melo b776154f74 [LIB]: Comment the DW_TAG_inheritance tags in class__fprintf output
So that it looks more like a compilable representation.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-25 21:45:30 -03:00
Arnaldo Carvalho de Melo 9d6ac7737b [LIB]: Print class member accessibility in class__fprintf
Now we see the "private:\n" etc, everytime the accessibility is changed from
one member to the next.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-25 17:33:49 -03:00
Arnaldo Carvalho de Melo ed927ac7cd [LIB]: Introduce tag__accessibility()
Helper to check if the tag has accessibility info, returning one of
"protected", "private", "public" or NULL if there is no accessibility info.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-25 17:02:05 -03:00