Inspecting contents of std::vector in Eclipse CDT debugger

半城伤御伤魂 提交于 2019-12-22 01:34:13

问题


I'm using Eclipse with the CDT plugin to develop in C++. I'm also using std library to create vectors and I am having an issue while debugging: Eclipse does not allow me to view the content of the vectors.

Is there any way to be able to debug it properly?


回答1:


Debugging STL containers in Eclipse is not quite straightforward. Please have a look at this question and the answers explaining the reasons for this. The simplest way without fiddling with the GDB for me is this answer, which can be summarized as follows:

Expand your vector in the variable view, you should find a nested variable _M_start. Right-click, choose "Display As Array..." and enter the desired range. The elements should then show up nested under _M_start.



来源:https://stackoverflow.com/questions/22246065/inspecting-contents-of-stdvector-in-eclipse-cdt-debugger

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!