Linux native: Use TRAP_BRKPT/TRAP_HWBPT
authorPedro Alves <palves@redhat.com>
Wed, 4 Mar 2015 20:41:16 +0000 (20:41 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 4 Mar 2015 20:41:16 +0000 (20:41 +0000)
commitfaf09f0119da40d9b408021ad5665a906e00ee59
treec1cee6b85358a10f56b1279ab2864137665f26af
parentf7e6eed5283bb5c8a3598dd986dc922b9a794f58
Linux native: Use TRAP_BRKPT/TRAP_HWBPT

This patch adjusts the native Linux target backend to tell the core
whether a trap was caused by a breakpoint.

It teaches the target to get that information out of the si_code of
the SIGTRAP siginfo.

Tested on x86-64 Fedora 20, s390 RHEL 7, and PPC64 Fedora 18.  An
earlier version was tested on ARM Fedora 21.

gdb/ChangeLog:
2015-03-04  Pedro Alves  <palves@redhat.com>

* linux-nat.c (save_sigtrap): Check for breakpoints before
checking watchpoints.
(status_callback) [USE_SIGTRAP_SIGINFO]: Don't check whether a
breakpoint is inserted if relying on SIGTRAP's siginfo.si_code.
(check_stopped_by_breakpoint) [USE_SIGTRAP_SIGINFO]: Decide whether
a breakpoint triggered based on the SIGTRAP's siginfo.si_code.
(linux_nat_stopped_by_sw_breakpoint)
(linux_nat_supports_stopped_by_sw_breakpoint)
(linux_nat_stopped_by_hw_breakpoint)
(linux_nat_supports_stopped_by_hw_breakpoint): New functions.
(linux_nat_wait_1): Don't re-increment the PC if relying on
SIGTRAP's siginfo->si_code.
(linux_nat_add_target): Install new target methods.
* linux-thread-db.c (check_event): Don't account for breakpoint PC
offset if the target already adjusted the PC.
* nat/linux-ptrace.h (USE_SIGTRAP_SIGINFO): New.
(GDB_ARCH_TRAP_BRKPT): New.
(TRAP_HWBKPT): Define if not already defined.
gdb/ChangeLog
gdb/linux-nat.c
gdb/linux-thread-db.c
gdb/nat/linux-ptrace.h