|
From: Tang, M. <mi...@am...> - 2010-04-01 06:12:16
|
I got lots of helgrind error messages like the following:
Possible data race during read of size 4 at 0x827de98 by thread #7
at 0xAEFB2E: std::string::append(char const*, unsigned int) (in /usr/lib/libstdc++.so.6.0.8)
by 0xAC5E90: std::basic_istream<char, std::char_traits<char> >& std::getline<char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::cha
by 0xADF9A7: std::basic_istream<char, std::char_traits<char> >& std::getline<char, std::char_traits<char>, std::allocator<char> >(std::basic_istream<char, std::cha
...
This conflicts with a previous write of size 4 by thread #8
at 0xAEFF68: std::string::_M_mutate(unsigned int, unsigned int, unsigned int) (in /usr/lib/libstdc++.so.6.0.8)
by 0xAF00C9: std::string::_M_replace_safe(unsigned int, unsigned int, char const*, unsigned int) (in /usr/lib/libstdc++.so.6.0.8)
by 0xAF0164: std::string::assign(char const*, unsigned int) (in /usr/lib/libstdc++.so.6.0.8)
...
The stack for the first thread varies. However, the stack for the second thread remains the same. I would like to build suppression on the stack of the second thread. I.e. something like:
{
std_string_mutate_race
Helgrind:Race
fun:_ZNSs9_M_mutateEjjj
...
}
This does not work since mutate appears on the call stack of the second thread not the first one.
Is there a way to make it work?
Thanks!
-- Mingyu
|
|
From: Konstantin S. <kon...@gm...> - 2010-04-01 07:23:01
|
AFAICT, there is not way to do this in helgrind. BTW, this is a real race in libstdc++ (though a benign one). In ThreadSanitizer we have to avoid it in a hackish way: http://code.google.com/p/data-race-test/source/browse/trunk/tsan/thread_sanitizer.cc?spec=svn1930&r=1926#4370 It would be also possible to use a suppression or ignore file with ThreadSanitizer, but there is a risk to loose a real race on a string. Hence this hack. --kcc On Thu, Apr 1, 2010 at 9:38 AM, Tang, Mingyu <mi...@am...> wrote: > I got lots of helgrind error messages like the following: > > > > Possible data race during read of size 4 at 0x827de98 by thread #7 > > at 0xAEFB2E: std::string::append(char const*, unsigned int) (in > /usr/lib/libstdc++.so.6.0.8) > > by 0xAC5E90: std::basic_istream<char, std::char_traits<char> >& > std::getline<char, std::char_traits<char>, std::allocator<char> > >(std::basic_istream<char, std::cha > > by 0xADF9A7: std::basic_istream<char, std::char_traits<char> >& > std::getline<char, std::char_traits<char>, std::allocator<char> > >(std::basic_istream<char, std::cha > > … > > This conflicts with a previous write of size 4 by thread #8 > > at 0xAEFF68: std::string::_M_mutate(unsigned int, unsigned int, > unsigned int) (in /usr/lib/libstdc++.so.6.0.8) > > by 0xAF00C9: std::string::_M_replace_safe(unsigned int, unsigned int, > char const*, unsigned int) (in /usr/lib/libstdc++.so.6.0.8) > > by 0xAF0164: std::string::assign(char const*, unsigned int) (in > /usr/lib/libstdc++.so.6.0.8) > > … > > > > The stack for the first thread varies. However, the stack for the second > thread remains the same. I would like to build suppression on the stack of > the second thread. I.e. something like: > > > > { > > std_string_mutate_race > > Helgrind:Race > > fun:_ZNSs9_M_mutateEjjj > > … > > } > > > > This does not work since mutate appears on the call stack of the second > thread not the first one. > > Is there a way to make it work? > > > > Thanks! > > > > -- Mingyu > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > > |