I have a Python program that is feeding JSON
input to a binary running in GDB
which then reads that input using the C function fread()
.
The problem is that fread()
needs a EOF/Ctrl-D
to stop reading but the JSON input I am passing to the binary in GDB
are strings so the binary just hangs waiting for more input or a Ctrl-D
.
I have red that apparently there isn't a way to pass an EOF
instruction using Python. Is there a way to define an instruction in GDB
that sends an EOF
to the binary instead maybe?
If this was possible I could then trigger that instruction in Python after I send the input.
I am not sure if something like this is possible in GDB
using the 'define' feature.
Thanks