开发者

How can I see stl list values in gdb

I'm using Eclipse, and when I debug, the values of the list variables are unreadable and cr开发者_JAVA百科yptic. How can I see those values? I'm on Linux.


GDB 7 has support for python scripting which can be used to write pretty printers. For STL, the pretty printers need to understand the details of the implementation, so the pretty printers definitions must be supplied as part the standard library implementation.

For libstdc++, you can get a copy of the pretty printers from here, though you probably want to track down the specific version of that file that matches your particular libstdc++ version.

You will need to do some work to educate your copy of GDB about this file, probably via the gdb 'source' command, but once you have convinced GDB to load it you should be able to pretty print many STL data structures, std::list included.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