[PATCH/7.10 2/2] gdbserver: Fix non-stop / fork / step-over issues

Pedro Alves palves@redhat.com
Mon Aug 3 16:20:00 GMT 2015

On 08/03/2015 04:14 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>>    I fixed some of these issues recently, but there's a lot more to
>>    do.  Fixing that one just exposes other similar problems elsewhere.
>>    Meanwhile, I've filed PR18749 and kfailed the test for native.
> This test case also exposes the issue on arm-linux with gdbserver,
> (gdb) PASS: gdb.threads/fork-plus-threads-2.exp: detach-on-fork=on: continue &
> [New Thread 29905]^M
> [New Thread 29900]^M
> [New Thread 29895]^M
> [New Thread 29898]^M
> [New Thread 29902]^M
> [New Thread 29896]^M
> [New Thread 29903]^M
> [New Thread 29901]^M
> [New Thread 29899]^M
> [New Thread 29904]^M
> [New Thread 29897]^M
> Error in testing breakpoint condition:^M
> Cannot access memory at address 0x11094^M
> FAIL: gdb.threads/fork-plus-threads-2.exp: detach-on-fork=on: inferior 1 exited

Ah, OK, so I guess it'll fail on all targets where gdbserver
does not handle the breakpoint condition server-side.

> Remote debugging from host^M
> ^M
> Child exited with status 0^M
> GDBserver exiting^M
> ../../binutils-gdb/gdb/thread.c:936: internal-error: finish_thread_state: Assertion `tp' failed.^M
> A problem internal to GDB has been detected,^M
> further debugging may prove unreliable.^M
> Quit this debugging session? (y or n) monitor exit^M
> Please answer y or n.^M
> ../../binutils-gdb/gdb/thread.c:936: internal-error: finish_thread_state: Assertion `tp' failed.^

I've seem this too while developing the patch.  I saw it happen when the
connection is abruptly closed while there's a finish_thread_state cleanup
installed (while gdb is handling an event, within fetch_inferior_event).  The
connection-close deletes all threads, and the cleanup wants to finish the
state of a now-nonexisting thread.  See [palves/fork_stale_running] on my github.

Pedro Alves

More information about the Gdb-patches mailing list