diff options
author | Tom Tromey <tromey@redhat.com> | 2011-04-04 15:19:59 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2011-04-04 15:19:59 +0000 |
commit | 00174a8637c5c42b77b190c38b1afa94c4c14517 (patch) | |
tree | e15de61016caa1be91047423ceeff6cd9031e94e /gdb/source.c | |
parent | 30cc903e7cd4678ec556d5386be55c3c726b6a27 (diff) | |
download | gdb-00174a8637c5c42b77b190c38b1afa94c4c14517.zip gdb-00174a8637c5c42b77b190c38b1afa94c4c14517.tar.gz gdb-00174a8637c5c42b77b190c38b1afa94c4c14517.tar.bz2 |
* symtab.h (free_symtab): Remove.
(forget_cached_source_info_for_objfile): Declare.
* symmisc.c (free_symtab): Remove.
* source.c (forget_cached_source_info_for_objfile): New function.
(forget_cached_source_info): Use it.
* objfiles.c (free_objfile): Simplify check before calling
clear_current_source_symtab_and_line. Call
forget_cached_source_info_for_objfile.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/gdb/source.c b/gdb/source.c index 81e4b4f..70890e1 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -335,6 +335,32 @@ show_directories_command (struct ui_file *file, int from_tty, show_directories_1 (NULL, from_tty); } +/* Forget line positions and file names for the symtabs in a + particular objfile. */ + +void +forget_cached_source_info_for_objfile (struct objfile *objfile) +{ + struct symtab *s; + + ALL_OBJFILE_SYMTABS (objfile, s) + { + if (s->line_charpos != NULL) + { + xfree (s->line_charpos); + s->line_charpos = NULL; + } + if (s->fullname != NULL) + { + xfree (s->fullname); + s->fullname = NULL; + } + + if (objfile->sf) + objfile->sf->qf->forget_cached_source_info (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. */ @@ -349,22 +375,7 @@ forget_cached_source_info (void) ALL_PSPACES (pspace) ALL_PSPACE_OBJFILES (pspace, objfile) { - for (s = objfile->symtabs; s != NULL; s = s->next) - { - if (s->line_charpos != NULL) - { - xfree (s->line_charpos); - s->line_charpos = NULL; - } - if (s->fullname != NULL) - { - xfree (s->fullname); - s->fullname = NULL; - } - } - - if (objfile->sf) - objfile->sf->qf->forget_cached_source_info (objfile); + forget_cached_source_info_for_objfile (objfile); } last_source_visited = NULL; |