From patchwork Wed May 22 13:10:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32794 Received: (qmail 111497 invoked by alias); 22 May 2019 13:10:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 110929 invoked by uid 89); 22 May 2019 13:10:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 May 2019 13:10:57 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 0AEE311654C; Wed, 22 May 2019 09:10:56 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dToiQ33PsMrb; Wed, 22 May 2019 09:10:55 -0400 (EDT) Received: from murgatroyd.gnat.com (unknown [IPv6:2620:20:4000:40:60aa:25d0:ef41:54b6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id EB785116533; Wed, 22 May 2019 09:10:55 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Make some DWARF complaints clearer Date: Wed, 22 May 2019 09:10:51 -0400 Message-Id: <20190522131051.13568-1-tromey@adacore.com> MIME-Version: 1.0 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-22 Tom Tromey * 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. --- gdb/ChangeLog | 7 +++++++ gdb/dwarf2read.c | 25 +++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index f48b931a3f3..f47d130fa22 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_", 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_"; + 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_"; + 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_"; + 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_"; + return dwarf_unknown ("ATE", enc); return name; }