[PATCH 00/18] Remote all-stop on top of non-stop

Pedro Alves
2015-10-14T15:28:19Z

This series implements remote support for all-stop on top of non-stop.

The first bits do the base work, enough to start running the testsuite
with "maint set target-non-stop on". And then one by one, the patches
tackle issues exposed by the testsuite until I found no regressions on
x86-64 Fedora 20 (remote and extended-remote).

The last patch in the series enables the feature by default. What
this means is that for non-stop-aware remote stubs that support all
the needed extensions, GDB will always connect in non-stop mode. Note
that from the users' perspective, nothing should change -- gdb still
stops all threads whenever a breakpoint hits, etc.

The difference is that with the remote side in non-stop mode, gdb is
always free to sent commands/packets, even while the target is
running, due to the asynchronous nature of the non-stop variant of the
RSP. E.g.,

Before:

(gdb) c&
Continuing.
(gdb) Reading /lib64/libpthread.so.0 from remote target...
Reading /lib64/libc.so.6 from remote target...
b threads.c:68
Cannot execute this command while the target is running.
Use the "interrupt" command to stop the target
and then try again.
(gdb)

After:

(gdb) c&
Continuing.
(gdb) Reading /lib64/libpthread.so.0 from remote target...
Reading /lib64/libc.so.6 from remote target...
info threads
[New Thread 24891]
[New Thread 24892]
Id Target Id Frame
3 Thread 24892 (running)
2 Thread 24891 (running)
* 1 Thread 24881 (running)
(gdb) b threads.c:68
Breakpoint 1 at 0x400811: file threads.c, line 68.
(gdb) [Switching to Thread 24891]

Breakpoint 1, thread_function0 (arg=0x0) at threads.c:68
68 (*myp) ++;
info threads
Id Target Id Frame
3 Thread 24892 0x0000003615ebc6ed in nanosleep () at ../sysdeps/unix/syscall-template.S:81
* 2 Thread 24891 thread_function0 (arg=0x0) at threads.c:68
1 Thread 24881 0x0000003616a09237 in pthread_join (threadid=140737353881344, thread_return=0x7fffffffd718) at pthread_join.c:92
(gdb)

In addition, this paves to way for itsets support with remote
targets too.

As with the equivalent work done for the native target, it's easy to
revert back to the old behavior by entering "maint set target-non-stop
off" or reverting the last patch.

Pedro Alves (18):
Fix mi-nonstop.exp with extended-remote
Remote all-stop-on-top-of-non-stop
attach + target always in non-stop mode: stop all threads
gdbserver crash running gdb.threads/non-ldr-exc-1.exp
remote: stop reason and watchpoint data address per thread
New vCtrlC packet, non-stop mode equivalent of \003
gdbserver crash if gdb attaches too fast
gdbserver resume_stop handling bug
Make dprintf-non-stop.exp cope with remote testing
Remote thread create/exit events
gdbserver: fix killed-outside.exp
testsuite: Range stepping and non-stop mode
infrun: Fix TARGET_WAITKIND_NO_RESUMED handling in non-stop mode
Implement TARGET_WAITKIND_NO_RESUMED in the remote protocol
gdbserver:prepare_access_memory: pick another thread
gdbserver/linux: Always wake up event loop after resume
gdbserver: don't exit until GDB disconnects
remote: enable "maint set target-non-stop" by default

gdb/NEWS | 28 ++
gdb/doc/gdb.texinfo | 123 +++++++-
gdb/gdbserver/gdbthread.h | 4 +
gdb/gdbserver/inferiors.c | 23 ++
gdb/gdbserver/linux-low.c | 180 ++++++++---
gdb/gdbserver/mem-break.c | 17 +-
gdb/gdbserver/remote-utils.c | 21 +-
gdb/gdbserver/server.c | 151 ++++++---
gdb/gdbserver/server.h | 1 +
gdb/gdbserver/target.c | 107 +++++++
gdb/gdbserver/target.h | 14 +-
gdb/gdbthread.h | 7 +-
gdb/infcmd.c | 101 ++++--
gdb/inferior.h | 12 +
gdb/infrun.c | 150 ++++++++-
gdb/infrun.h | 6 +
gdb/remote-notif.c | 4 +-
gdb/remote.c | 438 ++++++++++++++++++++++-----
gdb/target-delegates.c | 28 ++
gdb/target.c | 8 +
gdb/target.h | 5 +
gdb/target/waitstatus.c | 5 +
gdb/target/waitstatus.h | 8 +-
gdb/testsuite/gdb.base/dprintf-non-stop.exp | 10 +-
gdb/testsuite/gdb.mi/mi-nonstop.exp | 11 +-
gdb/testsuite/lib/gdb.exp | 20 +-
gdb/testsuite/lib/mi-support.exp | 9 +
gdb/testsuite/lib/range-stepping-support.exp | 7 +-
gdb/thread.c | 16 +
29 files changed, 1266 insertions(+), 248 deletions(-)

--
1.9.3