Reputation: 35982
char* buf;
...
(gdb) x/s buf
0x7fffef8f5f80: "35=DC\001\064\071=ABCD\001"
(gdb) x/12cb buf
0x7fffef8f5f80: 51 '3' 53 '5' 61 '=' 65 'D' 66 'C' 1 '\001' 52 '4' 57 '9'
0x7fffef8f5f88: 61 '=' 83 'A' 80 'B' 88 'C' 84 'D' 1 '\001'
Question> How can I enable gdb to print the buf as the following:
"35=DC\00149=ABCD\001"
?
Thank you
Upvotes: 2
Views: 3659
Reputation: 22549
Question> How can I enable gdb to print the buf as the following:
There is no way to do this right now. You could file a gdb bug report if you like.
What is going on here is that gdb's string-printing function has a special case to escape a digit when it follows a character that was emitted as an escape sequence. That is why you see \064
and not 4
.
Upvotes: 3