particle128
particle128

Reputation: 185

How can I print the elements of a C++ vector in GDB on OSX 10.9?

I have read all the answers in How do I print the elements of a C++ vector in GDB?. But none of them can solve my problem on OSX 10.9, because nearly all of them are based on the fact that _M_impl is a member of vector, which is not the case on Mac.

Here is the result when I tried to write ~/.gdbinit according to this link

(gdb) pvector palin
There is no member or method named _M_impl.

I tried to read the source code of vector in /usr/include/c++/4.2.1/debug/vector (is this the right file ???), but I found it confusing. I think it is a little beyond my competence.

How can I print the elements of a C++ vector in GDB on OSX 10.9?

Upvotes: 0

Views: 901

Answers (1)

particle128
particle128

Reputation: 185

Finally, I turn to lldb, the default debug tool on Mac OSX.

I can print any container now. Thank god.

Upvotes: 1

Related Questions