|
|
"sylvaticus" <blackhole@xxxxxxxxxxxx> writes:
> I tryed both Eclipse and Kdevelop (with gdb), but in both cases I have
> _M_start , _M_finish and _M_end_of_storage but I can't display the
> whole vector content...
If you want graphical display, try TotalView (expensive).
In gdb you can peek inside vector like this:
(gdb) p v
$1 = {<std::_Vector_base<int, std::allocator<int> >> =
{<std::_Vector_alloc_base<int, std::allocator<int>, true>> = {_M_start =
0x8bd70a8, _M_finish = 0x8bd70b4,
_M_end_of_storage = 0x8bd70b8}, <No data fields>}, <No data fields>}
(gdb) p v.size()
$2 = 3
(gdb) x/3d v._M_start
0x8bd70a8: 1 2 3
Or, if you want to do this often, like this:
- add lines below to ~/.gdbinit
define vprint
set $n = $arg0._M_finish - $arg0._M_start
set $i = 0
while $i < $n
print $arg0._M_start[$i++]
end
end
- call it:
(gdb) vprint v
$3 = 1
$4 = 2
$5 = 3
The souce for above is:
$ cat vector.cc
#include <vector>
int main()
{
std::vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
return 0;
}
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
|
|