Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inspecting contents of std::vector in Eclipse CDT debugger

Tags:

c++

std

eclipse

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?

like image 640
Frion3L Avatar asked Mar 07 '14 09:03

Frion3L


1 Answers

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.

like image 85
pederpansen Avatar answered Nov 04 '22 09:11

pederpansen