From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.148.231]) by sourceware.org (Postfix) with ESMTPS id 1B9C0385E01E for ; Sun, 22 Mar 2020 18:45:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1B9C0385E01E 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 cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway34.websitewelcome.com (Postfix) with ESMTP id BCBA312CF535 for ; Sun, 22 Mar 2020 13:45:26 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id G5bCjxjTl1s2xG5bCjfayV; Sun, 22 Mar 2020 13:45:26 -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=Yg7O1/hVYteg12ajBI76Vr6wiyxCZgl6ZbRZLzQCRSc=; b=pr3kOEMIDAcoqgD98XbF90dyTI MeagX2hh3XeMhcQWJPN+MJknJtwTvM1xBtkgeF5ZdXbE+C8kvT9CWUK+nSAmjTyFwN2gYt2OfQgHC dLGnGppzrnes1Xp4L7RAVQvx0; 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 1jG5bC-000LNS-Hb; Sun, 22 Mar 2020 12:45:26 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 06/22] Convert dwarf2_section_buffer_overflow_complaint to a method Date: Sun, 22 Mar 2020 12:45:07 -0600 Message-Id: <20200322184523.28959-7-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: 1jG5bC-000LNS-Hb 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: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-24.0 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: Sun, 22 Mar 2020 18:45:29 -0000 This changes dwarf2_section_buffer_overflow_complaint to be a method on dwarf2_section_info. gdb/ChangeLog 2020-03-22 Tom Tromey * dwarf2/section.h (struct dwarf2_section_info) : Declare. (dwarf2_section_buffer_overflow_complaint): Don't declare. * dwarf2/section.c (dwarf2_section_info::overflow_complaint): Rename from dwarf2_section_buffer_overflow_complaint. * dwarf2/read.c (skip_one_die, partial_die_info::read) (skip_form_bytes, dwarf_decode_macro_bytes): Update. --- gdb/ChangeLog | 10 ++++++++++ gdb/dwarf2/read.c | 10 +++++----- gdb/dwarf2/section.c | 5 ++--- gdb/dwarf2/section.h | 7 ++++--- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2b4f693c38a..52a53428d5b 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8595,7 +8595,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr, if (sibling_ptr < info_ptr) complaint (_("DW_AT_sibling points backwards")); else if (sibling_ptr > reader->buffer_end) - dwarf2_section_buffer_overflow_complaint (reader->die_section); + reader->die_section->overflow_complaint (); else return sibling_ptr; } @@ -18079,7 +18079,7 @@ partial_die_info::read (const struct die_reader_specs *reader, if (sibling_ptr < info_ptr) complaint (_("DW_AT_sibling points backwards")); else if (sibling_ptr > reader->buffer_end) - dwarf2_section_buffer_overflow_complaint (reader->die_section); + reader->die_section->overflow_complaint (); else sibling = sibling_ptr; } @@ -23329,7 +23329,7 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end, bytes = gdb_skip_leb128 (bytes, buffer_end); if (bytes == NULL) { - dwarf2_section_buffer_overflow_complaint (section); + section->overflow_complaint (); return NULL; } break; @@ -23492,7 +23492,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile, /* Do we at least have room for a macinfo type byte? */ if (mac_ptr >= mac_end) { - dwarf2_section_buffer_overflow_complaint (section); + section->overflow_complaint (); break; } @@ -23645,7 +23645,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile, /* Do we at least have room for a macinfo type byte? */ if (mac_ptr >= mac_end) { - dwarf2_section_buffer_overflow_complaint (section); + section->overflow_complaint (); return; } diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c index 31cb8b9b2e7..9714368a5d2 100644 --- a/gdb/dwarf2/section.c +++ b/gdb/dwarf2/section.c @@ -31,12 +31,11 @@ #include "complaints.h" void -dwarf2_section_buffer_overflow_complaint (struct dwarf2_section_info *section) +dwarf2_section_info::overflow_complaint () const { complaint (_("debug info runs off end of %s section" " [in module %s]"), - section->get_name (), - section->get_file_name ()); + get_name (), get_file_name ()); } struct dwarf2_section_info * diff --git a/gdb/dwarf2/section.h b/gdb/dwarf2/section.h index f4ac9af311e..555efecacd6 100644 --- a/gdb/dwarf2/section.h +++ b/gdb/dwarf2/section.h @@ -94,6 +94,10 @@ struct dwarf2_section_info return size; } + /* Issue a complaint that something was outside the bounds of this + buffer. */ + void overflow_complaint () const; + union { /* If this is a real section, the bfd section. */ @@ -116,7 +120,4 @@ struct dwarf2_section_info bool is_virtual; }; -extern void dwarf2_section_buffer_overflow_complaint - (struct dwarf2_section_info *section); - #endif /* GDB_DWARF2_SECTION_H */ -- 2.17.2