Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH, doc RFA] Add ability to set random attributes in python objfiles,progspaces
Date: Fri, 10 Oct 2014 07:58:00 -0000	[thread overview]
Message-ID: <8338awbblf.fsf@gnu.org> (raw)
In-Reply-To: <yjt27g09qcx2.fsf@ruffy.mtv.corp.google.com>

> From: Doug Evans <dje@google.com>
> 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.


  parent reply	other threads:[~2014-10-10  7:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <yjt27g09qcx2.fsf@ruffy.mtv.corp.google.com>
2014-10-09 19:10 ` Doug Evans
2014-10-10  7:58 ` Eli Zaretskii [this message]
2014-10-10 17:21   ` Doug Evans
2014-10-10  8:00 ` Phil Muldoon
2014-10-10 17:35   ` Doug Evans
2014-10-10 18:25     ` Phil Muldoon
2014-10-17 20:29       ` Doug Evans
2014-10-18  5:40         ` Eli Zaretskii
2014-10-21 16:53           ` Doug Evans
2014-10-21 18:23             ` Phil Muldoon
2014-10-31  0:07               ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8338awbblf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox