linux gdb 调试STL

发布时间 2023-08-01 16:01:52作者: angryCoder996

1.进入网站:https://sourceware.org/gdb/wiki/STLSupport,下载STL Surport Tool

 2.将stl_views_1.0.3.gdb放到linux任意路径下,如/data/

3.进入gdb调试模式,输入source /data/stl_views_1.0.3.gdb

4.使用pmap查看std::map的内容 pmap MYMAP int int (后面2个int标识map中key和value的类型)

 

支持的STL

#       std::vector<T> -- via pvector command
# std::list<T> -- via plist or plist_member command
# std::map<T,T> -- via pmap or pmap_member command
# std::multimap<T,T> -- via pmap or pmap_member command
# std::set<T> -- via pset command
# std::multiset<T> -- via pset command
# std::deque<T> -- via pdequeue command
# std::stack<T> -- via pstack command
# std::queue<T> -- via pqueue command
# std::priority_queue<T> -- via ppqueue command
# std::bitset<n> -- via pbitset command
# std::string -- via pstring command
# std::widestring -- via pwstring command