* remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close.
(pmon_load_fast): Likewise. * m32r-rom.c (m32r_load): Use make_cleanup_bfd_close. (m32r_upload_command): Likewise. * dsrec.c (load_srec): Use make_cleanup_bfd_close. * solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init): Use make_cleanup_bfd_close.
This commit is contained in:
parent
a4453b7e0b
commit
d6ad71ba41
|
@ -1,3 +1,13 @@
|
|||
2012-07-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close.
|
||||
(pmon_load_fast): Likewise.
|
||||
* m32r-rom.c (m32r_load): Use make_cleanup_bfd_close.
|
||||
(m32r_upload_command): Likewise.
|
||||
* dsrec.c (load_srec): Use make_cleanup_bfd_close.
|
||||
* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
|
||||
Use make_cleanup_bfd_close.
|
||||
|
||||
2012-07-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* symfile.c (symfile_bfd_open): Don't copy name. Call
|
||||
|
|
|
@ -57,6 +57,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
|||
int reclen;
|
||||
time_t start_time, end_time;
|
||||
unsigned long data_count = 0;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
srec = (char *) alloca (maxrecsize + 1);
|
||||
|
||||
|
@ -67,9 +68,11 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
|||
return;
|
||||
}
|
||||
|
||||
cleanup = make_cleanup_bfd_close (abfd);
|
||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
||||
{
|
||||
printf_filtered (_("File is not an object file\n"));
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -171,6 +174,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
|
|||
serial_flush_input (desc);
|
||||
|
||||
report_transfer_performance (data_count, start_time, end_time);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -125,6 +125,7 @@ m32r_load (char *filename, int from_tty)
|
|||
bfd *abfd;
|
||||
unsigned int data_count = 0;
|
||||
struct timeval start_time, end_time;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
if (filename == NULL || filename[0] == 0)
|
||||
filename = get_exec_file (1);
|
||||
|
@ -132,6 +133,7 @@ m32r_load (char *filename, int from_tty)
|
|||
abfd = gdb_bfd_ref (bfd_openr (filename, 0));
|
||||
if (!abfd)
|
||||
error (_("Unable to open file %s."), filename);
|
||||
cleanup = make_cleanup_bfd_close (abfd);
|
||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
||||
error (_("File is not an object file."));
|
||||
gettimeofday (&start_time, NULL);
|
||||
|
@ -189,6 +191,7 @@ m32r_load (char *filename, int from_tty)
|
|||
confused... */
|
||||
|
||||
clear_symtab_users (0);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -435,6 +438,7 @@ m32r_upload_command (char *args, int from_tty)
|
|||
char buf[1024];
|
||||
struct hostent *hostent;
|
||||
struct in_addr inet_addr;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
/* First check to see if there's an ethernet port! */
|
||||
monitor_printf ("ust\r");
|
||||
|
@ -526,6 +530,7 @@ m32r_upload_command (char *args, int from_tty)
|
|||
|
||||
gettimeofday (&end_time, NULL);
|
||||
abfd = gdb_bfd_ref (bfd_openr (args, 0));
|
||||
cleanup = make_cleanup_bfd_close (abfd);
|
||||
if (abfd != NULL)
|
||||
{ /* Download is done -- print section statistics. */
|
||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
||||
|
@ -566,6 +571,7 @@ m32r_upload_command (char *args, int from_tty)
|
|||
confused... */
|
||||
|
||||
clear_symtab_users (0);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||
|
|
|
@ -2784,6 +2784,7 @@ mips_load_srec (char *args)
|
|||
unsigned int i;
|
||||
unsigned int srec_frame = 200;
|
||||
int reclen;
|
||||
struct cleanup *cleanup;
|
||||
static int hashmark = 1;
|
||||
|
||||
buffer = alloca (srec_frame * 2 + 256);
|
||||
|
@ -2795,9 +2796,11 @@ mips_load_srec (char *args)
|
|||
return;
|
||||
}
|
||||
|
||||
cleanup = make_cleanup_bfd_close (abfd);
|
||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
||||
{
|
||||
printf_filtered ("File is not an object file\n");
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2851,6 +2854,7 @@ mips_load_srec (char *args)
|
|||
send_srec (srec, reclen, abfd->start_address);
|
||||
|
||||
serial_flush_input (mips_desc);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3367,6 +3371,7 @@ pmon_load_fast (char *file)
|
|||
int bintotal = 0;
|
||||
int final = 0;
|
||||
int finished = 0;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
buffer = (char *) xmalloc (MAXRECSIZE + 1);
|
||||
binbuf = (unsigned char *) xmalloc (BINCHUNK);
|
||||
|
@ -3377,10 +3382,12 @@ pmon_load_fast (char *file)
|
|||
printf_filtered ("Unable to open file %s\n", file);
|
||||
return;
|
||||
}
|
||||
cleanup = make_cleanup_bfd_close (abfd);
|
||||
|
||||
if (bfd_check_format (abfd, bfd_object) == 0)
|
||||
{
|
||||
printf_filtered ("File is not an object file\n");
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3504,6 +3511,7 @@ pmon_load_fast (char *file)
|
|||
pmon_end_download (final, bintotal);
|
||||
}
|
||||
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -357,6 +357,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
|
|||
gdb_byte *interp_name;
|
||||
CORE_ADDR load_addr = 0;
|
||||
bfd *dyld_bfd = NULL;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
/* This method doesn't work with an attached process. */
|
||||
if (current_inferior ()->attach_flag)
|
||||
|
@ -367,24 +368,30 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
|
|||
if (!interp_name)
|
||||
return;
|
||||
|
||||
cleanup = make_cleanup (null_cleanup, NULL);
|
||||
|
||||
/* Create a bfd for the interpreter. */
|
||||
dyld_bfd = gdb_bfd_ref (bfd_openr (interp_name, gnutarget));
|
||||
if (dyld_bfd)
|
||||
{
|
||||
bfd *sub;
|
||||
|
||||
make_cleanup_bfd_close (dyld_bfd);
|
||||
sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object,
|
||||
gdbarch_bfd_arch_info (target_gdbarch));
|
||||
if (sub)
|
||||
dyld_bfd = sub;
|
||||
else
|
||||
{
|
||||
gdb_bfd_unref (dyld_bfd);
|
||||
dyld_bfd = NULL;
|
||||
dyld_bfd = gdb_bfd_ref (sub);
|
||||
make_cleanup_bfd_close (sub);
|
||||
}
|
||||
else
|
||||
dyld_bfd = NULL;
|
||||
}
|
||||
if (!dyld_bfd)
|
||||
return;
|
||||
{
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We find the dynamic linker's base address by examining
|
||||
the current pc (which should point at the entry point for the
|
||||
|
@ -396,7 +403,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
|
|||
info->all_image_addr =
|
||||
lookup_symbol_from_bfd (dyld_bfd, "_dyld_all_image_infos");
|
||||
|
||||
gdb_bfd_unref (dyld_bfd);
|
||||
do_cleanups (cleanup);
|
||||
|
||||
if (info->all_image_addr == 0)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue