问题
If I start a normal 'gdb' session, then I can reach STDIN
and see STDOUT
directly in the terminal:
$ gdb wc
GNU gdb (Gentoo 7.10.1 vanilla) 7.10.1
...
gdb> run
Starting program: /usr/bin/wc
asdf
1 1 5
[Inferior 1 (process 28131) exited normally]
gdb> quit
$
Can I do the same with a gdbserver???
Here is what I have tried (gdbserver):
$ gdbserver /dev/ttyS0 wc
Process wc created; pid = 28156
Listening on port 2345
and client:
$ gdb
GNU gdb (Gentoo 7.10.1 vanilla) 7.10.1
...
gdb> c
Continuing.
Program received signal SIGINT, Interrupt.
0x00007ffff7ddbc40 in _start () from target:/lib64/ld-linux-x86-64.so.2
gdb>
But, it seems like STDIN
/STDOUT
is not being connected when using the gdbserver.
How can I run remote debugging over the serial line, and also access STDIN
/STDOUT
of the application that I'm debugging over the same serial line??
回答1:
How can I run remote debugging over the serial line, and also access STDIN/STDOUT of the application that I'm debugging over the same serial line??
You'll need to use screen or tmux to multiplex gdb<->gdbserver
and keyboard->application traffic over a single serial line.
来源:https://stackoverflow.com/questions/35082005/how-can-i-reach-stdin-stdout-through-a-gdbserver-session