Hello community,
here is the log from the commit of package dwarves for openSUSE:Factory checked in at 2012-06-10 20:15:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/dwarves (Old)
and /work/SRC/openSUSE:Factory/.dwarves.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dwarves", Maintainer is ""
Changes:
--------
--- /work/SRC/openSUSE:Factory/dwarves/dwarves.changes 2011-09-23 01:55:56.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.dwarves.new/dwarves.changes 2012-06-10 21:50:40.000000000 +0200
@@ -1,0 +2,8 @@
+Wed Jun 6 21:39:25 UTC 2012 - jengelh@inai.de
+
+- Update to new upstream release 1.10
+* Initial DWARF4 support
+* Add stubs for some new GNU tags
+* Fix a crash when pahole is called with -R -S
+
+-------------------------------------------------------------------
Old:
----
dwarves-1.9.tar.bz2
New:
----
dwarves-1.10.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ dwarves.spec ++++++
--- /var/tmp/diff_new_pack.Yby8lr/_old 2012-06-10 21:50:42.000000000 +0200
+++ /var/tmp/diff_new_pack.Yby8lr/_new 2012-06-10 21:50:42.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package dwarves
#
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,21 +16,24 @@
#
-
Name: dwarves
Url: http://acmel.wordpress.com/
Summary: DWARF utilities
-Version: 1.9
-Release: 1
License: GPL-2.0
Group: Development/Tools/Debuggers
+Version: 1.10
+Release: 0
#Git-Clone: git://git.kernel.org/pub/scm/linux/kernel/git/acme/pahole
#DL-URL: http://fedorapeople.org/~acme/dwarves/
Source: http://fedorapeople.org/~acme/dwarves/%{name}-%{version}.tar.bz2
Source2: baselibs.conf
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: cmake libdw-devel libdwarf-devel libebl-devel libelf-devel
+BuildRequires: cmake
+BuildRequires: libdw-devel >= 0.142
+BuildRequires: libdwarf-devel
+BuildRequires: libebl-devel
+BuildRequires: libelf-devel
BuildRequires: zlib-devel
# Also known by its most prominent tool
Provides: pahole = %version-%release
++++++ dwarves-1.9.tar.bz2 -> dwarves-1.10.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/NEWS new/NEWS
--- old/NEWS 2011-02-28 19:11:33.000000000 +0100
+++ new/NEWS 2012-05-30 20:39:32.000000000 +0200
@@ -1,3 +1,15 @@
+v1.10
+
+Wed May 30 2012
+
+. Initial DWARF4 support, by Tom Tromey
+
+. Add stubs for some new GNU Tags
+
+. Fix build on older systems
+
+. Fix a crash when pahole is called with -R -S, from Tal Kelrich
+
v1.9:
Ignore DW_TAG_template_{type,value}_parameter, fixing a bug reported at:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dutil.h new/dutil.h
--- old/dutil.h 2009-08-13 18:08:08.000000000 +0200
+++ new/dutil.h 2012-03-20 17:17:25.000000000 +0100
@@ -72,4 +72,12 @@
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
GElf_Shdr *shp, const char *name, size_t *index);
+#ifndef SHT_GNU_ATTRIBUTES
+/* Just a way to check if we're using an old elfutils version */
+static inline int elf_getshdrstrndx(Elf *elf, size_t *dst)
+{
+ return elf_getshstrndx(elf, dst);
+}
+#endif
+
#endif /* _DUTIL_H_ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwarf_loader.c new/dwarf_loader.c
--- old/dwarf_loader.c 2011-02-28 19:11:33.000000000 +0100
+++ new/dwarf_loader.c 2012-05-15 15:46:43.000000000 +0200
@@ -34,13 +34,22 @@
#define DW_AT_GNU_vector 0x2107
#endif
+#ifndef DW_TAG_GNU_call_site
+#define DW_TAG_GNU_call_site 0x4109
+#define DW_TAG_GNU_call_site_parameter 0x410a
+#endif
+
#define hashtags__fn(key) hash_64(key, HASHTAGS__BITS)
static void __tag__print_not_supported(uint32_t tag, const char *func)
{
-
+#ifdef STB_GNU_UNIQUE
static bool dwarf_tags_warned[DW_TAG_rvalue_reference_type];
static bool dwarf_gnu_tags_warned[DW_TAG_GNU_formal_parameter_pack - DW_TAG_MIPS_loop];
+#else
+ static bool dwarf_tags_warned[DW_TAG_shared_type];
+ static bool dwarf_gnu_tags_warned[DW_TAG_class_template - DW_TAG_MIPS_loop];
+#endif
if (tag < DW_TAG_MIPS_loop) {
if (dwarf_tags_warned[tag])
@@ -61,13 +70,20 @@
#define tag__print_not_supported(tag) \
__tag__print_not_supported(tag, __func__)
+struct dwarf_off_ref {
+ unsigned int from_types : 1;
+ Dwarf_Off off;
+};
+
+typedef struct dwarf_off_ref dwarf_off_ref;
+
struct dwarf_tag {
struct hlist_node hash_node;
- Dwarf_Off type;
+ dwarf_off_ref type;
Dwarf_Off id;
union {
- Dwarf_Off abstract_origin;
- Dwarf_Off containing_type;
+ dwarf_off_ref abstract_origin;
+ dwarf_off_ref containing_type;
};
struct tag *tag;
strings_t decl_file;
@@ -75,14 +91,14 @@
uint16_t small_id;
};
-static Dwarf_Off dwarf_tag__spec(struct dwarf_tag *self)
+static dwarf_off_ref dwarf_tag__spec(struct dwarf_tag *self)
{
- return *(Dwarf_Off *)(self + 1);
+ return *(dwarf_off_ref *)(self + 1);
}
-static void dwarf_tag__set_spec(struct dwarf_tag *self, Dwarf_Off spec)
+static void dwarf_tag__set_spec(struct dwarf_tag *self, dwarf_off_ref spec)
{
- *(Dwarf_Off *)(self + 1) = spec;
+ *(dwarf_off_ref *)(self + 1) = spec;
}
#define HASHTAGS__BITS 8
@@ -105,6 +121,7 @@
struct hlist_head hash_types[HASHTAGS__SIZE];
struct obstack obstack;
struct cu *cu;
+ struct dwarf_cu *type_unit;
};
static void dwarf_cu__init(struct dwarf_cu *self)
@@ -115,6 +132,7 @@
INIT_HLIST_HEAD(&self->hash_types[i]);
}
obstack_init(&self->obstack);
+ self->type_unit = NULL;
}
static void hashtags__hash(struct hlist_head *hashtable,
@@ -152,16 +170,29 @@
hashtags__hash(hashtable, tag->priv);
}
-static struct dwarf_tag *dwarf_cu__find_tag_by_id(const struct dwarf_cu *self,
- const Dwarf_Off id)
+static struct dwarf_tag *dwarf_cu__find_tag_by_ref(const struct dwarf_cu *self,
+ const struct dwarf_off_ref *ref)
{
- return self ? hashtags__find(self->hash_tags, id) : NULL;
+ if (self == NULL)
+ return NULL;
+ if (ref->from_types) {
+ return NULL;
+ }
+ return hashtags__find(self->hash_tags, ref->off);
}
-static struct dwarf_tag *dwarf_cu__find_type_by_id(const struct dwarf_cu *self,
- const Dwarf_Off id)
+static struct dwarf_tag *dwarf_cu__find_type_by_ref(const struct dwarf_cu *self,
+ const struct dwarf_off_ref *ref)
{
- return self ? hashtags__find(self->hash_types, id) : NULL;
+ if (self == NULL)
+ return NULL;
+ if (ref->from_types) {
+ self = self->type_unit;
+ if (self == NULL) {
+ return NULL;
+ }
+ }
+ return hashtags__find(self->hash_types, ref->off);
}
extern struct strings *strings;
@@ -237,7 +268,12 @@
}
break;
case DW_FORM_flag:
- return 1;
+ case DW_FORM_flag_present: {
+ bool value;
+ if (dwarf_formflag(&attr, &value) == 0)
+ return value;
+ }
+ break;
default:
fprintf(stderr, "DW_AT_<0x%x>=0x%x\n", name, form);
break;
@@ -296,16 +332,20 @@
return NULL;
}
-static Dwarf_Off attr_type(Dwarf_Die *die, uint32_t attr_name)
+static struct dwarf_off_ref attr_type(Dwarf_Die *die, uint32_t attr_name)
{
Dwarf_Attribute attr;
+ struct dwarf_off_ref ref;
if (dwarf_attr(die, attr_name, &attr) != NULL) {
- Dwarf_Die type_die;
- if (dwarf_formref_die(&attr, &type_die) != NULL)
- return dwarf_dieoffset(&type_die);
-
+ Dwarf_Die type_die;
+ if (dwarf_formref_die(&attr, &type_die) != NULL) {
+ ref.from_types = attr.form == DW_FORM_ref_sig8;
+ ref.off = dwarf_dieoffset(&type_die);
+ return ref;
+ }
}
- return 0;
+ memset(&ref, 0, sizeof(ref));
+ return ref;
}
static int attr_location(Dwarf_Die *die, Dwarf_Op **expr, size_t *exprlen)
@@ -321,9 +361,9 @@
static void *__tag__alloc(struct dwarf_cu *dcu, size_t size, bool spec)
{
- struct dwarf_tag *dtag = obstack_alloc(&dcu->obstack,
- (sizeof(*dtag) +
- (spec ? sizeof(Dwarf_Off) : 0)));
+ struct dwarf_tag *dtag = obstack_zalloc(&dcu->obstack,
+ (sizeof(*dtag) +
+ (spec ? sizeof(dwarf_off_ref) : 0)));
if (dtag == NULL)
return NULL;
@@ -334,7 +374,6 @@
dtag->tag = self;
self->priv = dtag;
- dtag->type = 0;
self->type = 0;
self->top_level = 0;
@@ -555,8 +594,8 @@
switch (self->tag) {
case DW_TAG_typedef: {
const struct dwarf_tag *dself = self->priv;
- struct dwarf_tag *dtype = dwarf_cu__find_type_by_id(cu->priv,
- dself->type);
+ struct dwarf_tag *dtype = dwarf_cu__find_type_by_ref(cu->priv,
+ &dself->type);
struct tag *type = dtype->tag;
id = tag__recode_dwarf_bitfield(type, cu, bit_size);
@@ -578,8 +617,8 @@
case DW_TAG_const_type:
case DW_TAG_volatile_type: {
const struct dwarf_tag *dself = self->priv;
- struct dwarf_tag *dtype = dwarf_cu__find_type_by_id(cu->priv,
- dself->type);
+ struct dwarf_tag *dtype = dwarf_cu__find_type_by_ref(cu->priv,
+ &dself->type);
struct tag *type = dtype->tag;
id = tag__recode_dwarf_bitfield(type, cu, bit_size);
@@ -665,7 +704,7 @@
struct cu *cu)
{
struct dwarf_tag *dtag = self->tag.priv;
- struct dwarf_tag *type = dwarf_cu__find_type_by_id(cu->priv, dtag->type);
+ struct dwarf_tag *type = dwarf_cu__find_type_by_ref(cu->priv, &dtag->type);
int recoded_type_id = tag__recode_dwarf_bitfield(type->tag, cu,
self->bitfield_size);
if (recoded_type_id < 0)
@@ -1201,8 +1240,10 @@
{
do {
switch (dwarf_tag(die)) {
+#ifdef STB_GNU_UNIQUE
case DW_TAG_GNU_template_template_param:
case DW_TAG_GNU_template_parameter_pack:
+#endif
case DW_TAG_template_type_parameter:
case DW_TAG_template_value_parameter:
/* FIXME: probably we'll have to attach this as a list of
@@ -1328,6 +1369,14 @@
long id = -1;
switch (dwarf_tag(die)) {
+ case DW_TAG_GNU_call_site:
+ case DW_TAG_GNU_call_site_parameter:
+ /*
+ * FIXME: read http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open
+ * and write proper support.
+ */
+ tag__print_not_supported(dwarf_tag(die));
+ continue;
case DW_TAG_lexical_block:
if (die__create_new_lexblock(die, cu, NULL) != 0)
goto out_enomem;
@@ -1409,6 +1458,14 @@
long id = -1;
switch (dwarf_tag(die)) {
+ case DW_TAG_GNU_call_site:
+ case DW_TAG_GNU_call_site_parameter:
+ /*
+ * FIXME: read http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open
+ * and write proper support.
+ */
+ tag__print_not_supported(dwarf_tag(die));
+ continue;
case DW_TAG_template_type_parameter:
case DW_TAG_template_value_parameter:
/* FIXME: probably we'll have to attach this as a list of
@@ -1552,7 +1609,7 @@
{
struct dwarf_tag *dtag = self->priv;
fprintf(stderr, "%s: couldn't find %#llx type for %#llx (%s)!\n", func,
- (unsigned long long)dtag->type, (unsigned long long)dtag->id,
+ (unsigned long long)dtag->type.off, (unsigned long long)dtag->id,
dwarf_tag_name(self->tag));
}
@@ -1596,20 +1653,20 @@
ftype__recode_dwarf_types(pos, cu);
break;
case DW_TAG_imported_module:
- dtype = dwarf_cu__find_tag_by_id(dcu, dpos->type);
+ dtype = dwarf_cu__find_tag_by_ref(dcu, &dpos->type);
goto check_type;
/* Can be for both types and non types */
case DW_TAG_imported_declaration:
- dtype = dwarf_cu__find_tag_by_id(dcu, dpos->type);
+ dtype = dwarf_cu__find_tag_by_ref(dcu, &dpos->type);
if (dtype != NULL)
goto next;
goto find_type;
}
- if (dpos->type == 0) /* void */
+ if (dpos->type.off == 0) /* void */
continue;
find_type:
- dtype = dwarf_cu__find_type_by_id(dcu, dpos->type);
+ dtype = dwarf_cu__find_type_by_ref(dcu, &dpos->type);
check_type:
if (dtype == NULL) {
tag__print_type_not_found(pos);
@@ -1625,12 +1682,12 @@
{
struct dwarf_tag *dtype;
struct type *t = tag__type(self);
- Dwarf_Off specification = dwarf_tag__spec(self->priv);
+ dwarf_off_ref specification = dwarf_tag__spec(self->priv);
- if (t->namespace.name != 0 || specification == 0)
+ if (t->namespace.name != 0 || specification.off == 0)
return;
- dtype = dwarf_cu__find_type_by_id(cu->priv, specification);
+ dtype = dwarf_cu__find_type_by_ref(cu->priv, &specification);
if (dtype != NULL)
t->namespace.name = tag__namespace(dtype->tag)->name;
else {
@@ -1640,7 +1697,7 @@
"%s: couldn't find name for "
"class %#llx, specification=%#llx\n", __func__,
(unsigned long long)dtag->id,
- (unsigned long long)specification);
+ (unsigned long long)specification.off);
}
}
@@ -1650,7 +1707,7 @@
struct dwarf_tag *dtag = self->priv;
fprintf(stderr,
"%s: couldn't find %#llx abstract_origin for %#llx (%s)!\n",
- func, (unsigned long long)dtag->abstract_origin,
+ func, (unsigned long long)dtag->abstract_origin.off,
(unsigned long long)dtag->id,
dwarf_tag_name(self->tag));
}
@@ -1668,13 +1725,13 @@
struct dwarf_tag *dpos = pos->tag.priv;
struct dwarf_tag *dtype;
- if (dpos->type == 0) {
- if (dpos->abstract_origin == 0) {
+ if (dpos->type.off == 0) {
+ if (dpos->abstract_origin.off == 0) {
/* Function without parameters */
pos->tag.type = 0;
continue;
}
- dtype = dwarf_cu__find_tag_by_id(dcu, dpos->abstract_origin);
+ dtype = dwarf_cu__find_tag_by_ref(dcu, &dpos->abstract_origin);
if (dtype == NULL) {
tag__print_abstract_origin_not_found(&pos->tag);
continue;
@@ -1684,7 +1741,7 @@
continue;
}
- dtype = dwarf_cu__find_type_by_id(dcu, dpos->type);
+ dtype = dwarf_cu__find_type_by_ref(dcu, &dpos->type);
if (dtype == NULL) {
tag__print_type_not_found(&pos->tag);
continue;
@@ -1707,7 +1764,7 @@
lexblock__recode_dwarf_types(tag__lexblock(pos), cu);
continue;
case DW_TAG_inlined_subroutine:
- dtype = dwarf_cu__find_tag_by_id(dcu, dpos->type);
+ dtype = dwarf_cu__find_tag_by_ref(dcu, &dpos->type);
if (dtype == NULL) {
tag__print_type_not_found(pos);
continue;
@@ -1716,12 +1773,12 @@
continue;
case DW_TAG_formal_parameter:
- if (dpos->type != 0)
+ if (dpos->type.off != 0)
break;
struct parameter *fp = tag__parameter(pos);
- dtype = dwarf_cu__find_tag_by_id(dcu,
- dpos->abstract_origin);
+ dtype = dwarf_cu__find_tag_by_ref(dcu,
+ &dpos->abstract_origin);
if (dtype == NULL) {
tag__print_abstract_origin_not_found(pos);
continue;
@@ -1731,12 +1788,12 @@
continue;
case DW_TAG_variable:
- if (dpos->type != 0)
+ if (dpos->type.off != 0)
break;
struct variable *var = tag__variable(pos);
- if (dpos->abstract_origin == 0) {
+ if (dpos->abstract_origin.off == 0) {
/*
* DW_TAG_variable completely empty was
* found on libQtGui.so.4.3.4.debug
@@ -1745,8 +1802,8 @@
continue;
}
- dtype = dwarf_cu__find_tag_by_id(dcu,
- dpos->abstract_origin);
+ dtype = dwarf_cu__find_tag_by_ref(dcu,
+ &dpos->abstract_origin);
if (dtype == NULL) {
tag__print_abstract_origin_not_found(pos);
continue;
@@ -1758,10 +1815,10 @@
case DW_TAG_label: {
struct label *l = tag__label(pos);
- if (dpos->abstract_origin == 0)
+ if (dpos->abstract_origin.off == 0)
continue;
- dtype = dwarf_cu__find_tag_by_id(dcu, dpos->abstract_origin);
+ dtype = dwarf_cu__find_tag_by_ref(dcu, &dpos->abstract_origin);
if (dtype != NULL)
l->name = tag__label(dtype->tag)->name;
else
@@ -1770,7 +1827,7 @@
continue;
}
- dtype = dwarf_cu__find_type_by_id(dcu, dpos->type);
+ dtype = dwarf_cu__find_type_by_ref(dcu, &dpos->type);
if (dtype == NULL) {
tag__print_type_not_found(pos);
continue;
@@ -1799,9 +1856,9 @@
struct function *fn = tag__function(self);
if (fn->name == 0) {
- Dwarf_Off specification = dwarf_tag__spec(dtag);
- if (dtag->abstract_origin == 0 &&
- specification == 0) {
+ dwarf_off_ref specification = dwarf_tag__spec(dtag);
+ if (dtag->abstract_origin.off == 0 &&
+ specification.off == 0) {
/*
* Found on libQtGui.so.4.3.4.debug
* <3><1423de>: Abbrev Number: 209 (DW_TAG_subprogram)
@@ -1809,9 +1866,9 @@
*/
return 0;
}
- dtype = dwarf_cu__find_tag_by_id(cu->priv, dtag->abstract_origin);
+ dtype = dwarf_cu__find_tag_by_ref(cu->priv, &dtag->abstract_origin);
if (dtype == NULL)
- dtype = dwarf_cu__find_tag_by_id(cu->priv, specification);
+ dtype = dwarf_cu__find_tag_by_ref(cu->priv, &specification);
if (dtype != NULL)
fn->name = tag__function(dtype->tag)->name;
else {
@@ -1820,8 +1877,8 @@
"function %#llx, abstract_origin=%#llx,"
" specification=%#llx\n", __func__,
(unsigned long long)dtag->id,
- (unsigned long long)dtag->abstract_origin,
- (unsigned long long)specification);
+ (unsigned long long)dtag->abstract_origin.off,
+ (unsigned long long)specification.off);
}
}
lexblock__recode_dwarf_types(&fn->lexblock, cu);
@@ -1840,7 +1897,7 @@
case DW_TAG_ptr_to_member_type: {
struct ptr_to_member_type *pt = tag__ptr_to_member_type(self);
- dtype = dwarf_cu__find_type_by_id(cu->priv, dtag->containing_type);
+ dtype = dwarf_cu__find_type_by_ref(cu->priv, &dtag->containing_type);
if (dtype != NULL)
pt->containing_type = dtype->small_id;
else {
@@ -1849,7 +1906,7 @@
"containing_type %#llx, containing_type=%#llx\n",
__func__,
(unsigned long long)dtag->id,
- (unsigned long long)dtag->containing_type);
+ (unsigned long long)dtag->containing_type.off);
}
}
break;
@@ -1862,23 +1919,23 @@
The others also point to routines, so are in tags_table */
case DW_TAG_inlined_subroutine:
case DW_TAG_imported_module:
- dtype = dwarf_cu__find_tag_by_id(cu->priv, dtag->type);
+ dtype = dwarf_cu__find_tag_by_ref(cu->priv, &dtag->type);
goto check_type;
/* Can be for both types and non types */
case DW_TAG_imported_declaration:
- dtype = dwarf_cu__find_tag_by_id(cu->priv, dtag->type);
+ dtype = dwarf_cu__find_tag_by_ref(cu->priv, &dtag->type);
if (dtype != NULL)
goto out;
goto find_type;
}
- if (dtag->type == 0) {
+ if (dtag->type.off == 0) {
self->type = 0; /* void */
return 0;
}
find_type:
- dtype = dwarf_cu__find_type_by_id(cu->priv, dtag->type);
+ dtype = dwarf_cu__find_type_by_ref(cu->priv, &dtag->type);
check_type:
if (dtype == NULL) {
tag__print_type_not_found(self);
@@ -1934,13 +1991,6 @@
return cu->extra_dbg_info ? dtag->id : 0;
}
-static unsigned long long dwarf_tag__orig_type(const struct tag *self,
- const struct cu *cu)
-{
- struct dwarf_tag *dtag = self->priv;
- return cu->extra_dbg_info ? dtag->type : 0;
-}
-
static const char *dwarf__strings_ptr(const struct cu *cu __unused,
strings_t s)
{
@@ -1954,8 +2004,8 @@
Dwarf_Die child;
const uint16_t tag = dwarf_tag(die);
- if (tag != DW_TAG_compile_unit) {
- fprintf(stderr, "%s: DW_TAG_compile_unit expected got %s!\n",
+ if (tag != DW_TAG_compile_unit && tag != DW_TAG_type_unit) {
+ fprintf(stderr, "%s: DW_TAG_compile_unit or DW_TAG_type_unit expected got %s!\n",
__FUNCTION__, dwarf_tag_name(tag));
return -EINVAL;
}
@@ -1973,6 +2023,14 @@
"DW_TAG_compile_unit!\n",
__FUNCTION__, dwarf_tag_name(tag));
+ return 0;
+}
+
+static int die__process_and_recode(Dwarf_Die *die, struct cu *cu)
+{
+ int ret = die__process(die, cu);
+ if (ret != 0)
+ return ret;
return cu__recode_dwarf_types(cu);
}
@@ -2033,6 +2091,96 @@
return 0;
}
+static int finalize_cu(struct cus *self, struct cu *cu, struct dwarf_cu *dcu,
+ struct conf_load *conf)
+{
+ base_type_name_to_size_table__init(strings);
+ cu__for_all_tags(cu, class_member__cache_byte_size, conf);
+ if (conf && conf->steal) {
+ return conf->steal(cu, conf);
+ }
+ return LSK__KEEPIT;
+}
+
+static int finalize_cu_immediately(struct cus *self, struct cu *cu,
+ struct dwarf_cu *dcu,
+ struct conf_load *conf)
+{
+ int lsk = finalize_cu(self, cu, dcu, conf);
+ switch (lsk) {
+ case LSK__DELETE:
+ cu__delete(cu);
+ break;
+ case LSK__STOP_LOADING:
+ break;
+ case LSK__KEEPIT:
+ if (!cu->extra_dbg_info)
+ obstack_free(&dcu->obstack, NULL);
+ cus__add(self, cu);
+ break;
+ }
+ return lsk;
+}
+
+static int cus__load_debug_types(struct cus *self, struct conf_load *conf,
+ Dwfl_Module *mod, Dwarf *dw, Elf *elf,
+ const char *filename,
+ const unsigned char *build_id,
+ int build_id_len,
+ struct cu **cup, struct dwarf_cu *dcup)
+{
+ Dwarf_Off off = 0, noff, type_off;
+ size_t cuhl;
+ uint8_t pointer_size, offset_size;
+ uint64_t signature;
+
+ *cup = NULL;
+
+ while (dwarf_next_unit(dw, off, &noff, &cuhl, NULL, NULL, &pointer_size,
+ &offset_size, &signature, &type_off)
+ == 0) {
+
+ if (*cup == NULL) {
+ struct cu *cu;
+
+ cu = cu__new("", pointer_size, build_id,
+ build_id_len, filename);
+ if (cu == NULL) {
+ return DWARF_CB_ABORT;
+ }
+
+ cu->uses_global_strings = true;
+ cu->elf = elf;
+ cu->dwfl = mod;
+ cu->extra_dbg_info = conf ? conf->extra_dbg_info : 0;
+ cu->has_addr_info = conf ? conf->get_addr_info : 0;
+
+ dwarf_cu__init(dcup);
+ dcup->cu = cu;
+ /* Funny hack. */
+ dcup->type_unit = dcup;
+ cu->priv = dcup;
+ cu->dfops = &dwarf__ops;
+
+ *cup = cu;
+ }
+
+ Dwarf_Die die_mem;
+ Dwarf_Die *cu_die = dwarf_offdie_types(dw, off + cuhl,
+ &die_mem);
+
+ if (die__process(cu_die, *cup) != 0)
+ return DWARF_CB_ABORT;
+
+ off = noff;
+ }
+
+ if (*cup != NULL && cu__recode_dwarf_types(*cup) != 0)
+ return DWARF_CB_ABORT;
+
+ return 0;
+}
+
static int cus__load_module(struct cus *self, struct conf_load *conf,
Dwfl_Module *mod, Dwarf *dw, Elf *elf,
const char *filename)
@@ -2041,18 +2189,37 @@
size_t cuhl;
GElf_Addr vaddr;
const unsigned char *build_id = NULL;
+ uint8_t pointer_size, offset_size;
#ifdef HAVE_DWFL_MODULE_BUILD_ID
int build_id_len = dwfl_module_build_id(mod, &build_id, &vaddr);
#else
int build_id_len = 0;
#endif
- while (dwarf_nextcu(dw, off, &noff, &cuhl, NULL, NULL, NULL) == 0) {
- Dwarf_Die die_mem, tmp;
+
+ struct cu *type_cu;
+ struct dwarf_cu type_dcu;
+ int type_lsk = LSK__KEEPIT;
+
+ int res = cus__load_debug_types(self, conf, mod, dw, elf, filename,
+ build_id, build_id_len,
+ &type_cu, &type_dcu);
+ if (res != 0) {
+ return res;
+ }
+
+ if (type_cu != NULL) {
+ type_lsk = finalize_cu(self, type_cu, &type_dcu, conf);
+ if (type_lsk == LSK__KEEPIT) {
+ cus__add(self, type_cu);
+ }
+ }
+
+ while (dwarf_nextcu(dw, off, &noff, &cuhl, NULL, &pointer_size,
+ &offset_size) == 0) {
+ Dwarf_Die die_mem;
Dwarf_Die *cu_die = dwarf_offdie(dw, off + cuhl, &die_mem);
- uint8_t pointer_size, offset_size;
- dwarf_diecu(cu_die, &tmp, &pointer_size, &offset_size);
/*
* DW_AT_name in DW_TAG_compile_unit can be NULL, first
* seen in:
@@ -2073,35 +2240,23 @@
dwarf_cu__init(&dcu);
dcu.cu = cu;
+ dcu.type_unit = type_cu ? &type_dcu : NULL;
cu->priv = &dcu;
cu->dfops = &dwarf__ops;
- if (die__process(cu_die, cu) != 0)
+ if (die__process_and_recode(cu_die, cu) != 0)
return DWARF_CB_ABORT;
- base_type_name_to_size_table__init(strings);
- cu__for_all_tags(cu, class_member__cache_byte_size, conf);
- off = noff;
- if (conf && conf->steal) {
- switch (conf->steal(cu, conf)) {
- case LSK__STOP_LOADING:
- return DWARF_CB_ABORT;
- case LSK__STOLEN:
- /*
- * The app stole this cu, possibly deleting it,
- * so forget about it:
- */
- continue;
- case LSK__KEEPIT:
- break;
- }
- }
- if (!cu->extra_dbg_info)
- obstack_free(&dcu.obstack, NULL);
+ if (finalize_cu_immediately(self, cu, &dcu, conf)
+ == LSK__STOP_LOADING)
+ return DWARF_CB_ABORT;
- cus__add(self, cu);
+ off = noff;
}
+ if (type_lsk == LSK__DELETE)
+ cu__delete(type_cu);
+
return DWARF_CB_OK;
}
@@ -2234,5 +2389,4 @@
.tag__decl_file = dwarf_tag__decl_file,
.tag__decl_line = dwarf_tag__decl_line,
.tag__orig_id = dwarf_tag__orig_id,
- .tag__orig_type = dwarf_tag__orig_type,
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwarves.h new/dwarves.h
--- old/dwarves.h 2009-12-05 22:04:30.000000000 +0100
+++ new/dwarves.h 2012-05-15 00:41:11.000000000 +0200
@@ -25,7 +25,7 @@
enum load_steal_kind {
LSK__KEEPIT,
- LSK__STOLEN,
+ LSK__DELETE,
LSK__STOP_LOADING,
};
@@ -160,8 +160,6 @@
const struct cu *cu);
unsigned long long (*tag__orig_id)(const struct tag *self,
const struct cu *cu);
- unsigned long long (*tag__orig_type)(const struct tag *self,
- const struct cu *cu);
void (*tag__free_orig_info)(struct tag *self,
struct cu *cu);
const char *(*function__name)(struct function *self,
@@ -441,14 +439,6 @@
return 0;
}
-static inline unsigned long long tag__orig_type(const struct tag *self,
- const struct cu *cu)
-{
- if (cu->dfops && cu->dfops->tag__orig_type)
- return cu->dfops->tag__orig_type(self, cu);
- return 0;
-}
-
static inline void tag__free_orig_info(struct tag *self, struct cu *cu)
{
if (cu->dfops && cu->dfops->tag__free_orig_info)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dwarves_fprintf.c new/dwarves_fprintf.c
--- old/dwarves_fprintf.c 2011-02-28 19:11:33.000000000 +0100
+++ new/dwarves_fprintf.c 2012-03-20 17:18:48.000000000 +0100
@@ -77,8 +77,10 @@
[DW_TAG_mutable_type] = "mutable_type",
[DW_TAG_condition] = "condition",
[DW_TAG_shared_type] = "shared_type",
+#ifdef STB_GNU_UNIQUE
[DW_TAG_type_unit] = "type_unit",
[DW_TAG_rvalue_reference_type] = "rvalue_reference_type",
+#endif
};
static const char *dwarf_gnu_tag_names[] = {
@@ -86,18 +88,32 @@
[DW_TAG_format_label - DW_TAG_MIPS_loop] = "format_label",
[DW_TAG_function_template - DW_TAG_MIPS_loop] = "function_template",
[DW_TAG_class_template - DW_TAG_MIPS_loop] = "class_template",
+#ifdef STB_GNU_UNIQUE
[DW_TAG_GNU_BINCL - DW_TAG_MIPS_loop] = "BINCL",
[DW_TAG_GNU_EINCL - DW_TAG_MIPS_loop] = "EINCL",
[DW_TAG_GNU_template_template_param - DW_TAG_MIPS_loop] = "template_template_param",
[DW_TAG_GNU_template_parameter_pack - DW_TAG_MIPS_loop] = "template_parameter_pack",
[DW_TAG_GNU_formal_parameter_pack - DW_TAG_MIPS_loop] = "formal_parameter_pack",
+#endif
};
const char *dwarf_tag_name(const uint32_t tag)
{
- if (tag >= DW_TAG_array_type && tag <= DW_TAG_rvalue_reference_type)
+ if (tag >= DW_TAG_array_type && tag <=
+#ifdef STB_GNU_UNIQUE
+ DW_TAG_rvalue_reference_type
+#else
+ DW_TAG_shared_type
+#endif
+ )
return dwarf_tag_names[tag];
- else if (tag >= DW_TAG_MIPS_loop && tag <= DW_TAG_GNU_formal_parameter_pack)
+ else if (tag >= DW_TAG_MIPS_loop && tag <=
+#ifdef STB_GNU_UNIQUE
+ DW_TAG_GNU_formal_parameter_pack
+#else
+ DW_TAG_class_template
+#endif
+ )
return dwarf_gnu_tag_names[tag - DW_TAG_MIPS_loop];
return "INVALID";
}
@@ -1175,7 +1191,7 @@
const uint16_t t = tself->namespace.tag.tag;
size_t printed = fprintf(fp, "%s%s%s%s%s",
cconf.prefix ?: "", cconf.prefix ? " " : "",
- ((conf->classes_as_structs ||
+ ((cconf.classes_as_structs ||
t == DW_TAG_structure_type) ? "struct" :
t == DW_TAG_class_type ? "class" :
"interface"),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pahole.c new/pahole.c
--- old/pahole.c 2009-12-06 17:13:20.000000000 +0100
+++ new/pahole.c 2012-05-15 00:41:11.000000000 +0200
@@ -1100,7 +1100,7 @@
static enum load_steal_kind pahole_stealer(struct cu *cu,
struct conf_load *conf_load __unused)
{
- int ret = LSK__STOLEN;
+ int ret = LSK__DELETE;
if (!cu__filter(cu))
goto filter_it;
@@ -1184,7 +1184,6 @@
if (first_obj_only)
ret = LSK__STOP_LOADING;
filter_it:
- cu__delete(cu);
return ret;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pdwtags.c new/pdwtags.c
--- old/pdwtags.c 2009-04-05 01:08:13.000000000 +0200
+++ new/pdwtags.c 2012-05-15 00:41:11.000000000 +0200
@@ -75,8 +75,7 @@
struct conf_load *conf_load __unused)
{
cu__emit_tags(cu);
- cu__delete(cu);
- return LSK__STOLEN;
+ return LSK__DELETE;
}
static struct conf_load pdwtags_conf_load = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regtest new/regtest
--- old/regtest 2009-09-14 22:36:35.000000000 +0200
+++ new/regtest 2012-05-15 00:39:42.000000000 +0200
@@ -240,7 +240,7 @@
do_tool_on_files(arg, dirname, fnames, True)
else:
do_tools(when)
- elif o in ('-d', 'diff'):
+ elif o in ('-d', '--diff'):
if len(args) > 0:
from_dir = os.path.join(regtest_output_dir,
"before", "pahole",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpm/SPECS/dwarves.spec new/rpm/SPECS/dwarves.spec
--- old/rpm/SPECS/dwarves.spec 2011-02-28 19:11:33.000000000 +0100
+++ new/rpm/SPECS/dwarves.spec 2012-05-30 20:34:50.000000000 +0200
@@ -2,12 +2,12 @@
%define libver 1
Name: dwarves
-Version: 1.9
+Version: 1.10
Release: 1%{?dist}
License: GPLv2
Summary: Debugging Information Manipulation Tools
Group: Development/Tools
-URL: http://oops.ghostprotocols.net:81/blog
+URL: http://acmel.wordpress.com
Source: http://fedorapeople.org/~acme/dwarves/%{name}-%{version}.tar.bz2
BuildRequires: cmake
BuildRequires: elfutils-devel >= 0.130
@@ -113,6 +113,9 @@
%{_libdir}/%{libname}_reorganize.so
%changelog
+* Wed May 30 2012 Arnaldo Carvalho de Melo