aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-01-19 09:47:47 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-01-19 09:47:47 +0000
commitb74845da582460c3fb05bef68c0c1a1ea38c2e7d (patch)
tree5e125c4a0318a0bcd0b303cc6df8c6f9bf36ad80
parent65c0609283d2b4eb4da829c7107da9e6d8d68654 (diff)
downloadgdb-b74845da582460c3fb05bef68c0c1a1ea38c2e7d.zip
gdb-b74845da582460c3fb05bef68c0c1a1ea38c2e7d.tar.gz
gdb-b74845da582460c3fb05bef68c0c1a1ea38c2e7d.tar.bz2
Delete free_named_symtabs and associated cleanup.
* symfile.h (free_named_symtabs): Delete declaration. * symfile.c: Remove some commented out code (clear_symtab_users_once). (cashier_psymtab): Comment function out. Delete declaration. (free_named_symtabs): Delete. * coffread.c (coff_end_symtab): Remove call to free_named_symtabs. * dbxread.c (end_psymtab): Likewise. * dwarf2read.c (process_psymtab_comp_unit): Ditto. * exec.c (exec_close_1): Ditto. * xcoffread.c (xcoff_end_psymtab): Likewise.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/coffread.c3
-rw-r--r--gdb/dbxread.c5
-rw-r--r--gdb/dwarf2read.c6
-rw-r--r--gdb/exec.c6
-rw-r--r--gdb/symfile.c207
-rw-r--r--gdb/symfile.h2
-rw-r--r--gdb/xcoffread.c5
8 files changed, 14 insertions, 234 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e4ad91c..c3f2df8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
2010-01-19 Joel Brobecker <brobecker@adacore.com>
+ Delete free_named_symtabs and associated cleanup.
+ * symfile.h (free_named_symtabs): Delete declaration.
+ * symfile.c: Remove some commented out code (clear_symtab_users_once).
+ (cashier_psymtab): Comment function out.
+ Delete declaration.
+ (free_named_symtabs): Delete.
+ * coffread.c (coff_end_symtab): Remove call to free_named_symtabs.
+ * dbxread.c (end_psymtab): Likewise.
+ * dwarf2read.c (process_psymtab_comp_unit): Ditto.
+ * exec.c (exec_close_1): Ditto.
+ * xcoffread.c (xcoff_end_psymtab): Likewise.
+
+2010-01-19 Joel Brobecker <brobecker@adacore.com>
+
* stack.c (print_block_frame_labels): Comment function out.
2010-01-19 Joel Brobecker <brobecker@adacore.com>
diff --git a/gdb/coffread.c b/gdb/coffread.c
index eca6618..8e5dca9 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -402,9 +402,6 @@ coff_end_symtab (struct objfile *objfile)
symtab = end_symtab (current_source_end_addr, objfile, SECT_OFF_TEXT (objfile));
- if (symtab != NULL)
- free_named_symtabs (symtab->filename);
-
/* Reinitialize for beginning of new file. */
last_source_file = NULL;
}
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 816a355..6ef6767 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2360,11 +2360,6 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
sort_pst_symbols (pst);
- /* If there is already a psymtab or symtab for a file of this name, remove it.
- (If there is a symtab, more drastic things also happen.)
- This happens in VxWorks. */
- free_named_symtabs (pst->filename);
-
if (num_includes == 0
&& number_dependencies == 0
&& pst->n_global_syms == 0
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 243859c..4903ac4 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2016,12 +2016,6 @@ process_psymtab_comp_unit (struct objfile *objfile,
(objfile->static_psymbols.list + pst->statics_offset);
sort_pst_symbols (pst);
- /* If there is already a psymtab or symtab for a file of this
- name, remove it. (If there is a symtab, more drastic things
- also happen.) This happens in VxWorks. */
- if (! this_cu->from_debug_types)
- free_named_symtabs (pst->filename);
-
info_ptr = (beg_of_comp_unit + cu.header.length
+ cu.header.initial_length_size);
diff --git a/gdb/exec.c b/gdb/exec.c
index c0b4f12..4ced968 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -145,12 +145,6 @@ exec_close_1 (int quitting)
warning (_("cannot close \"%s\": %s"),
vp->name, bfd_errmsg (bfd_get_error ()));
- /* FIXME: This routine is #if 0'd in symfile.c. What should we
- be doing here? Should we just free everything in
- vp->objfile->symtabs? Should free_objfile do that?
- FIXME-as-well: free_objfile already free'd vp->name, so it isn't
- valid here. */
- free_named_symtabs (vp->name);
xfree (vp);
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 89cc07c..bc52406 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -97,8 +97,6 @@ static void symbol_file_add_main_1 (char *args, int from_tty, int flags);
static void add_symbol_file_command (char *, int);
-static void cashier_psymtab (struct partial_symtab *);
-
bfd *symfile_bfd_open (char *);
int get_section_index (struct objfile *, char *);
@@ -2577,7 +2575,6 @@ deduce_language_from_filename (char *filename)
symtab->dirname
symtab->free_code
symtab->free_ptr
- possibly free_named_symtabs (symtab->filename);
*/
struct symtab *
@@ -2706,210 +2703,6 @@ clear_symtab_users_cleanup (void *ignore)
{
clear_symtab_users ();
}
-
-/* clear_symtab_users_once:
-
- This function is run after symbol reading, or from a cleanup.
- If an old symbol table was obsoleted, the old symbol table
- has been blown away, but the other GDB data structures that may
- reference it have not yet been cleared or re-directed. (The old
- symtab was zapped, and the cleanup queued, in free_named_symtab()
- below.)
-
- This function can be queued N times as a cleanup, or called
- directly; it will do all the work the first time, and then will be a
- no-op until the next time it is queued. This works by bumping a
- counter at queueing time. Much later when the cleanup is run, or at
- the end of symbol processing (in case the cleanup is discarded), if
- the queued count is greater than the "done-count", we do the work
- and set the done-count to the queued count. If the queued count is
- less than or equal to the done-count, we just ignore the call. This
- is needed because reading a single .o file will often replace many
- symtabs (one per .h file, for example), and we don't want to reset
- the breakpoints N times in the user's face.
-
- The reason we both queue a cleanup, and call it directly after symbol
- reading, is because the cleanup protects us in case of errors, but is
- discarded if symbol reading is successful. */
-
-#if 0
-/* FIXME: As free_named_symtabs is currently a big noop this function
- is no longer needed. */
-static void clear_symtab_users_once (void);
-
-static int clear_symtab_users_queued;
-static int clear_symtab_users_done;
-
-static void
-clear_symtab_users_once (void)
-{
- /* Enforce once-per-`do_cleanups'-semantics */
- if (clear_symtab_users_queued <= clear_symtab_users_done)
- return;
- clear_symtab_users_done = clear_symtab_users_queued;
-
- clear_symtab_users ();
-}
-#endif
-
-/* Delete the specified psymtab, and any others that reference it. */
-
-static void
-cashier_psymtab (struct partial_symtab *pst)
-{
- struct partial_symtab *ps, *pprev = NULL;
- int i;
-
- /* Find its previous psymtab in the chain */
- for (ps = pst->objfile->psymtabs; ps; ps = ps->next)
- {
- if (ps == pst)
- break;
- pprev = ps;
- }
-
- if (ps)
- {
- /* Unhook it from the chain. */
- if (ps == pst->objfile->psymtabs)
- pst->objfile->psymtabs = ps->next;
- else
- pprev->next = ps->next;
-
- /* FIXME, we can't conveniently deallocate the entries in the
- partial_symbol lists (global_psymbols/static_psymbols) that
- this psymtab points to. These just take up space until all
- the psymtabs are reclaimed. Ditto the dependencies list and
- filename, which are all in the objfile_obstack. */
-
- /* We need to cashier any psymtab that has this one as a dependency... */
- again:
- for (ps = pst->objfile->psymtabs; ps; ps = ps->next)
- {
- for (i = 0; i < ps->number_of_dependencies; i++)
- {
- if (ps->dependencies[i] == pst)
- {
- cashier_psymtab (ps);
- goto again; /* Must restart, chain has been munged. */
- }
- }
- }
- }
-}
-
-/* If a symtab or psymtab for filename NAME is found, free it along
- with any dependent breakpoints, displays, etc.
- Used when loading new versions of object modules with the "add-file"
- command. This is only called on the top-level symtab or psymtab's name;
- it is not called for subsidiary files such as .h files.
-
- Return value is 1 if we blew away the environment, 0 if not.
- FIXME. The return value appears to never be used.
-
- FIXME. I think this is not the best way to do this. We should
- work on being gentler to the environment while still cleaning up
- all stray pointers into the freed symtab. */
-
-int
-free_named_symtabs (char *name)
-{
-#if 0
- /* FIXME: With the new method of each objfile having it's own
- psymtab list, this function needs serious rethinking. In particular,
- why was it ever necessary to toss psymtabs with specific compilation
- unit filenames, as opposed to all psymtabs from a particular symbol
- file? -- fnf
- Well, the answer is that some systems permit reloading of particular
- compilation units. We want to blow away any old info about these
- compilation units, regardless of which objfiles they arrived in. --gnu. */
-
- struct symtab *s;
- struct symtab *prev;
- struct partial_symtab *ps;
- struct blockvector *bv;
- int blewit = 0;
-
- /* We only wack things if the symbol-reload switch is set. */
- if (!symbol_reloading)
- return 0;
-
- /* Some symbol formats have trouble providing file names... */
- if (name == 0 || *name == '\0')
- return 0;
-
- /* Look for a psymtab with the specified name. */
-
-again2:
- for (ps = partial_symtab_list; ps; ps = ps->next)
- {
- if (strcmp (name, ps->filename) == 0)
- {
- cashier_psymtab (ps); /* Blow it away...and its little dog, too. */
- goto again2; /* Must restart, chain has been munged */
- }
- }
-
- /* Look for a symtab with the specified name. */
-
- for (s = symtab_list; s; s = s->next)
- {
- if (strcmp (name, s->filename) == 0)
- break;
- prev = s;
- }
-
- if (s)
- {
- if (s == symtab_list)
- symtab_list = s->next;
- else
- prev->next = s->next;
-
- /* For now, queue a delete for all breakpoints, displays, etc., whether
- or not they depend on the symtab being freed. This should be
- changed so that only those data structures affected are deleted. */
-
- /* But don't delete anything if the symtab is empty.
- This test is necessary due to a bug in "dbxread.c" that
- causes empty symtabs to be created for N_SO symbols that
- contain the pathname of the object file. (This problem
- has been fixed in GDB 3.9x). */
-
- bv = BLOCKVECTOR (s);
- if (BLOCKVECTOR_NBLOCKS (bv) > 2
- || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK))
- || BLOCK_NSYMS (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)))
- {
- complaint (&symfile_complaints, _("Replacing old symbols for `%s'"),
- name);
- clear_symtab_users_queued++;
- make_cleanup (clear_symtab_users_once, 0);
- blewit = 1;
- }
- else
- complaint (&symfile_complaints, _("Empty symbol table found for `%s'"),
- name);
-
- free_symtab (s);
- }
- else
- {
- /* It is still possible that some breakpoints will be affected
- even though no symtab was found, since the file might have
- been compiled without debugging, and hence not be associated
- with a symtab. In order to handle this correctly, we would need
- to keep a list of text address ranges for undebuggable files.
- For now, we do nothing, since this is a fairly obscure case. */
- ;
- }
-
- /* FIXME, what about the minimal symbol table? */
- return blewit;
-#else
- return (0);
-#endif
-}
/* Allocate and partially fill a partial symtab. It will be
completely filled at the end of the symbol list.
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 7ae819c..efa069e 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -215,8 +215,6 @@ extern void sort_pst_symbols (struct partial_symtab *);
extern struct symtab *allocate_symtab (char *, struct objfile *);
-extern int free_named_symtabs (char *);
-
extern void add_symtab_fns (struct sym_fns *);
/* This enum encodes bit-flags passed as ADD_FLAGS parameter to
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 6301b61..25cc2d9 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2048,11 +2048,6 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list,
sort_pst_symbols (pst);
- /* If there is already a psymtab or symtab for a file of this name,
- remove it. (If there is a symtab, more drastic things also
- happen.) This happens in VxWorks. */
- free_named_symtabs (pst->filename);
-
if (num_includes == 0
&& number_dependencies == 0
&& pst->n_global_syms == 0