From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5974 invoked by alias); 9 Feb 2012 11:05:21 -0000 Received: (qmail 5966 invoked by uid 22791); 9 Feb 2012 11:05:20 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 11:05:07 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1RvRoH-0001s0-Cp from Luis_Gustavo@mentor.com ; Thu, 09 Feb 2012 03:05:05 -0800 Received: from NA1-MAIL.mgc.mentorg.com ([147.34.98.181]) by svr-orw-fem-01.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 9 Feb 2012 03:05:05 -0800 Received: from [0.0.0.0] ([172.16.63.104]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 9 Feb 2012 03:05:04 -0800 Message-ID: <4F33A85A.4090404@mentor.com> Date: Thu, 09 Feb 2012 11:05:00 -0000 From: Luis Gustavo Reply-To: "Gustavo, Luis" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110922 Lightning/1.0b2 Thunderbird/3.1.15 MIME-Version: 1.0 To: Jan Kratochvil CC: Joel Brobecker , Pedro Alves , 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> In-Reply-To: <20120209082230.GB10358@host2.jankratochvil.net> Content-Type: multipart/mixed; boundary="------------060708040905010005020509" 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: 2012-02/txt/msg00136.txt.bz2 This is a multi-part message in MIME format. --------------060708040905010005020509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 982 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? --------------060708040905010005020509 Content-Type: text/x-patch; name="0001-fix_multiprocess_breaks.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-fix_multiprocess_breaks.diff" Content-length: 1024 2012-02-09 Luis Machado * breakpoint.c (bp_location_compare): Sort by pspace before sorting by number. Index: gdb/gdb/breakpoint.c =================================================================== --- gdb.orig/gdb/breakpoint.c 2012-02-09 08:46:30.495074997 -0200 +++ gdb/gdb/breakpoint.c 2012-02-09 09:02:14.227075000 -0200 @@ -10593,6 +10593,14 @@ bp_location_compare (const void *ap, con where A and B memory inside GDB can differ. Breakpoint locations of the same type at the same address can be sorted in arbitrary order. */ + /* Sort locations at the same address by their pspace number, keeping + locations of the same inferior (in a multi-inferior environment) + grouped. */ + + if (a->pspace->num != b->pspace->num) + return ((a->pspace->num > b->pspace->num) + - (a->pspace->num < b->pspace->num)); + if (a->owner->number != b->owner->number) return ((a->owner->number > b->owner->number) - (a->owner->number < b->owner->number)); --------------060708040905010005020509--