From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway20.websitewelcome.com (gateway20.websitewelcome.com [192.185.58.11]) by sourceware.org (Postfix) with ESMTPS id 1FA143899073 for ; Sat, 28 Mar 2020 19:22:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1FA143899073 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 cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 84589400C6398 for ; Sat, 28 Mar 2020 13:06:16 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id IH24jVDwfSl8qIH24j1uFT; Sat, 28 Mar 2020 14:22:12 -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=2Kb5It2ULce3L0ZMlY4iLtIQw5gbWs90tGqZtZuagS4=; b=wLp8RbQM+lEvSz8h8h0AEfVkG9 szuTD4nzsTFtMDKJ6VU2NOzw3PjfgX4LAFkPYAzdWFe0kZR0CsezNG8UdDMgJdO2FTAsHUhqaFLWS LvLo6Z7CcMKMDZ6kJdTYTlNXh; 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 1jIH24-003oZR-I0; Sat, 28 Mar 2020 13:22:12 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 12/20] Remove DW_ADDR Date: Sat, 28 Mar 2020 13:22:00 -0600 Message-Id: <20200328192208.11324-13-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: 1jIH24-003oZR-I0 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: 15 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:15 -0000 This removes DW_ADDR in favor of accessor methods. gdb/ChangeLog 2020-03-28 Tom Tromey * dwarf2/read.c (read_attribute_reprocess, read_attribute_value) (dwarf2_const_value_attr, dump_die_shallow) (dwarf2_fetch_constant_bytes): Update. * dwarf2/attribute.h (struct attribute) : Update comment. : New method. (DW_ADDR): Remove. * dwarf2/attribute.c (attribute::form_is_ref): Update comment. --- gdb/ChangeLog | 11 +++++++++++ gdb/dwarf2/attribute.c | 3 +-- gdb/dwarf2/attribute.h | 17 ++++++++++++++--- gdb/dwarf2/read.c | 18 +++++++++++------- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c index 73c1ef9f792..94bedf6dbd3 100644 --- a/gdb/dwarf2/attribute.c +++ b/gdb/dwarf2/attribute.c @@ -128,8 +128,7 @@ attribute::form_is_constant () const } } -/* DW_ADDR is always stored already as sect_offset; despite for the forms - besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file. */ +/* See attribute.h. */ bool attribute::form_is_ref () const diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h index b96fdac5201..972beef9825 100644 --- a/gdb/dwarf2/attribute.h +++ b/gdb/dwarf2/attribute.h @@ -111,8 +111,9 @@ struct attribute bool form_is_constant () const; - /* DW_ADDR is always stored already as sect_offset; despite for the forms - besides DW_FORM_ref_addr it is stored as cu_offset in the DWARF file. */ + /* The address is always stored already as sect_offset; despite for + the forms besides DW_FORM_ref_addr it is stored as cu_offset in + the DWARF file. */ bool form_is_ref () const; @@ -202,6 +203,17 @@ struct attribute requires_reprocessing = 1; } + /* Set this attribute to an address. */ + void set_address (CORE_ADDR addr) + { + gdb_assert (form == DW_FORM_addr + || ((form == DW_FORM_addrx + || form == DW_FORM_GNU_addr_index) + && requires_reprocessing)); + u.addr = addr; + requires_reprocessing = 0; + } + ENUM_BITFIELD(dwarf_attribute) name : 15; @@ -231,6 +243,5 @@ struct attribute /* Get at parts of an attribute structure. */ #define DW_UNSND(attr) ((attr)->u.unsnd) -#define DW_ADDR(attr) ((attr)->u.addr) #endif /* GDB_DWARF2_ATTRIBUTE_H */ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index a5c2c52375d..b010c9c3b01 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -18314,7 +18314,8 @@ read_attribute_reprocess (const struct die_reader_specs *reader, { case DW_FORM_addrx: case DW_FORM_GNU_addr_index: - DW_ADDR (attr) = read_addr_index (cu, attr->get_unsigned_reprocess ()); + attr->set_address (read_addr_index (cu, + attr->get_unsigned_reprocess ())); break; case DW_FORM_strx: case DW_FORM_strx1: @@ -18373,9 +18374,12 @@ read_attribute_value (const struct die_reader_specs *reader, info_ptr += bytes_read; break; case DW_FORM_addr: - DW_ADDR (attr) = cu->header.read_address (abfd, info_ptr, &bytes_read); - DW_ADDR (attr) = gdbarch_adjust_dwarf2_addr (gdbarch, DW_ADDR (attr)); - info_ptr += bytes_read; + { + CORE_ADDR addr = cu->header.read_address (abfd, info_ptr, &bytes_read); + addr = gdbarch_adjust_dwarf2_addr (gdbarch, addr); + attr->set_address (addr); + info_ptr += bytes_read; + } break; case DW_FORM_block2: blk = dwarf_alloc_block (cu); @@ -20468,7 +20472,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type, data[0] = DW_OP_addr; store_unsigned_integer (&data[1], cu_header->addr_size, - byte_order, DW_ADDR (attr)); + byte_order, attr->address ()); data[cu_header->addr_size + 1] = DW_OP_stack_value; } break; @@ -21342,7 +21346,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) case DW_FORM_addrx: case DW_FORM_GNU_addr_index: fprintf_unfiltered (f, "address: "); - fputs_filtered (hex_string (DW_ADDR (&die->attrs[i])), f); + fputs_filtered (hex_string (die->attrs[i].address ()), f); break; case DW_FORM_block2: case DW_FORM_block4: @@ -21783,7 +21787,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off, *len = cu->header.addr_size; tem = (gdb_byte *) obstack_alloc (obstack, *len); - store_unsigned_integer (tem, *len, byte_order, DW_ADDR (attr)); + store_unsigned_integer (tem, *len, byte_order, attr->address ()); result = tem; } break; -- 2.17.2