what would "<_ZThn24_N15[Some namespace]22[Some class name]D1Ev>" mean in gdb?

I'm trying to debug one core dump and I've found structure, whose first variable points to 0x00000055558.. when I type x 0x00000055558.., it outputs:

0x55558.. <_ZTVN15NameSpace22ClassNameE+16>:    0x0000005..

Does that means there is a variable of this class defined here? Trying to go 16 bytes back and casting this to ClassName does not give valid values.

Sorry for such newbie question, but I couldn't find that in google for quite a lot of time.

Answers


You are seeing a mangled name. You can tell GDB to demangle it for you (or better yet, demangle names from now on):

set print demangle on

According to this website, this command tells GDB to:

Print C++ names in their source form rather than in the encoded ("mangled") form passed to the assembler and linker for type-safe linkage. The default is on.

Also, to see the code at a certain address, you can write:

l *0x<address>

See the other answers for ways to demangle that symbol name. It will probably turn out to be something like "vtable for NameSpace::ClassName". (g++ symbols beginning with _ZTV are vtables.)

Finding a pointer to an offset inside a vtable is usually a very good indication that you have found memory containing an object whose most-derived type is that class. It doesn't guarantee it's not left over deallocated memory or some such thing, of course.


Need Your Help

How to combine CCSpriteBatchNode with CCAnimation?

objective-c ios cocos2d-iphone

I've been trying to wrap my head around this, and I haven't found any good explanation in the docs or the forum or here, so here goes: