aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRogerio Alves <rcardoso@linux.ibm.com>2020-12-01 16:53:38 -0300
committerRogerio Alves <rcardoso@linux.ibm.com>2020-12-01 16:53:38 -0300
commit539d71e89a21990d9fd15641477e4790129bdb11 (patch)
treee9b6b57d0132c057ecfdc9346c13ac3c61122371
parent0ae45769809bc2d571c3c75cec27c76ec4c1bfc3 (diff)
downloadfsf-binutils-gdb-539d71e89a21990d9fd15641477e4790129bdb11.zip
fsf-binutils-gdb-539d71e89a21990d9fd15641477e4790129bdb11.tar.gz
fsf-binutils-gdb-539d71e89a21990d9fd15641477e4790129bdb11.tar.bz2
PowerPC remove 512 bytes region limit if 2nd DAWR is avaliable.
Power 10 introduces the 2nd DAWR (second watchpoint) and also removed a restriction that limit the watch region to 512 bytes. 2020-11-08 Rogerio A. Cardoso <rcardoso@linux.ibm.com> /gdb * ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define. (region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before set region.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/ppc-linux-nat.c26
2 files changed, 23 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a1814a0..39637aa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-12-01 Rogerio A. Cardoso <rcardoso@linux.ibm.com>
+ * ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define.
+ (region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before
+ set region.
+
2020-11-30 Tom de Vries <tdevries@suse.de>
PR symtab/26905
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 095ed57..a4d216b 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -138,6 +138,11 @@ struct ppc_hw_breakpoint
#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10
#endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */
+/* Feature defined on Linux kernel v5.1: Second watchpoint support. */
+#ifndef PPC_DEBUG_FEATURE_DATA_BP_ARCH_31
+#define PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 0x20
+#endif /* PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 */
+
/* The version of the PowerPC HWDEBUG kernel interface that we will use, if
available. */
#define PPC_DEBUG_CURRENT_VERSION 1
@@ -2108,9 +2113,10 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
watchpoints. */
if (m_dreg_interface.hwdebug_p ())
{
- int region_size;
const struct ppc_debug_info &hwdebug_info = (m_dreg_interface
.hwdebug_info ());
+ int region_size = hwdebug_info.data_bp_alignment;
+ int region_align = region_size;
/* Embedded DAC-based processors, like the PowerPC 440 have ranged
watchpoints and can watch any access within an arbitrary memory
@@ -2122,15 +2128,19 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
return 2;
/* Check if the processor provides DAWR interface. */
if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
- /* DAWR interface allows to watch up to 512 byte wide ranges which
- can't cross a 512 byte boundary. */
- region_size = 512;
- else
- region_size = hwdebug_info.data_bp_alignment;
+ {
+ /* DAWR interface allows to watch up to 512 byte wide ranges. */
+ region_size = 512;
+ /* DAWR interface allows to watch up to 512 byte wide ranges which
+ can't cross a 512 byte bondary on machines that doesn't have a
+ second DAWR (P9 or less). */
+ if (!(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_ARCH_31))
+ region_align = 512;
+ }
/* Server processors provide one hardware watchpoint and addr+len should
fall in the watchable region provided by the ptrace interface. */
- if (region_size
- && (addr + len > (addr & ~(region_size - 1)) + region_size))
+ if (region_align
+ && (addr + len > (addr & ~(region_align - 1)) + region_size))
return 0;
}
/* addr+len must fall in the 8 byte watchable region for DABR-based