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>
Cut'n'paste error, was never looking into DW_TAG_subprogram tags.
Also traverse the forest of lexblocks.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
So that we can go on adding more config knobs without requiring adding new
parameters to lots of functions.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
[acme@mica pahole]$ pahole lala
pahole: Permission denied
[acme@mica pahole]$ pahole foo
pahole: No such file or directory
[acme@mica pahole]$ pahole ctracer.c
pahole: couldn't load DWARF info from ctracer.c
[acme@mica pahole]$
Thanks to Matthew Wilcox for noticing how lame it was :-)
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
So that in tools like ctracer we can print to a file, most of the tools just
pass stdout, keeping the previous behaviour.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Using export CFLAGS="-Wall -Wfatal-errors -Wformat=2 -Wsequence-point -Wextra
-Wno-parentheses -g", suggested by Davi Arnault, amazing how cruft piles up
when one is not looking ;)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Out of struct typedef_tag, that now becomes the superclass of struct class, and
that also will be for struct enumeration, struct union_type and then finally
for struct struct_type, when struct class finally dies.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
By having its own class, struct typedef_tag.
As it, as structs, unions and enums have a common part, the node and visited
fields, required when emitting its definitions there is an opportunity for
consolidation, that will be explored when adding the specific classes for
DW_TAG_enumeration & DW_TAG_union.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Almost mirroring the DWARF on-disk linkage on memory, more to come before
getting over these simplification refactorings.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
To preserve ordering, even with DW_tag_label tags not being kept in order by
gcc its better to have just one list, uses less space and keeps what is in the
dwarf sections.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Will be reused when handling DW_TAG_subprogram_type more comprehensively, in
the upcoming csets.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
So far struct class was being used as the main data structure, switch to struct
tag, that already was the top of the tag hierarchy, being a struct class
ancestor, so reflect that and stop using struct class as the catch all class,
as a started DW_TAG_array_type tags are now represented by a new class, struct
array_type, reducing the size of struct class and reducing DW__TAG_array_type
instance memory usage.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
So that we can extract bits from one and combine it bits from other instances,
like we'll do in ctracer, where we want to have a cus instance just to get the
kprobes definitions and forward declarations but not handle the methods in it.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
So that we can load many object files, that is what the next csets will
do, to recursively look for files with debug info in a build tree, such
as the kernel one.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
To simplify the callsites and make implementing the same thing on the other
dwarves (prefcnt, pfunct, etc) easy.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
To represent DW_TAG_lexical_block, for now just group the lists of
labels, inline expansions and variables, struct function now has
the root of the tree as ->lexblock.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
And helper routines, so as to separate DW_TAG_subprogram from
the type tags (DW_TAG_structure_type, basic_type, etc).
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This should have been done from the start: all DW_TAG_s will be represented by
structs that has as its first member a struct tag, so that we can fully
represent the DWARF information, following csets will take continue the
restructuring.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
At least GCC only emits DW_TAG_subprogram for inline functions if they were
used somewhere in the CU, even if no DW_TAG_inlined_subroutine tag is emitted
due to optimizations reducing inline functions to nothing.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
prefcnt is a new tool to do reference counting on all the TAGs, starting
from the list of DW_TAG_subroutine tags and going down thru the return type,
parameter list types, variables and inline expansions in the functions, to
help finding unused stuff, its not so effective because of bugs in gcc
DWARF emitting code for concrete inline instances, i.e. the inline expansions
are not all being emitted, see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29792
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>