Alex Rivera | Logout

How do I print the full value of a long string in gdb?

Asked 2008-10-24T12:36:01.353
480

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?

Edit
Report

1 Answer

25

Just to complete it:

(gdb) p (char[10]) *($ebx)
$87 =   "asdfasdfe\n"

You must give a length, but may change the representation of that string:

(gdb) p/x (char[10]) *($ebx)
$90 =   {0x61,
  0x73,
  0x64,
  0x66,
  0x61,
  0x73,
  0x64,
  0x66,
  0x65,
  0xa}

This may be useful if you want to debug by their values

answered 2012-01-18T11:05:52.507

Your Answer