/* Darwin support for GDB, the GNU debugger.
- Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by AdaCore.
/* Port set. */
mach_port_t darwin_port_set;
-/* Page size. */
+/* Page size. */
static vm_size_t mach_page_size;
/* If Set, catch all mach exceptions (before they are converted to signals
if (func == NULL)
func = _("[UNKNOWN]");
- warning (_("Mach error at \"%s:%u\" in function \"%s\": %s (0x%lx)\n"),
+ warning (_("Mach error at \"%s:%u\" in function \"%s\": %s (0x%lx)"),
file, line, func, mach_error_string (ret), (unsigned long) ret);
}
old_ix++;
continue;
}
- gdb_assert (0);
+ gdb_assert_not_reached ("unexpected thread case");
}
if (darwin_inf->threads)
case EXC_BREAKPOINT:
/* Many internal GDB routines expect breakpoints to be reported
as TARGET_SIGNAL_TRAP, and will report TARGET_EXC_BREAKPOINT
- as a spurious signal. */
+ as a spurious signal. */
status->value.sig = TARGET_SIGNAL_TRAP;
break;
default:
static int
cancel_breakpoint (ptid_t ptid)
{
- /* Arrange for a breakpoint to be hit again later. We will handle
+ /* Arrange for a breakpoint to be hit again later. We will handle
the current event, eventually we will resume this thread, and this
breakpoint will trap again.
res = kill (inf->pid, SIGSTOP);
if (res != 0)
- warning (_("cannot kill: %s\n"), safe_strerror (errno));
+ warning (_("cannot kill: %s"), safe_strerror (errno));
/* Wait until the process is really stopped. */
while (1)
darwin_reply_to_all_pending_messages (inf);
- darwin_resume_inferior (inf);
+ /* When using ptrace, we have just performed a PT_DETACH, which
+ resumes the inferior. On the other hand, when we are not using
+ ptrace, we need to resume its execution ourselves. */
+ if (inf->private->no_ptrace)
+ darwin_resume_inferior (inf);
darwin_mourn_inferior (ops);
}
inferior_debug (8, _("darwin_read_write_inferior(task=%x, %s, len=%d)\n"),
task, core_addr_to_string (addr), length);
- /* Get memory from inferior with page aligned addresses */
+ /* Get memory from inferior with page aligned addresses. */
kret = mach_vm_read (task, low_address, aligned_length,
&copied, ©_count);
if (kret != KERN_SUCCESS)
core_addr_to_string (region_start),
core_addr_to_string (region_length));
- /* Check for holes in memory */
+ /* Check for holes in memory. */
if (region_start > region_address)
{
- warning (_("No memory at %s (vs %s+0x%x). Nothing written"),
+ warning (_("No memory at %s (vs %s+0x%x). Nothing written"),
core_addr_to_string (region_address),
core_addr_to_string (region_start),
(unsigned)region_length);
\f
/* Return 0 on failure, number of bytes handled otherwise. TARGET
- is ignored. */
+ is ignored. */
static int
darwin_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
struct mem_attrib *attrib, struct target_ops *target)