aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-04-04 15:19:59 +0000
committerTom Tromey <tromey@redhat.com>2011-04-04 15:19:59 +0000
commit00174a8637c5c42b77b190c38b1afa94c4c14517 (patch)
treee15de61016caa1be91047423ceeff6cd9031e94e
parent30cc903e7cd4678ec556d5386be55c3c726b6a27 (diff)
downloadgdb-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.
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/objfiles.c10
-rw-r--r--gdb/source.c43
-rw-r--r--gdb/symmisc.c12
-rw-r--r--gdb/symtab.h3
5 files changed, 43 insertions, 36 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e044207..3ced718 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,16 @@
2011-04-04 Tom Tromey <tromey@redhat.com>
+ * 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.
+
+2011-04-04 Tom Tromey <tromey@redhat.com>
+
* mdebugread.c (psymtab_to_symtab_1): Copy linetable to obstack.
(new_symtab): Don't set `free_code' on symtab.
(new_linetable): Properly handle size==0.
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 6c1c91a..1664e42 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -632,15 +632,13 @@ free_objfile (struct objfile *objfile)
{
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
- struct symtab *s;
- ALL_OBJFILE_SYMTABS (objfile, s)
- {
- if (s == cursal.symtab)
- clear_current_source_symtab_and_line ();
- }
+ if (cursal.symtab && cursal.symtab->objfile == objfile)
+ clear_current_source_symtab_and_line ();
}
+ forget_cached_source_info_for_objfile (objfile);
+
/* The last thing we do is free the objfile struct itself. */
xfree (objfile->name);
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;
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 5120162..117a22b 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -79,18 +79,6 @@ struct print_symbol_args
static int print_symbol (void *);
-/* Free all the storage associated with the struct symtab <- S. */
-
-void
-free_symtab (struct symtab *s)
-{
- /* Free source-related stuff. */
- if (s->line_charpos != NULL)
- xfree (s->line_charpos);
- if (s->fullname != NULL)
- xfree (s->fullname);
- xfree (s);
-}
void
print_symbol_bcache_statistics (void)
diff --git a/gdb/symtab.h b/gdb/symtab.h
index e39f049..59bbe24 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1165,8 +1165,6 @@ void maintenance_check_symtabs (char *, int);
void maintenance_print_statistics (char *, int);
-extern void free_symtab (struct symtab *);
-
/* Symbol-reading stuff in symfile.c and solib.c. */
extern void clear_solib (void);
@@ -1177,6 +1175,7 @@ extern int identify_source_line (struct symtab *, int, int, CORE_ADDR);
extern void print_source_lines (struct symtab *, int, int, int);
+extern void forget_cached_source_info_for_objfile (struct objfile *);
extern void forget_cached_source_info (void);
extern void select_source_symtab (struct symtab *);