On Mon, 2013-12-16 at 17:01 +0100, Jan Kratochvil wrote:
> On Mon, 16 Dec 2013 16:24:26 +0100, Mark Wielaard wrote:
> > --- 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.
I pushed this variant of the fix as attached.
Thanks for reporting Masatake and sorry we went with the simpler fix.
Cheers,
Mark
>From c76b2ff3eebc04c628ea7475c7ea0abb6cf0ff0d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <[email protected]>
Date: Tue, 17 Dec 2013 10:37:29 +0100
Subject: [PATCH] libdwfl: linux-pid-attach.c (pid_next_thread): Use rewinddir on first call.
dwfl_getthreads would otherwise fail to report any threads after it was
called once.
Reported-by: Masatake YAMATO <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/linux-pid-attach.c | 3 +++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 67f1fcf..76538e6 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-17 Mark Wielaard <[email protected]>
+
+ * linux-pid-attach.c (pid_next_thread): Call rewinddir on first
+ traversal.
+
2013-12-16 Mark Wielaard <[email protected]>
* libdwfl.h (dwfl_module_getsymtab_first_global): New function
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index 45a0732..3d0716a 100644
--- a/libdwfl/linux-pid-attach.c
+++ b/libdwfl/linux-pid-attach.c
@@ -164,6 +164,9 @@ pid_next_thread (Dwfl *dwfl __attribute__ ((unused)), void *dwfl_arg,
{
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;
--
1.7.1