From: Phil Muldoon <pmuldoon@redhat.com>
To: tromey@redhat.com
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [python][patch] Inferior and Thread information support.
Date: Tue, 15 Jun 2010 19:58:00 -0000 [thread overview]
Message-ID: <4C17DB57.3060107@redhat.com> (raw)
In-Reply-To: <m3iq5kupwi.fsf@fleche.redhat.com>
On 06/15/2010 07:11 PM, Tom Tromey wrote:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> 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.
We talked a little about this on irc. I think your original instincts
were totally right. I had second thoughts about it. We're going through this
bit of code, so lets just fix it -- and I'm happy to do it. I did a
basic conversion to obstacks today; I'll refine it for the patch
later. I don't see it being a huge issue.
>
> 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)
When I ported this code from Archer I thought the (t)pid equality was
fine. But as in any porting effort you take the sum of several
authors and decide to rewrite/port what you have. I thought that this
equality was ok. OTOH I don't see why either (on your original
question). I'll investigate further and report back.
Cheers,
Phil
next prev parent reply other threads:[~2010-06-15 19:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-24 13:36 Phil Muldoon
2010-05-24 18:06 ` Eli Zaretskii
2010-06-10 18:40 ` Tom Tromey
2010-06-14 12:42 ` Phil Muldoon
2010-06-15 15:24 ` Pedro Alves
2010-06-15 18:11 ` Tom Tromey
2010-06-15 18:24 ` Pedro Alves
2010-06-15 19:58 ` Phil Muldoon [this message]
2010-06-15 20:36 ` Pedro Alves
2010-06-18 6:49 ` Phil Muldoon
2010-06-18 14:21 ` Doug Evans
2010-06-18 15:47 ` Phil Muldoon
2010-06-18 17:59 ` Tom Tromey
2010-06-18 20:10 ` Phil Muldoon
2010-06-25 20:41 ` Tom Tromey
2010-06-18 18:04 ` Tom Tromey
2010-06-22 10:32 ` Phil Muldoon
2010-06-25 20:38 ` Tom Tromey
2010-06-28 9:22 ` Phil Muldoon
2010-06-28 19:51 ` Tom Tromey
2010-06-28 21:35 ` Phil Muldoon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C17DB57.3060107@redhat.com \
--to=pmuldoon@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).