/* Darwin support for GDB, the GNU debugger.
- Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright 1997-2002, 2008-2012 Free Software Foundation, Inc.
Contributed by Apple Computer, Inc.
#include "arch-utils.h"
#include "gdbcore.h"
+#include "i386-nat.h"
#include "darwin-nat.h"
#include "i386-darwin-tdep.h"
&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);
&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);
&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++)
&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);
/* 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)
{
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);
}
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);
}
}
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);
}
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
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)
{
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) ®s, count);
MACH_CHECK_ERROR (kret);
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) ®s, count);
MACH_CHECK_ERROR (kret);
break;
#endif
default:
- error (_("darwin_set_sstep: unknown flavour: %d\n"), regs.tsh.flavor);
+ error (_("darwin_set_sstep: unknown flavour: %d"), regs.tsh.flavor);
}
}