This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/5] libdwfl: add interface for attaching to/detaching from threads


Hi Omar,

On Mon, 2019-10-07 at 02:05 -0700, Omar Sandoval wrote:
> libdwfl has implementations of attaching to/detaching from threads
> and
> unwinding stack traces. However, that functionality is only available
> through the dwfl_thread_getframes interface, which isn't very flexible.
> This adds two new functions, dwfl_attach_thread and dwfl_detach_thread,
> which separate the thread stopping functionality out of
> dwfl_thread_getframes. Additionally, it makes dwfl_thread_getframes
> cache the stack trace for threads stopped this way. This makes it
> possible to use the frames after dwfl_thread_getframes returns.

The advantage of the dwfl_thread_getframes interface is that you cannot
forget to "detach", so no Dwfl_Frames get dangling and (if the process
is life) you don't disrupt it more than necessary. This new interface
seems very simple to get wrong causing leaks and locking up
processes/threads.

Also, if we would adopt dwfl_attach_thread then I think it should take
a Dwfl_Thread object not a pid/tid as argument.

Could you provide some examples where this new interface/style is
beneficial?

Thanks,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]