From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19883 invoked by alias); 10 Oct 2014 07:58:09 -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 19873 invoked by uid 89); 10 Oct 2014 07:58:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout23.012.net.il Received: from mtaout23.012.net.il (HELO mtaout23.012.net.il) (80.179.55.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Oct 2014 07:58:07 +0000 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0ND700B00XJLWN00@a-mtaout23.012.net.il> for gdb-patches@sourceware.org; Fri, 10 Oct 2014 10:58:05 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0ND700BOIY4SSJ90@a-mtaout23.012.net.il>; Fri, 10 Oct 2014 10:58:05 +0300 (IDT) Date: Fri, 10 Oct 2014 07:58:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH, doc RFA] Add ability to set random attributes in python objfiles,progspaces In-reply-to: To: Doug Evans Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <8338awbblf.fsf@gnu.org> References: X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00234.txt.bz2 > From: Doug Evans > Date: Thu, 09 Oct 2014 12:08:09 -0700 > > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -9,6 +9,7 @@ > > ** You can now access frame registers from Python scripts. > ** New attribute 'producer' for gdb.Symtab objects. > + ** You can now add attributes to gdb.Objfile and gdb.Progspace objects. This part is OK. > --- a/gdb/doc/python.texi > +++ b/gdb/doc/python.texi > @@ -3356,6 +3356,10 @@ The @code{frame_filters} attribute is a dictionary of frame filter > objects. @xref{Frame Filter API}, for more information. > @end defvar > > +One may add arbitrary attributes to @code{gdb.Progspace} objects. Add how? If this is done by "usual" Python ways, please say so. > +This is useful if for example one needs to do some extra record keeping > +associated with the progspace. Please add commas where they are needed in this sentence. > +One may add arbitrary attributes to @code{gdb.Objfile} objects. > +This is useful if for example one needs to do some extra record keeping > +associated with the objfile. Same comments here. > +In this contrived example we record the time when @value{GDBN} > +loaded the objfile. > + > +@smallexample > +(gdb) python > +import datetime > +def new_objfile_handler (event): > + event.new_objfile.time_loaded = datetime.datetime.today () > +gdb.events.new_objfile.connect (new_objfile_handler) > +end > +(gdb) file ./hello > +Reading symbols from ./hello...done. > +(gdb) python print gdb.objfiles()[0].time_loaded > +2014-10-09 11:41:36.770345 > +@end smallexample If this is related to adding attributes, then I'd like the text say that more explicitly. Alternatively, some comment in the example that mentions "attributes" could do. Btw, why do we only support adding attributes for these 2 types of objects? Why not for any object? Thanks.