Output formats (debugging with gdb)by default, gdb prints a value according to its data type Sometimes this is not what you want For example, you might want to print a number in hex, or a pointer in decimal Or you might want to view data in memory at a certain address as a character string or as an instruction To do these things, specify an output format when you print a value. What language are you after
For c strings, you use the strlen () function In c++, you have a length () function on your std::string type In python, it's the len () function. (gdb) show print elements limit on string chars or array elements to printis200 you can see that the default will only print200characters This can be verified by the previous example. This page explains the print command
Run set print elements 0 When the last number is a positive integer, it denotes the number of elements in an array (in this case, a char array since our target is a string) that should be printed without truncation Every element will be printed out. (gdb) p l l=0x9aa1f48 up2 129104596496602200 19 0 0 3 0 eth1 xx :001cb,'0' <repeats 12 times>, dc is there a setting to have p print the whole string and not fill inn the repeats If gdb is printing a large string, it stops printing after it has printed the number of characters set by the set print characters command
WATCH