Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: matt rice <ratmice@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 0/7] [python] API for macros
Date: Tue, 30 Aug 2011 09:44:00 -0000	[thread overview]
Message-ID: <m362lfw8gr.fsf@redhat.com> (raw)
In-Reply-To: <1314198654-9008-1-git-send-email-ratmice@gmail.com> (matt rice's	message of "Wed, 24 Aug 2011 08:10:47 -0700")

matt rice <ratmice@gmail.com> writes:

> take 2 on the python macro API...
> In addition to the testsuite, I tested with the last release of
> gcc following: http://gcc.gnu.org/wiki/DebuggingGCC
>
> using variations of the do_stuff function in following script...
> I didn't save exact timing #'s but it was something like
>  2 mins to count all 600+ million macros
>  5 mins to filter all by name with macro.name().startswith()
>  15 mins to call the str() method (which calls all other methods).

I'm more concerned about having 600 million Python objects lying around
indefinitely ;)  (When a macro is invalidated, the Python object still
has to exist so that the user can still call the APIs (to figure out,
hey this macro is now invalid.))

But I looked at your code, and to be honest, this area of GDB is brand
new to me, so I don't feel very qualified to review it.  I will try.  My
main overall concern is removing the macro cache.  Given that we cannot
count the numbers before your change (well not easily, as there is no
real way to script them), I'm a little bit concerned if the above
numbers are significantly impacted by the removal of the macro cache.

> I'd tried doing a deep copy in the gdb.Macro class,
> to avoid all the objfile/obstack/bcache horse pucky evident in this series,
> but i killed it before it completed when working with gcc...

Given that macros can be extremely prevalent in some projects, I think a
deep copy would not be the way to proceed anyway.

> it's not really timing equivalent to that last 15 minutes case since
> we use lots more memory having a deep copy of all the macros in a symtab in a
> list.  Where the 15 minute version does a deep copy, with only one macro's
> contents in memory at a time.
>
> thus, I think it is useful even for large projects (if used with care.)
> this will fall over if someone has has way too many
> macros in a single symtab.  should that happen we can add a macro_map()
> that behaves sort of like the python map function.

We should add it now, IMO, instead of waiting for it to fail later.  I'm
not sure of the exact requirements for the number of macros in symtab to
qualify for this case, but given how widely used GDB is, it will fail,
sooner or later.


> I think a list is the most straight forward approach for general usage,
> and has been shown to work even with projects that use macros extensively.

You did not note your machine specifications, btw.

> With regards to the hash/compare methods, the implementation of those
> is up for debate, I see at least 3 valid ways to compare them and have only one
> comparison function.  right now I have it compare deeply e.g. including the whole include_trail
> other options that seem valid, compare the name,args,defininition, 
> and compare the name,args,definition and partial include_trail
> (just definition location) since they pretty much are equal before expansion,
> and expansion is an 'expression' thing.

I'd rather correct hash uniqueness over comparable performance here.

> There are some implementation quirks described in the documentation,
> some of these are so in the future we can add a gdb.UserMacro which does
> a deep-copy on initialization, I wasn't going to add that unless someone
> requests it.  Python doesn't seem to have any form of java's `interface',
> or abstract base classing at least within our version range,
> we could also hack up something ugly in the future to avoid this documentation,
> (read union'ify the class implementation,
>  or make gdb.Macro have a pointer to a gdb.ObjfileMacro
>  and do the lambda macro: macro.method() inside gdb.Macro)
> I'd personally just leave it there to give us future choice on the matter.
> we can always remove that from the docs if we implement it in a way


I really think we ought to do this now, not what you wanted to hear, I
know.  But I think it would be genuinely useful.  No hacks, though! ;)

Cheers,

Phil


  parent reply	other threads:[~2011-08-30  9:44 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 15:11 matt rice
2011-08-24 15:11 ` [PATCH 5/7] [python] API for macros: gdb.Objfile symtabs method matt rice
2011-08-30 13:08   ` Phil Muldoon
2011-09-01 23:18     ` Matt Rice
2011-09-02  1:07       ` Paul_Koning
2011-08-30 17:34   ` Tom Tromey
2011-09-02  0:56     ` Matt Rice
2011-08-24 15:11 ` [PATCH 2/7] [python] API for macros: memory management quirks matt rice
2011-08-26 20:40   ` Tom Tromey
2011-08-30 11:47   ` Phil Muldoon
2011-09-01 22:46     ` Matt Rice
2011-08-24 15:11 ` [PATCH 1/7] [python] API for macros: abort or continuing macro iterators matt rice
2011-08-26 20:23   ` Tom Tromey
2011-08-30 11:10   ` Phil Muldoon
2011-09-01 21:48     ` Matt Rice
2011-08-24 15:12 ` [PATCH 6/7] [python] API for macros: Add docs matt rice
2011-08-24 20:10   ` Eli Zaretskii
2011-08-25 12:33     ` Matt Rice
2011-08-25 17:36       ` Eli Zaretskii
2011-08-26  8:04         ` Matt Rice
2011-08-26 10:42           ` Eli Zaretskii
2011-08-26 11:17             ` Matt Rice
2011-08-26 12:08               ` Eli Zaretskii
2011-08-26 14:06                 ` Matt Rice
2011-08-26 15:05                   ` Eli Zaretskii
2011-08-24 15:12 ` [PATCH 3/7] [python] API for macros: Add gdb.Macro class matt rice
2011-08-30 12:45   ` Phil Muldoon
2011-09-01 22:57     ` Matt Rice
2011-08-24 15:12 ` [PATCH 4/7] [python] API for macros: Add methods to get a gdb.Macro matt rice
2011-08-30 13:04   ` Phil Muldoon
2011-08-30 17:41     ` Tom Tromey
2011-08-30 20:28       ` Phil Muldoon
2011-08-30 20:35         ` Phil Muldoon
2011-09-01 23:13           ` Matt Rice
2011-09-02  1:15             ` Paul_Koning
2011-09-02 10:04               ` Paul_Koning
2011-09-02 12:04             ` Phil Muldoon
2011-08-30 20:38         ` Tom Tromey
2011-08-30 20:58           ` Phil Muldoon
2011-08-24 15:12 ` [PATCH 7/7] [python] API for macros: Add tests matt rice
2011-08-30 13:12   ` Phil Muldoon
2011-08-30 15:54   ` Tom Tromey
2011-08-30  9:44 ` Phil Muldoon [this message]
2011-09-01 21:33   ` [PATCH 0/7] [python] API for macros Matt Rice

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=m362lfw8gr.fsf@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ratmice@gmail.com \
    /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