Drd - 如何解读这个"其他部分"调用堆栈?

时间:2015-09-02 09:01:52

标签: c++ valgrind race-condition

我正在运行 drd 来捕获某些遗留代码中的数据争用。我知道 drd 适用于段而不是单个指令,我希望在其他段启动的调用堆栈之间找到公共点 其他细分结束,但事实并非如此。

==12982== Thread 5:
==12982== Conflicting load by thread 5 at 0x0060e6b0 size 8
==12982==    at 0x4F2CBEB: std::_Rb_tree<int, std::pair<int const, CMNSSrvNesting*>, std::_Select1st<std::pair<int const, CMNSSrvNesting*> >, std::less<int>, std::allocator<std::pair<int const, CMNSSrvNesting*> > >::find(int const&) (stl_tree.h:502)
==12982==    by 0x4F27FBE: CMetiMNSSrv::GetSockDataPtr(int, int) (stl_map.h:822)
==12982==    by 0x4F2A8E2: CMetiMNSSrv::ServerMessagesHandler(t_blkLx, unsigned char*, CAsyncSocketL*, void*) (MetiMNSSrv.cpp:957)
==12982==    by 0x507A705: CAsyncSocketL::SockHandlerCallback(void*, t_blkLx*, unsigned char*) (TWSocketLinux.cpp:417)
==12982==    by 0x518F2D1: _SK_Connection_handler (twlsocket.c:434)
==12982==    by 0x4C30E7B: ??? (in /usr/lib/valgrind/vgpreload_drd-amd64-linux.so)
==12982==    by 0x685F181: start_thread (pthread_create.c:312)
==12982==    by 0x6B6F47C: clone (clone.S:111)
==12982== Allocation context: BSS section of /home/teseo/bin/LiMNEGUI/LiMNEGUI
==12982== Other segment start (thread 4)
==12982==    at 0x4C34544: pthread_mutex_unlock (in /usr/lib/valgrind/vgpreload_drd-amd64-linux.so)
==12982==    by 0x5135589: pthreadMutexLeave (sqlite3.c:18998)
==12982==    by 0x5122E3F: sqlite3_mutex_leave (sqlite3.c:18451)
==12982==    by 0x5123321: sqlite3_free (sqlite3.c:19929)
==12982==    by 0x5168349: sqlite3LeaveMutexAndCloseZombie (sqlite3.c:122082)
==12982==    by 0x51685A4: sqlite3Close (sqlite3.c:121948)
==12982==    by 0x51685C5: sqlite3_close (sqlite3.c:121961)
==12982==    by 0x518FA7F: Sqlite3Db::~Sqlite3Db() (twnestshared.cpp:89)
==12982==    by 0x519A346: CIniFile::SetValue(std::string const&, std::string const&, std::string const&, std::string const&) (twnestshared.cpp:1264)
==12982==    by 0x519B148: CMetiReg::SerialItem(char const*, unsigned int*, unsigned int, char const*) (twnestshared.cpp:1431)
==12982==    by 0x4F22D6F: CMetiMNSSrv::SetRegistryVal(char const*, char const*, unsigned int, bool) (MetiMNSSrv.cpp:72)
==12982==    by 0x4F24BAE: CMNSSrvNesting::SetLastOperationTime(bool, unsigned int, unsigned long long, unsigned long long) (MetiMNSSrv.cpp:616)
==12982== Other segment end (thread 4)
==12982==    at 0x68667EB: recv (recv.c:33)
==12982==    by 0x518E736: SK_GetBytes (socket2.h:44)
==12982==    by 0x518E8D6: SK_GetBlock (twlsocket.c:858)
==12982==    by 0x518F19D: _SK_Connection_handler (twlsocket.c:407)
==12982==    by 0x4C30E7B: ??? (in /usr/lib/valgrind/vgpreload_drd-amd64-linux.so)
==12982==    by 0x685F181: start_thread (pthread_create.c:312)
==12982==    by 0x6B6F47C: clone (clone.S:111)

我应该如何解释这些信息?我在哪里可以找到thread 4thread 5冲突的点?

修改:其他信息

该程序已使用GCC 4.8,调试信息-g3和优化-Og进行编译。

1 个答案:

答案 0 :(得分:2)

drd无法在另一个帖子中给出冲突的准确位置。

在上面的drd错误输出中,2段开始/结束限制为12 程序计数器默认。您可以使用以下命令更改此设置 选项--num-callers =

如果您想获得更准确的信息,可以试试     --tool = helgrind 可以记录比赛中涉及的两个线程的精确堆栈跟踪。 但是,对于helgrind,“其他线程”堆栈跟踪限制为8 程序计数器(而'第一个线程'堆栈跟踪是类似的 由--num-callers =

限制