From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22273 invoked by alias); 20 Nov 2009 11:39:46 -0000 Received: (qmail 22263 invoked by uid 22791); 20 Nov 2009 11:39:45 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS 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; Fri, 20 Nov 2009 11:38:34 +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.13.8/8.13.8) with ESMTP id nAKBcPsd018567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 20 Nov 2009 06:38:26 -0500 Received: from host0.dyn.jankratochvil.net (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 nAKBcNS7023985 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Nov 2009 06:38:25 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id nAKBcNwZ020275; Fri, 20 Nov 2009 12:38:23 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id nAKBcMPt020273; Fri, 20 Nov 2009 12:38:22 +0100 Date: Fri, 20 Nov 2009 11:39:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: Fix regression in always-inserted breakpoints mode. Message-ID: <20091120113821.GA30659@host0.dyn.jankratochvil.net> References: <200911200211.18854.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200911200211.18854.pedro@codesourcery.com> User-Agent: Mutt/1.5.20 (2009-08-17) 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: 2009-11/txt/msg00432.txt.bz2 On Fri, 20 Nov 2009 03:11:18 +0100, Pedro Alves wrote: > There's for loop a bit below, that starts iterating on > `locp', and that would misses a few locations, I agree I brought in such regression, thanks for catching it. I will check-in the [obv] patch below after you check it in. > There's another problem with this for loop. The > breakpoint_address_match is too strict when debugging > more than one inferior. Even if breakpoint_address_match > fails due to address space mismatch, there could be other > locations with the same address following loc2p. This is unrelated to the regression from me. Sorry, Jan gdb/ 2009-11-20 Jan Kratochvil * breakpoint.c (bp_location_compare): Change parameter a to ap and b to bp. New variables a and b. (bp_location_compare_for_qsort): Remove. (update_global_location_list): Use now bp_location_compare. --- ./gdb/breakpoint.c-1 2009-11-20 12:22:12.000000000 +0100 +++ ./gdb/breakpoint.c 2009-11-20 12:27:44.000000000 +0100 @@ -8073,15 +8073,17 @@ breakpoint_auto_delete (bpstat bs) } } -/* A comparison function for bp_location A and B being interfaced to qsort. +/* A comparison function for bp_location AP and BP being interfaced to qsort. Sort elements primarily by their ADDRESS (no matter what does breakpoint_address_is_meaningful say for its OWNER), secondarily by ordering first bp_permanent OWNERed elements and terciarily just ensuring the array is sorted stable way despite qsort being an instable algorithm. */ static int -bp_location_compare (struct bp_location *a, struct bp_location *b) +bp_location_compare (const void *ap, const void *bp) { + struct bp_location *a = *(void **) ap; + struct bp_location *b = *(void **) bp; int a_perm = a->owner->enable_state == bp_permanent; int b_perm = b->owner->enable_state == bp_permanent; @@ -8102,17 +8104,6 @@ bp_location_compare (struct bp_location return (a > b) - (a < b); } -/* Interface bp_location_compare as the COMPAR parameter of qsort function. */ - -static int -bp_location_compare_for_qsort (const void *ap, const void *bp) -{ - struct bp_location *a = *(void **) ap; - struct bp_location *b = *(void **) bp; - - return bp_location_compare (a, b); -} - /* Set bp_location_placed_address_before_address_max and bp_location_shadow_len_after_address_max according to the current content of the bp_location array. */ @@ -8196,7 +8187,7 @@ update_global_location_list (int should_ for (loc = b->loc; loc; loc = loc->next) *locp++ = loc; qsort (bp_location, bp_location_count, sizeof (*bp_location), - bp_location_compare_for_qsort); + bp_location_compare); bp_location_target_extensions_update ();