* inferior.h (ptid_match): Declare.
* infrun.c (ptid_match): New. * remote.c (queued_stop_reply): Rewrite and use ptid_match. (handle_notification): Add debug output. * linux-nat.c (ptid_match): Delete.
This commit is contained in:
parent
09de9781bd
commit
0723dbf578
@ -1,3 +1,11 @@
|
||||
2010-02-24 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* inferior.h (ptid_match): Declare.
|
||||
* infrun.c (ptid_match): New.
|
||||
* remote.c (queued_stop_reply): Rewrite and use ptid_match.
|
||||
(handle_notification): Add debug output.
|
||||
* linux-nat.c (ptid_match): Delete.
|
||||
|
||||
2010-02-24 David S. Miller <davem@davemloft.net>
|
||||
|
||||
* gdb_ptrace.h (PT_SYSCALL): If PTRACE_SYSCALL is available, use it.
|
||||
|
@ -105,6 +105,16 @@ extern int ptid_equal (ptid_t p1, ptid_t p2);
|
||||
/* Return true if PTID represents a process id. */
|
||||
extern int ptid_is_pid (ptid_t ptid);
|
||||
|
||||
/* Returns true if PTID matches filter FILTER. FILTER can be the wild
|
||||
card MINUS_ONE_PTID (all ptid match it); can be a ptid representing
|
||||
a process (ptid_is_pid returns true), in which case, all lwps and
|
||||
threads of that given process match, lwps and threads of other
|
||||
processes do not; or, it can represent a specific thread, in which
|
||||
case, only that thread will match true. PTID must represent a
|
||||
specific LWP or THREAD, it can never be a wild card. */
|
||||
|
||||
extern int ptid_match (ptid_t ptid, ptid_t filter);
|
||||
|
||||
/* Save value of inferior_ptid so that it may be restored by
|
||||
a later call to do_cleanups(). Returns the struct cleanup
|
||||
pointer needed for later doing the cleanup. */
|
||||
|
20
gdb/infrun.c
20
gdb/infrun.c
@ -6126,6 +6126,26 @@ ptid_is_pid (ptid_t ptid)
|
||||
return (ptid_get_lwp (ptid) == 0 && ptid_get_tid (ptid) == 0);
|
||||
}
|
||||
|
||||
int
|
||||
ptid_match (ptid_t ptid, ptid_t filter)
|
||||
{
|
||||
/* Since both parameters have the same type, prevent easy mistakes
|
||||
from happening. */
|
||||
gdb_assert (!ptid_equal (ptid, minus_one_ptid)
|
||||
&& !ptid_equal (ptid, null_ptid)
|
||||
&& !ptid_is_pid (ptid));
|
||||
|
||||
if (ptid_equal (filter, minus_one_ptid))
|
||||
return 1;
|
||||
if (ptid_is_pid (filter)
|
||||
&& ptid_get_pid (ptid) == ptid_get_pid (filter))
|
||||
return 1;
|
||||
else if (ptid_equal (ptid, filter))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* restore_inferior_ptid() will be used by the cleanup machinery
|
||||
to restore the inferior_ptid value saved in a call to
|
||||
save_inferior_ptid(). */
|
||||
|
@ -1221,33 +1221,6 @@ find_lwp_pid (ptid_t ptid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Returns true if PTID matches filter FILTER. FILTER can be the wild
|
||||
card MINUS_ONE_PTID (all ptid match it); can be a ptid representing
|
||||
a process (ptid_is_pid returns true), in which case, all lwps of
|
||||
that give process match, lwps of other process do not; or, it can
|
||||
represent a specific thread, in which case, only that thread will
|
||||
match true. PTID must represent an LWP, it can never be a wild
|
||||
card. */
|
||||
|
||||
static int
|
||||
ptid_match (ptid_t ptid, ptid_t filter)
|
||||
{
|
||||
/* Since both parameters have the same type, prevent easy mistakes
|
||||
from happening. */
|
||||
gdb_assert (!ptid_equal (ptid, minus_one_ptid)
|
||||
&& !ptid_equal (ptid, null_ptid));
|
||||
|
||||
if (ptid_equal (filter, minus_one_ptid))
|
||||
return 1;
|
||||
if (ptid_is_pid (filter)
|
||||
&& ptid_get_pid (ptid) == ptid_get_pid (filter))
|
||||
return 1;
|
||||
else if (ptid_equal (ptid, filter))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Call CALLBACK with its second argument set to DATA for every LWP in
|
||||
the list. If CALLBACK returns 1 for a particular LWP, return a
|
||||
pointer to the structure describing that LWP immediately.
|
||||
|
45
gdb/remote.c
45
gdb/remote.c
@ -4637,26 +4637,23 @@ do_stop_reply_xfree (void *arg)
|
||||
static struct stop_reply *
|
||||
queued_stop_reply (ptid_t ptid)
|
||||
{
|
||||
struct stop_reply *it, *prev;
|
||||
struct stop_reply head;
|
||||
struct stop_reply *it;
|
||||
struct stop_reply **it_link;
|
||||
|
||||
head.next = stop_reply_queue;
|
||||
prev = &head;
|
||||
|
||||
it = head.next;
|
||||
|
||||
if (!ptid_equal (ptid, minus_one_ptid))
|
||||
for (; it; prev = it, it = it->next)
|
||||
if (ptid_equal (ptid, it->ptid))
|
||||
break;
|
||||
|
||||
if (it)
|
||||
it = stop_reply_queue;
|
||||
it_link = &stop_reply_queue;
|
||||
while (it)
|
||||
{
|
||||
prev->next = it->next;
|
||||
it->next = NULL;
|
||||
}
|
||||
if (ptid_match (it->ptid, ptid))
|
||||
{
|
||||
*it_link = it->next;
|
||||
it->next = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
stop_reply_queue = head.next;
|
||||
it_link = &it->next;
|
||||
it = *it_link;
|
||||
}
|
||||
|
||||
if (stop_reply_queue)
|
||||
/* There's still at least an event left. */
|
||||
@ -6169,10 +6166,13 @@ handle_notification (char *buf, size_t length)
|
||||
if (strncmp (buf, "Stop:", 5) == 0)
|
||||
{
|
||||
if (pending_stop_reply)
|
||||
/* We've already parsed the in-flight stop-reply, but the stub
|
||||
for some reason thought we didn't, possibly due to timeout
|
||||
on its side. Just ignore it. */
|
||||
;
|
||||
{
|
||||
/* We've already parsed the in-flight stop-reply, but the
|
||||
stub for some reason thought we didn't, possibly due to
|
||||
timeout on its side. Just ignore it. */
|
||||
if (remote_debug)
|
||||
fprintf_unfiltered (gdb_stdlog, "ignoring resent notification\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
struct cleanup *old_chain;
|
||||
@ -6190,6 +6190,9 @@ handle_notification (char *buf, size_t length)
|
||||
/* Notify the event loop there's a stop reply to acknowledge
|
||||
and that there may be more events to fetch. */
|
||||
mark_async_event_handler (remote_async_get_pending_events_token);
|
||||
|
||||
if (remote_debug)
|
||||
fprintf_unfiltered (gdb_stdlog, "stop notification captured\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user