Change program_space::ebfd to a gdb_bfd_ref_ptr
[deliverable/binutils-gdb.git] / gdb / solib-darwin.c
index ee0483d2c87a2702beb91c343a5bbf5e3ba23dde..e784e5618a0568ab0dafb629315ed6ca769679fe 100644 (file)
@@ -192,12 +192,13 @@ find_program_interpreter (void)
 {
   char *buf = NULL;
 
-  /* If we have an exec_bfd, get the interpreter from the load commands.  */
-  if (exec_bfd)
+  /* If we have an current exec_bfd, get the interpreter from the load
+     commands.  */
+  if (current_program_space->exec_bfd ())
     {
       bfd_mach_o_load_command *cmd;
 
-      if (bfd_mach_o_lookup_command (exec_bfd,
+      if (bfd_mach_o_lookup_command (current_program_space->exec_bfd (),
                                      BFD_MACH_O_LC_LOAD_DYLINKER, &cmd) == 1)
         return cmd->command.dylinker.name_str;
     }
@@ -251,8 +252,6 @@ darwin_current_sos (void)
       CORE_ADDR path_addr;
       struct mach_o_header_external hdr;
       unsigned long hdr_val;
-      gdb::unique_xmalloc_ptr<char> file_path;
-      int errcode;
 
       /* Read image info from inferior.  */
       if (target_read_memory (iinfo, buf, image_info_size))
@@ -275,9 +274,9 @@ darwin_current_sos (void)
       if (hdr_val == BFD_MACH_O_MH_EXECUTE)
         continue;
 
-      target_read_string (path_addr, &file_path,
-                         SO_NAME_MAX_PATH_SIZE - 1, &errcode);
-      if (errcode)
+      gdb::unique_xmalloc_ptr<char> file_path
+       = target_read_string (path_addr, SO_NAME_MAX_PATH_SIZE - 1);
+      if (file_path == nullptr)
        break;
 
       /* Create and fill the new so_list element.  */
@@ -545,7 +544,7 @@ darwin_solib_create_inferior_hook (int from_tty)
       CORE_ADDR vmaddr;
 
       /* Find the base address of the executable.  */
-      vmaddr = bfd_mach_o_get_base_address (exec_bfd);
+      vmaddr = bfd_mach_o_get_base_address (current_program_space->exec_bfd ());
 
       /* Relocate.  */
       if (vmaddr != load_addr)
@@ -559,7 +558,8 @@ darwin_solib_create_inferior_hook (int from_tty)
     {
       /* Dyld hasn't yet relocated itself, so the notifier address may
         be incorrect (as it has to be relocated).  */
-      CORE_ADDR start = bfd_get_start_address (exec_bfd);
+      CORE_ADDR start
+       = bfd_get_start_address (current_program_space->exec_bfd ());
       if (start == 0)
        notifier = 0;
       else
This page took 0.024724 seconds and 4 git commands to generate.