This is the mail archive of the
mailing list for the GDB project.
Re: [python][patch] Inferior and Thread information support.
- From: Tom Tromey <tromey at redhat dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Tue, 15 Jun 2010 12:11:41 -0600
- Subject: Re: [python][patch] Inferior and Thread information support.
- References: <4BFA6E82.email@example.com> <firstname.lastname@example.org> <4C1623C1.email@example.com>
- Reply-to: tromey at redhat dot com
>>>>> "Phil" == Phil Muldoon <firstname.lastname@example.org> writes:
Phil> I've no complaint to using obstacks. This function basically
Phil> wraps/tidies the existing code that was just coded directly in a loop
Phil> in parse_find_args. That code just realloc'd by a factor of two whenever
Phil> the buffer was too small. This code is exactly the same, except it
Phil> has been squirrelled away in a function. So we are not introducing or
Phil> adding any more growable types in this patch, just moving the code
Phil> bits that already existed into function. I'm not adverse to changing
Phil> that code to use obstacks, that being said!
Just for the record -- ordinarily I try not to request cleanups to
existing code as part of a new patch. It is nice to get cleanups, and
if you want to do them (or if there is a reason for them beyond mere
tidiness) then that is great. But feel free to push back if I've
erroneously reviewed the context and not the patch.
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)