gdb/
[deliverable/binutils-gdb.git] / gdb / i386-darwin-nat.c
index 2584dbc3b33ba414a8ba6a94d20650e45b3aecc9..23f6a6dfe2172544c285ab4050809bb6251cdd6b 100644 (file)
@@ -1,5 +1,5 @@
 /* Darwin support for GDB, the GNU debugger.
-   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2008, 2009, 2010
+   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
    Contributed by Apple Computer, Inc.
@@ -69,7 +69,9 @@ i386_darwin_fetch_inferior_registers (struct target_ops *ops,
              &gp_count);
          if (ret != KERN_SUCCESS)
            {
-             printf_unfiltered (_("Error calling thread_get_state for GP registers for thread 0x%ulx"), current_thread);
+             printf_unfiltered (_("Error calling thread_get_state for "
+                                  "GP registers for thread 0x%ulx"),
+                                current_thread);
              MACH_CHECK_ERROR (ret);
            }
          amd64_supply_native_gregset (regcache, &gp_regs.uts, -1);
@@ -87,7 +89,9 @@ i386_darwin_fetch_inferior_registers (struct target_ops *ops,
              &fp_count);
          if (ret != KERN_SUCCESS)
            {
-             printf_unfiltered (_("Error calling thread_get_state for float registers for thread 0x%ulx"), current_thread);
+             printf_unfiltered (_("Error calling thread_get_state for "
+                                  "float registers for thread 0x%ulx"),
+                                current_thread);
              MACH_CHECK_ERROR (ret);
            }
           amd64_supply_fxsave (regcache, -1, &fp_regs.ufs.fs64.__fpu_fcw);
@@ -109,7 +113,9 @@ i386_darwin_fetch_inferior_registers (struct target_ops *ops,
              &gp_count);
          if (ret != KERN_SUCCESS)
            {
-             printf_unfiltered (_("Error calling thread_get_state for GP registers for thread 0x%ulx"), current_thread);
+             printf_unfiltered (_("Error calling thread_get_state for "
+                                  "GP registers for thread 0x%ulx"),
+                                current_thread);
              MACH_CHECK_ERROR (ret);
            }
          for (i = 0; i < I386_NUM_GREGS; i++)
@@ -132,7 +138,9 @@ i386_darwin_fetch_inferior_registers (struct target_ops *ops,
              &fp_count);
          if (ret != KERN_SUCCESS)
            {
-             printf_unfiltered (_("Error calling thread_get_state for float registers for thread 0x%ulx"), current_thread);
+             printf_unfiltered (_("Error calling thread_get_state for "
+                                  "float registers for thread 0x%ulx"),
+                                current_thread);
              MACH_CHECK_ERROR (ret);
            }
           i387_supply_fxsave (regcache, -1, &fp_regs.__fpu_fcw);
@@ -255,23 +263,6 @@ i386_darwin_store_inferior_registers (struct target_ops *ops,
 
 /* Support for debug registers, boosted mostly from i386-linux-nat.c.  */
 
-#ifndef DR_FIRSTADDR
-#define DR_FIRSTADDR 0
-#endif
-
-#ifndef DR_LASTADDR
-#define DR_LASTADDR 3
-#endif
-
-#ifndef DR_STATUS
-#define DR_STATUS 6
-#endif
-
-#ifndef DR_CONTROL
-#define DR_CONTROL 7
-#endif
-
-
 static void
 i386_darwin_dr_set (int regnum, uint32_t value)
 {
@@ -293,7 +284,9 @@ i386_darwin_dr_set (int regnum, uint32_t value)
 
   if (ret != KERN_SUCCESS)
     {
-      printf_unfiltered (_("Error reading debug registers thread 0x%x via thread_get_state\n"), (int) current_thread);
+      printf_unfiltered (_("Error reading debug registers "
+                          "thread 0x%x via thread_get_state\n"),
+                        (int) current_thread);
       MACH_CHECK_ERROR (ret);
     }
 
@@ -330,7 +323,9 @@ i386_darwin_dr_set (int regnum, uint32_t value)
 
   if (ret != KERN_SUCCESS)
     {
-      printf_unfiltered (_("Error writing debug registers thread 0x%x via thread_get_state\n"), (int) current_thread);
+      printf_unfiltered (_("Error writing debug registers "
+                          "thread 0x%x via thread_get_state\n"),
+                        (int) current_thread);
       MACH_CHECK_ERROR (ret);
     }
 }
@@ -355,7 +350,9 @@ i386_darwin_dr_get (int regnum)
 
   if (ret != KERN_SUCCESS)
     {
-      printf_unfiltered (_("Error reading debug registers thread 0x%x via thread_get_state\n"), (int) current_thread);
+      printf_unfiltered (_("Error reading debug registers "
+                          "thread 0x%x via thread_get_state\n"),
+                        (int) current_thread);
       MACH_CHECK_ERROR (ret);
     }
 
@@ -396,12 +393,10 @@ i386_darwin_dr_set_addr (int regnum, CORE_ADDR addr)
   i386_darwin_dr_set (DR_FIRSTADDR + regnum, addr);
 }
 
-void
-i386_darwin_dr_reset_addr (int regnum)
+CORE_ADDR
+i386_darwin_dr_get_addr (int regnum)
 {
-  gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
-
-  i386_darwin_dr_set (DR_FIRSTADDR + regnum, 0L);
+  return i386_darwin_dr_get (regnum);
 }
 
 unsigned long
@@ -410,6 +405,12 @@ i386_darwin_dr_get_status (void)
   return i386_darwin_dr_get (DR_STATUS);
 }
 
+unsigned long
+i386_darwin_dr_get_control (void)
+{
+  return i386_darwin_dr_get (DR_CONTROL);
+}
+
 void
 darwin_check_osabi (darwin_inferior *inf, thread_t thread)
 {
@@ -542,7 +543,8 @@ darwin_set_sstep (thread_t thread, int enable)
          return;
        if ((regs.uts.ts32.__eflags & X86_EFLAGS_T) == bit)
          return;
-       regs.uts.ts32.__eflags = (regs.uts.ts32.__eflags & ~X86_EFLAGS_T) | bit;
+       regs.uts.ts32.__eflags
+         = (regs.uts.ts32.__eflags & ~X86_EFLAGS_T) | bit;
        kret = thread_set_state (thread, x86_THREAD_STATE, 
                                 (thread_state_t) &regs, count);
        MACH_CHECK_ERROR (kret);
@@ -557,7 +559,8 @@ darwin_set_sstep (thread_t thread, int enable)
          return;
        if ((regs.uts.ts64.__rflags & X86_EFLAGS_T) == bit)
          return;
-       regs.uts.ts64.__rflags = (regs.uts.ts64.__rflags & ~X86_EFLAGS_T) | bit;
+       regs.uts.ts64.__rflags
+         = (regs.uts.ts64.__rflags & ~X86_EFLAGS_T) | bit;
        kret = thread_set_state (thread, x86_THREAD_STATE, 
                                 (thread_state_t) &regs, count);
        MACH_CHECK_ERROR (kret);
@@ -565,7 +568,7 @@ darwin_set_sstep (thread_t thread, int enable)
       break;
 #endif
     default:
-      error (_("darwin_set_sstep: unknown flavour: %d\n"), regs.tsh.flavor);
+      error (_("darwin_set_sstep: unknown flavour: %d"), regs.tsh.flavor);
     }
 }
 
This page took 0.025944 seconds and 4 git commands to generate.