Commit Graph

1070 Commits

Author SHA1 Message Date
Cody P Schafer e512e3f9b3 dwarves: Update git url
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-03-20 09:45:47 -03:00
Arnaldo Carvalho de Melo 8c6378fd88 dwarves: Support static class data members
Fixes the following BFA:

[acme@sandy pahole]$ pahole brainfart.o
class ios_base {
	enum _Ios_Openmodeconst    in;                   /*     0     4 */
	typedef enum _Ios_Fmtflags fmtflags;

	/* size: 1, cachelines: 1, members: 1 */
	/* padding: 65533 */
	/* last cacheline: 1 bytes */

	/* BRAIN FART ALERT! 1 != 4 + 0(holes), diff = -3 */

};

That now produces:

[acme@sandy pahole]$ build/pahole brainfart.o
class ios_base {
	static enum _Ios_Openmodeconst    in = 8;        /*     0     0 */
	typedef enum _Ios_Fmtflags fmtflags;

	/* size: 1, cachelines: 0, members: 0, static members: 1 */
	/* last cacheline: 1 bytes */
};
[acme@sandy pahole]$

Reported-by: Nicolas <nikos42@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-08-20 14:42:17 -03:00
Arnaldo Carvalho de Melo a54515fa6e dwarves: Stop using 'self'
As Thomas Gleixner wisely pointed out, using 'self' is stupid, it
doesn't convey useful information, so use sensible names.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-08-17 18:47:15 -03:00
Arnaldo Carvalho de Melo 6035b0d91f rpm: Add missing BuildRequires: zlib-devel
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-08-16 14:59:38 -03:00
Arnaldo Carvalho de Melo be7b691756 dwarf_loader: Don't stop processing after finding unsupported tag
After emitting a warning that a tag is not supported __die__process_tag
was returning NULL, making die__process_unit think that the problem
was insufficient memory.

Introduce a global variable 'unsupported_tag' and return it instead,
that way die__process_unit can distinguish ENOMEM from unsupported tags.

Reported-by: Thiago Macieira <thiago.macieira@intel.com>
Tested-by: Thiago Macieira <thiago.macieira@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-08-16 14:55:14 -03:00
Arnaldo Carvalho de Melo e887636d6d v1.10
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-30 15:40:22 -03:00
Arnaldo Carvalho de Melo 50d4bd4a5b dwarf_loader: Stub for DW_TAG_GNU_call_site{_parameter} in inline expansion too
Need to study
http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open to
implement proper support.

Reported-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-15 10:47:29 -03:00
Arnaldo Carvalho de Melo 109dcf9bd0 dwarf loader: Fix some type/tag searches
The 2938a70 changeset incorectly changed some searches that needed to be
done on the all tags hashtable to the type only one.

This lead to problems such as:

