TYPE_NAME memory management

Doug Evans dje@google.com
Fri Sep 4 22:54:00 GMT 2009


On Fri, Sep 4, 2009 at 3:41 PM, Tom Tromey<tromey@redhat.com> wrote:
>
> My understanding is that in the past the rule was that if a type had an
> objfile, then the type name could come directly from the debuginfo
> (allocated on the objfile's obstack), because GDB made a guarantee about
> the relative lifetimes of these objects.  In particular, types were
> copied by preserve_one_value at a point where the string data was still
> live.
>
> Why can't we maintain that guarantee for mmap'd debuginfo as well?

Oh, we can.  It's fairly straightforward.  I just wanted to make sure
I was on solid ground.

> I realize that having a lot of lifetime dependencies can be tricky.
> But, this one is fairly well established already.

Thanks.

> For objfile-less types, I suspect we ought to always malloc any
> associated strings.  That will let us avoid memory leaks once the type
> GC work is completed.  (Currently I don't think we ever free such
> types.)



More information about the Gdb mailing list