From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14218 invoked by alias); 15 Jun 2010 18:24:37 -0000 Received: (qmail 14121 invoked by uid 22791); 15 Jun 2010 18:24:33 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Jun 2010 18:24:20 +0000 Received: (qmail 14586 invoked from network); 15 Jun 2010 18:24:17 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Jun 2010 18:24:17 -0000 From: Pedro Alves To: gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: [python][patch] Inferior and Thread information support. Date: Tue, 15 Jun 2010 18:24:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.32-22-generic; KDE/4.4.2; x86_64; ; ) Cc: Phil Muldoon References: <4BFA6E82.3070704@redhat.com> <4C1623C1.6090205@redhat.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201006151924.12745.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00349.txt.bz2 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 * 1 -- Pedro Alves