English 中文(简体)
增减:现用率高
原标题:Debug boost::thread application, high false positive rate

我已规划了一种推动措施:在我有某些种族条件的地方,我已经做好了准备。 我愿 de击这一方案。 因此,我使用了以下阀门工具:

  1. halgrind
  2. drd

不幸的是,他们有很不实的正率。 因此,在<代码>valgrind -tool=drd以下的实际简单方案就94个错误提出了申诉,这些错误不应存在。 因此,由于我的复杂方案,我有大约15 000个错误。 因此,很难找到实际错误。

我可以照搬这些图书馆:1.46.0和1.47.0。 And with valgrind 3.7.0 SVN and valgrind 3.8.0 SVN. 我尝试了乌班图11.10和MacOS X10.7的操作系统。 gcc 4.2.1和4.6.1。

#include <iostream>
#include <boost/thread.hpp>

void run()
{
    //do some stuff here
}

int main(int argc, char* argv[])
{
    boost::thread thread(run);
    thread.join();
    std::cerr << "main: done" << std::endl;
    return 0;
}
;

你们如何淡化你们的强化方案? 是否有其他可能更适合的工具?

<>Solution

看来,第3.6.1版后半衰期被打破。 如果我使用瓦尔格里德3.6.1号文件,所有东西都会被罚款。

页: 1 --tool=drd

==60767== Thread 1:
==60767== Conflicting store by thread 1 at 0x100026ec0 size 8
==60767==    at 0x2A316E: pthread_mutex_lock (in /usr/lib/system/libsystem_c.dylib)
==60767==    by 0x2A82FA: _pthread_cond_wait (in /usr/lib/system/libsystem_c.dylib)
==60767==    by 0x32A4E: boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) (in /usr/local/lib/libboost_thread.dylib)
==60767==    by 0x2BE5A: boost::thread::join() (in /usr/local/lib/libboost_thread.dylib)
==60767==    by 0x10000195C: main (in ./playgroudThreads)
==60767== Address 0x100026ec0 is at offset 144 from 0x100026e30. Allocation context:
==60767==    at 0xC5B3: malloc (vg_replace_malloc.c:266)
==60767==    by 0x9968D: operator new(unsigned long) (in /usr/lib/libstdc++.6.0.9.dylib)
==60767==    by 0x1000069ED: boost::detail::thread_data<void (*)()>* boost::detail::heap_new_impl<boost::detail::thread_data<void (*)()>, void (*&)()>(void (*&)()) (in ./playgroudThreads)
==60767==    by 0x100006A87: boost::detail::thread_data<void (*)()>* boost::detail::heap_new<boost::detail::thread_data<void (*)()>, void (*)()>(void (*&)()) (in ./playgroudThreads)
==60767==    by 0x100006ACA: boost::shared_ptr<boost::detail::thread_data_base> boost::thread::make_thread_info<void (*)()>(void (*)()) (in ./playgroudThreads)
==60767==    by 0x100006B08: boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type) (in ./playgroudThreads)
==60767==    by 0x100001950: main (in ./playgroudThreads)
==60767== Other segment start (thread 2)
==60767==    at 0x2A7B68: thread_start (in /usr/lib/system/libsystem_c.dylib)
==60767== Other segment end (thread 2)
==60767==    at 0x3E667A: mach_msg_trap (in /usr/lib/system/libsystem_kernel.dylib)
==60767==    by 0x3DED38: semaphore_create (in /usr/lib/system/libsystem_kernel.dylib)
==60767==    by 0x2A50F7: new_sem_from_pool (in /usr/lib/system/libsystem_c.dylib)
==60767==    by 0x2A6199: _pthread_exit (in /usr/lib/system/libsystem_c.dylib)
==60767==    by 0x2A48C9: _pthread_start (in /usr/lib/system/libsystem_c.dylib)
==60767==    by 0x2A7B74: thread_start (in /usr/lib/system/libsystem_c.dylib)
最佳回答

http://valgrind.org/docs/manual/drd-manual.html

An important advantage of happens-before data race detectors is that these do not report any false positives. DRD is based on the happens-before algorithm.

因此,如果执行工作只使用浮标线,而不是像六氯环己烷的脂肪一样,DRD就不会有任何错误的积极性。

因此,如果复兴共和与诸位一样,就是一个无种族方案而言,民主共和与世隔绝,就会有ug。 它不应有虚假的正面。

然而,我无法复制你在我的机器上报告的错误(Archlinux/ gcc 4.6.2 /valgrind 3.6.1 /rove 1.47)。

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签