<p>I want to examine the contents of a std::vector in gdb but I don't have access to _M_impl because I'm using icc, not gcc, how do I do it? Let's say it's a std::vector for the sake of simplicity.</p>

<p>There is a very nice answer <a href="https://stackoverflow.com/questions/253099/how-do-i-print-the-elements-of-a-c-vector-in-gdb">here</a> but this doesn't work if I use icc, the error message is "There is no member or method named _M_impl". There appears to be a nice debug toolset <a href="http://www.yolinux.com/TUTORIALS/GDB-Commands.html#STLDEREF" rel="noreferrer">here</a> but it also relies on _M_impl.</p>

The
```
std::vector
```
template
guarantees the data is stored contiguously
.  If you take the address of the front element (say,
```
&v[0]
```
, for instance), you can access any other element in the vector through a C-style array.  That doesn't require you to have the source code of the STL available to your debugger.
After messing with this some, it appears that
```
v.front()
```
and
```
v.begin()
```
are likely inlined and GDB isn't finding them.  I'll keep looking, but personally I would simply add the line
```
int* i = &v[0]
```
to the source file, and then use GDB commands on
```
i
```
while debugging.  Note that the compiler is free to remove that dead code.  You may need to output the value of
```
i
```
to avoid that, or simply not crank up optimizations.