I've read many questions/answers here on SO on this topic but none of the solutions worked... I want to pipe a string generated by perl to an executable being debugged by gdb. But I can't even pass an escaped hexadecimal character... I've tried the following "solutions":
1:
$ gdb ./a.out
(gdb) r "\x41"
2:
perl -e 'print "\x41"' > input.cmd
$ gdb ./a.out
(gdb) r < input.cmd
3:
$ gdb --args ./a.out "\x41"
(gdb) r
4:
$ gdb ./a.out
(gdb) set args "\x41"
(gdb) r
and I also tried many different combinations of escape characters ", /, \, ', ` ... none worked. Solution number 2 is discussed on many posts here on SO but I get "<" as an argument (gdb is escaping everything to a string)
I even tried to no avail to debug bash and set the executable as a minor but the bash crashes...
What am I missing? I'm using gdb 8.0.1 on macOS 10.13
UPDATE:
just tried on a linux machine and the solutions above work. I'm guessing the problem is with the bash/gdb interaction on macOS... any ideas?
UPDATE2:
SOLVED
definitely an issue with bash calls inside gdb on macOS, managed to workaround like this:
$ gdb --args ./a.out $(perl -e 'print "\x41"')