binutils-gdb/gdb/testsuite/gdb.server
Pedro Alves 3d40fbb53b gdbserver crashes when multiprocess extensions aren't supported
Ref: https://sourceware.org/ml/gdb-patches/2015-08/msg00675.html

If multiprocess extensions are off (because specific gdbserver port
doesn't support them), then when gdbserver doesn't have a thread
selected yet, and GDB sends Hg packet to select one, gdbserver
crashes.  That's because extracting the desired thread id out of the
packet that GDB sent depends on the current thread to fill in the
missing process id ...  Fix this by getting the process id from the
first (and only) process in the processes list instead.

The GNU/Linux port doesn't trip on this because it always runs with
multiprocess extensions enabled.  To make it easier to catch such
regressions going forward, this commit also adds a new smoke test that
spawns gdbserver, connects to it and runs to main with the
multiprocess extensions force-disabled.

gdb/gdbserver/ChangeLog:
2015-08-24  Pedro Alves  <palves@redhat.com>

	* inferiors.c (get_first_process): New function.
	* inferiors.h (get_first_process): New declaration.
	* remote-utils.c (read_ptid): Default to the first process in the
	list, instead of to the current thread's process.

gdb/testsuite/ChangeLog:
2015-08-24  Pedro Alves  <palves@redhat.com>

	* gdb.server/connect-without-multi-process.c: New file.
	* gdb.server/connect-without-multi-process.exp: New file.
2015-08-24 19:58:31 +01:00
..
Makefile.in
connect-stopped-target.c remote non-stop: Process initially stopped threads before other commands 2015-08-20 18:27:55 +01:00
connect-stopped-target.exp remote non-stop: Process initially stopped threads before other commands 2015-08-20 18:27:55 +01:00
connect-without-multi-process.c gdbserver crashes when multiprocess extensions aren't supported 2015-08-24 19:58:31 +01:00
connect-without-multi-process.exp gdbserver crashes when multiprocess extensions aren't supported 2015-08-24 19:58:31 +01:00
ext-attach.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
ext-attach.exp testsuite: tcl exec& -> 'kill -9 $pid' is racy (attach-many-short-lived-thread.exp races and others) 2015-07-31 20:06:24 +01:00
ext-restart.exp Set general_thread after restart 2015-07-24 14:40:34 +01:00
ext-run.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
ext-wrapper.exp Test --wrapper when restarting process. 2015-07-24 14:40:34 +01:00
file-transfer.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
no-thread-db.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
no-thread-db.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
non-existing-program.exp Fix sequential gdb test runs 2015-05-08 18:06:46 +01:00
server-exec-info.exp Fix gdb.server/server-exec-info.exp with the extended-remote board 2015-07-28 18:04:07 +01:00
server-kill.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
server-kill.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
server-mon.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
server-run.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
server.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
solib-list-lib.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
solib-list-main.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
solib-list.exp Fix gdb.server/solib-list.exp native-extended-gdbserver regression 2015-08-20 20:08:48 +01:00
transfer.txt
wrapper.c Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00
wrapper.exp Update year range in copyright notice of all files owned by the GDB project. 2015-01-01 13:32:14 +04:00