[PATCH] Introduce tids cache for dwfl_getthreads
Jan Kratochvil
jan.kratochvil at redhat.com
Mon Dec 16 16:01:05 UTC 2013
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
More information about the elfutils-devel
mailing list