diff options
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 207 |
1 files changed, 0 insertions, 207 deletions
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. |