I'm writing a client/server program in C.
My client has a thread reading input from stdin, it's just a while(1) loop to read input from stdin. Whenever it reads a line, it deliver it to another thread that handles message parsing and framing.
As I enter gdb, the command line is occupied by gdb prompt and I can no longer input lines into stdin.
Is there a way to do it? (I don't want to redirect stdin to an input file because I've tried this method and it didn't work)
Run your program in one terminal and attach to it from gdb in another terminal.
To attach to a running program, find the process ID (PID) of the program you want to attach to, then execute gdb <executable> <PID>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With