This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [python][patch] Inferior and Thread information support.


On Tuesday 15 June 2010 19:11:41, Tom Tromey wrote:
> Phil> +  /* Find inferior_object for the given PID.  */
> Phil> +  for (inf_entry = &gdbpy_inferior_list; *inf_entry != NULL;
> Phil> +       inf_entry = &(*inf_entry)->next)
> Phil> +    if ((*inf_entry)->inf_obj->inferior->pid == inf->pid)
> Phil> +      break;
> > 
> Tom> It seems strange to compare the pid fields when we could just compare
> Tom> the inferior objects themselves.
> 
> Phil> Do you mean using the Python object's cmp inbuilt method here?
> 
> No, I'm just curious why that can't be more simply written:
> 
>   if ((*inf_entry)->inf_obj == inf)
> 

In fact, you can have two distinct inferiors both
with pid == 0:

$ gdb
(gdb) add-inferior
(gdb) info inferiors 
  Num  Description       Executable        
  2    <null>                              
* 1    <null> 

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]