Add tiny memory model GD test cases.
[deliverable/binutils-gdb.git] / gdb / solib-darwin.c
index ba807a2746cba1a00052b69b3e1e82c61db99da6..d742f825f9054017ed79651ac9f59b9e4033b7b0 100644 (file)
@@ -1,6 +1,6 @@
 /* Handle Darwin shared libraries for GDB, the GNU Debugger.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -30,8 +30,6 @@
 #include "gdbthread.h"
 #include "gdb_bfd.h"
 
-#include "gdb_assert.h"
-
 #include "solist.h"
 #include "solib.h"
 #include "solib-svr4.h"
@@ -40,7 +38,6 @@
 #include "elf-bfd.h"
 #include "exec.h"
 #include "auxv.h"
-#include "exceptions.h"
 #include "mach-o.h"
 #include "mach-o/external.h"
 
@@ -70,7 +67,7 @@ struct gdb_dyld_all_image_infos
 
 /* Current all_image_infos version.  */
 #define DYLD_VERSION_MIN 1
-#define DYLD_VERSION_MAX 12
+#define DYLD_VERSION_MAX 14
 
 /* Per PSPACE specific data.  */
 struct darwin_info
@@ -103,7 +100,7 @@ get_darwin_info (void)
   if (info != NULL)
     return info;
 
-  info = XZALLOC (struct darwin_info);
+  info = XCNEW (struct darwin_info);
   set_program_space_data (current_program_space,
                          solib_darwin_pspace_data, info);
   return info;
@@ -304,7 +301,7 @@ darwin_current_sos (void)
        break;
 
       /* Create and fill the new so_list element.  */
-      dnew = XZALLOC (struct darwin_so_list);
+      dnew = XCNEW (struct darwin_so_list);
       new = &dnew->sl;
       old_chain = make_cleanup (xfree, dnew);
 
@@ -513,7 +510,10 @@ darwin_solib_create_inferior_hook (int from_tty)
   darwin_load_image_infos (info);
 
   if (!darwin_dyld_version_ok (info))
-    return;
+    {
+      warning (_("unhandled dyld version (%d)"), info->all_image.version);
+      return;
+    }
 
   create_solib_event_breakpoint (target_gdbarch (), info->all_image.notifier);
 
@@ -521,26 +521,10 @@ darwin_solib_create_inferior_hook (int from_tty)
   load_addr = darwin_read_exec_load_addr (info);
   if (load_addr != 0 && symfile_objfile != NULL)
     {
-      CORE_ADDR vmaddr = 0;
-      struct mach_o_data_struct *md = bfd_mach_o_get_data (exec_bfd);
-      unsigned int i, num;
+      CORE_ADDR vmaddr;
 
       /* Find the base address of the executable.  */
-      for (i = 0; i < md->header.ncmds; i++)
-       {
-         struct bfd_mach_o_load_command *cmd = &md->commands[i];
-
-         if (cmd->type != BFD_MACH_O_LC_SEGMENT
-             && cmd->type != BFD_MACH_O_LC_SEGMENT_64)
-           continue;
-         if (cmd->command.segment.fileoff == 0
-             && cmd->command.segment.vmaddr != 0
-             && cmd->command.segment.filesize != 0)
-           {
-             vmaddr = cmd->command.segment.vmaddr;
-             break;
-           }
-       }
+      vmaddr = bfd_mach_o_get_base_address (exec_bfd);
 
       /* Relocate.  */
       if (vmaddr != load_addr)
@@ -586,7 +570,7 @@ darwin_relocate_section_addresses (struct so_list *so,
 }
 \f
 static struct symbol *
-darwin_lookup_lib_symbol (const struct objfile *objfile,
+darwin_lookup_lib_symbol (struct objfile *objfile,
                          const char *name,
                          const domain_enum domain)
 {
This page took 0.027113 seconds and 4 git commands to generate.