Suppose I have a buffer buf
whose c string representation is
char* buf = \"Hello World \\x1c\"
When I print this buf in gdb using
For anyone else who shares the irritation with octal escape-sequences in GDB, it's easy to fix (if you're prepared to build GDB yourself): in gdb/valprint.c, find the comment:
/* If the value fits in 3 octal digits, print it that
way. Otherwise, print it as a hex escape. */
and comment out the following 4 lines - all escape-sequences will then be printed as hex.