Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reach STDIN/STDOUT through a gdbserver session

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??

like image 310
Allan Avatar asked Oct 30 '22 10:10

Allan


1 Answers

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.

like image 99
Employed Russian Avatar answered Nov 09 '22 09:11

Employed Russian