Fix to dwarfread.c to target pointer and target long sizes, fixes for
mapped symbol file handling, and a couple of other misc small fixes.
This commit is contained in:
parent
d453b386ac
commit
2d6d969c61
6 changed files with 103 additions and 25 deletions
|
@ -1,3 +1,24 @@
|
|||
Thu Apr 16 19:56:50 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* dwarfread.c (TARGET_FT_POINTER_SIZE, TARGET_FT_LONG_SIZE):
|
||||
Define using TARGET_PTR_BIT and TARGET_LONG_BIT for now.
|
||||
* objfiles.c: Cast calls to close() with unused returns to void.
|
||||
* objfiles.c (allocate_objfile): Initialize objfile's mmfd, free
|
||||
old objfile's name before updating it.
|
||||
* objfiles.c (free_objfile): Major rewrite for mapped objfiles.
|
||||
* objfiles.h (objfile struct): Add mmfd member.
|
||||
* symfile.c (syms_from_objfile): Move some code to
|
||||
new_symfile_objfile.
|
||||
* symfile.c (new_symfile_objfile): Add new function, common code
|
||||
from syms_from_objfile.
|
||||
* symfile.c (symbol_file_add): Call new_symfile_objfile for both
|
||||
mapped and unmapped symbol files.
|
||||
* symfile.c (symbol_file_command): Print "No symbol file now"
|
||||
message, ala exec_file_command for the exec file.
|
||||
* symfile.h (new_symfile_objfile): Add prototype.
|
||||
* xcoffexec.c (map_vmap): Add call to new_symfile_objfile.
|
||||
* xcoffsolib.c (solib_add): Add call to new_symfile_objfile.
|
||||
|
||||
Thu Apr 16 18:26:34 1992 Per Bothner (bothner@cygnus.com)
|
||||
|
||||
* rs6000-pinsn.c: New version from IBM (Metin).
|
||||
|
|
|
@ -103,15 +103,15 @@ typedef unsigned int DIE_REF; /* Reference to a DIE */
|
|||
/* Macros that return the sizes of various types of data in the target
|
||||
environment.
|
||||
|
||||
FIXME: They currently just return the sizes in the host environment.
|
||||
They need to be able to get the right size either from the bfd or possibly
|
||||
from the DWARF info. It would be nice if the DWARF producer inserted DIES
|
||||
that describe the fundamental types in the target environment into the
|
||||
DWARF info, similar to the way dbx stabs producers produce information
|
||||
about their fundamental types. */
|
||||
FIXME: Currently these are just compile time constants (as they are in
|
||||
other parts of gdb as well). They need to be able to get the right size
|
||||
either from the bfd or possibly from the DWARF info. It would be nice if
|
||||
the DWARF producer inserted DIES that describe the fundamental types in
|
||||
the target environment into the DWARF info, similar to the way dbx stabs
|
||||
producers produce information about their fundamental types. */
|
||||
|
||||
#define TARGET_FT_POINTER_SIZE(objfile) sizeof (PTR) /* FIXME */
|
||||
#define TARGET_FT_LONG_SIZE(objfile) sizeof (long) /* FIXME */
|
||||
#define TARGET_FT_POINTER_SIZE(objfile) (TARGET_PTR_BIT / TARGET_CHAR_BIT)
|
||||
#define TARGET_FT_LONG_SIZE(objfile) (TARGET_LONG_BIT / TARGET_CHAR_BIT)
|
||||
|
||||
/* The Amiga SVR4 header file <dwarf.h> defines AT_element_list as a
|
||||
FORM_BLOCK2, and this is the value emitted by the AT&T compiler.
|
||||
|
|
|
@ -84,13 +84,14 @@ allocate_objfile (abfd, mapped)
|
|||
if (((mapto = map_to_address ()) == 0) ||
|
||||
((md = mmalloc_attach (fd, (void *) mapto)) == NULL))
|
||||
{
|
||||
close (fd);
|
||||
(void) close (fd);
|
||||
}
|
||||
else if ((objfile = (struct objfile *) mmalloc_getkey (md, 0)) != NULL)
|
||||
{
|
||||
/* Update memory corruption handler function addresses. */
|
||||
init_malloc (md);
|
||||
objfile -> md = md;
|
||||
objfile -> mmfd = fd;
|
||||
/* Update pointers to functions to *our* copies */
|
||||
obstack_chunkfun (&objfile -> psymbol_obstack, xmmalloc);
|
||||
obstack_freefun (&objfile -> psymbol_obstack, mfree);
|
||||
|
@ -107,6 +108,7 @@ allocate_objfile (abfd, mapped)
|
|||
objfile = (struct objfile *) xmmalloc (md, sizeof (struct objfile));
|
||||
(void) memset (objfile, 0, sizeof (struct objfile));
|
||||
objfile -> md = md;
|
||||
objfile -> mmfd = fd;
|
||||
objfile -> flags |= OBJF_MAPPED;
|
||||
mmalloc_setkey (objfile -> md, 0, objfile);
|
||||
obstack_full_begin (&objfile -> psymbol_obstack, 0, 0,
|
||||
|
@ -165,6 +167,10 @@ allocate_objfile (abfd, mapped)
|
|||
region. */
|
||||
|
||||
objfile -> obfd = abfd;
|
||||
if (objfile -> name != NULL)
|
||||
{
|
||||
mfree (objfile -> md, objfile -> name);
|
||||
}
|
||||
objfile -> name = mstrsave (objfile -> md, bfd_get_filename (abfd));
|
||||
objfile -> mtime = bfd_get_mtime (abfd);
|
||||
|
||||
|
@ -186,28 +192,40 @@ allocate_objfile (abfd, mapped)
|
|||
|
||||
objfile -> sf
|
||||
|
||||
*/
|
||||
FIXME: If the objfile is using reusable symbol information (via mmalloc),
|
||||
then we need to take into account the fact that more than one process
|
||||
may be using the symbol information at the same time (when mmalloc is
|
||||
extended to support cooperative locking). When more than one process
|
||||
is using the mapped symbol info, we need to be more careful about when
|
||||
we free objects in the reusable area. */
|
||||
|
||||
void
|
||||
free_objfile (objfile)
|
||||
struct objfile *objfile;
|
||||
{
|
||||
struct objfile *ofp;
|
||||
int mmfd;
|
||||
|
||||
/* First do any symbol file specific actions required when we are
|
||||
finished with a particular symbol file. Note that if the objfile
|
||||
is using reusable symbol information (via mmalloc) then each of
|
||||
these routines is responsible for doing the correct thing, either
|
||||
freeing things which are valid only during this particular gdb
|
||||
execution, or leaving them to be reused during the next one. */
|
||||
|
||||
if (objfile -> sf != NULL)
|
||||
{
|
||||
(*objfile -> sf -> sym_finish) (objfile);
|
||||
}
|
||||
if (objfile -> name != NULL)
|
||||
{
|
||||
mfree (objfile -> md, objfile -> name);
|
||||
}
|
||||
|
||||
/* We always close the bfd. */
|
||||
|
||||
if (objfile -> obfd != NULL)
|
||||
{
|
||||
bfd_close (objfile -> obfd);
|
||||
}
|
||||
|
||||
/* Remove it from the chain of all objfiles. */
|
||||
/* Remove it from the chain of all objfiles. */
|
||||
|
||||
if (object_files == objfile)
|
||||
{
|
||||
|
@ -220,13 +238,11 @@ free_objfile (objfile)
|
|||
if (ofp -> next == objfile)
|
||||
{
|
||||
ofp -> next = objfile -> next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
obstack_free (&objfile -> psymbol_obstack, 0);
|
||||
obstack_free (&objfile -> symbol_obstack, 0);
|
||||
obstack_free (&objfile -> type_obstack, 0);
|
||||
objfile -> next = NULL;
|
||||
|
||||
#if 0 /* FIXME!! */
|
||||
|
||||
|
@ -245,9 +261,31 @@ free_objfile (objfile)
|
|||
|
||||
#endif
|
||||
|
||||
/* The last thing we do is free the objfile struct itself */
|
||||
/* The last thing we do is free the objfile struct itself for the
|
||||
non-reusable case, or detach from the mapped file for the reusable
|
||||
case. Note that the mmalloc_detach or the mfree is the last thing
|
||||
we can do with this objfile. */
|
||||
|
||||
mfree (objfile -> md, objfile);
|
||||
if (objfile -> flags & OBJF_MAPPED)
|
||||
{
|
||||
/* Remember the fd so we can close it. We can't close it before
|
||||
doing the detach, and after the detach the objfile is gone. */
|
||||
mmfd = objfile -> mmfd;
|
||||
mmalloc_detach (objfile -> md);
|
||||
(void) close (mmfd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (objfile -> name != NULL)
|
||||
{
|
||||
mfree (objfile -> md, objfile -> name);
|
||||
}
|
||||
/* Free the obstacks for non-reusable objfiles */
|
||||
obstack_free (&objfile -> psymbol_obstack, 0);
|
||||
obstack_free (&objfile -> symbol_obstack, 0);
|
||||
obstack_free (&objfile -> type_obstack, 0);
|
||||
mfree (objfile -> md, objfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -356,7 +394,7 @@ open_mapped_file (filename, mtime, mapped)
|
|||
{
|
||||
if (fstat (fd, &sbuf) != 0)
|
||||
{
|
||||
close (fd);
|
||||
(void) close (fd);
|
||||
perror_with_name (symfilename);
|
||||
}
|
||||
else if (sbuf.st_mtime > mtime)
|
||||
|
@ -365,7 +403,7 @@ open_mapped_file (filename, mtime, mapped)
|
|||
}
|
||||
else
|
||||
{
|
||||
close (fd);
|
||||
(void) close (fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,18 @@ struct objfile
|
|||
|
||||
/* All struct objfile's are chained together by their next pointers.
|
||||
The global variable "object_files" points to the first link in this
|
||||
chain. */
|
||||
chain.
|
||||
|
||||
FIXME: There is a problem here if the objfile is reusable, and if
|
||||
multiple users are to be supported. The problem is that the objfile
|
||||
list is linked through a member of the objfile struct itself, which
|
||||
is only valid for one gdb process. The list implementation needs to
|
||||
be changed to something like:
|
||||
|
||||
struct list {struct list *next; struct objfile *objfile};
|
||||
|
||||
where the list structure is completely maintained separately within
|
||||
each gdb process. */
|
||||
|
||||
struct objfile *next;
|
||||
|
||||
|
@ -205,6 +216,12 @@ struct objfile
|
|||
|
||||
PTR md;
|
||||
|
||||
/* The file descriptor that was used to obtain the mmalloc descriptor
|
||||
for this objfile. If we call mmalloc_detach with the malloc descriptor
|
||||
we should then close this file descriptor. */
|
||||
|
||||
int mmfd;
|
||||
|
||||
/* Structure which keeps track of functions that manipulate objfile's
|
||||
of the same type as this objfile. I.E. the function to read partial
|
||||
symbols for example. Note that this structure is in statically
|
||||
|
|
|
@ -345,6 +345,7 @@ map_vmap (bfd *bf, bfd *arch)
|
|||
we don't have to load them as default anymore.
|
||||
|
||||
syms_from_objfile (obj, 0, 0, 0);
|
||||
new_symfile_objfile (obj, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ solib_add (arg_string, from_tty, target)
|
|||
continue;
|
||||
}
|
||||
|
||||
syms_from_objfile (obj, 0, 0);
|
||||
syms_from_objfile (obj, 0, 0, 0);
|
||||
new_symfile_objfile (obj, 0, 0);
|
||||
vmap_symtab (vp, 0, 0);
|
||||
printf ("Done.\n");
|
||||
loaded = vp->loaded = 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue