This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdbserver: Reset current_thread when its process is removed.
- From: Aleksandar Ristovski <aristovski at qnx dot com>
- To: Pedro Alves <palves at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 16 Oct 2015 10:48:41 -0400
- Subject: Re: [PATCH] gdbserver: Reset current_thread when its process is removed.
- Authentication-results: sourceware.org; auth=none
- References: <1444919808-22088-1-git-send-email-aristovski at qnx dot com> <561FD2B2 dot 6070509 at redhat dot com> <5620FE5F dot 4000006 at qnx dot com> <562103DC dot 70605 at redhat dot com>
On 15-10-16 10:04 AM, Pedro Alves wrote:
> On 10/16/2015 02:40 PM, Aleksandar Ristovski wrote:
>
>> +static int
>> +thread_pid_matches_callback (struct inferior_list_entry *entry, void *args)
>> +{
>
> ...
>
>> +static struct thread_info *
>> +find_thread_process (const struct process_info *const process)
>> +{
>
> OK with intro comments added.
>
Like this?
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index fe47a72..72a3ef1 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -141,12 +141,18 @@ find_thread_ptid (ptid_t ptid)
return (struct thread_info *) find_inferior_id (&all_threads, ptid);
}
+/* Predicate function for matching thread entry's pid to the given
+ pid value passed by address in ARGS. */
+
static int
thread_pid_matches_callback (struct inferior_list_entry *entry, void *args)
{
return (ptid_get_pid (entry->id) == *(pid_t *)args);
}
+/* Find a thread associated with the given PROCESS, or NULL if no
+ such thread exists. */
+
static struct thread_info *
find_thread_process (const struct process_info *const process)
{