Today, I searched for something to substitute it. I found a very useful webpage. The GDB 7.0 now include support for writing pretty-printers in Python. I followed the instruction and tried it. It works! The good thing is that you do not need to remember any command, just type "p vector_name", "p set_name" in terminal.
p myvec
std::vector of length 12, capacity 12 = {1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0}
p primeset
$15 = std::set with 17 elements = {
[0] = 11,
[1] = 17,
[2] = 19,
[3] = 23,
[4] = 29,
[5] = 31,
[6] = 37,
[7] = 41,
[8] = 43,
[9] = 47,
[10] = 53,
[11] = 59,
[12] = 61,
[13] = 67,
[14] = 71,
[15] = 73,
[16] = 79
}
You can also view iterator in the same way.
I do not know why I can not print an element of a vector(p myvec[2]) in my working place although I installed a gdb with-python. But I found that yolinux had updated the gdb-stl-view utility. I can view set or map using this utility again! I noticed the following comments in it.
# Modified to work with g++ 4.3 by Anders Elton # Also added _member functions, that instead of printing the entire class in map, prints a member.
No comments:
Post a Comment