This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
Re: Elf and Dwarf from DwflModule life times?
- From: Roland McGrath <roland at redhat dot com>
- To: Andrew Cagney <cagney at redhat dot com>
- Cc: frysk <frysk at sources dot redhat dot com>
- Date: Thu, 12 Jul 2007 13:31:50 -0700 (PDT)
- Subject: Re: Elf and Dwarf from DwflModule life times?
> I'm trying to understand the lifetime of the Elf and Dwarf objects
> returned by the dwfl_module_getelf and dwfl_module_getdwarf methods.
Everything you get from libdwfl about a particular module is live while
that module is live. You have to assume it all gets freed and becomes
invalid pointers when the module is removed. A module gets removed at the
end of a reporting pass that did not report it, when your dwfl_report_end
call will make callbacks to its REMOVED argument. (And of course all the
modules go away at dwfl_end.)
> Is there anything explaining this, in the header, say?
I don't think it is very clear anywhere. (I always figured the details of
the reporting stuff might change a little when nontrivial users came along.)
There is a longer-term plan for caching and sharing that will complicate
the situation with the potential for options other than eagerly dropping
everything when a module dies. (It may soon be about time for that work.)
But the conservative rules for callers now will continue to be safe.
Thanks,
Roland