Commit Graph

948 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo a693b7fde9 cmake: move headers to /usr/include/dwarves/ and tag 1.8pre1
In reponse to https://bugzilla.redhat.com/show_bug.cgi?id=497285 I
included the header files that are needed by the dwarves*.h files
and moved them to /usr/include/dwarves.h.

The CTF work is not completed yet, but the non-CTF related improvements
(progressive loading of CUs, etc) are worth a release till I can get back to
dedicate solid time for developing these tools again.

Reported-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-23 15:13:50 -03:00
Arnaldo Carvalho de Melo 602e02fc28 MANIFEST: add missing files
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-23 14:49:44 -03:00
Arnaldo Carvalho de Melo 29e67fce58 dwarf_loader: Add containing_type to dwarf_tag
Sharing the same space with abstract_origin, so that we can remove the last
Dwarf_Off in dwarf_fprintf.c.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-19 14:04:59 -03:00
Arnaldo Carvalho de Melo f84bf73d54 dwarves: Move the fprintf code to a new source file.
$ wc -l dwarves.c dwarves_fprintf.c
 1468 dwarves.c
 1554 dwarves_fprintf.c
 3022 total
$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-19 13:48:51 -03:00
Arnaldo Carvalho de Melo e148f93418 code: Combine the debugging_formats and debug_fmt_ops structs
Paving the way for pluggable debugging formats via dlopen.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-04 14:56:39 -03:00
Arnaldo Carvalho de Melo 7cfe6f22e3 ctracer: blacklist functions in .init.text (__init marked)
We do this by just creating a strlist with all the functions that are in
section ".init.text", as found out by looking at the symtab.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 11:56:52 -03:00
Arnaldo Carvalho de Melo f74ad7eb4c elf_symtab: Add elf_sym__section helper
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 11:56:03 -03:00
Arnaldo Carvalho de Melo 0e56f5e562 core: Be more strict with the return of __name() routines
In the past we did integer testing, and testing against 0 was no problem, but
now they return NULL and we are back using strcmp, oops.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 11:55:02 -03:00
Arnaldo Carvalho de Melo 1701b6d68d dutil: Allow returning the section index in elf_section_by_name
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 11:53:05 -03:00
Arnaldo Carvalho de Melo 08d41fb4d2 strlist: Return false if NULL is passed to strlist__has_entry
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 11:49:46 -03:00
Arnaldo Carvalho de Melo 57ae9740d8 strlist: Allow strlist__add to distinguish ENOMEM from EEXIST
I.e. the operation may fail because the string is already there or
because there wasn't enough memory.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 11:47:28 -03:00
Arnaldo Carvalho de Melo 1d7bea33b7 libctf: ctf__delete must call elf_symtab__delete
Its used when loading a CTF file, not when encoding.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:45:15 -03:00
Arnaldo Carvalho de Melo 33d73f990a pahole: remove the alloc_detective include, it is not included yet :-\
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:43:38 -03:00
Arnaldo Carvalho de Melo 33ed25d5cd elf_symtab: elf_symtab__delete must free ->name too
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:41:09 -03:00
Arnaldo Carvalho de Melo 4f5e2226de ctf_encoder: ctf__encode has to free the buf when compressing
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:25:48 -03:00
Arnaldo Carvalho de Melo bd68f6bbc1 ctf_encoder: We have to free the gobuffer entries for the sections
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:22:48 -03:00
Arnaldo Carvalho de Melo 38b7f8aecf core: list__for_all_tags should delete shared enumerations
Its just the enumerator list (enum entries) that are shared.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:19:19 -03:00
Arnaldo Carvalho de Melo 58f29607a2 core: Add ->init and ->exit hooks to be called at dwarves__{init,exit}
So that we can more early return if we can't process files for some supported
debugging format and as well release all resources allocated when dwarves__exit
is called.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:05:36 -03:00
Arnaldo Carvalho de Melo db9774f38e core: cu__delete must delete ->filename too
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:05:11 -03:00
Arnaldo Carvalho de Melo 89afe150ea pahole: structure__delete should free ->name too.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:04:26 -03:00
Arnaldo Carvalho de Melo 87f3f634f2 dwarf_loader: tag__recode_dwarf_bitfield should use cu__add_tag
So that it gets linked in the cu tags list to be deleted at cu__delete ->
tag__delete time.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-03 09:02:50 -03:00
Arnaldo Carvalho de Melo 4d619ac4cb core: Only DWARF uses the global strings table, so move it there
There is still the problem of handing the strings table to the CTF encoder, but
that will be fixed another day.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 18:46:54 -03:00
Arnaldo Carvalho de Melo 486299a359 ctf: Plug debug_fmt_ops->strings__ptr
So that we can use the strings in ".strtab" directly, without duplicating them
on the global strings table.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 17:55:17 -03:00
Arnaldo Carvalho de Melo 870afee9ce core: Stop using strings__ptr(strings, i) directly
Instead pass thru cu__strings(cu, i) so that we can figure out if the
underlying debugging format handler can do that more efficiently, such as by
looking up directly the ELF section ".strtab".

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 17:54:43 -03:00
Arnaldo Carvalho de Melo 83a2b3bb60 pahole: Don't assume all strings are in the global strings table
It ain't gonna be like that soon, when every cu that comes from a CTF file will
have all its strings_t pointing to strings in .strtab.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 16:46:37 -03:00
Arnaldo Carvalho de Melo e6ed526926 core: tag__name can't assume all cus use the global string table
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 16:45:30 -03:00
Arnaldo Carvalho de Melo 9bb29daac4 base_type: Don't combine names with attributes
Such as signed, etc. This is in preparation for using directly ctf_strings.
Instead of duplicating it in the global strings table.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 16:12:36 -03:00
Arnaldo Carvalho de Melo 9a5678904b reorganize: class__demote_bitfield_members should update member->byte_size
That became cached when we moved to CTF like bitfields, i.e. each bit size
creates a new type so that the encoding for class members can have just the
name, type and bit_offset.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 15:57:21 -03:00
Arnaldo Carvalho de Melo 50844b5f25 dwarf_loader: Handle volatile bitfields in class_member__cache_byte_size
Reported-by: Breno Leitão <leitao@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 13:58:46 -03:00
Arnaldo Carvalho de Melo 7fc7148be7 core: Fix thinko in type__find_first_biggest_size_base_type_member
ctracer was segfaulting due to this problem.

Reported-by: Breno Leitão <leitao@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 13:33:05 -03:00
Arnaldo Carvalho de Melo 495c70ae14 ctf_encoder: Add void entries for variables not found on DWARF
Temporary hack till I figure out how to do more filtering on the variables on
the symtab that aren't in the DWARF info.

Problem is that if we don't put something on the table at encode time, we won't
find it at decode time, when we don't have DWARF to notice that its not there
because its not in DWARF.

We then discard it at load time, as "void foo;" doesn't make sense.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 12:41:01 -03:00
Arnaldo Carvalho de Melo c93fff6743 core: Add variable__name to struct debug_fmt_ops
Same reason as for function__name

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 12:40:33 -03:00
Arnaldo Carvalho de Melo 3b3388cb78 pdwtags: Allow specifying the debug format to be decoded
Just like the other dwarves.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 12:38:41 -03:00
Arnaldo Carvalho de Melo ea4ff04f8e core: class__vtable_fprintf should use function__name
Same reason as for last commit.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 12:10:33 -03:00
Arnaldo Carvalho de Melo d5d45ab5af core: cu__find_function_by_name must use function__name()
And not compare by string_t, as now it may not be on the global strings table,
so we have to give a chance to the underlying debug format to translate that to
a string for us.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 12:07:53 -03:00
Arnaldo Carvalho de Melo 8f14fd6d53 core: Check if the debug_fmt_ops methods are available
In the paste we ass-umed that if cu->dfops != NULL, all the methods would be
there, this ain't so anymore, so check it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 12:05:50 -03:00
Arnaldo Carvalho de Melo 0837979e09 core: function__name in CTF gets the name from .strtab
That is done by adding some new struct debug_fmt_ops methods:

