I am starting to look into gdb python extension, some help needed.
Here is an example:
#include <vector>
int main() {
using namespace std;
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
return 0;
}
Here are the commands I used inside gdb:
(gdb) set print pretty
(gdb) n
7 v.push_back(1);
(gdb)
8 v.push_back(2);
(gdb)
9 v.push_back(3);
(gdb)
11 return 0;
(gdb) p v
$1 = std::vector of length 3, capacity 4 = {1, 2, 3}
You can see that vector printer just prints out some simple info. I wonder how to hack the vector printer so that it prints out all the elements?
Further, my ultimate goal is to print out a vector of my data type. I do not know how to print the individual data yet, is looking at that, but if you could point me the direction as of hooking up the printer for the individual data and the vector, I'd appreciate that.
Thanks!
[UPDATE] I certainly have been working too hard today, the values are printed out and I did not see it, sigh. Sorry.
My next step is to write a printer for my data type, so once I have that printer registered, vector printer can automatically uses it to print the individual data, is that right?