forked from Imagelibrary/binutils-gdb
* symfile.c (reread_symbols): Include bfd_errmsg string in error
message if bfd_close fails. * exec.c (exec_close), solib.c (clear_solib), corelow.c (core_close), objfiles.c (free_objfile), irix5-nat.c (clear_solib), osfsolib.c (clear_solib), remote-utils.c (gr_load_image): Check for errors from bfd_close. * solib.c (look_for_base), remote-utils.c (gr_load_image), remote-udi.c (download), corelow.c (core_open), symfile.c (symfile_bfd_open), symfile.c (generic_load): Add comment regarding error from bfd_close. * remote-udi.c (download), remote-utils.c (gr_load_image): Add comment about bogus handling of errors from bfd_openr. * exec.c (exec_close): Add comment regarding memory leak and dangling reference to vp->name.
This commit is contained in:
@@ -7,8 +7,8 @@ Fri Oct 14 10:29:08 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
|
|||||||
message if bfd_close fails.
|
message if bfd_close fails.
|
||||||
* exec.c (exec_close), solib.c (clear_solib), corelow.c
|
* exec.c (exec_close), solib.c (clear_solib), corelow.c
|
||||||
(core_close), objfiles.c (free_objfile), irix5-nat.c
|
(core_close), objfiles.c (free_objfile), irix5-nat.c
|
||||||
(clear_solib), remote-utils.c (gr_load_image):
|
(clear_solib), osfsolib.c (clear_solib), remote-utils.c
|
||||||
Check for errors from bfd_close.
|
(gr_load_image): Check for errors from bfd_close.
|
||||||
* solib.c (look_for_base), remote-utils.c (gr_load_image),
|
* solib.c (look_for_base), remote-utils.c (gr_load_image),
|
||||||
remote-udi.c (download), corelow.c (core_open), symfile.c
|
remote-udi.c (download), corelow.c (core_open), symfile.c
|
||||||
(symfile_bfd_open), symfile.c (generic_load): Add comment
|
(symfile_bfd_open), symfile.c (generic_load): Add comment
|
||||||
|
|||||||
@@ -54,11 +54,15 @@ static void
|
|||||||
core_close (quitting)
|
core_close (quitting)
|
||||||
int quitting;
|
int quitting;
|
||||||
{
|
{
|
||||||
|
char *name;
|
||||||
inferior_pid = 0; /* Avoid confusion from thread stuff */
|
inferior_pid = 0; /* Avoid confusion from thread stuff */
|
||||||
|
|
||||||
if (core_bfd) {
|
if (core_bfd) {
|
||||||
free (bfd_get_filename (core_bfd));
|
name = bfd_get_filename (core_bfd);
|
||||||
bfd_close (core_bfd);
|
if (!bfd_close (core_bfd))
|
||||||
|
warning ("cannot close \"%s\": %s",
|
||||||
|
bfd_filename, bfd_errmsg (bfd_get_error ()));
|
||||||
|
free (name);
|
||||||
core_bfd = NULL;
|
core_bfd = NULL;
|
||||||
#ifdef CLEAR_SOLIB
|
#ifdef CLEAR_SOLIB
|
||||||
CLEAR_SOLIB ();
|
CLEAR_SOLIB ();
|
||||||
@@ -154,6 +158,9 @@ core_open (filename, from_tty)
|
|||||||
if (!bfd_check_format (temp_bfd, bfd_core))
|
if (!bfd_check_format (temp_bfd, bfd_core))
|
||||||
{
|
{
|
||||||
/* Do it after the err msg */
|
/* Do it after the err msg */
|
||||||
|
/* FIXME: should be checking for errors from bfd_close (for one thing,
|
||||||
|
on error it does not free all the storage associated with the
|
||||||
|
bfd). */
|
||||||
make_cleanup (bfd_close, temp_bfd);
|
make_cleanup (bfd_close, temp_bfd);
|
||||||
error ("\"%s\" is not a core dump: %s", filename, bfd_errmsg(bfd_get_error ()));
|
error ("\"%s\" is not a core dump: %s", filename, bfd_errmsg(bfd_get_error ()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -792,7 +792,9 @@ clear_solib()
|
|||||||
if (so_list_head -> abfd)
|
if (so_list_head -> abfd)
|
||||||
{
|
{
|
||||||
bfd_filename = bfd_get_filename (so_list_head -> abfd);
|
bfd_filename = bfd_get_filename (so_list_head -> abfd);
|
||||||
bfd_close (so_list_head -> abfd);
|
if (!bfd_close (so_list_head -> abfd))
|
||||||
|
warning ("cannot close \"%s\": %s",
|
||||||
|
bfd_filename, bfd_errmsg (bfd_get_error ()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* This happens for the executable on SVR4. */
|
/* This happens for the executable on SVR4. */
|
||||||
|
|||||||
@@ -341,7 +341,9 @@ free_objfile (objfile)
|
|||||||
if (objfile -> obfd != NULL)
|
if (objfile -> obfd != NULL)
|
||||||
{
|
{
|
||||||
char *name = bfd_get_filename (objfile->obfd);
|
char *name = bfd_get_filename (objfile->obfd);
|
||||||
bfd_close (objfile -> obfd);
|
if (!bfd_close (objfile -> obfd))
|
||||||
|
warning ("cannot close \"%s\": %s",
|
||||||
|
name, bfd_errmsg (bfd_get_error ()));
|
||||||
free (name);
|
free (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -679,7 +679,9 @@ clear_solib()
|
|||||||
if (so_list_head -> abfd)
|
if (so_list_head -> abfd)
|
||||||
{
|
{
|
||||||
bfd_filename = bfd_get_filename (so_list_head -> abfd);
|
bfd_filename = bfd_get_filename (so_list_head -> abfd);
|
||||||
bfd_close (so_list_head -> abfd);
|
if (!bfd_close (so_list_head -> abfd))
|
||||||
|
warning ("cannot close \"%s\": %s",
|
||||||
|
bfd_filename, bfd_errmsg (bfd_get_error ()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* This happens for the executable on SVR4. */
|
/* This happens for the executable on SVR4. */
|
||||||
|
|||||||
@@ -648,8 +648,13 @@ gr_load_image (args, fromtty)
|
|||||||
abfd = bfd_openr (args, (char *) 0);
|
abfd = bfd_openr (args, (char *) 0);
|
||||||
|
|
||||||
if (!abfd)
|
if (!abfd)
|
||||||
|
/* FIXME: should be using bfd_errmsg, not assuming it was
|
||||||
|
bfd_error_system_call. */
|
||||||
perror_with_name (args);
|
perror_with_name (args);
|
||||||
|
|
||||||
|
/* FIXME: should be checking for errors from bfd_close (for one thing,
|
||||||
|
on error it does not free all the storage associated with the
|
||||||
|
bfd). */
|
||||||
old_cleanups = make_cleanup (bfd_close, abfd);
|
old_cleanups = make_cleanup (bfd_close, abfd);
|
||||||
|
|
||||||
QUIT;
|
QUIT;
|
||||||
@@ -682,7 +687,9 @@ gr_load_image (args, fromtty)
|
|||||||
|
|
||||||
free (buffer);
|
free (buffer);
|
||||||
write_pc (bfd_get_start_address (abfd));
|
write_pc (bfd_get_start_address (abfd));
|
||||||
bfd_close (abfd);
|
if (!bfd_close (abfd))
|
||||||
|
warning ("cannot close \"%s\": %s",
|
||||||
|
args, bfd_errmsg (bfd_get_error ()));
|
||||||
discard_cleanups (old_cleanups);
|
discard_cleanups (old_cleanups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user