tags:

views:

175

answers:

3

I'm printing a string(char *) in gdb

(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 ... ". While at it - also extend the default printable length of a string, p seems to cut off if the string is quite long.

A: 

Try:

(gdb) x /s l
Paul R
Still get the "<repeats 12 times>" stuff.
nos
That's odd - I get that with `p` but not with `x /s`.
Paul R
A: 

Use gdb's printf command like this:

(gdb) printf "%s\n", a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

instead of

(gdb) p a  
$1 = 'a' <repeats 32 times>
Todd Hayton
+1  A: 
set print repeats 0

Example:

(gdb) p "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
$6 = 'a' <repeats 30 times>
(gdb) set print repeats 0
(gdb) p "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
$7 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
(gdb) set print repeats 10
(gdb) p "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
$8 = 'a' <repeats 30 times>
KennyTM