From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21595 invoked by alias); 9 Feb 2012 11:32:08 -0000 Received: (qmail 21583 invoked by uid 22791); 9 Feb 2012 11:32:08 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 11:31:51 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q19BVQgF027718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Feb 2012 06:31:26 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q19BVPrC016411; Thu, 9 Feb 2012 06:31:25 -0500 Message-ID: <4F33AE8C.5000400@redhat.com> Date: Thu, 09 Feb 2012 11:32:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: "Gustavo, Luis" CC: Jan Kratochvil , Joel Brobecker , gdb-patches@sourceware.org Subject: Re: [patch] update_global_location_list my comment fix [Re: [PATCH] Fix breakpoint updates for multi-inferior] References: <4F20610B.5010403@mentor.com> <4F3291D9.80705@redhat.com> <4F329468.3020307@mentor.com> <4F32990B.7060203@redhat.com> <20120208172728.GA6951@host2.jankratochvil.net> <4F3302F5.1030809@mentor.com> <20120208233211.GC19247@adacore.com> <4F3307BE.2050909@mentor.com> <20120209082230.GB10358@host2.jankratochvil.net> <4F33A85A.4090404@mentor.com> In-Reply-To: <4F33A85A.4090404@mentor.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-02/txt/msg00137.txt.bz2 On 02/09/2012 11:04 AM, Luis Gustavo wrote: > On 02/09/2012 06:22 AM, Jan Kratochvil wrote: >> On Thu, 09 Feb 2012 00:39:42 +0100, Luis Gustavo wrote: >>> + /* Sort by pspace. This effectively sorts locations by inferior in >>> + a multi-inferior environment. */ >>> + >>> + if (a->pspace != b->pspace) >>> + return (a->pspace> b->pspace) - (a->pspace< b->pspace); >> >> This does not follow the comment I made: >> >> /* Make the internal GDB representation stable across GDB runs >> where A and B memory inside GDB can differ. >> >> I would prefer there (and it will not fit on a single line :-) ): >> >> return (a->pspace->num> b->pspace->num) - (a->pspace->num< b->pspace->num); >> >> NUM should be the same on each GDB run for the same inferior / command file. > > I would still like to keep an appropriate comment regarding multi-inferiors next to the pspace comparison, like the following... maybe it would've been best to keep the change above your new comment. Here's a new version. > > What do you think? We need to sort by pspace even before that, before: /* Sort permanent breakpoints first. */ if (a_perm != b_perm) return (a_perm < b_perm) - (a_perm > b_perm); So that you don't get: #1 PSPACE1 ADDR1 PERM #2 PSPACE2 ADDR1 PERM #3 PSPACE1 ADDR1 #4 PSPACE2 ADDR1 But instead: #1 PSPACE1 ADDR1 PERM #2 PSPACE1 ADDR1 #3 PSPACE2 ADDR1 PERM #4 PSPACE2 ADDR1 -- Pedro Alves