2010-01-04 75 views
4

我用多線程HTTP服務器的Boost asio example(3)寫了一個小應用程序。定期我得到一個seg錯誤,如果我按ctrl-c該應用程序。我知道我必須在某處覆蓋內存,但不知道如何調試它。 GDB中的堆棧跟蹤沒有幫助。 GCC中有一些工具可以幫助我在檢測到腐敗之前將其擊中在Dtor中? (對不起,我大多是爪哇人)Boost線程中的分段錯誤tls_destructor

謝謝。在Debian Linux上

PS使用Boost 1.38這裏是堆棧跟蹤


Program terminated with signal 11, Segmentation fault. 
#0 0xb7f74389 in tls_destructor (data=0xb5200fc8) at libs/thread/src/pthread/thread.cpp:86 
86          thread_info->tss_data=current_node->next; 
(gdb) where 
#0 0xb7f74389 in tls_destructor (data=0xb5200fc8) at libs/thread/src/pthread/thread.cpp:86 
#1 0xb7f75351 in thread_proxy (param=0xb5200fc8) at libs/thread/src/pthread/thread.cpp:142 
#2 0xb7c03240 in start_thread() from /lib/tls/i686/cmov/libpthread.so.0 
#3 0xb7dc049e in clone() from /lib/tls/i686/cmov/libc.so.6 
(gdb) 
+1

Boost線程最近修復了很多錯誤。嘗試更新的版本。 – 2010-01-04 20:28:21

回答

1

由於這是一個多線程程序,有能夠提升只能升級躲在一個真正的錯誤的可能性。我建議按照順序使用Valgrind Memcheck和Helgrind工具進行測試。第一個檢查內存管理問題,第二個檢查競爭情況。恕我直言,一個真正不可或缺的工具。