From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10809 invoked by alias); 17 Aug 2010 21:15:34 -0000 Received: (qmail 10791 invoked by uid 22791); 17 Aug 2010 21:15:32 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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, 17 Aug 2010 21:15:28 +0000 Received: (qmail 15855 invoked from network); 17 Aug 2010 21:15:26 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 Aug 2010 21:15:26 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] Fix crash on conditional watchpoints (PR 11371) Date: Tue, 17 Aug 2010 21:15:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.33-29-realtime; KDE/4.4.2; x86_64; ; ) Cc: Jan Kratochvil , Chris Moller References: <20100811202053.GB16057@host1.dyn.jankratochvil.net> <20100815120352.GA31465@host1.dyn.jankratochvil.net> <201008172214.10329.pedro@codesourcery.com> In-Reply-To: <201008172214.10329.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008172215.25383.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-08/txt/msg00280.txt.bz2 On Tuesday 17 August 2010 22:14:09, Pedro Alves wrote: > > > +static void > > > +decref_bp_location (struct bp_location **blp) > > > +{ > > > > I miss here some: > > gdb_assert ((*blp)->refc > 0); > > Whoops, only after committing have I noticed that I forgot to > add this, so I added it with the obvious followup patch. For completeness, here it is. I tested it on x86_64-linux. -- Pedro Alves gdb/ 2010-08-17 Pedro Alves PR breakpoints/11371 * breakpoint.c (decref_bp_location): Assert the reference count is sane. --- gdb/breakpoint.c | 2 ++ 1 file changed, 2 insertions(+) Index: src/gdb/breakpoint.c =================================================================== --- src.orig/gdb/breakpoint.c 2010-08-17 21:55:29.000000000 +0100 +++ src/gdb/breakpoint.c 2010-08-17 22:03:06.000000000 +0100 @@ -5423,6 +5423,8 @@ incref_bp_location (struct bp_location * static void decref_bp_location (struct bp_location **blp) { + gdb_assert ((*blp)->refc > 0); + if (--(*blp)->refc == 0) free_bp_location (*blp); *blp = NULL;