Commit Graph

560 Commits

Author SHA1 Message Date
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
Arnaldo Carvalho de Melo eba595f958 [LIB]: Add accessibility and virtuality members to struct function
Will be used in the following csets, where we'll print the accessibility
info in C++ classes.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-25 16:42:49 -03:00
Arnaldo Carvalho de Melo 9e48067e92 [LIB]: Some stopgap hacks on DW_TAG_inheritance + DW_AT_virtuality == DW_VIRTUALITY_virtual
The offsets doesn't make sense, /me lazy right now to look at untangling the
expressions in the DW_AT_data_member_location.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 19:11:53 -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 53ede5ee16 [PDWTAGS]: Use conf_fprintf in pdwtags
So that it prints struct stats and decl info (file/line number were tags were
declared).

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 17:19:21 -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 106a78fd08 [LIB]: Print DW_TAG_inheritance together with DW_TAG_member entries
In class__fprintf, at least this can help till we get proper DW_TAG_inheritance
layout printing, that is right now blocked by lack of knowledge about
DW_AT_data_member_location DWARF expression parsing for non const expressions.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 14:11:33 -03:00
Arnaldo Carvalho de Melo 5463bc5419 [LIB]: Support DW_AT_accessibility and DW_AT_virtuality
So that in DW_TAG_inheritance we can should "virtual", "virtual public", etc.

This has yet to be supported for normal class members, constructors, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 13:57:08 -03:00
Arnaldo Carvalho de Melo 25c2b7a095 [LIB]: Handle DW_TAG_inheritance in class__fprintf
Printing things like:

class foo : bar, baz, bada {
<SNIP>
};

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 13:38:13 -03:00
Arnaldo Carvalho de Melo ec2c921b05 [LIB]: Introduce namespace__fprintf
Use pdwtags, that prints all the tags, pahole has to be changed to traverse
namespaces looking for structs.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 13:18:38 -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 37204266b1 [LIB]: Allow specifying in conf_fprintf if the decl info is to be printed
By default it is not, was getting too much in the way with the namespace support.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 12:45:45 -03:00
Arnaldo Carvalho de Melo 8562640b58 [LIB]: Rename type__find_tag_by_id to namespace__find_tag_by_id
Go down the rabbit hole baby, oops, the namespace hole that is. Now we find
types inside namespaces. Off to implement namespace__fprintf so that we can see
more brunnetes and blondes out of the DWARF encoding 8)

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 12:40:43 -03:00
Arnaldo Carvalho de Melo 2b47267e23 [LIB]: Introduce tag__namespace()
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 12:31:40 -03:00
Arnaldo Carvalho de Melo 32cad958cd [LIB]: Initial support for namespace
We still don't search for tags inside namespaces, next cset...

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 12:30:33 -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 c1eff2b2ca [LIB]: Introduce class__tags()
Also preparatory for struct namespace.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 12:07:41 -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 2b480348e9 [LIB]: Make class__fprintf print non DW_TAG_member entries
Such as types within types and class methods. This greatly improves support for
C++. Next improvements will be supporting DW_TAG_namespace and properly
supporting DW_TAG_inheritance.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-24 00:16:23 -03:00
Arnaldo Carvalho de Melo a1e75c91e2 [LIB]: Properly nest types within types
Now we need add support to scope type pretty-printing.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-23 23:19:35 -03:00
Arnaldo Carvalho de Melo 2f7f49b107 [LIB]: Put infrastructure for type scoping in place
Now it is possible to have types defined inside types.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-23 22:38:29 -03:00
Arnaldo Carvalho de Melo e905635260 [LIB]: Introduce type__last_member
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-23 22:10:50 -03:00
Arnaldo Carvalho de Melo c0cbf4fa94 [LIB]: Introduce type__for_each_member
Will be useful to show that the intent is to traverse just the DW_TAG_member
entries in the type list. Right now there are both DW_TAG_inheritance and
DW_TAG_member entries in the ->members type list. But there will be many more
tags, like enumerations, classes, etc, that are defined inside classes, a C++
feature. This will also help with DW_TAG_namespace support.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-23 21:43:01 -03:00
Arnaldo Carvalho de Melo f359e784af [NEWS]: Update entry about the --separator new option
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
2007-05-23 16:27:33 -03:00