2016-08-27 48 views
0
  1. 如果在gdb核心中存在丟失/損壞的庫,我該如何隔離它?有關線程的兩個問題

  2. 我也讀過,有可能線程可能會覆蓋自己的堆棧,我該如何檢測?

如何將上述問題與以下bt分離?

/etc/gdb/gdbinit:105: Error in sourced command file: 
Error while executing Python code. 
Reading symbols from /opt/hsp/bin/addrman...done. 

warning: Corrupted shared library list: 0x0 != 0x7c8d48ea8948c089 

warning: Corrupted shared library list: 0x0 != 0x4ed700 

warning: no loadable sections found in added symbol-file system-supplied DSO at 
0x7ffd50ff6000 
Core was generated by `addrman --notification-socket 
/opt/hsp/sockets/memb_notify.socket'. 
Program terminated with signal 11, Segmentation fault. 
#0 0x00000000004759e4 in ps_locktrk_info::lktrk_locker_set (this=0x348, 
locker_ip=<optimized out>) at ./ps/ps_lock_track.h:292 
292  ./ps/ps_lock_track.h: No such file or directory. 
(gdb) bt 
#0 0x00000000004759e4 in ps_locktrk_info::lktrk_locker_set (this=0x348, 
locker_ip=<optimized out>) at ./ps/ps_lock_track.h:292 
#1 0x0000000000000000 in ??() 

回答

0

它看起來像核心文件已損壞,可能是由於堆或堆棧損壞。腐敗通常是緩衝區溢出或其他未定義行爲的結果。

如果你在Linux上運行,我會嘗試valgrind。它通常可以很快發現腐敗現象。 Windows有一些類似的工具。

是的,多線程應用程序可能會溢出堆棧。每個線程只能分配一定數量。這通常只發生在您有非常深的函數調用堆棧或您正在堆棧上分配大型本地對象時。

關於爲Linux應用程序設置堆棧大小的一些有趣信息herehere

你面臨的問題,我想:

  1. 檢查lktrk_loce​​r_set方法的所有調用者。仔細研究每個,如果可能的話,看是否有明顯的堆棧溢出或堆損壞
  2. 嘗試使用Valgrind的或類似的工具來發現問題
  3. 添加調試日誌記錄的問題
0

隔離warning: Corrupted shared library list: 0x0 != 0x7c8d48ea8948c089

上述錯誤通常爲製作核心轉儲時所使用的那些,你給GDB不同系統庫的標誌(或主二進制)。

要麼在開發機器上分析「生產」核心轉儲,要麼在覈心轉儲生成和分析時間之間升級系統庫,或者重新構建主要二進制文件。

請參閱this answer如果以上任何一項是正確的,該怎麼做。