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

Pedro Alves pedro@codesourcery.com
Tue Jun 15 18:24:00 GMT 2010


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



More information about the Gdb-patches mailing list