I want to print the full length of a C-string in GDB. By default it\'s being abbreviated, how do I force GDB to print the whole string?
Using set elements ... isn't always the best way. It would be useful if there were a distinct set string-elements ....
So, I use these functions in my .gdbinit:
define pstr
ptype $arg0._M_dataplus._M_p
printf "[%d] = %s\n", $arg0._M_string_length, $arg0._M_dataplus._M_p
end
define pcstr
ptype $arg0
printf "[%d] = %s\n", strlen($arg0), $arg0
end
Caveats: