ping On Fri, Jan 19, 2024 at 12:57 PM Alexandra Hájková wrote: > Currently, when GDBserver is run locally using stdio, the inferior > is unable to read from STDIN so we can't give it any input. > The main motivation to address this issue is to use GDB together > with Valgrind, using vgdb --multi feature which allows to run > Valgrind from inside GDB. Valgrind then acts as a locally run > GDBserver that uses stdio. > > Add a new DefaultInferiorFd feature and the corresponding packet. > This feature allows GDB to send, to GDBserver, the file descriptor > numbers of the terminal to which GDB is connected. The inferior is > then started connected to the same terminal as GDB. This allows the > inferior run by local GDBserver to read from GDB's STDIN and write > its output to GDB's STOUT/ERR the same way as native target. > > v2: - [2/6]:- add an error handling in a case dup would fail > - hoist the calls to mark_fd_no_cloexec near the dup()s > [3/6] - improve documentation formatting > - rephrase and extend the documentation > - cosmetics > - add a new target method so that gdbserver doesn't advertise > this new feauture on platforms it does not work at > [4/3] - cosmetics > > Alexandra Hájková (6): > gdb.server/non-existing-program.exp: Use gdbserver_start. > gdb/ser-pipe.c: Duplicate the file descriptors > Add new vDefaultInferiorFd packet > gdbserver/linux-low.cc: Connect the inferior to the terminal > remote.c: Add terminal handling functions > Add defaultinf.exp test to the testsuite > > gdb/doc/gdb.texinfo | 42 ++++++ > gdb/remote.c | 83 +++++++++++ > gdb/ser-pipe.c | 40 ++++++ > gdb/serial.c | 4 + > gdb/serial.h | 4 + > gdb/testsuite/gdb.server/defaultinf.c | 39 +++++ > gdb/testsuite/gdb.server/defaultinf.exp | 59 ++++++++ > .../gdb.server/non-existing-program.exp | 54 ++----- > gdb/testsuite/lib/gdbserver-support.exp | 62 +++++--- > gdbserver/linux-low.cc | 38 ++++- > gdbserver/linux-low.h | 2 + > gdbserver/server.cc | 135 +++++++++++++++++- > gdbserver/server.h | 12 ++ > gdbserver/target.cc | 6 + > gdbserver/target.h | 6 + > 15 files changed, 524 insertions(+), 62 deletions(-) > create mode 100644 gdb/testsuite/gdb.server/defaultinf.c > create mode 100644 gdb/testsuite/gdb.server/defaultinf.exp > > -- > 2.43.0 > >