S/390: displaced stepping and PC-relative RIL-b/RIL-c instructions
This adds displaced stepping support for the General-Instruction
Extension Facility instructions, which have a PC-relative displacement
(RIL-b/RIL-c). We already handle RIL branches, but not others.
Currently, displaced stepping a breakpoint put on any of these
instructions results in the inferior crashing when or after the
instruction is executed out-of-line in the scratch pad.
This patch takes the easy route of patching the displacement in the
copy of the instruction in the scratch pad. As the displacement is a
signed 32-bit field, it's possible that the stratch pad ends too far
that the needed displacement doesn't fit in the adjusted instruction,
as e.g., if stepping over a breakpoint in a shared library (the
scratch pad is around the main program's entry point). That case is
detected and GDB falls back to stepping over the breakpoint in-line
(which involves pausing all threads momentarily).
(We could probably do something smarter, but I don't plan on doing it
myself. This was already sufficient to get "maint set target-non-stop
on" working regression free on S/390.)
Tested on S/390 RHEL 7.1, where it fixes a few hundred FAILs when
testing with displaced stepping force-enabled, with the end result
being no regressions compared to a test run that doesn't force
displaced stepping. Fixes the non-stop tests compared to mainline
too; most are crashing due to this on the machine I run tests on.
gdb/ChangeLog:
2015-08-07 Pedro Alves <palves@redhat.com>
* s390-linux-tdep.c (is_non_branch_ril)
(s390_displaced_step_copy_insn): New functions.
(s390_displaced_step_fixup): Update comment.
(s390_gdbarch_init): Install s390_displaced_step_copy_insn as
gdbarch_displaced_step_copy_insn hook.