This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [python][patch] Inferior and Thread information support.
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org, tromey at redhat dot com
- Cc: Phil Muldoon <pmuldoon at redhat dot com>
- Date: Tue, 15 Jun 2010 19:24:12 +0100
- Subject: Re: [python][patch] Inferior and Thread information support.
- References: <4BFA6E82.3070704@redhat.com> <4C1623C1.6090205@redhat.com> <m3iq5kupwi.fsf@fleche.redhat.com>
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