mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-02-11 03:55:50 +00:00
* jit.c (jit_object_close_impl): Don't malloc the objfile
name. * objfiles.c (allocate_objfile): Don't malloc the objfile name. (free_objfile): Don't free the objfile name. * objfiles.h (struct objfile) <name>: Update comment. * symfile.c (reread_symbols): Fix reference counting. Don't malloc objfile name.
This commit is contained in:
parent
1c00ec6b06
commit
e1507e953e
@ -1,3 +1,14 @@
|
||||
2012-08-22 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* jit.c (jit_object_close_impl): Don't malloc the objfile
|
||||
name.
|
||||
* objfiles.c (allocate_objfile): Don't malloc the objfile
|
||||
name.
|
||||
(free_objfile): Don't free the objfile name.
|
||||
* objfiles.h (struct objfile) <name>: Update comment.
|
||||
* symfile.c (reread_symbols): Fix reference counting. Don't
|
||||
malloc objfile name.
|
||||
|
||||
2012-08-22 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* windows-nat.c (windows_make_so): Use gdb_bfd_open.
|
||||
|
@ -761,8 +761,7 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
|
||||
|
||||
terminate_minimal_symbol_table (objfile);
|
||||
|
||||
xfree (objfile->name);
|
||||
objfile->name = xstrdup ("<< JIT compiled code >>");
|
||||
objfile->name = "<< JIT compiled code >>";
|
||||
|
||||
j = NULL;
|
||||
for (i = obj->symtabs; i; i = j)
|
||||
|
@ -271,7 +271,7 @@ allocate_objfile (bfd *abfd, int flags)
|
||||
/* Look up the gdbarch associated with the BFD. */
|
||||
objfile->gdbarch = gdbarch_from_bfd (abfd);
|
||||
|
||||
objfile->name = xstrdup (bfd_get_filename (abfd));
|
||||
objfile->name = bfd_get_filename (abfd);
|
||||
objfile->mtime = bfd_get_mtime (abfd);
|
||||
|
||||
/* Build section table. */
|
||||
@ -279,7 +279,7 @@ allocate_objfile (bfd *abfd, int flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
objfile->name = xstrdup ("<<anonymous objfile>>");
|
||||
objfile->name = "<<anonymous objfile>>";
|
||||
}
|
||||
|
||||
objfile->per_bfd = get_objfile_bfd_data (objfile, abfd);
|
||||
@ -670,7 +670,6 @@ free_objfile (struct objfile *objfile)
|
||||
|
||||
/* The last thing we do is free the objfile struct itself. */
|
||||
|
||||
xfree (objfile->name);
|
||||
if (objfile->global_psymbols.list)
|
||||
xfree (objfile->global_psymbols.list);
|
||||
if (objfile->static_psymbols.list)
|
||||
|
@ -197,8 +197,9 @@ struct objfile
|
||||
|
||||
struct objfile *next;
|
||||
|
||||
/* The object file's name, tilde-expanded and absolute. Malloc'd; free it
|
||||
if you free this struct. This pointer is never NULL. */
|
||||
/* The object file's name, tilde-expanded and absolute. This
|
||||
pointer is never NULL. This does not have to be freed; it is
|
||||
guaranteed to have a lifetime at least as long as the objfile. */
|
||||
|
||||
char *name;
|
||||
|
||||
|
@ -2506,9 +2506,7 @@ reread_symbols (void)
|
||||
|
||||
clear_objfile_data (objfile);
|
||||
|
||||
/* Clean up any state BFD has sitting around. We don't need
|
||||
to close the descriptor but BFD lacks a way of closing the
|
||||
BFD without closing the descriptor. */
|
||||
/* Clean up any state BFD has sitting around. */
|
||||
{
|
||||
struct bfd *obfd = objfile->obfd;
|
||||
|
||||
@ -2516,11 +2514,18 @@ reread_symbols (void)
|
||||
/* Open the new BFD before freeing the old one, so that
|
||||
the filename remains live. */
|
||||
objfile->obfd = gdb_bfd_open_maybe_remote (obfd_filename);
|
||||
if (objfile->obfd == NULL)
|
||||
{
|
||||
/* We have to make a cleanup and error here, rather
|
||||
than erroring later, because once we unref OBFD,
|
||||
OBFD_FILENAME will be freed. */
|
||||
make_cleanup_bfd_unref (obfd);
|
||||
error (_("Can't open %s to read symbols."), obfd_filename);
|
||||
}
|
||||
gdb_bfd_unref (obfd);
|
||||
}
|
||||
|
||||
if (objfile->obfd == NULL)
|
||||
error (_("Can't open %s to read symbols."), objfile->name);
|
||||
objfile->name = bfd_get_filename (objfile->obfd);
|
||||
/* bfd_openr sets cacheable to true, which is what we want. */
|
||||
if (!bfd_check_format (objfile->obfd, bfd_object))
|
||||
error (_("Can't read symbols from %s: %s."), objfile->name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user