->function__name()

This one, if specified, will be called by function__name(), giving a chance to
formats such as CTF to get this from some other place than the global strings
table. CTF does this by storing GElf_Sym->st_name in function->name, and by
providing a dfops->function__name() that uses function->name as an index into
the .strtab ELF section.

->cu__delete()

This is needed because we can't anymore call ctf__delete at the end of
ctf__load_file, as we will need at least the .strstab ELF section to be
available till we're done with the cu, i.e. till we call cu__delete(), that now
calls dfops->cu__delete() if it is available.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 11:46:26 -03:00
Arnaldo Carvalho de Melo 6b4aec4a73 core: Rename cu_orig_info to debug_fmt_ops
There are more things that should be handled differently, such as function
names coming from the .strtab ELF section instead of from the global strings_t
table.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-02 11:12:02 -03:00
Arnaldo Carvalho de Melo b911a0aa7a ctf_encoder: Add void (void) signature for functions not found on DWARF
Temporary hack till I figure out how to do more filtering on the functions on
the symtab that aren't in the DWARF info.

Problem is that if we don't put something on the table at encode time, we won't
find it at decode time, when we don't have DWARF to notice that its not there
because its not in DWARF.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 14:11:51 -03:00
Arnaldo Carvalho de Melo deb509cf6c libctf: Ignore hidden symbols
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 14:03:04 -03:00
Arnaldo Carvalho de Melo e104ae6b69 codiff: Support -F/--format_path
So that we can ask for a CTF on a file with both CTF and DWARF.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 14:02:21 -03:00
Arnaldo Carvalho de Melo db741ee3fc core: Hasta la vista cu__for_each_tag
build/libdwarves.so.1.0.0:
 1 function changed, 169 bytes removed, diff: -169

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 13:49:58 -03:00
Arnaldo Carvalho de Melo 583ba1c645 codiff: Stop using cu__for_each_tag
Just use cu__for_each_struct and cu__for_each_function, newer functions that
are more appropriate and make the code more easy to follow.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 13:47:48 -03:00
Arnaldo Carvalho de Melo 3c94ff34ec core: Fix cu__for_each_struct and cu__for_each_type
To cover the case where there aren't structs or even any type at all.

It looks now just like cu__for_each_function, so its more consistent as a bonus
:-)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 13:46:11 -03:00
Arnaldo Carvalho de Melo 6025d4ce38 pfunct: Stop using cu__for_each_tag
All it really needs its the recently introduced cu__for_each_function.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:55:49 -03:00
Arnaldo Carvalho de Melo f77930c4f8 prefcnt: Stop using cu__for_each_tag
The new iterators cu__for_each_function and cu__for_all_tags are better suited.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:43:58 -03:00
Arnaldo Carvalho de Melo 0048711e43 pglobal: Stop using cu__for_each_tag
It really needs the recently introduced cu__for_each_variable and
cu__for_each_function.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:39:43 -03:00
Arnaldo Carvalho de Melo 2584df6335 ctf_loader: Fill in the binding information for variables and functions
Using elf_sym__bind, i.e. Elf_Sym->st_info bind subfield.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:38:37 -03:00
Arnaldo Carvalho de Melo c73972591b syscse: Stop using cu__for_each_tag
What it really needs is cu__for_each_function.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:11:20 -03:00
Arnaldo Carvalho de Melo 494d32fba0 dtagnames: Stop using cu__for_each_tag
It really wants to do cu__for_all_tags

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-01 11:01:16 -03:00