User forums > Help

Display 2d Vector in Watches

(1/2) > >>

nyislander:
C::B 10.02

In debug if I set a breakpoint on the "Pause" and try to display let's say temp[1] in the Watches for the following code I get the message "no available data" under the temp[1] watch.  What am I doing wrong?


--- Code: ---#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

int main()
{ // main

int j = 0, h = 0;
vector< vector< int > > temp (5);

        for (h = 0; h < 5; ++h)
           {for (j = 0; j < 5; ++j){temp[h].push_back(j); cout << setw(2) << temp[h][j];} cout << endl;}
        system("PAUSE");

} // end main
--- End code ---

oBFusCATed:
Does watches for 1d vector work?
Does watches work for simple variables (int,float)?

nyislander:
Yes, for a 1d vector Watches works.  When I watched 2d & 3d vectors in 8.02 I could see them.

ollydbg:
works  here (latest debugger branch nightly, windows, gdb with python)
here is the log:

--- Code: ---> p temp
$6 = std::vector of length 5, capacity 5 = {std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}, std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}, std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}, std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}, std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}}
>>>>>>cb_gdb:
> pvector temp
elem[0]: $7 = std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}
elem[1]: $8 = std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}
elem[2]: $9 = std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}
elem[3]: $10 = std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}
elem[4]: $11 = std::vector of length 5, capacity 8 = {0, 1, 2, 3, 4}
Vector size = 5
Vector capacity = 5
Element type = std::vector<int, std::allocator<int> >

--- End code ---


--- Code: ---p temp
--- End code ---
command internally call the python pretty printer.

--- Code: ---pvector temp
--- End code ---
use the stl container script support.

But the watch window does not parse the output quite well. :(

oBFusCATed:
Watch windows doesn't parse the pretty printer output...

And I suppose that nyislander doesn't have pretty printers...

Navigation

[0] Message Index

[#] Next page

Go to full version