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?
#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
Does watches for 1d vector work?
Does watches work for simple variables (int,float)?
Yes, for a 1d vector Watches works. When I watched 2d & 3d vectors in 8.02 I could see them.
works here (latest debugger branch nightly, windows, gdb with python)
here is the log:
> 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> >
p temp command internally call the python pretty printer.
pvector temp use the stl container script support.
But the watch window does not parse the output quite well. :(
Watch windows doesn't parse the pretty printer output...
And I suppose that nyislander doesn't have pretty printers...
I went back to C::B 8.02 - all is well.
Quote from: nyislander on January 05, 2011, 03:56:33 AM
I went back to C::B 8.02 - all is well.
1, it seems only vector<int> is supported, so ,if you write vector<wxString>, I think you will get failed.
2, well, it seems there is a tiny bug in parsing the gdb's response string, I personally suggest using the python gdb script, it really support more types. (and can be extended to more user types).