[PATCH 0/4] GDBServer: introduce a dedicated stderr stream

Cleber Rosa
2015-03-21T02:35:02Z

This patch series add command line options and monitor commands that
will redirect all of the gdbserver's own output (always sent to stderr)
to a separate file. This feature makes it possible to distinguish between
the inferior process stderr and gdbserver's own stderr.

This happens to be needed for the Avocado[1] project GDB support[2][3].
One of Avocado's GDB features is that it lets users "transparently"
run binaries instrumented by GDB. A test that executes binaries
can give the user the opportunity to interact with the process running
within gdb(server). This uses a combination of gdb (with MI) and gdbserver.
So far so good.

But, since Avocado is a test framework, it lets tests PASS or FAIL
depending on executed commands' STDERR and STDOUT matching what the
test writer expects. Matching against STDOUT is already doable as
gdbserver doesn't write to stdout, but it does write to stderr, the
same stderr that the inferior process writes to.

I appreciate any comments/questions/reviews.

Thanks,
Cleber Rosa.

[1] - http://github.com/avocado-framework
[2] - http://avocado-framework.readthedocs.org/en/latest/DebuggingWithGDB.html
[3] - https://github.com/avocado-framework/avocado/blob/master/avocado/gdb.py

---
gdb/doc/gdb.texinfo | 13 +++++
gdb/gdbserver/ax.c | 3 +-
gdb/gdbserver/debug.c | 6 +--
gdb/gdbserver/event-loop.c | 2 +-
gdb/gdbserver/linux-aarch64-low.c | 28 +++++------
gdb/gdbserver/linux-low.c | 10 ++--
gdb/gdbserver/lynx-low.c | 8 +--
gdb/gdbserver/mem-break.c | 4 +-
gdb/gdbserver/notif.c | 4 +-
gdb/gdbserver/remote-utils.c | 54 ++++++++++-----------
gdb/gdbserver/server.c | 145 +++++++++++++++++++++++++++++++++++++------------------
gdb/gdbserver/server.h | 4 ++
gdb/gdbserver/spu-low.c | 14 +++---
gdb/gdbserver/target.c | 4 +-
gdb/gdbserver/thread-db.c | 4 +-
gdb/gdbserver/utils.c | 25 +++++-----
gdb/testsuite/gdb.server/server-mon.exp | 8 +++