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] Introduce tids cache for dwfl_getthreads


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 <mjw@redhat.com>
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 <yamato@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 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  <mjw@redhat.com>
+
+	* linux-pid-attach.c (pid_next_thread): Call rewinddir on first
+	traversal.
+
 2013-12-16  Mark Wielaard  <mjw@redhat.com>
 
 	* 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


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