aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-05-22 09:08:49 -0400
committerTom Tromey <tromey@adacore.com>2019-05-29 09:57:47 -0600
commitfa9c3fa035433debc24503e32c59688650ffcdbb (patch)
tree748962869050a8b22eac312e0c23f8d19c79067c
parent4330d61dfb05d77fd925efdca45091f12e3a6266 (diff)
downloadgdb-fa9c3fa035433debc24503e32c59688650ffcdbb.zip
gdb-fa9c3fa035433debc24503e32c59688650ffcdbb.tar.gz
gdb-fa9c3fa035433debc24503e32c59688650ffcdbb.tar.bz2
Make some DWARF complaints clearer
I noticed that the complaint in partial_die_parent_scope was not using dwarf_tag_name, so I changed that. Then I noticed that dwarf_tag_name does not show the numeric value for an unrecognized tag, so I changed that function and all the related functions to do so. gdb/ChangeLog 2019-05-29 Tom Tromey <tromey@adacore.com> * dwarf2read.c (partial_die_parent_scope): Call dwarf_tag_name. (dwarf_unknown): New function. (dwarf_tag_name, dwarf_attr_name, dwarf_form_name) (dwarf_type_encoding_name): Use dwarf_unknown.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/dwarf2read.c25
2 files changed, 26 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 82655ea..37c0069 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2019-05-29 Tom Tromey <tromey@adacore.com>
+ * dwarf2read.c (partial_die_parent_scope): Call dwarf_tag_name.
+ (dwarf_unknown): New function.
+ (dwarf_tag_name, dwarf_attr_name, dwarf_form_name)
+ (dwarf_type_encoding_name): Use dwarf_unknown.
+
+2019-05-29 Tom Tromey <tromey@adacore.com>
+
PR c++/20020:
* cp-valprint.c (cp_print_value_fields): Call
cp_print_static_field inside "try".
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f48b931..f47d130 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8831,8 +8831,9 @@ partial_die_parent_scope (struct partial_die_info *pdi,
/* FIXME drow/2004-04-01: What should we be doing with
function-local names? For partial symbols, we should probably be
ignoring them. */
- complaint (_("unhandled containing DIE tag %d for DIE at %s"),
- parent->tag, sect_offset_str (pdi->sect_off));
+ complaint (_("unhandled containing DIE tag %s for DIE at %s"),
+ dwarf_tag_name (parent->tag),
+ sect_offset_str (pdi->sect_off));
parent->scope = grandparent_scope;
}
@@ -22829,6 +22830,18 @@ dwarf2_extension (struct die_info *die, struct dwarf2_cu **ext_cu)
return follow_die_ref (die, attr, ext_cu);
}
+/* A convenience function that returns an "unknown" DWARF name,
+ including the value of V. STR is the name of the entity being
+ printed, e.g., "TAG". */
+
+static const char *
+dwarf_unknown (const char *str, unsigned v)
+{
+ char *cell = get_print_cell ();
+ xsnprintf (cell, PRINT_CELL_SIZE, "DW_%s_<unknown: %u>", str, v);
+ return cell;
+}
+
/* Convert a DIE tag into its string name. */
static const char *
@@ -22837,7 +22850,7 @@ dwarf_tag_name (unsigned tag)
const char *name = get_DW_TAG_name (tag);
if (name == NULL)
- return "DW_TAG_<unknown>";
+ return dwarf_unknown ("TAG", tag);
return name;
}
@@ -22860,7 +22873,7 @@ dwarf_attr_name (unsigned attr)
name = get_DW_AT_name (attr);
if (name == NULL)
- return "DW_AT_<unknown>";
+ return dwarf_unknown ("AT", attr);
return name;
}
@@ -22873,7 +22886,7 @@ dwarf_form_name (unsigned form)
const char *name = get_DW_FORM_name (form);
if (name == NULL)
- return "DW_FORM_<unknown>";
+ return dwarf_unknown ("FORM", form);
return name;
}
@@ -22895,7 +22908,7 @@ dwarf_type_encoding_name (unsigned enc)
const char *name = get_DW_ATE_name (enc);
if (name == NULL)
- return "DW_ATE_<unknown>";
+ return dwarf_unknown ("ATE", enc);
return name;
}