c++ - GDB set variable from the return of whatis -
gdb whatis returns type of variable. wonder how use result variable.
(gdb) whatis myintvalue int (gdb) set $typeint = whatis myintvalue // it's impossible want (gdb) p *($typeint)0xabcd // address having int value
i want use above casting generic memory address template class type (which has very long name).
and casting type variant hard put every single name while debugging.
there's no way assign type convenience variable. however, can saving value in convenience variable , using typeof
:
(gdb) set $x = 23ll (gdb) ptype $x type = long long (gdb) ptype (typeof($x))'z' type = long long
Comments
Post a Comment