How can I reach STDIN/STDOUT through a gdbserver session

自古美人都是妖i 提交于 2019-12-12 12:08:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!