summaryrefslogtreecommitdiff
path: root/gdb/linux-thread-db.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-03-04 20:41:16 +0000
committerPedro Alves <palves@redhat.com>2015-03-04 20:41:16 +0000
commitfaf09f0119da40d9b408021ad5665a906e00ee59 (patch)
treec1cee6b85358a10f56b1279ab2864137665f26af /gdb/linux-thread-db.c
parentf7e6eed5283bb5c8a3598dd986dc922b9a794f58 (diff)
downloadbinutils-gdb-faf09f0119da40d9b408021ad5665a906e00ee59.tar.gz
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.
Diffstat (limited to 'gdb/linux-thread-db.c')
-rw-r--r--gdb/linux-thread-db.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index c3d479b466a..29b52b33269 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1437,8 +1437,10 @@ check_event (ptid_t ptid)
info = get_thread_db_info (ptid_get_pid (ptid));
/* Bail out early if we're not at a thread event breakpoint. */
- stop_pc = regcache_read_pc (regcache)
- - target_decr_pc_after_break (gdbarch);
+ stop_pc = regcache_read_pc (regcache);
+ if (!target_supports_stopped_by_sw_breakpoint ())
+ stop_pc -= target_decr_pc_after_break (gdbarch);
+
if (stop_pc != info->td_create_bp_addr
&& stop_pc != info->td_death_bp_addr)
return;