From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27442 invoked by alias); 6 May 2013 20:57:32 -0000 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 Received: (qmail 27421 invoked by uid 89); 6 May 2013 20:57:28 -0000 X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_XS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 06 May 2013 20:57:28 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r46KvQrM016430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 May 2013 16:57:26 -0400 Received: from psique (ovpn-113-115.phx2.redhat.com [10.3.113.115]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r46KvMf1001555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 6 May 2013 16:57:24 -0400 From: Sergio Durigan Junior To: Pedro Alves Cc: GDB Patches , "Dr. David Alan Gilbert" Subject: Re: [PATCH] Fix for PR 15413 (segfault when completing "condition" for pending bp) References: <5187ED3A.8000108@redhat.com> X-URL: http://www.redhat.com Date: Mon, 06 May 2013 20:57:00 -0000 In-Reply-To: <5187ED3A.8000108@redhat.com> (Pedro Alves's message of "Mon, 06 May 2013 18:49:46 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00154.txt.bz2 Thanks for the review. On Monday, May 06 2013, Pedro Alves wrote: > On 05/06/2013 03:58 AM, Sergio Durigan Junior wrote: >> + xsnprintf (location, sizeof (location), "%d", b->number); >> + } >> else >> - xsnprintf (location, sizeof (location), "%d.%d", b->number, >> - count); >> + { >> + if (b->loc->next == NULL) >> + xsnprintf (location, sizeof (location), "%d", b->number); >> + else >> + xsnprintf (location, sizeof (location), "%d.%d", b->number, >> + count); >> + >> + loc = b->loc->next; > > This is always picking the same loc over and over? I guess this means > the test should be extended. :-) Ops, you're right, I will fix it right away, thanks for the catch. >> + } >> >> if (strncmp (location, text, len) == 0) >> VEC_safe_push (char_ptr, result, xstrdup (location)); >> >> ++count; >> } >> + while (loc != NULL); >> } >> > > I notice the condition completer is more broken than this, btw: > > $ ./gdb ./testsuite/gdb.cp/mb-ctor > GNU gdb (GDB) 7.6.50.20130430-cvs > (gdb) b Derived::Derived > Breakpoint 1 at 0x400811: Derived::Derived. (2 locations) > (gdb) info breakpoints > Num Type Disp Enb Address What > 1 breakpoint keep y > 1.1 y 0x0000000000400811 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34 > 1.2 y 0x0000000000400867 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34 > (gdb) complete condition > condition 1.1 > condition 1.2 > (gdb) complete condition 1 > condition 1.1 > condition 1.2 > (gdb) complete condition 1. > condition 1.1.1 > condition 1.1.2 > (gdb) complete condition 1.1 > condition 1.1.1 > (gdb) complete condition 1.1 > condition 1.1.1 > (gdb) complete condition 1.1.1 > (gdb) > > Or: > > (gdb) condition > (gdb) condition 1.1. > (gdb) condition 1. > (gdb) condition 1. > (gdb) condition 1.1. > (gdb) condition 1.1. > Bad breakpoint argument: '1.1.' > > > BTW2, I'm thinking it'd make sense to always include the > breakpoint-number-only ("%d", b->number) completion option, even if there > are multiple locations? That is, with breakpoint 1 having two locations, > this would happen: > > (gdb) condition 1 > 1 1.1 1.2 > > instead of: > (gdb) condition 1 > (gdb) condition 1. > (gdb) condition 1. > 1.1 1.2 > > Oh, wait, wait, wait... The condition is a breakpoint property, > not a location property, so what's with the completer suggesting > location numbers at all? > > (gdb) info breakpoints > Num Type Disp Enb Address What > 1 breakpoint keep y > 1.1 y 0x0000000000400811 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34 > 1.2 y 0x0000000000400867 in Derived::Derived(int) at ../../../src/gdb/testsuite/gdb.cp/mb-ctor.cc:34 > (gdb) condition 1 0 > (gdb) > (gdb) condition 1.2 0 > Bad breakpoint argument: '1.2 0' So, if I understood your brain dump correctly, you're suggesting that the "condition" command shouldn't complete multiple locations at all, since the condition is inherent to the breakpoint, not to the location(s). Is that right? I will submit a patch soon. [OTOH, I guess it would make more sense if the condition were a location property.] Thanks, -- Sergio