c++ - gdb: show typeinfo of some data - Stack Overflow 85 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 tried print typeid(*this) but it says that typeid is unknown (because I didn't included it there in the source file)
GDB Tips and Tricks #6: Examining Data Types - ShaneKirk. com You can turn to the source code to seek this out If the type turns out to be a struct class, typedef, or type alias, you might need to do a bit more spelunking to fully understand what kind of data is in play Fortunately, gdb provides us with a couple of commands to help us out when it comes to data types – whatis and ptype whatis
gdb. types (Debugging with GDB) - sourceware. org get_basic_type (type) Return type with const and volatile qualifiers stripped, and with typedefs and C ++ references converted to the underlying type C ++ example: typedef const int const_int; const_int foo (3); const_int foo_ref (foo); int main () { return 0; } Then in gdb: (gdb) start (gdb) python import gdb types (gdb) python foo_ref = gdb parse_and_eval ("foo_ref") (gdb) python print
c - Unknown type in gdb - Stack Overflow $17 = <unknown type> When I print byte_size I get: Function return type unknown I'm getting a seg fault on the asprint command so I'm trying to see the values of these two variables I "set complaints 5" in gdb and now I see this after running in gdb (the line number is the line where bytes_over has a value assigned to it):
Type examination in gdb | sfink @ Mozilla Type examination in gdb Sometimes, the exact layout of objects in memory becomes very important Some situations you may encounter: When overlaying different types as “views” of the same memory location, perhaps via reinterpret_cast, union s, or void* -casting You want to know where the field in one view lands in another
Variables (Debugging with GDB) - sourceware. org See unknown type, for more about unknown types If you cast the variable to its declared type, GDB gets the variable’s value using the cast-to type as the variable’s type