2010-02-22 50 views
0

我正在研究多線程應用程序時,永遠的過程轉儲它總是生成核心,如下所示我不能夠了解它實際上傾倒的地方。不能爲analayze多線程應用程序的核心轉儲問題.........(需要幫助)

GNU gdb Red Hat Linux (6.5-25.el5rh) 
Copyright (C) 2006 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "x86_64-redhat-linux-gnu"...(no debugging symbols found) 
Using host libthread_db library "/lib64/libthread_db.so.1". 


warning: exec file is newer than core file. 
Core was generated by `multithreadprocess                  '. 
Program terminated with signal 11, Segmentation fault. 
#0 0x0000000000448f7a in std::ostream::operator<<() 
(gdb) where 
0x000000000044bd32 in std::ostream::operator<<() 
#1 0x0000000000450b21 in std::ostream::operator<<() 
#2 0x000000000042eda9 in std::string::operator=() 
#3 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
#4 0x00000030576ce3bd in clone() from /lib64/libc.so.6 

(gdb)thread apply all bt 
Thread 6 (process 11674): 
#0 0x000000305820a687 in [email protected]@GLIBC_2.3.2() from /lib64/libpthread.so.0 
#1 0x0000000000431140 in std::string::operator=() 
#2 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
#3 0x00000030576ce3bd in clone() from /lib64/libc.so.6 

Thread 5 (process 11683): 
#0 0x000000305820cbfb in write() from /lib64/libpthread.so.0 
#1 0x0000000000449151 in std::ostream::operator<<() 
#2 0x000000000043b74a in std::string::operator=() 
#3 0x000000000046c3f4 in std::string::substr() 
#4 0x000000000046e3c1 in std::string::substr() 
#5 0x00000000004305a4 in std::string::operator=() 
#6 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
#7 0x00000030576ce3bd in clone() from /lib64/libc.so.6 

Thread 4 (process 11744): 
#0 0x00000030576c5896 in poll() from /lib64/libc.so.6 
#1 0x0000000000474f1c in std::string::substr() 
#2 0x000000000043b889 in std::string::operator=() 
#3 0x0000000000474dbc in std::string::substr() 
#4 0x00000000004306a5 in std::string::operator=() 
#5 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
#6 0x00000030576ce3bd in clone() from /lib64/libc.so.6 

Thread 3 (process 11864): 
#0 0x000000305820a687 in [email protected]@GLIBC_2.3.2() from /lib64/libpthread.so.0 
#1 0x0000000000431140 in std::string::operator=() 
#2 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
#3 0x00000030576ce3bd in clone() from /lib64/libc.so.6 

Thread 2 (process 11866): 
#0 0x000000305820a687 in [email protected]@GLIBC_2.3.2() from /lib64/libpthread.so.0 
#1 0x0000000000431140 in std::string::operator=() 
#2 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
#3 0x00000030576ce3bd in clone() from /lib64/libc.so.6 

Thread 1 (process 11865): 
#0 0x000000000044bd32 in std::ostream::operator<<() 
#1 0x0000000000450b21 in std::ostream::operator<<() 
#2 0x000000000042eda9 in std::string::operator=() 
#3 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
#4 0x00000030576ce3bd in clone() from /lib64/libc.so.6 

如果我給全bt後它顯示像這樣

(gdb) bt full 
#0 0x000000000044bd32 in std::ostream::operator<<() 
No symbol table info available. 
#1 0x0000000000450b21 in std::ostream::operator<<() 
No symbol table info available. 
#2 0x000000000042eda9 in std::string::operator=() 
No symbol table info available. 
#3 0x00000030582062e7 in start_thread() from /lib64/libpthread.so.0 
No symbol table info available. 
#4 0x00000030576ce3bd in clone() from /lib64/libc.so.6 
No symbol table info available. 
+1

注意:「警告:exec文件比核心文件更新。」你最好重新運行你現在擁有的可執行文件。 – Drakosha 2010-02-22 14:59:05

+0

所有列出的行看起來都來自標準庫 - 我建議用符號重新編譯代碼,如果可能直接在gdb中重現崩潰。 – 2010-02-22 15:16:14

回答

1

就像你使用的iostream沒有相應的標誌多線程應用程序中看起來對我來說。見this。特別要注意,它說

當你構建 使用libC 庫的iostream類以在多線程 環境中運行,編譯和鏈接使用 的應用程序的 源代碼的應用-mt選項。此選項將 -D_REENTRANT傳遞給預處理程序,並將-lthread傳遞給鏈接程序。

這是針對特定的平臺;您的要求可能有所不同

+1

在Linux上,-D_REENTRANT大多是空操作,並且不太可能與此問題有關。 – 2010-02-24 06:57:25

1

GDB 6.5已經很老了。您可能會從(當前)GDB 7.0.1獲得更好的堆棧跟蹤。

您似乎也試圖調試優化的代碼,沒有-g標誌,而且您可能沒有調試正確的可執行文件(GDB警告您的可執行文件比核心文件更新)。

確保您的可執行文件和所有庫中info shared GDB輸出中正是您的核心製作系統,並在系統上,你所分析的核心(如果他們不是之間的匹配相同) - 這是最重要的 - 如果存在不匹配,您可能會收到虛假堆棧跟蹤(並且您發佈的堆棧跟蹤看起來完全是虛假的)。

相關問題