From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97111 invoked by alias); 9 Sep 2017 17:05:25 -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 97101 invoked by uid 89); 9 Sep 2017 17:05:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Sep 2017 17:05:24 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v89H5Hgm019120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 9 Sep 2017 13:05:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 7B01A1EAAC; Sat, 9 Sep 2017 13:05:17 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id BA6B41EA18; Sat, 9 Sep 2017 13:05:05 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 09 Sep 2017 17:05:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA 3/3] Make it simpler to add events to Python In-Reply-To: <20170909003353.25883-4-tom@tromey.com> References: <20170909003353.25883-1-tom@tromey.com> <20170909003353.25883-4-tom@tromey.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 9 Sep 2017 17:05:17 +0000 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00241.txt.bz2 On 2017-09-09 02:33, Tom Tromey wrote: > The first patch in this series went through several iterations as I'd > forgotten how many places had to be touched to add a new event and a > new event type. > > This patch simplifies the process using two new ".def" files. Now, a > new event type can be added by adding a line to "py-event-types.def", > and a new event registry can be added by adding a line to > "py-all-events.def". Hi Tom, This looks great. The patch is ok, I have two little nits below, which you can address before pushing if you agree. > diff --git a/gdb/python/py-event-types.def > b/gdb/python/py-event-types.def > new file mode 100644 > index 0000000..d35cbe5 > --- /dev/null > +++ b/gdb/python/py-event-types.def > @@ -0,0 +1,120 @@ > +/* Python event definitions -*- c++ -*- > + > + Copyright (C) 2017 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or > modify > + it under the terms of the GNU General Public License as published > by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see > . */ > + > +/* To use this file, define GDB_PY_DEFINE_EVENT_TYPE to expand how you > + like, then include the file. > + I think it would be clearer if you added the macro "prototype" here, otherwise the parameter names refer to nothing. GDB_PY_DEFINE_EVENT_TYPE (name, py_path, py_bame, doc, base) ... > + NAME is the name of the event. > + PY_PATH is a string representing the module and python name of > + the event. > + PY_NAME a string representing what the event should be called in > + python. > + DOC Python documentation for the new event type > + BASE the base event for this event usually just event_object_type. > +*/ > + > +GDB_PY_DEFINE_EVENT_TYPE (breakpoint, > + "gdb.BreakpointEvent", > + "BreakpointEvent", The py_path and py_name are duplicated everywhere. We could get rid of py_path. At the only place where it is used, we can replace it with "gdb." py_name Thanks, Simon