On Thu, 2013-03-14 at 18:48 +0100, David Faure wrote:
> The attached testcase (which is simply pthread_cond_init + 
> pthread_cond_destroy), leads to an error in helgrind:
> "pthread_cond_destroy: destruction of unknown cond var"
Looks like this is:
https://bugs.kde.org/show_bug.cgi?id=307082
which contains an analysis and has an attached patch.
I have on my list of things to do to look at this patch.


> 
> I've seen this forever with helgrind, but it's time to clean this up :)
> 
> However my debugging got stuck. I found out that 1) the call is given a valid 
> condition variable pointer, and it actually succeeds, outside and inside 
> helgrind. 2) the error message comes from this line of code:
> 
>     DO_CREQ_v_W(_VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE,
>                 pthread_cond_t*,cond);
> 
> (hg_intercepts.c:940).
> How do I debug this further? This looks like a hook to me, the actual call is 
> the next line,  CALL_FN_W_W(ret, fn, cond), isn't it?
There are two possible "levels" at which you can debug.
You can debug the application level (guest process), using gdb+vgdb.
This debugs the "virtual" cpu emulated by Valgrind.
Or you can debug the Valgrind level (using gdb, directly on the
process). This debugs the real cpu.
A client request is executed by the guest process by the virtual
cpu, but "switches" to the real cpu to do the real work
(which is then Valgrind code which is executed by the real cpu).

Not easy to debug simultaneously, but not impossible
(you need two GDBs, one debugging the real cpu, one debugging
the virtual cpu).
You might need to e.g. avoid vgdb using ptrace syscalls.
See README_DEVELOPERS for more details.

Philippe



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to