* [PATCH] Merge forget_cached_source_info_for_objfile into objfile method
@ 2023-02-21 22:25 Tom Tromey
2023-03-07 21:46 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2023-02-21 22:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Merge forget_cached_source_info_for_objfile into objfile method
2023-02-21 22:25 [PATCH] Merge forget_cached_source_info_for_objfile into objfile method Tom Tromey
@ 2023-03-07 21:46 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2023-03-07 21:46 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
Tom> forget_cached_source_info_for_objfile does some objfile-specific work
Tom> and then calls objfile::forget_cached_source_info. It seems better to
Tom> me to just have the method do all the work.
I'm going to check this in now.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-07 21:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 22:25 [PATCH] Merge forget_cached_source_info_for_objfile into objfile method Tom Tromey
2023-03-07 21:46 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).