Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Matt Rice <ratmice@gmail.com>
To: pmuldoon@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] PR python/10807 API for macros.
Date: Wed, 17 Aug 2011 13:44:00 -0000	[thread overview]
Message-ID: <CACTLOFooE1u3VvMC8uAOUwjRztdV8K0hzc77UpDX3Tk4PkC2TQ@mail.gmail.com> (raw)
In-Reply-To: <m339h01eh7.fsf@redhat.com>

On Wed, Aug 17, 2011 at 4:09 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
> Matt Rice <ratmice@gmail.com> writes:
>
>
>>> What do you mean by inconsistent memory management?  Can you expand/explain
>>> this.  Do macro definitions have a life-cycle in GDB?
>>
>> depends on the source of the macro, xmalloc directly for user-defined,
>> or the macro table's obstack.
>>
>> from macroscope.c:
>> /* A table of user-defined macros.  Unlike the macro tables used for
>>    symtabs, this one uses xmalloc for all its allocation, not an
>>    obstack, and it doesn't bcache anything; it just xmallocs things.  So
>>    it's perfectly possible to remove things from this, or redefine
>>    things.  */
>>
>> I'm second guessing myself that caching the macro_source file is safe though.
>
> Is there life-cycle management for macros?  (See py-symbol.c for
> life-cycle management of symbols).  If so, we should invalidate (but keep
> around) the macro Python object, but run a validity routine to check
> that the macro exists.

Yeah, there is.

I was confused by free_macro_table != a destructor.
it seems to be there to discard macro_tables in the case of 'early retirement'
they can *poof* via obstack regardless of free_macro_table.

I'll just get rid of this for now, and do a deep copy of the macro on
initialization,
and see how that works with the macro iterator mechanism we discussed.

revisit it later when i can figure out how to get at the obstack, and
get it working correctly
with the obstackless macro tables, we can change this under the hood
without changing the API...

I suppose i should add an is_valid method that just returns True for
now with the deep copy.

> If not, then I am not sure.  If you cache the macro_source file, do you
> keep it around forever?  I am also unsure if it is ok to do this.

just as long as the macro_object *, so potentially forever.


      reply	other threads:[~2011-08-17 13:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16  6:36 Matt Rice
2011-08-16 10:02 ` Phil Muldoon
2011-08-16 15:16   ` Matt Rice
2011-08-17 11:10     ` Phil Muldoon
2011-08-17 13:44       ` Matt Rice [this message]

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