|
From: David F. <fa...@kd...> - 2013-03-14 18:07:27
Attachments:
testcase_pthread_cond.cpp
|
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"
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?
Output from helgrind (with debug output added by me)
==4741== Helgrind, a thread error detector
==4741== Copyright (C) 2007-2012, and GNU GPL'd, by OpenWorks LLP et al.
==4741== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info
==4741== Command: ./bin/testcase_pthread_cond
==4741==
pthread_cond_init(0xffefff390) said 0
cond = 0xffefff390
==4741== ---Thread-Announcement------------------------------------------
==4741==
==4741== Thread #1 is the program's root thread
==4741==
==4741== ----------------------------------------------------------------
==4741==
==4741== Thread #1: pthread_cond_destroy: destruction of unknown cond var
==4741== at 0x4C2EB28: pthread_cond_destroy_WRK (hg_intercepts.c:940)
==4741== by 0x4C2FA44: pthread_cond_destroy@* (hg_intercepts.c:958)
==4741== by 0x400AFC: main (testcase_pthread_cond.cpp:21)
==4741==
pthread_cond_destroy 0xffefff390 in helgrind, AFTER DO_ and before CALL_
pthread_cond_destroy(0xffefff390) said 0
--
David Faure, fa...@kd..., http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
|
|
From: Philippe W. <phi...@sk...> - 2013-03-14 20:52:08
|
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 |
|
From: ISHIKAWA,chiaki <ish...@yk...> - 2013-03-15 14:46:39
|
Hi, You can try the patch against 3.8.1 and it should work as expected. > Looks like this is: > https://bugs.kde.org/show_bug.cgi?id=307082 > which contains an analysis and has an attached patch. The output from the patch in the bug database may insert one extra line to offend some users's taste, but it should be easy to fix that issue. TIA (2013/03/15 2:48), 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" > > 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? > > Output from helgrind (with debug output added by me) > > ==4741== Helgrind, a thread error detector > ==4741== Copyright (C) 2007-2012, and GNU GPL'd, by OpenWorks LLP et al. > ==4741== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info > ==4741== Command: ./bin/testcase_pthread_cond > ==4741== > pthread_cond_init(0xffefff390) said 0 > cond = 0xffefff390 > ==4741== ---Thread-Announcement------------------------------------------ > ==4741== > ==4741== Thread #1 is the program's root thread > ==4741== > ==4741== ---------------------------------------------------------------- > ==4741== > ==4741== Thread #1: pthread_cond_destroy: destruction of unknown cond var > ==4741== at 0x4C2EB28: pthread_cond_destroy_WRK (hg_intercepts.c:940) > ==4741== by 0x4C2FA44: pthread_cond_destroy@* (hg_intercepts.c:958) > ==4741== by 0x400AFC: main (testcase_pthread_cond.cpp:21) > ==4741== > pthread_cond_destroy 0xffefff390 in helgrind, AFTER DO_ and before CALL_ > pthread_cond_destroy(0xffefff390) said 0 > > > > > ------------------------------------------------------------------------------ > 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 > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |