code_junkie

How do I print the elements of a C++ vector in GDB?

Nov 12th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. print *(myVector._M_impl._M_start)@myVector.size()
  2.  
  3. print *(myVector._M_impl._M_start)@N
  4.  
  5. myVector._M_impl._M_start
  6.  
  7. print P@N
  8.  
  9. (gdb) print myVector
  10.  
  11. $1 = std::vector of length 3, capacity 4 = {10, 20, 30}
Add Comment
Please, Sign In to add comment