displaced_step_fixup may access memory from the wrong inferior/thread
displaced_step_fixup takes an thread to work with, as argument. OTOH,
gdbarch_displaced_step_fixup fixes up the current thread. The former
calls the latter without making sure the current thread is the one
that was passed in. If it is not, then gdbarch_displaced_step_fixup
may e.g., try reading from a running thread, which doesn't work on
some targets, or worse, read memory from the wrong inferior and
succeed.
This is mostly a latent problem currently, as non-stop switches the
current thread to the event thread early in fetch_inferior_event.
Tested on x86_64 Fedora 20.
gdb/
2015-02-10 Pedro Alves <palves@redhat.com>
* infrun.c (displaced_step_fixup): Switch to the event thread
before calling gdbarch_displaced_step_fixup.