Reputation: 313
I have a small program that can ask users for some input (in essence just the gets function). Now, I want to play around with the input a little bit. I run the program with gdb and I want to insert bytes in hexadecimal format in the gdb prompt.
The way I tried to do it on the gdb command line interface is like so:
(gdb) printf "\x20\x20" | ./program
But that results in the error:
Unrecognized escape character \x in format string.
If I do the same in the shell without the gdb prompt its working. What am I doing wrong?
Thanks :)
Upvotes: 0
Views: 730
Reputation: 22529
You aren't doing anything wrong -- it is just a missing feature of gdb. You could file a bug report.
A workaround is:
(gdb) printf "%c", 0x20
Upvotes: 1