From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29982 invoked by alias); 8 Feb 2012 23:19:38 -0000 Received: (qmail 29911 invoked by uid 22791); 8 Feb 2012 23:19:36 -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; Wed, 08 Feb 2012 23:19:22 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1RvGnJ-0003k1-LB from Luis_Gustavo@mentor.com ; Wed, 08 Feb 2012 15:19:21 -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); Wed, 8 Feb 2012 15:19:21 -0800 Received: from [0.0.0.0] ([172.16.63.104]) by NA1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 8 Feb 2012 15:19:20 -0800 Message-ID: <4F3302F5.1030809@mentor.com> Date: Wed, 08 Feb 2012 23:19: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: 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> In-Reply-To: <20120208172728.GA6951@host2.jankratochvil.net> Content-Type: multipart/mixed; boundary="------------090709010106040503060801" 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/msg00123.txt.bz2 This is a multi-part message in MIME format. --------------090709010106040503060801 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1057 On 02/08/2012 03:27 PM, Jan Kratochvil wrote: > On Wed, 08 Feb 2012 16:47:23 +0100, Pedro Alves wrote: >> We're already sorting by address first, so I'm not really sure what is >> it that's user-visible that we're trying to preserve. Jan? > > I no longer remember if > > (a) I was wrongly expecting "duplicate"-marked locations are somehow visible > in "info breakpoints". > or > (b). > > I will check the comment change in, I hope everyone agrees with the reason. > > >> Even if that is still necessary, would it be ok to sort by address, then >> pspace, and only after by bkpt number? > > I agree with Pedro, update_global_location_list was introduced as GDB > acceleration as the breakpoints performance became no longer bearable. > > While update_global_location_list is far from perfect (it should be > incremental) we should not regress performance when it is enough to do it just > in a bit different way as Pedro suggests. I agree. Here's a new patch that touches the bp_location_compare function instead. Luis --------------090709010106040503060801 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: 937 2012-02-08 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-08 15:55:24.535075001 -0200 +++ gdb/gdb/breakpoint.c 2012-02-08 15:57:26.107075004 -0200 @@ -10589,6 +10589,13 @@ bp_location_compare (const void *ap, con if (a_perm != b_perm) return (a_perm < b_perm) - (a_perm > b_perm); + /* 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); + /* Make the internal GDB representation stable across GDB runs 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. */ --------------090709010106040503060801--