public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Elf and Dwarf from DwflModule life times?
@ 2007-07-12 15:29 Andrew Cagney
  2007-07-12 20:32 ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2007-07-12 15:29 UTC (permalink / raw)
  To: Roland McGrath; +Cc: frysk

Roland,

I'm trying to understand the lifetime of the Elf and Dwarf objects 
returned by the dwfl_module_getelf and dwfl_module_getdwarf methods.

Is there anything explaining this, in the header, say?

Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Elf and Dwarf from DwflModule life times?
  2007-07-12 15:29 Elf and Dwarf from DwflModule life times? Andrew Cagney
@ 2007-07-12 20:32 ` Roland McGrath
  2007-07-12 21:37   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Roland McGrath @ 2007-07-12 20:32 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: frysk

> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Elf and Dwarf from DwflModule life times?
  2007-07-12 20:32 ` Roland McGrath
@ 2007-07-12 21:37   ` Andrew Cagney
  2007-07-12 22:24     ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2007-07-12 21:37 UTC (permalink / raw)
  To: Roland McGrath; +Cc: frysk


Roland McGrath wrote:
>> 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.)
>
>   

Ok, thanks.

I just figured out that "fildes" is copied (not duped) when elf_clone is 
called; we'll need to be careful there as well.

Andrew

>> 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
>
>
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Elf and Dwarf from DwflModule life times?
  2007-07-12 21:37   ` Andrew Cagney
@ 2007-07-12 22:24     ` Roland McGrath
  0 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2007-07-12 22:24 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: frysk

> I just figured out that "fildes" is copied (not duped) when elf_clone is 
> called; we'll need to be careful there as well.

I can't imagine why you would ever use elf_clone.  Anyway, yes, libelf does
nothing special to manage file descriptors.

libdwfl manages the file descriptors.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-12 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-12 15:29 Elf and Dwarf from DwflModule life times? Andrew Cagney
2007-07-12 20:32 ` Roland McGrath
2007-07-12 21:37   ` Andrew Cagney
2007-07-12 22:24     ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).