This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] Introduce tids cache for dwfl_getthreads
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Mon, 16 Dec 2013 17:01:05 +0100
- Subject: Re: [PATCH] Introduce tids cache for dwfl_getthreads
On Mon, 16 Dec 2013 16:24:26 +0100, Mark Wielaard wrote:
> On Mon, 2013-12-16 at 15:07 +0900, Masatake YAMATO wrote:
> > dwfl_getthreads can be called once for the same Dwfl object. In
> > dwfl_getthreads, directory entries under /proc/$pid/tasks are
> > traversed and the directory descriptor points the end of
> > /proc/$pid/tasks. Even if dwfl_getthreads called again, no
> > more directory entry can be read from the descriptor.
>
> Yes, that seems like a bug indeed.
This all changed from the original design and it is true this issue has been
forgotten.
> --- a/libdwfl/linux-pid-attach.c
> +++ b/libdwfl/linux-pid-attach.c
> @@ -164,6 +164,9 @@ pid_next_thread (Dwfl *dwfl __attribute__
> ((unused)), void *
> {
> struct pid_arg *pid_arg = dwfl_arg;
> struct dirent *dirent;
> + /* Start fresh on first traversal. */
> + if (*thread_argp == NULL)
> + rewinddir (pid_arg->dir);
> do
> {
> errno = 0;
I also find this patch somehow more suitable / good enough.
Thanks,
Jan