aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-05-17 23:54:32 +0000
committerFred Fish <fnf@specifix.com>1992-05-17 23:54:32 +0000
commit6c316cfd666cefcdb824fbcb823358c308255b29 (patch)
treedea599c7f5f3b0b9641620b06dd8288b8156bf15 /gdb/objfiles.c
parentbec9b335511df9f349805bf807d07b1e26d98010 (diff)
downloadgdb-6c316cfd666cefcdb824fbcb823358c308255b29.zip
gdb-6c316cfd666cefcdb824fbcb823358c308255b29.tar.gz
gdb-6c316cfd666cefcdb824fbcb823358c308255b29.tar.bz2
* inflow.c (new_tty): Temporarily ignore SIGTTOU when
disconnecting from controlling terminal, to avoid gdb hanging on SVR4. Fixes bug reported by Oliver Okrongli. * procfs.c (PROC_NAME_FMT): Change format to match default used by system, as suggested by Oliver Okrongli. * tm-68k.h (FRAME_FIND_SAVED_REGS): Apply missing parentheses bug fix from Brent Townshend (bst%tt@cam.ORG). * c-exp.y (nonempty_typelist): Fix memory overrun bug reported by turlais@rechser.total.fr. * dwarfread.c (decode_subscr_data): Fix bug in calculation of length of non-zero lowerbound arrays. Bug fix from Peggy Fieland. * objfiles.h (unlink_objfile): Add prototype. * objfiles.c (unlink_objfile): Add function. * objfiles.c (free_objfile): Call unlink_objfile. * objfiles.c (allocate_objfile): Call unlink_objfile on newly remapped objfiles. Bug reported by hahn@sunshine.labs.tek.com. Also, discard old possibly bogus sf struct. * symfile.c (symbol_file_add): Call init_entry_point_info() and find_sym_fns() for remapped symbol files, in case of any changes since the last mapping.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 642026c..1ad5d94 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -110,6 +110,10 @@ allocate_objfile (abfd, mapped)
obstack_freefun (&objfile -> symbol_obstack, mfree);
obstack_chunkfun (&objfile -> type_obstack, xmmalloc);
obstack_freefun (&objfile -> type_obstack, mfree);
+ /* If already in objfile list, unlink it. */
+ unlink_objfile (objfile);
+ /* Forget things specific to a particular gdb, may have changed. */
+ objfile -> sf = NULL;
}
else
{
@@ -193,6 +197,36 @@ allocate_objfile (abfd, mapped)
return (objfile);
}
+/* Unlink OBJFILE from the list of known objfiles, if it is found in the
+ list.
+
+ It is not a bug, or error, to call this function if OBJFILE is not known
+ to be in the current list. This is done in the case of mapped objfiles,
+ for example, just to ensure that the mapped objfile doesn't appear twice
+ in the list. Since the list is threaded, linking in a mapped objfile
+ twice would create a circular list.
+
+ If OBJFILE turns out to be in the list, we zap it's NEXT pointer after
+ unlinking it, just to ensure that we have completely severed any linkages
+ between the OBJFILE and the list. */
+
+void
+unlink_objfile (objfile)
+ struct objfile *objfile;
+{
+ struct objfile** objpp;
+
+ for (objpp = &object_files; *objpp != NULL; objpp = &((*objpp) -> next))
+ {
+ if (*objpp == objfile)
+ {
+ *objpp = (*objpp) -> next;
+ objfile -> next = NULL;
+ break;
+ }
+ }
+}
+
/* Destroy an objfile and all the symtabs and psymtabs under it. Note
that as much as possible is allocated on the symbol_obstack and
@@ -238,22 +272,7 @@ free_objfile (objfile)
/* Remove it from the chain of all objfiles. */
- if (object_files == objfile)
- {
- object_files = objfile -> next;
- }
- else
- {
- for (ofp = object_files; ofp; ofp = ofp -> next)
- {
- if (ofp -> next == objfile)
- {
- ofp -> next = objfile -> next;
- break;
- }
- }
- }
- objfile -> next = NULL;
+ unlink_objfile (objfile);
#if 0 /* FIXME!! */