From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway21.websitewelcome.com (gateway21.websitewelcome.com [192.185.46.113]) by sourceware.org (Postfix) with ESMTPS id 9F7CF385E026 for ; Sun, 22 Mar 2020 18:45:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9F7CF385E026 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 cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 4FD43400C45EC for ; Sun, 22 Mar 2020 13:45:28 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id G5bEjWklL8vkBG5bEjNGSF; Sun, 22 Mar 2020 13:45:28 -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=meEjquBi63IEvAgefbyWvGy5gfdGeSBhipjK6OWyt2U=; b=JT3F8jppXf1e46o082JQctSdEC kEmXJRyQbRCi1n3ftYs5c4GAe7+R9WURZKKOwBkV+6DYgJU2rBudXfxRWwIWG0U8u4avlDiWCe5Qo 457dog4kln7uVdLC+VlLCLDpa; Received: from 97-118-117-21.hlrn.qwest.net ([97.118.117.21]:48304 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jG5bE-000LNS-4C; Sun, 22 Mar 2020 12:45:28 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 13/22] Convert read_indirect_line_string to a method Date: Sun, 22 Mar 2020 12:45:14 -0600 Message-Id: <20200322184523.28959-14-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200322184523.28959-1-tom@tromey.com> References: <20200322184523.28959-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: 1jG5bE-000LNS-4C X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-117-21.hlrn.qwest.net (bapiya.Home) [97.118.117.21]:48304 X-Source-Auth: tom+tromey.com X-Email-Count: 14 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-23.5 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_MSPIKE_BL, RCVD_IN_MSPIKE_L3, 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: Sun, 22 Mar 2020 18:45:31 -0000 This changes read_indirect_line_string to be a method on dwarf2_per_objfile. This makes it a bit simpler to share between files. gdb/ChangeLog 2020-03-22 Tom Tromey * dwarf2/read.h (struct dwarf2_per_objfile) : Declare method. * dwarf2/read.c (read_attribute_value): Update. (dwarf2_per_objfile::read_line_string): Rename from read_indirect_line_string. (read_formatted_entries): Update. --- gdb/ChangeLog | 9 +++++++++ gdb/dwarf2/read.c | 28 +++++++++++----------------- gdb/dwarf2/read.h | 8 ++++++++ 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 13fa63bff57..001030b31c0 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1251,10 +1251,6 @@ static const char *read_indirect_string (struct dwarf2_per_objfile *dwarf2_per_objfile, bfd *, const gdb_byte *, const struct comp_unit_head *, unsigned int *); -static const char *read_indirect_line_string - (struct dwarf2_per_objfile *dwarf2_per_objfile, bfd *, const gdb_byte *, - const struct comp_unit_head *, unsigned int *); - static const char *read_indirect_string_at_offset (struct dwarf2_per_objfile *dwarf2_per_objfile, LONGEST str_offset); @@ -18550,9 +18546,9 @@ read_attribute_value (const struct die_reader_specs *reader, case DW_FORM_line_strp: if (!cu->per_cu->is_dwz) { - DW_STRING (attr) = read_indirect_line_string (dwarf2_per_objfile, - abfd, info_ptr, - cu_header, &bytes_read); + DW_STRING (attr) + = dwarf2_per_objfile->read_line_string (info_ptr, cu_header, + &bytes_read); DW_STRING_IS_CANONICAL (attr) = 0; info_ptr += bytes_read; break; @@ -18790,17 +18786,15 @@ read_indirect_string (struct dwarf2_per_objfile *dwarf2_per_objfile, bfd *abfd, BUF is assumed to be in a compilation unit described by CU_HEADER. Return *BYTES_READ_PTR count of bytes read from BUF. */ -static const char * -read_indirect_line_string (struct dwarf2_per_objfile *dwarf2_per_objfile, - bfd *abfd, const gdb_byte *buf, +const char * +dwarf2_per_objfile::read_line_string (const gdb_byte *buf, const struct comp_unit_head *cu_header, unsigned int *bytes_read_ptr) { + bfd *abfd = objfile->obfd; LONGEST str_offset = cu_header->read_offset (abfd, buf, bytes_read_ptr); - return dwarf2_per_objfile->line_str.read_string (dwarf2_per_objfile->objfile, - str_offset, - "DW_FORM_line_strp"); + return line_str.read_string (objfile, str_offset, "DW_FORM_line_strp"); } /* Given index ADDR_INDEX in .debug_addr, fetch the value. @@ -19284,10 +19278,10 @@ read_formatted_entries (struct dwarf2_per_objfile *dwarf2_per_objfile, break; case DW_FORM_line_strp: - string.emplace (read_indirect_line_string (dwarf2_per_objfile, - abfd, buf, - cu_header, - &bytes_read)); + string.emplace + (dwarf2_per_objfile->read_line_string (buf, + cu_header, + &bytes_read)); buf += bytes_read; break; diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index c5a8ecf8a6a..039113f87e9 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -110,6 +110,14 @@ struct dwarf2_per_objfile /* Free all cached compilation units. */ void free_cached_comp_units (); + + /* Return pointer to string at .debug_line_str offset as read from BUF. + BUF is assumed to be in a compilation unit described by CU_HEADER. + Return *BYTES_READ_PTR count of bytes read from BUF. */ + const char *read_line_string (const gdb_byte *buf, + const struct comp_unit_head *cu_header, + unsigned int *bytes_read_ptr); + private: /* This function is mapped across the sections and remembers the offset and size of each of the debugging sections we are -- 2.17.2