參考: http://sourceware.org/gdb/wiki/STLSupport
http://blog.csdn.net/fdl19881/article/details/8710636
http://blog.sina.com.cn/s/blog_4fcd1ea30100xhio.html
vi ~/.gdbinit 輸入一下內容
python
import sys
sys.path.insert(0, '/usr/share/gdb/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
set print pretty on
set print elements 1000
原中的方法用過前2中,自己做過測試,第一種直接p就可以
第二種需要對應的 pvector pmap plist pset pqueue 等命令
注意:如果map 中有自己定義的結構體且有string , 第二種方法打印會有錯誤(char數組沒有類似問題)