gdbserver: Reset current_thread when its process is removed.

Message ID 56210E49.9010304@qnx.com
State New, archived
Headers

Commit Message

Aleksandar Ristovski Oct. 16, 2015, 2:48 p.m. UTC
  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?
  

Comments

Pedro Alves Oct. 16, 2015, 3:06 p.m. UTC | #1
On 10/16/2015 03:48 PM, Aleksandar Ristovski wrote:
> On 15-10-16 10:04 AM, Pedro Alves wrote:

>> OK with intro comments added.
>>
> 
> Like this?

That's perfect.  Please push.

Thanks,
Pedro Alves
  

Patch

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)
 {