All the cu__create_new_foo functions are now being normalised, will provide
opportunies for further consolidation/cleaning up, lets do this now before
moving on to libelf work.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Now that we have its parameter list we must call cus__emit_ftype_definitions in
cus__emit_typedef_definitions when we find DW_TAG_subroutine tags.
This fixes this problem with ctracer:
[acme@newtoy ctracer_example]$ make
<SNIP>
CC [M] /home/acme/pahole/ctracer_example/ctracer.o
/home/acme/pahole/ctracer_example/ctracer.c:21: warning: 'struct pt_regs' declared inside parameter list
/home/acme/pahole/ctracer_example/ctracer.c:21: warning: its scope is only this definition or declaration, which is probably not what you want
/home/acme/pahole/ctracer_example/ctracer.c:21: warning: 'struct kprobe' declared inside parameter list
<SNIP>
I.e. the struct pt_regs and kprobe forward declarations are done earlier.
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>
And make cu__process_function use a real loop for the siblings, not calling
itself again like in the code pahole was initially based of.
This causes tags below DW_TAG_lexical_block tags to be discarded, will be fixed
in the next csets, with proper lex block support.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This is very hackish, see the previous cset comment, without this hack
unrelated, deeper DW_TAG_formal_parameter tags were being attributed to the
function being processed, proper fix is described in previous comment, for now
this is enough as a bandaid.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
There are cases where just a declaration is emitted, such as in
blk_rq_map_user_iov's iov parameter:
<2><dc04>: Abbrev Number: 29 (DW_TAG_structure_type)
DW_AT_name : (indirect string, offset: 0x3be8): sg_iovec
DW_AT_declaration : 1
<2><dc0a>: Abbrev Number: 88 (DW_TAG_formal_parameter)
DW_AT_name : iov
DW_AT_decl_file : 1
DW_AT_decl_line : 2472
DW_AT_type : <dc60>
DW_AT_location : 0x4288 (location list)
I.e. the DW_TAG_structure_type tag is emitted at the same level as the
DW_TAG_formal_parameter tags, so handled inside the cu__process_function
method.
This and the next cset only shows that a normalization in the parsing routines
is in real demand and will be done, normalization because what needs to be done
is similar to what is already done in places like cu__create_new_array, i.e.
process all the siblings in a level in tag specific cu methods.
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>
This reduces by 8MB the dtagnames memory footprint when processing a qemu
vmlinux, that now uses ~79MB.
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>
Only needed, so far, when processing functions, have to reenable this in the
future when we got to handle it.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
To load directory trees, looking for files with a specified glob mask, calling
cus__load() on the ones that match and optionally recursively searching for
more matches in subdirectories.
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>
For the ranges cases we store the lowest low_pc (in the first range) and the
highest high_pc (in the last range).
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Now we handle:
typedef void (dio_iodone_t)(void /* FIXME: add parm list */);
In addition to:
typedef int (*kprobe_pre_handler_t)(void /* FIXME: add parm list */);
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This is part of a cleanup process were I'm revisiting the types used for
the various abstractions, using the correct libdw.h types.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
If a definition is being emitted and there was already a forward declaration,
remove the class from the fwd_decl list before adding it to the declarations
list, in the reverse case just don't add it to the fwd_decl list.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>