gdbserver crash if gdb attaches too fast
authorPedro Alves <palves@redhat.com>
Mon, 30 Nov 2015 16:05:18 +0000 (16:05 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 30 Nov 2015 18:39:12 +0000 (18:39 +0000)
commit500c1d8576ad5a5bdc791fc7f7c3518a4d3f4b39
tree01c9ddf76e648f6e5b8153d84d569b07c0d79c79
parentde979965d3f5de7e4bf2354871fe85b3f77c720e
gdbserver crash if gdb attaches too fast

With "maint set target-non-stop on", the attach tests occasionally
crash gdbserver.

Basically, gdb attaches with vAttach;PID, and then shortly after reads
the xml target description for that process, to figure out the
process' architecture.  On the gdbserver side, the target description
is only filled in when the first process/thread in the thread group
reports its initial PTRACE_ATTACH SIGSTOP.  So if GDB is fast enough,
it can read the target description _before_ that initial stop, and
then gdbserver dies dereferencing a NULL tdesc pointer.

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

* linux-low.c (linux_attach): In non-stop mode, wait for one stop
before returning.
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
This page took 0.027956 seconds and 4 git commands to generate.