From: Tom Tromey Date: Wed, 5 Jun 2024 15:06:30 +0000 (-0600) Subject: Add compunit_symtab::forget_cached_source_info X-Git-Tag: binutils-2_43~302 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f59be2ed3946b69a969c65dd7093b4e865bba003;p=thirdparty%2Fbinutils-gdb.git 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. --- diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 39128894a5c..3a223d0789e 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 4888ebcbf68..39a6915ee76 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 19bb697a5a1..d0b599fc58e 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;