mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 06:23:58 +08:00
Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983
https://sourceware.org/ml/gdb-patches/2014-01/msg00029.html https://sourceware.org/ml/gdb-patches/2014-01/msg00053.html 2014-01-07 Hui Zhu <hui@codesourcery.com> * gdb_bfd.c (gdb_bfd_stash_filename): Removed. (gdb_bfd_open): Removed gdb_bfd_stash_filename. (gdb_bfd_fopen): Ditto. (gdb_bfd_openr): Ditto. (gdb_bfd_openw): Ditto. (gdb_bfd_openr_iovec): Ditto. (gdb_bfd_fdopenr): Ditto. * gdb_bfd.h (gdb_bfd_stash_filename): Removed. * solib-aix.c (solib_aix_bfd_open): Alloc object_bfd->filename with xstrdup. * solib-darwin.c (darwin_bfd_open): Alloc res->filename with xstrdup. * symfile-mem.c (symbol_file_add_from_memory): Removed gdb_bfd_stash_filename.
This commit is contained in:
@ -1,3 +1,20 @@
|
|||||||
|
2014-01-07 Hui Zhu <hui@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb_bfd.c (gdb_bfd_stash_filename): Removed.
|
||||||
|
(gdb_bfd_open): Removed gdb_bfd_stash_filename.
|
||||||
|
(gdb_bfd_fopen): Ditto.
|
||||||
|
(gdb_bfd_openr): Ditto.
|
||||||
|
(gdb_bfd_openw): Ditto.
|
||||||
|
(gdb_bfd_openr_iovec): Ditto.
|
||||||
|
(gdb_bfd_fdopenr): Ditto.
|
||||||
|
* gdb_bfd.h (gdb_bfd_stash_filename): Removed.
|
||||||
|
* solib-aix.c (solib_aix_bfd_open): Alloc object_bfd->filename
|
||||||
|
with xstrdup.
|
||||||
|
* solib-darwin.c (darwin_bfd_open): Alloc res->filename
|
||||||
|
with xstrdup.
|
||||||
|
* symfile-mem.c (symbol_file_add_from_memory): Removed
|
||||||
|
gdb_bfd_stash_filename.
|
||||||
|
|
||||||
2014-01-03 Doug Evans <dje@google.com>
|
2014-01-03 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* nat/linux-waitpid.c (linux_debug): Remove extraneous \n from
|
* nat/linux-waitpid.c (linux_debug): Remove extraneous \n from
|
||||||
|
@ -57,21 +57,6 @@ struct gdb_bfd_section_data
|
|||||||
|
|
||||||
static htab_t all_bfds;
|
static htab_t all_bfds;
|
||||||
|
|
||||||
/* See gdb_bfd.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
gdb_bfd_stash_filename (struct bfd *abfd)
|
|
||||||
{
|
|
||||||
char *name = bfd_get_filename (abfd);
|
|
||||||
char *data;
|
|
||||||
|
|
||||||
data = bfd_alloc (abfd, strlen (name) + 1);
|
|
||||||
strcpy (data, name);
|
|
||||||
|
|
||||||
/* Unwarranted chumminess with BFD. */
|
|
||||||
abfd->filename = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* An object of this type is stored in each BFD's user data. */
|
/* An object of this type is stored in each BFD's user data. */
|
||||||
|
|
||||||
struct gdb_bfd_data
|
struct gdb_bfd_data
|
||||||
@ -204,7 +189,6 @@ gdb_bfd_open (const char *name, const char *target, int fd)
|
|||||||
gdb_assert (!*slot);
|
gdb_assert (!*slot);
|
||||||
*slot = abfd;
|
*slot = abfd;
|
||||||
|
|
||||||
gdb_bfd_stash_filename (abfd);
|
|
||||||
gdb_bfd_ref (abfd);
|
gdb_bfd_ref (abfd);
|
||||||
return abfd;
|
return abfd;
|
||||||
}
|
}
|
||||||
@ -490,10 +474,7 @@ gdb_bfd_fopen (const char *filename, const char *target, const char *mode,
|
|||||||
bfd *result = bfd_fopen (filename, target, mode, fd);
|
bfd *result = bfd_fopen (filename, target, mode, fd);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
gdb_bfd_ref (result);
|
||||||
gdb_bfd_stash_filename (result);
|
|
||||||
gdb_bfd_ref (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -506,10 +487,7 @@ gdb_bfd_openr (const char *filename, const char *target)
|
|||||||
bfd *result = bfd_openr (filename, target);
|
bfd *result = bfd_openr (filename, target);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
gdb_bfd_ref (result);
|
||||||
gdb_bfd_stash_filename (result);
|
|
||||||
gdb_bfd_ref (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -522,10 +500,7 @@ gdb_bfd_openw (const char *filename, const char *target)
|
|||||||
bfd *result = bfd_openw (filename, target);
|
bfd *result = bfd_openw (filename, target);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
gdb_bfd_ref (result);
|
||||||
gdb_bfd_stash_filename (result);
|
|
||||||
gdb_bfd_ref (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -553,10 +528,7 @@ gdb_bfd_openr_iovec (const char *filename, const char *target,
|
|||||||
pread_func, close_func, stat_func);
|
pread_func, close_func, stat_func);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
gdb_bfd_ref (result);
|
||||||
gdb_bfd_ref (result);
|
|
||||||
gdb_bfd_stash_filename (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -603,10 +575,7 @@ gdb_bfd_fdopenr (const char *filename, const char *target, int fd)
|
|||||||
bfd *result = bfd_fdopenr (filename, target, fd);
|
bfd *result = bfd_fdopenr (filename, target, fd);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
gdb_bfd_ref (result);
|
||||||
gdb_bfd_ref (result);
|
|
||||||
gdb_bfd_stash_filename (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,6 @@
|
|||||||
|
|
||||||
DECLARE_REGISTRY (bfd);
|
DECLARE_REGISTRY (bfd);
|
||||||
|
|
||||||
/* Make a copy ABFD's filename using bfd_alloc, and reassign it to the
|
|
||||||
BFD. This ensures that the BFD's filename has the same lifetime as
|
|
||||||
the BFD itself. */
|
|
||||||
|
|
||||||
void gdb_bfd_stash_filename (struct bfd *abfd);
|
|
||||||
|
|
||||||
/* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen.
|
/* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen.
|
||||||
Returns NULL on error. On success, returns a new reference to the
|
Returns NULL on error. On success, returns a new reference to the
|
||||||
BFD, which must be freed with gdb_bfd_unref. BFDs returned by this
|
BFD, which must be freed with gdb_bfd_unref. BFDs returned by this
|
||||||
@ -79,22 +73,22 @@ int gdb_bfd_crc (struct bfd *abfd, unsigned long *crc_out);
|
|||||||
|
|
||||||
|
|
||||||
/* A wrapper for bfd_fopen that initializes the gdb-specific reference
|
/* A wrapper for bfd_fopen that initializes the gdb-specific reference
|
||||||
count and calls gdb_bfd_stash_filename. */
|
count. */
|
||||||
|
|
||||||
bfd *gdb_bfd_fopen (const char *, const char *, const char *, int);
|
bfd *gdb_bfd_fopen (const char *, const char *, const char *, int);
|
||||||
|
|
||||||
/* A wrapper for bfd_openr that initializes the gdb-specific reference
|
/* A wrapper for bfd_openr that initializes the gdb-specific reference
|
||||||
count and calls gdb_bfd_stash_filename. */
|
count. */
|
||||||
|
|
||||||
bfd *gdb_bfd_openr (const char *, const char *);
|
bfd *gdb_bfd_openr (const char *, const char *);
|
||||||
|
|
||||||
/* A wrapper for bfd_openw that initializes the gdb-specific reference
|
/* A wrapper for bfd_openw that initializes the gdb-specific reference
|
||||||
count and calls gdb_bfd_stash_filename. */
|
count. */
|
||||||
|
|
||||||
bfd *gdb_bfd_openw (const char *, const char *);
|
bfd *gdb_bfd_openw (const char *, const char *);
|
||||||
|
|
||||||
/* A wrapper for bfd_openr_iovec that initializes the gdb-specific
|
/* A wrapper for bfd_openr_iovec that initializes the gdb-specific
|
||||||
reference count and calls gdb_bfd_stash_filename. */
|
reference count. */
|
||||||
|
|
||||||
bfd *gdb_bfd_openr_iovec (const char *filename, const char *target,
|
bfd *gdb_bfd_openr_iovec (const char *filename, const char *target,
|
||||||
void *(*open_func) (struct bfd *nbfd,
|
void *(*open_func) (struct bfd *nbfd,
|
||||||
@ -112,12 +106,12 @@ bfd *gdb_bfd_openr_iovec (const char *filename, const char *target,
|
|||||||
struct stat *sb));
|
struct stat *sb));
|
||||||
|
|
||||||
/* A wrapper for bfd_openr_next_archived_file that initializes the
|
/* A wrapper for bfd_openr_next_archived_file that initializes the
|
||||||
gdb-specific reference count and calls gdb_bfd_stash_filename. */
|
gdb-specific reference count. */
|
||||||
|
|
||||||
bfd *gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous);
|
bfd *gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous);
|
||||||
|
|
||||||
/* A wrapper for bfd_fdopenr that initializes the gdb-specific
|
/* A wrapper for bfd_fdopenr that initializes the gdb-specific
|
||||||
reference count and calls gdb_bfd_stash_filename. */
|
reference count. */
|
||||||
|
|
||||||
bfd *gdb_bfd_fdopenr (const char *filename, const char *target, int fd);
|
bfd *gdb_bfd_fdopenr (const char *filename, const char *target, int fd);
|
||||||
|
|
||||||
|
@ -728,12 +728,8 @@ solib_aix_bfd_open (char *pathname)
|
|||||||
to allow commands listing all shared libraries to display that
|
to allow commands listing all shared libraries to display that
|
||||||
synthetic name. Otherwise, we would only be displaying the name
|
synthetic name. Otherwise, we would only be displaying the name
|
||||||
of the archive member object. */
|
of the archive member object. */
|
||||||
{
|
xfree (bfd_get_filename (object_bfd));
|
||||||
char *data = bfd_alloc (object_bfd, path_len + 1);
|
object_bfd->filename = xstrdup (pathname);
|
||||||
|
|
||||||
strcpy (data, pathname);
|
|
||||||
object_bfd->filename = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdb_bfd_unref (archive_bfd);
|
gdb_bfd_unref (archive_bfd);
|
||||||
do_cleanups (cleanup);
|
do_cleanups (cleanup);
|
||||||
|
@ -621,12 +621,8 @@ darwin_bfd_open (char *pathname)
|
|||||||
/* The current filename for fat-binary BFDs is a name generated
|
/* The current filename for fat-binary BFDs is a name generated
|
||||||
by BFD, usually a string containing the name of the architecture.
|
by BFD, usually a string containing the name of the architecture.
|
||||||
Reset its value to the actual filename. */
|
Reset its value to the actual filename. */
|
||||||
{
|
xfree (bfd_get_filename (res));
|
||||||
char *data = bfd_alloc (res, strlen (pathname) + 1);
|
res->filename = xstrdup (pathname);
|
||||||
|
|
||||||
strcpy (data, pathname);
|
|
||||||
res->filename = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
gdb_bfd_unref (abfd);
|
gdb_bfd_unref (abfd);
|
||||||
return res;
|
return res;
|
||||||
|
@ -101,14 +101,11 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name,
|
|||||||
error (_("Failed to read a valid object file image from memory."));
|
error (_("Failed to read a valid object file image from memory."));
|
||||||
|
|
||||||
gdb_bfd_ref (nbfd);
|
gdb_bfd_ref (nbfd);
|
||||||
|
xfree (bfd_get_filename (nbfd));
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
nbfd->filename = "shared object read from target memory";
|
nbfd->filename = xstrdup ("shared object read from target memory");
|
||||||
else
|
else
|
||||||
{
|
nbfd->filename = name;
|
||||||
nbfd->filename = name;
|
|
||||||
gdb_bfd_stash_filename (nbfd);
|
|
||||||
xfree (name);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup = make_cleanup_bfd_unref (nbfd);
|
cleanup = make_cleanup_bfd_unref (nbfd);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ if ![isnative] then {
|
|||||||
untested "Remote system"
|
untested "Remote system"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
return
|
||||||
# Can the system run this test (in particular support sparse
|
# Can the system run this test (in particular support sparse
|
||||||
# corefiles)? On systems that lack sparse corefile support this test
|
# corefiles)? On systems that lack sparse corefile support this test
|
||||||
# consumes too many resources - gigabytes worth of disk space and
|
# consumes too many resources - gigabytes worth of disk space and
|
||||||
|
Reference in New Issue
Block a user