mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 04:29:49 +00:00
darwin: warning resuming inferior after attach
This patch avoids a warning when resuming the execution of a program that we attached to. For instance: (gdb) attach 29989 (gdb) continue Continuing. warning: Mach error at "/[...]/darwin-nat.c:738" in function "darwin_resume_thread": (os/kern) failure (0x5) The warning is relatively harmless, but worrisome for the average user. The warning comes from the fact that darwin_wait recorded that the fake stop event corresponding to the suspend action was caused by the main thread being suspended on a SIGTRAP. As a result of this, when resuming the program's execution, we try to resume the thread's execution as well. This is where the issue occurs, as the thread was not in fact suspended, thus triggering the warning. gdb/ChangeLog: * darwin-nat.c (darwin_setup_fake_stop_event): New function. (darwin_attach): Adjust using darwin_setup_fake_stop_event.
This commit is contained in:
parent
c8c9911faa
commit
726ce67c26
@ -1,3 +1,8 @@
|
|||||||
|
2013-05-06 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
|
* darwin-nat.c (darwin_setup_fake_stop_event): New function.
|
||||||
|
(darwin_attach): Adjust using darwin_setup_fake_stop_event.
|
||||||
|
|
||||||
2013-05-06 Joel Brobecker <brobecker@adacore.com>
|
2013-05-06 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
* darwin-nat.c: Replace all "%x" instances in format strings
|
* darwin-nat.c: Replace all "%x" instances in format strings
|
||||||
|
@ -1586,6 +1586,32 @@ darwin_create_inferior (struct target_ops *ops, char *exec_file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Set things up such that the next call to darwin_wait will immediately
|
||||||
|
return a fake stop event for inferior INF.
|
||||||
|
|
||||||
|
This assumes that the inferior's thread list has been initialized,
|
||||||
|
as it will suspend the inferior's first thread. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
darwin_setup_fake_stop_event (struct inferior *inf)
|
||||||
|
{
|
||||||
|
darwin_thread_t *thread;
|
||||||
|
kern_return_t kret;
|
||||||
|
|
||||||
|
gdb_assert (darwin_inf_fake_stop == NULL);
|
||||||
|
darwin_inf_fake_stop = inf;
|
||||||
|
|
||||||
|
/* When detecting a fake pending stop event, darwin_wait returns
|
||||||
|
an event saying that the first thread is in a DARWIN_STOPPED
|
||||||
|
state. To make that accurate, we need to suspend that thread
|
||||||
|
as well. Otherwise, we'll try resuming it when resuming the
|
||||||
|
inferior, and get a warning because the thread's suspend count
|
||||||
|
is already zero, making the resume request useless. */
|
||||||
|
thread = VEC_index (darwin_thread_t, inf->private->threads, 0);
|
||||||
|
kret = thread_suspend (thread->gdb_port);
|
||||||
|
MACH_CHECK_ERROR (kret);
|
||||||
|
}
|
||||||
|
|
||||||
/* Attach to process PID, then initialize for debugging it
|
/* Attach to process PID, then initialize for debugging it
|
||||||
and wait for the trace-trap that results from attaching. */
|
and wait for the trace-trap that results from attaching. */
|
||||||
static void
|
static void
|
||||||
@ -1637,8 +1663,8 @@ darwin_attach (struct target_ops *ops, char *args, int from_tty)
|
|||||||
|
|
||||||
darwin_check_osabi (inf->private, ptid_get_tid (inferior_ptid));
|
darwin_check_osabi (inf->private, ptid_get_tid (inferior_ptid));
|
||||||
|
|
||||||
gdb_assert (darwin_inf_fake_stop == NULL);
|
darwin_setup_fake_stop_event (inf);
|
||||||
darwin_inf_fake_stop = inf;
|
|
||||||
inf->private->no_ptrace = 1;
|
inf->private->no_ptrace = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user