gdb: show typeinfo of some data

前端 未结 4 1369
轻奢々
轻奢々 2020-12-14 05:53

Basically, I want to get typeid(*this).name(), i.e. the real type of this.

I want to get this in GDB (without modifying the source code). I

4条回答
  •  既然无缘
    2020-12-14 06:22

    This question may be related: vtable in polymorphic class of C++ using gdb:

    (gdb) help set print object
    Set printing of object's derived type based on vtable info. 
    

    It's not exactly typeid() but it should show the real object type when inspecting a polymorphic pointer (e.g. this in a base class). Naturally works only for classes with a vtable (i.e. at least one virtual method) but so does typeid.

提交回复
热议问题