From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25739 invoked by alias); 9 Nov 2012 02:28:46 -0000 Received: (qmail 25731 invoked by uid 22791); 9 Nov 2012 02:28:45 -0000 X-SWARE-Spam-Status: No, hits=-7.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_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, 09 Nov 2012 02:28:37 +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 qA92SZm1008810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Nov 2012 21:28:35 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qA92SXaJ027772; Thu, 8 Nov 2012 21:28:34 -0500 Message-ID: <509C6A51.4090707@redhat.com> Date: Fri, 09 Nov 2012 02:28:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Add breakpoint_created observer to update tracepoint_count. References: <1352249397-15044-1-git-send-email-yao@codesourcery.com> <509AA4C6.2030102@redhat.com> <509C57B2.5020806@codesourcery.com> In-Reply-To: <509C57B2.5020806@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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-11/txt/msg00232.txt.bz2 On 11/09/2012 01:09 AM, Yao Qi wrote: > On 11/08/2012 02:13 AM, Pedro Alves wrote: >> > No need to install an observer for a notification that is emitted in the same >> > module the new observer is in. This is internals of the breakpoints module. >> > All set_breakpoint_count's calls are centralized in install_breakpoint, through >> > set_breakpoint_number. All but break-range's, that is. I don't recall why >> > that doesn't use install_breakpoint. Maybe it should. >> > > My original thought is to move tracepoint-related code from > breakpoint.c to tracepoint.c, so register a breakpoint_created observer > in tracepoint.c to update 'tracepoint_count'. Unfortunately, > tracepoint commands use some breakpoint internal macros that prevent > moving them to tracepoint.c, so I move the observer register code back > to breakpoint.c. I see. > > Yes, it is not necessary to register a observer to update some state in > the same module. > >> > We should be able to put 'if (is_tracepoint) set_tracepoint_count()' in >> > install_breakpoint too. > Hmmm, that sounds the right place to update 'tracepoint_count'. How > about patch below? A new test is added, without this fix, this test > fails. Looks good. Further comments below. > 2012-11-09 Yao Qi > > * gdb.mi/mi-break.exp (test_abreak_creation): New. I suggest: * gdb.mi/mi-break.exp (test_abreak_creation): New procedure. (top level): Call it. And here ... > +proc test_abreak_creation {} { > + mi_gdb_test "522-break-insert -a main" \ > + "522\\^done,bkpt=\{number=\"10\",type=\"tracepoint\".*\"\}" \ > + "break-insert -a operation" > + > + mi_gdb_test "p \$tpnum" ".* = 10.*" "print \$tpnum" > +} > + ... I suggest checking tpnum before creating the tracepoint too BTW, do we need "10.*", or is "10" good enough? "10.*" matches 100 or other bogus numbers too. And usually ".*" at the start of the regex is not necessary. So all in all (untested): mi_gdb_test "p \$tpnum" " = void" "\$tpnum before tracepoint" mi_gdb_test "522-break-insert -a main" \ "522\\^done,bkpt=\{number=\"10\",type=\"tracepoint\".*\"\}" \ "break-insert -a operation" mi_gdb_test "p \$tpnum" " = 10" "\$tpnum after tracepoint"