[acme@sandy pahole]$ build/pahole /usr/lib/debug/usr/libexec/pt_chown.debug > /dev/null
tag__recode_dwarf_type: couldn't find 0xf7a type for 0x1133 (inlined_subroutine)!
tag__recode_dwarf_type: couldn't find 0x1047 type for 0x1166 (inlined_subroutine)!
tag__recode_dwarf_type: couldn't find 0xf7a type for 0x11a8 (inlined_subroutine)!
lexblock__recode_dwarf_types: couldn't find 0xf7a type for 0x1133 (inlined_subroutine)!
lexblock__recode_dwarf_types: couldn't find 0x1047 type for 0x1166 (inlined_subroutine)!
lexblock__recode_dwarf_types: couldn't find 0xf7a type for 0x11a8 (inlined_subroutine)!
[acme@sandy pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-14 19:41:49 -03:00
Arnaldo Carvalho de Melo 172d4683a3 regtest: Accept --diff instad of plain 'diff' as long option
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-14 19:36:58 -03:00
Arnaldo Carvalho de Melo 8bd68e0f24 Merge branch 'debug-types' of https://github.com/tromey/dwarves 2012-05-14 14:39:49 -03:00
Arnaldo Carvalho de Melo 851daa958e Merge branch 'remove-unneeded-call' of https://github.com/tromey/dwarves 2012-05-14 14:38:35 -03:00
Arnaldo Carvalho de Melo edc0917ca3 dwarf_loader: Add stub for DW_TAG_GNU_call_site{_parameter}
Need to study http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open
to implement proper support.

Reported-by: Jakub Jelinek <jakub@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-09 15:47:02 -03:00
Tom Tromey 2938a70e1e Add support for .debug_types sections.
.debug_types is a new DWARF 4 feature that adds some simple
compression to DWARF.  The basic idea is that identical type
definitions are merged by the linker and put into a new .debug_types
section.

This introduces 'dwarf_off_ref', which is like Dwarf_Off, but carries
a flag indicating if the DIE came from .debug_types.  This allows
future uses to find the DIE properly.

Type units are read a little differently from ordinary CUs.  All type
units are read at once, then types are recoded for them.  (I think
something like this is needed more generally, to support inter-CU
references, but I have not tried that.)

The type unit is also kept around longer, because any other CU may
refer to it.  This necessitated a change to load_steal_kind to replace
the notion of a "stolen" CU with a request by the "stealer" for the
caller to delete the CU when appropriate.

I need elfutils patch 581c3f60e2b1fc7ddaf4260bb5a9cb59f8e3f0d0
to make this work properly; without it I see crashes.

You can make test cases by compiling with '-gdwarf-4 -fdebug-types-section'.
2012-03-22 12:51:20 -06:00
Tom Tromey 5ef26a053d Remove unused field from debug_fmt_ops
Nothing seemed to use the 'tag__orig_type' method in debug_fmt_ops.
It was simpler to remove it than to try to fix it for the next patch.
2012-03-22 12:43:59 -06:00
Tom Tromey 7defe84d73 Correctly handle DW_FORM_flag and add DW_FORM_flag_present support
Before this patch, running pahole on an executable compiled
with -gdwarf-4 gave:

DW_AT_<0x3c>=0x19

0x19 is DW_FORM_flag_present.
Also, DW_FORM_flag takes an argument.
Changing attr_numeric to call dwarf_formflag fixes both problems.
2012-03-20 12:31:08 -06:00
Tom Tromey 4df110dcc4 Remove unnecessary call to dwarf_diecu 2012-03-20 12:30:05 -06:00
Arnaldo Carvalho de Melo 4fa85d5b70 Merge pull request #1 from hasturkun/master
Fix crash on pahole -R -S due to NULL dereference
2012-02-26 14:23:33 -08:00
Tal Kelrich 4e5967a2ca Fix crash when pahole called with -R -S 2012-02-26 16:33:05 +02:00
Arnaldo Carvalho de Melo 76f687bf49 dwarf_loader: Fix the build on older systems
RHEL5 and Fedora 11 were not building due to the GNU attributes stuff,
cope with that using a define we know is not present in both RHEL5 and
Fedora 11 to #ifdef those parts. Ugly, but _ELFUTILS_PREREQ, i.e.
elfutils/version.h is not present in RHEL5 either.

Reported-by: Jon Stanley <jstanley@fedoraproject.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2011-03-17 15:33:28 -03:00
Arnaldo Carvalho de Melo c7fa6a9a40 dwarf loader: Catch some more template tags
Just warn about them not being supported yet.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 22:38:59 -02:00
Arnaldo Carvalho de Melo dae032ea3f dwarves fprintf: Add extra GNU tags
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 22:23:14 -02:00
Arnaldo Carvalho de Melo 250b8586d2 dwarf loader: Print tag numerical value in addition to string
So that we can get unknown tag values.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 22:10:18 -02:00
Arnaldo Carvalho de Melo 91a865bd8f dwarf loader: Initialize tag->node
So that we don't have false asserts at tag__delete thinking the tag is in
some list.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 22:09:05 -02:00
Arnaldo Carvalho de Melo 3a0f0df2e5 cmake: Add ${ELF_LIBRARY} to ctracer, scncopy and pfunct
Noticed on fedora 14, probably we were getting this indirectly, go figure.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 15:18:01 -02:00
Arnaldo Carvalho de Melo 525c2644f3 dwarf_loader: Catch DW_TAG_template_{type,value}_parameter
More work is needed to use this information in dwarves_fprintf.c.

Reported-by: Josh Stone <jistone@redhat.com>
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=654471
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 14:37:52 -02:00
Arnaldo Carvalho de Melo e1e7fc2f53 dwarves: Add missing #include <sys/stat.h>
Needed because it uses S_ISDIR. In the past this header probably was
being indirectly included. Noticed while building on RHEL6 Beta.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-06-04 09:26:13 -03:00
Arnaldo Carvalho de Melo f95bfb6e5a Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/acme/pahole 2010-05-04 13:36:24 -03:00
Arnaldo Carvalho de Melo c0bdd19f0e pfunct: Introduce '-P'/'--prototypes'
To print all the function prototypes.

Based-on-patch-by: Rakesh Pandit <rakesh.pandit@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-05-04 13:33:08 -03:00
Arnaldo Carvalho de Melo dfbb7dd53d cmake: fix DWARVES_VERSION definition, should be 1.8
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-13 18:02:24 -03:00
Peter Jones a6f5fedf37 scncopy: Fix minor problems with --usage.
- "-s section 0" doesn't really read the same as "-s section0"
- "--help" is something we should allow
- usage should say "scncopy" not "pjoc"

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-01-12 16:37:27 -02:00
Peter Jones c9d1352dfe Add scncopy to CMakeLists.txt
Add scncopy to the build.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-01-12 14:23:54 -02:00
Peter Jones 29ef465cd8 Add scncopy - like object copy but tries not to change section content
This adds scncopy, which is like objcopy with some differences:
- it doesn't try to update section contents, but does try to
  update program headers and such to correctly reflect the section
  contents.
- it doesn't necessarily try to create a binary eu-elflint will like.
  If you don't copy a required section, it won't make it for you.

TODO:
- Make it possible to copy sections to an already existant binary.
- Make phdrs only copy if they're needed, and/or modify old phdrs to
  point to new sections
- Make sure nothing is missing from fixup_dynamic()

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-01-12 14:23:32 -02:00
Rakesh Pandit 537db1da2d libctf: Replaces deprecated elf_getshstrndx with elf_getshdrstrndx
Removes irritating warning while compilation.

Signed-off-by: Rakesh Pandit <rakesh@fedoraproject.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-29 11:36:47 -02:00
Herton Ronaldo Krzesinski 7bc0b0c656 cmake: Avoid uneeded linking/unused libraries in some dwarves libraries and executables
currently mandriva has a packaging script which checks for uneeded linking in
package built files. For dwarves, it displays:

Warning: unused libraries in /usr/lib64/libdwarves_reorganize.so.1.0.0: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/lib64/libdwarves_emit.so.1.0.0: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/ctracer: libz.so.1
 libdw.so.1

Warning: unused libraries in /usr/bin/syscse: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pglobal: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pdwtags: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/prefcnt: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pfunct: libz.so.1
 libdw.so.1

Warning: unused libraries in /usr/bin/pahole: libz.so.1
 libdw.so.1
 libelf.so.1

Warning: unused libraries in /usr/bin/dtagnames: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/codiff: libdw.so.1
 libelf.so.1
 libz.so.1

The patch below fixes the issue (removing uneeded specified libraries and using
LINK_INTERFACE_LIBRARIES property, see
http://www.cmake.org/Wiki/CMake_FAQ#Why_are_libraries_linked_to_my_shared_library_included_when_something_links_to_it.3F)

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-17 15:20:27 -02:00
Arnaldo Carvalho de Melo 3e40f38821 New release: 1.8
See NEWS file for the summary.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-06 15:41:50 -02:00
Arnaldo Carvalho de Melo 01a7fb50d4 ctf_encoder: Allow specifying a verbose level for cu__encode_ctf
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-06 14:17:29 -02:00
Arnaldo Carvalho de Melo 25cd635806 dwarves: base_type->float_type holds only 12 possible values
So make it a :4 u8 to combine with the previous bitfield. This field is
also seldom used so no expected perf hit.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-05 19:07:51 -02:00
Arnaldo Carvalho de Melo c6d27e325c dwarves: Enlarge vtable_entry
Since we have two bytes after it in a hole, use them for vtable_entry,
hell knows if there isn't any crazy code with that many vtable
entries...

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-05 18:35:10 -02:00
Arnaldo Carvalho de Melo 800fd44d6b dwarves: Make two bitfield entries be bool
As we had 14 bits hole, so use them as bools, each taking one byte
but generating better/shorter code.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-05 18:31:16 -02:00
Arnaldo Carvalho de Melo 42bb02cdfb ctf_loader: Fix ptr diff printf specifier
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-05 18:30:30 -02:00
Arnaldo Carvalho de Melo fce01d3a36 dwarf_loader: Support more compact DW_AT_data_member_location form
Description by Mark Wielaard:

Its a more compact expression of struct field offsets. Jakub already
backported it to the 4.4 gcc in rawhide.

http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00437.html It simply means
that when you try to get the field offset based on a
DW_AT_data_member_location you would check dwarf_whatform() of the
attribute to see if it is a simple constant or a location expression
block/ptr.

Suggested-by: Mark Wielaard <mjw@redhat.com>
Reported-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-11-24 12:56:41 -02:00
Arnaldo Carvalho de Melo da0781e405 MANIFEST: Remove the .py extension for regtest
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-11-07 16:59:20 -02:00
Arnaldo Carvalho de Melo 6476d24d73 pahole: Introduce --hex to print offsets and sizes in hexadecimal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-10-20 13:59:12 -02:00
Arnaldo Carvalho de Melo 0412efb401 dwarf_loader: Properly initialize ->size in lexblock__init
When dwarf_lowpc failed we were not initializing ->size, so garbage was
being left there and thing like 'pfunct --sizes' were producing
senseless results.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-09-20 16:53:19 -03:00
Arnaldo Carvalho de Melo 5859ddcbf1 pahole: don't call class__delete for clones for now
As it is corrupting the obstack and it will be deleted completely at
cu__delete time anyway. Stick a FIXME tho, as it is good to completely
understand and fix this eventually.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-09-20 16:46:32 -03:00
Arnaldo Carvalho de Melo 0c50ef3a60 dwarves: class_member__clone need to allocate from the obstack
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-09-20 16:20:06 -03:00
Arnaldo Carvalho de Melo f001b9f688 dwarves: Add a newline to __tag__id_not_found_fprintf output
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-09-14 17:55:20 -03:00
Arnaldo Carvalho de Melo 5be2291b14 dwarves: Teach base_type__name_to_size about "long double"
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-09-14 17:50:14 -03:00
Arnaldo Carvalho de Melo d45a1e7c7c ctf_loader: Make a 'boo!' warning more verbose
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-09-14 17:48:37 -03:00
Arnaldo Carvalho de Melo b4977b20e0 dwarves: __tag__has_type_loop has to handle a NULL type (void)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-09-14 17:39:52 -03:00