From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.148.164]) by sourceware.org (Postfix) with ESMTPS id 51AE3389906C for ; Sat, 28 Mar 2020 19:22:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 51AE3389906C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 01ED2844822 for ; Sat, 28 Mar 2020 14:22:12 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id IH23jSoXCEfyqIH23jQdBF; Sat, 28 Mar 2020 14:22:11 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rFVk4+hhMB+dWXnBzAPLXEU5M5uvt8KWjT08eZv3+LE=; b=pfgeSEdl4lJVyF4HusSq5QnZWB cdv8+lKc3OTUlQGSl8nbohiDUZeZP6ksEaxdBPajXKvxJtBj19u/nRRKGPR9ZxW4kqffhwJ7576ST uDnHuAS9KoGZC8/GzI7iiShEs; Received: from 97-118-117-21.hlrn.qwest.net ([97.118.117.21]:55190 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jIH23-003oZR-O3; Sat, 28 Mar 2020 13:22:11 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 08/20] Remove DW_SIGNATURE Date: Sat, 28 Mar 2020 13:21:56 -0600 Message-Id: <20200328192208.11324-9-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200328192208.11324-1-tom@tromey.com> References: <20200328192208.11324-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.117.21 X-Source-L: No X-Exim-ID: 1jIH23-003oZR-O3 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-117-21.hlrn.qwest.net (bapiya.Home) [97.118.117.21]:55190 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-21.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2020 19:22:14 -0000 This removes DW_SIGNATURE in favor of methods on struct attribute. As usual, the methods check the form, which DW_SIGNATURE did not do. 2020-03-28 Tom Tromey * dwarf2/read.c (read_attribute_value, lookup_die_type) (dump_die_shallow, follow_die_sig, get_DW_AT_signature_type): Update. * dwarf2/attribute.h (struct attribute) : New methods. (DW_SIGNATURE): Remove. --- gdb/ChangeLog | 9 +++++++++ gdb/dwarf2/attribute.h | 16 +++++++++++++++- gdb/dwarf2/read.c | 10 +++++----- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h index f59986f78a3..8a7aab84eb2 100644 --- a/gdb/dwarf2/attribute.h +++ b/gdb/dwarf2/attribute.h @@ -57,6 +57,14 @@ struct attribute return u.blk; } + /* Return the signature. The attribute must have signature + form. */ + ULONGEST signature () const + { + gdb_assert (form == DW_FORM_ref_sig8); + return u.signature; + } + /* Return non-zero if ATTR's value is a section offset --- classes lineptr, loclistptr, macptr or rangelistptr --- or zero, otherwise. You may use DW_UNSND (attr) to retrieve such offsets. @@ -139,6 +147,13 @@ struct attribute u.blk = blk; } + /* Set the signature value for this attribute. */ + void set_signature (ULONGEST signature) + { + gdb_assert (form == DW_FORM_ref_sig8); + u.signature = signature; + } + ENUM_BITFIELD(dwarf_attribute) name : 16; ENUM_BITFIELD(dwarf_form) form : 15; @@ -165,6 +180,5 @@ struct attribute #define DW_UNSND(attr) ((attr)->u.unsnd) #define DW_SND(attr) ((attr)->u.snd) #define DW_ADDR(attr) ((attr)->u.addr) -#define DW_SIGNATURE(attr) ((attr)->u.signature) #endif /* GDB_DWARF2_ATTRIBUTE_H */ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 87bce7e51a9..cecdc41a0eb 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -18503,7 +18503,7 @@ read_attribute_value (const struct die_reader_specs *reader, info_ptr += 8; break; case DW_FORM_ref_sig8: - DW_SIGNATURE (attr) = read_8_bytes (abfd, info_ptr); + attr->set_signature (read_8_bytes (abfd, info_ptr)); info_ptr += 8; break; case DW_FORM_ref_udata: @@ -20693,7 +20693,7 @@ lookup_die_type (struct die_info *die, const struct attribute *attr, } else if (attr->form == DW_FORM_ref_sig8) { - ULONGEST signature = DW_SIGNATURE (attr); + ULONGEST signature = attr->signature (); return get_signatured_type (die, signature, cu); } @@ -21383,7 +21383,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) break; case DW_FORM_ref_sig8: fprintf_unfiltered (f, "signature: %s", - hex_string (DW_SIGNATURE (&die->attrs[i]))); + hex_string (die->attrs[i].signature ())); break; case DW_FORM_string: case DW_FORM_strp: @@ -21950,7 +21950,7 @@ static struct die_info * follow_die_sig (struct die_info *src_die, const struct attribute *attr, struct dwarf2_cu **ref_cu) { - ULONGEST signature = DW_SIGNATURE (attr); + ULONGEST signature = attr->signature (); struct signatured_type *sig_type; struct die_info *die; @@ -22057,7 +22057,7 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr, } else if (attr->form == DW_FORM_ref_sig8) { - return get_signatured_type (die, DW_SIGNATURE (attr), cu); + return get_signatured_type (die, attr->signature (), cu); } else { -- 2.17.2