From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8L6WLdMIjl9yRwAAWB0awg (envelope-from ) for ; Mon, 19 Oct 2020 17:44:51 -0400 Received: by simark.ca (Postfix, from userid 112) id B89C31EFC9; Mon, 19 Oct 2020 17:44:51 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C12A91EFBD for ; Mon, 19 Oct 2020 17:44:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACAC5388EC07; Mon, 19 Oct 2020 21:44:42 +0000 (GMT) Received: from gateway32.websitewelcome.com (gateway32.websitewelcome.com [192.185.145.111]) by sourceware.org (Postfix) with ESMTPS id 9F2A53844046 for ; Mon, 19 Oct 2020 21:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9F2A53844046 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 cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 3EFA05E5FA for ; Mon, 19 Oct 2020 16:44:36 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id UcxIkUxDDBD8bUcxIkRuBt; Mon, 19 Oct 2020 16:44:36 -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=UpGKv2l1sUvN5OkjO35QhmbkwQvnFKSNb4K9GppgHt4=; b=nqq3d+dXpMajySkWew0n5CGMcf eM5SZfJR98RbwLMIKxZI5NjkxL0xDjeilBn/MjQMGzq18bmhuzNNZgqsVV11XNLHfjs/kY9kYua/J k7KvsoV1CEs7D9gSlcObbVGp6; Received: from 75-166-102-113.hlrn.qwest.net ([75.166.102.113]:45712 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kUcxH-004Oci-VN; Mon, 19 Oct 2020 15:44:36 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH v2 14/16] Change add_target_sections_of_objfile to method on program_space Date: Mon, 19 Oct 2020 15:44:27 -0600 Message-Id: <20201019214429.13815-15-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20201019214429.13815-1-tom@tromey.com> References: <20201019214429.13815-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: 75.166.102.113 X-Source-L: No X-Exim-ID: 1kUcxH-004Oci-VN X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-102-113.hlrn.qwest.net (bapiya.Home) [75.166.102.113]:45712 X-Source-Auth: tom+tromey.com X-Email-Count: 15 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" This changes add_target_sections_of_objfile to be a method on program_space. It is renamed to be another overload of add_target_sections, because they are semantically equivalent in a sense. gdb/ChangeLog 2020-10-19 Tom Tromey * symfile.c (add_symbol_file_command): Update. * exec.c (program_space::add_target_sections): Rename. * symfile-mem.c (symbol_file_add_from_memory): Update. * progspace.h (struct program_space) : Declare new overload. * exec.h (add_target_sections_of_objfile): Don't declare. --- gdb/ChangeLog | 9 +++++++++ gdb/exec.c | 9 ++++----- gdb/exec.h | 5 ----- gdb/progspace.h | 4 ++++ gdb/symfile-mem.c | 2 +- gdb/symfile.c | 2 +- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/gdb/exec.c b/gdb/exec.c index 552730b4336..3736c3c9e67 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -626,9 +626,8 @@ program_space::add_target_sections (void *owner, /* Add the sections of OBJFILE to the current set of target sections. */ void -add_target_sections_of_objfile (struct objfile *objfile) +program_space::add_target_sections (struct objfile *objfile) { - target_section_table *table = ¤t_program_space->target_sections; struct obj_section *osect; gdb_assert (objfile != nullptr); @@ -639,9 +638,9 @@ add_target_sections_of_objfile (struct objfile *objfile) if (bfd_section_size (osect->the_bfd_section) == 0) continue; - table->emplace_back (obj_section_addr (osect), - obj_section_endaddr (osect), - osect->the_bfd_section, (void *) objfile); + target_sections.emplace_back (obj_section_addr (osect), + obj_section_endaddr (osect), + osect->the_bfd_section, (void *) objfile); } } diff --git a/gdb/exec.h b/gdb/exec.h index 3aa248527c9..4ddc6850be1 100644 --- a/gdb/exec.h +++ b/gdb/exec.h @@ -92,11 +92,6 @@ extern enum target_xfer_status /* Set the loaded address of a section. */ extern void exec_set_section_address (const char *, int, CORE_ADDR); -/* Add the sections of OBJFILE to the current set of target sections. - * OBJFILE owns the new target sections. */ - -extern void add_target_sections_of_objfile (struct objfile *objfile); - /* Prints info about all sections defined in the TABLE. ABFD is special cased --- it's filename is omitted; if it is the executable file, its entry point is printed. */ diff --git a/gdb/progspace.h b/gdb/progspace.h index 92a7942c560..c141731fa94 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -305,6 +305,10 @@ struct program_space void add_target_sections (void *owner, const target_section_table §ions); + /* Add the sections of OBJFILE to the current set of target + sections. They are given OBJFILE as the "owner". */ + void add_target_sections (struct objfile *objfile); + /* Unique ID number. */ int num = 0; diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index 6621bba7138..7e110173ad2 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -121,7 +121,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, objf = symbol_file_add_from_bfd (nbfd, bfd_get_filename (nbfd), add_flags, &sai, OBJF_SHARED, NULL); - add_target_sections_of_objfile (objf); + current_program_space->add_target_sections (objf); /* This might change our ideas about frames already looked at. */ reinit_frame_cache (); diff --git a/gdb/symfile.c b/gdb/symfile.c index 504132754b0..58ed660e52a 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2323,7 +2323,7 @@ add_symbol_file_command (const char *args, int from_tty) if (seen_offset) set_objfile_default_section_offset (objf, section_addrs, offset); - add_target_sections_of_objfile (objf); + current_program_space->add_target_sections (objf); /* Getting new symbols may change our opinion about what is frameless. */ -- 2.17.2