From f59be2ed3946b69a969c65dd7093b4e865bba003 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 5 Jun 2024 09:06:30 -0600 Subject: Add compunit_symtab::forget_cached_source_info It seemed cleaner to me for compunit_symtab to have a forget_cached_source_info method, then for the objfile to know how to do this. --- gdb/symfile-debug.c | 5 +---- gdb/symtab.c | 9 +++++++++ gdb/symtab.h | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'gdb') diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 3912889..3a223d0 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -154,10 +154,7 @@ objfile::forget_cached_source_info () objfile_debug_name (this)); for (compunit_symtab *cu : compunits ()) - { - for (symtab *s : cu->filetabs ()) - s->release_fullname (); - } + cu->forget_cached_source_info (); for (const auto &iter : qf) iter->forget_cached_source_info (this); diff --git a/gdb/symtab.c b/gdb/symtab.c index 4888ebc..39a6915 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -485,6 +485,15 @@ compunit_symtab::language () const return symtab->language (); } +/* See symtab.h. */ + +void +compunit_symtab::forget_cached_source_info () +{ + for (symtab *s : filetabs ()) + s->release_fullname (); +} + /* The relocated address of the minimal symbol, using the section offsets from OBJFILE. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 19bb697..d0b599f 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1965,6 +1965,9 @@ struct compunit_symtab /* Return the language of this compunit_symtab. */ enum language language () const; + /* Clear any cached source file names. */ + void forget_cached_source_info (); + /* Unordered chain of all compunit symtabs of this objfile. */ struct compunit_symtab *next; -- cgit v1.1