(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>
+
+ * 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
int reclen;
time_t start_time, end_time;
unsigned long data_count = 0;
+ struct cleanup *cleanup;
srec = (char *) alloca (maxrecsize + 1);
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;
}
serial_flush_input (desc);
report_transfer_performance (data_count, start_time, end_time);
+ do_cleanups (cleanup);
}
/*
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);
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);
confused... */
clear_symtab_users (0);
+ do_cleanups (cleanup);
}
static void
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");
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)
confused... */
clear_symtab_users (0);
+ do_cleanups (cleanup);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
unsigned int i;
unsigned int srec_frame = 200;
int reclen;
+ struct cleanup *cleanup;
static int hashmark = 1;
buffer = alloca (srec_frame * 2 + 256);
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;
}
send_srec (srec, reclen, abfd->start_address);
serial_flush_input (mips_desc);
+ do_cleanups (cleanup);
}
/*
int bintotal = 0;
int final = 0;
int finished = 0;
+ struct cleanup *cleanup;
buffer = (char *) xmalloc (MAXRECSIZE + 1);
binbuf = (unsigned char *) xmalloc (BINCHUNK);
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;
}
pmon_end_download (final, bintotal);
}
+ do_cleanups (cleanup);
return;
}
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)
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
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;