From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gproxy1-pub.mail.unifiedlayer.com (gproxy1-pub.mail.unifiedlayer.com [69.89.25.95]) by sourceware.org (Postfix) with ESMTPS id D93C53858D37 for ; Tue, 21 Feb 2023 22:25:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D93C53858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw11.mail.unifiedlayer.com (unknown [10.0.90.126]) by progateway3.mail.pro1.eigbox.com (Postfix) with ESMTP id 49C4F100417D6 for ; Tue, 21 Feb 2023 22:25:34 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id Ub4op0Wab8JGYUb4opNFa2; Tue, 21 Feb 2023 22:25:34 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=BJ92EHcG c=1 sm=1 tr=0 ts=63f544de a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=m04uMKEZRckA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=KVBbw0WaikJrjsYlrvIA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=o+UW68MYIptocYiUncaTOdM96fdNrCQrnorNMAt8ESc=; b=qkqTB7Hp5+8Dsp360yqb+EoH69 2ZfBY9o3cfo2iSMXHkeIjIDSHKqIS+6N2TPYML30j1741KJLHS6vFIKzKL4553jTrPK1TirUqcVJv pKwW3eN+LTjH/ORk7WNDpgpzo; Received: from 75-166-130-93.hlrn.qwest.net ([75.166.130.93]:42920 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pUb4n-000PBc-SS; Tue, 21 Feb 2023 15:25:33 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Merge forget_cached_source_info_for_objfile into objfile method Date: Tue, 21 Feb 2023 15:25:24 -0700 Message-Id: <20230221222524.403820-1-tom@tromey.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.130.93 X-Source-L: No X-Exim-ID: 1pUb4n-000PBc-SS X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-130-93.hlrn.qwest.net (localhost.localdomain) [75.166.130.93]:42920 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3026.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: forget_cached_source_info_for_objfile does some objfile-specific work and then calls objfile::forget_cached_source_info. It seems better to me to just have the method do all the work. --- gdb/objfiles.c | 2 +- gdb/source.c | 24 +----------------------- gdb/source.h | 4 ---- gdb/symfile-debug.c | 12 ++++++++++++ 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index ed29131d528..8e7be8e2e25 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -534,7 +534,7 @@ objfile::~objfile () /* It still may reference data modules have associated with the objfile and the symbol file data. */ - forget_cached_source_info_for_objfile (this); + forget_cached_source_info (); breakpoint_free_objfile (this); btrace_free_objfile (this); diff --git a/gdb/source.c b/gdb/source.c index ca0e8d51fbd..faf0be6fe5a 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -420,34 +420,12 @@ show_directories_command (struct ui_file *file, int from_tty, /* See source.h. */ -void -forget_cached_source_info_for_objfile (struct objfile *objfile) -{ - for (compunit_symtab *cu : objfile->compunits ()) - { - for (symtab *s : cu->filetabs ()) - { - if (s->fullname != NULL) - { - xfree (s->fullname); - s->fullname = NULL; - } - } - } - - objfile->forget_cached_source_info (); -} - -/* See source.h. */ - void forget_cached_source_info (void) { for (struct program_space *pspace : program_spaces) for (objfile *objfile : pspace->objfiles ()) - { - forget_cached_source_info_for_objfile (objfile); - } + objfile->forget_cached_source_info (); g_source_cache.clear (); last_source_visited = NULL; diff --git a/gdb/source.h b/gdb/source.h index dd6f58c579c..d3e612ceaa1 100644 --- a/gdb/source.h +++ b/gdb/source.h @@ -197,10 +197,6 @@ class source_lines_range extern void print_source_lines (struct symtab *s, source_lines_range r, print_source_lines_flags flags); -/* Forget line positions and file names for the symtabs in a - particular objfile. */ -extern void forget_cached_source_info_for_objfile (struct objfile *); - /* Forget what we learned about line positions in source files, and which directories contain them; must check again now since files may be found in a different directory now. */ diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index efc6bcdf2bd..9db5c47a8ce 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -155,6 +155,18 @@ objfile::forget_cached_source_info () gdb_printf (gdb_stdlog, "qf->forget_cached_source_info (%s)\n", objfile_debug_name (this)); + for (compunit_symtab *cu : compunits ()) + { + for (symtab *s : cu->filetabs ()) + { + if (s->fullname != NULL) + { + xfree (s->fullname); + s->fullname = NULL; + } + } + } + for (const auto &iter : qf_require_partial_symbols ()) iter->forget_cached_source_info (this); } -- 2.39.1