PR ld/12549
[binutils-gdb.git] / gdb / darwin-nat.c
index 26ee23a89ac6df9a443c6ce70ecae3e26ce4bb3e..1344101c7cb70ec3dda18031aa0bf9ee99bd6765 100644 (file)
@@ -1,5 +1,5 @@
 /* Darwin support for GDB, the GNU debugger.
-   Copyright (C) 2008-2012 Free Software Foundation, Inc.
+   Copyright (C) 2008-2013 Free Software Foundation, Inc.
 
    Contributed by AdaCore.
 
@@ -145,7 +145,7 @@ static struct inferior *darwin_inf_fake_stop;
 #define PAGE_ROUND(x) PAGE_TRUNC((x) + mach_page_size - 1)
 
 /* This controls output of inferior debugging.  */
-static int darwin_debug_flag = 0;
+static unsigned int darwin_debug_flag = 0;
 
 /* Create a __TEXT __info_plist section in the executable so that gdb could
    be signed.  This is required to get an authorization for task_for_pid.
@@ -1816,8 +1816,10 @@ out:
 
 /* Read LENGTH bytes at offset ADDR of task_dyld_info for TASK, and copy them
    to RDADDR.
-   Return 0 on failure; number of bytes read / writen otherwise.  */
+   Return 0 on failure; number of bytes read / written otherwise.  */
 
+#ifdef TASK_DYLD_INFO_COUNT
+/* This is not available in Darwin 9.  */
 static int
 darwin_read_dyld_info (task_t task, CORE_ADDR addr, char *rdaddr, int length)
 {
@@ -1839,6 +1841,7 @@ darwin_read_dyld_info (task_t task, CORE_ADDR addr, char *rdaddr, int length)
   memcpy (rdaddr, (char *)&task_dyld_info + addr, length);
   return length;
 }
+#endif
 
 \f
 /* Return 0 on failure, number of bytes handled otherwise.  TARGET
@@ -1881,6 +1884,7 @@ darwin_xfer_partial (struct target_ops *ops,
     case TARGET_OBJECT_MEMORY:
       return darwin_read_write_inferior (inf->private->task, offset,
                                          readbuf, writebuf, len);
+#ifdef TASK_DYLD_INFO_COUNT
     case TARGET_OBJECT_DARWIN_DYLD_INFO:
       if (writebuf != NULL || readbuf == NULL)
         {
@@ -1888,6 +1892,7 @@ darwin_xfer_partial (struct target_ops *ops,
           return -1;
         }
       return darwin_read_dyld_info (inf->private->task, offset, readbuf, len);
+#endif
     default:
       return -1;
     }
@@ -2057,12 +2062,12 @@ _initialize_darwin_inferior (void)
   inferior_debug (2, _("GDB task: 0x%lx, pid: %d\n"), mach_task_self (),
                   getpid ());
 
-  add_setshow_zinteger_cmd ("darwin", class_obscure,
-                           &darwin_debug_flag, _("\
+  add_setshow_zuinteger_cmd ("darwin", class_obscure,
+                            &darwin_debug_flag, _("\
 Set if printing inferior communication debugging statements."), _("\
 Show if printing inferior communication debugging statements."), NULL,
-                           NULL, NULL,
-                           &setdebuglist, &showdebuglist);
+                            NULL, NULL,
+                            &setdebuglist, &showdebuglist);
 
   add_setshow_boolean_cmd ("mach-exceptions", class_support,
                           &enable_mach_exceptions, _("\