Jan Kratochvil 3f32311
commit 49ecef2a7da2ee9df4ae675f99b70518fbf1bb23
Jan Kratochvil 3f32311
Author: Andrew Pinski <apinski@cavium.com>
Jan Kratochvil 3f32311
Date:   Sat Jul 23 09:56:44 2016 -0700
Jan Kratochvil 3f32311
Jan Kratochvil 3f32311
    Fix ARMv8.1/v8.2 for hw watchpoint and breakpoint
Jan Kratochvil 3f32311
    
Jan Kratochvil 3f32311
    The problem here is ARMv8.1 (and ARMv8.2) define a
Jan Kratochvil 3f32311
    different debug version than ARMv8 (7 and 8 respectively).
Jan Kratochvil 3f32311
    This fixes hw watchpoints and breakpoints by checking
Jan Kratochvil 3f32311
    for those debug versions too.
Jan Kratochvil 3f32311
    
Jan Kratochvil 3f32311
    Committed as obvious after a test on aarch64-linux-gnu
Jan Kratochvil 3f32311
    (on a ThunderX machine which has ARMv8.1 support enabled).
Jan Kratochvil 3f32311
    
Jan Kratochvil 3f32311
    ChangeLog:
Jan Kratochvil 3f32311
    	* nat/aarch64-linux-hw-point.c
Jan Kratochvil 3f32311
    	(aarch64_linux_get_debug_reg_capacity): Handle
Jan Kratochvil 3f32311
    	ARMv8.1 and ARMv8.2 debug versions.
Jan Kratochvil 3f32311
    	* nat/aarch64-linux-hw-point.h
Jan Kratochvil 3f32311
    	(AARCH64_DEBUG_ARCH_V8_1): New define.
Jan Kratochvil 3f32311
    	(AARCH64_DEBUG_ARCH_V8_2): New define.
Jan Kratochvil 3f32311
    
Jan Kratochvil 3f32311
    Signed-off-by: Andrew Pinski <apinski@cavium.com>
Jan Kratochvil 3f32311
Jan Kratochvil 3f32311
### a/gdb/ChangeLog
Jan Kratochvil 3f32311
### b/gdb/ChangeLog
Jan Kratochvil 3f32311
## -1,3 +1,12 @@
Jan Kratochvil 3f32311
+2016-07-23  Andrew Pinski  <apinski@cavium.com>
Jan Kratochvil 3f32311
+
Jan Kratochvil 3f32311
+	* nat/aarch64-linux-hw-point.c
Jan Kratochvil 3f32311
+	(aarch64_linux_get_debug_reg_capacity): Handle
Jan Kratochvil 3f32311
+	ARMv8.1 and ARMv8.2 debug versions.
Jan Kratochvil 3f32311
+	* nat/aarch64-linux-hw-point.h
Jan Kratochvil 3f32311
+	(AARCH64_DEBUG_ARCH_V8_1): New define.
Jan Kratochvil 3f32311
+	(AARCH64_DEBUG_ARCH_V8_2): New define.
Jan Kratochvil 3f32311
+
Jan Kratochvil 3f32311
 2016-06-30  Руслан Ижбулатов  <lrn1986@gmail.com>
Jan Kratochvil 3f32311
 
Jan Kratochvil 3f32311
 	PR gdb/14529
Jan Kratochvil 3f32311
--- a/gdb/nat/aarch64-linux-hw-point.c
Jan Kratochvil 3f32311
+++ b/gdb/nat/aarch64-linux-hw-point.c
Jan Kratochvil 3f32311
@@ -630,7 +630,9 @@ aarch64_linux_get_debug_reg_capacity (int tid)
Jan Kratochvil 3f32311
 
Jan Kratochvil 3f32311
   /* Get hardware watchpoint register info.  */
Jan Kratochvil 3f32311
   if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_HW_WATCH, &iov) == 0
Jan Kratochvil 3f32311
-      && AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8)
Jan Kratochvil 3f32311
+      && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8
Jan Kratochvil 3f32311
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1
Jan Kratochvil 3f32311
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2))
Jan Kratochvil 3f32311
     {
Jan Kratochvil 3f32311
       aarch64_num_wp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
Jan Kratochvil 3f32311
       if (aarch64_num_wp_regs > AARCH64_HWP_MAX_NUM)
Jan Kratochvil 3f32311
@@ -650,7 +652,9 @@ aarch64_linux_get_debug_reg_capacity (int tid)
Jan Kratochvil 3f32311
 
Jan Kratochvil 3f32311
   /* Get hardware breakpoint register info.  */
Jan Kratochvil 3f32311
   if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_HW_BREAK, &iov) == 0
Jan Kratochvil 3f32311
-      && AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8)
Jan Kratochvil 3f32311
+      && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8
Jan Kratochvil 3f32311
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1
Jan Kratochvil 3f32311
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2))
Jan Kratochvil 3f32311
     {
Jan Kratochvil 3f32311
       aarch64_num_bp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
Jan Kratochvil 3f32311
       if (aarch64_num_bp_regs > AARCH64_HBP_MAX_NUM)
Jan Kratochvil 3f32311
--- a/gdb/nat/aarch64-linux-hw-point.h
Jan Kratochvil 3f32311
+++ b/gdb/nat/aarch64-linux-hw-point.h
Jan Kratochvil 3f32311
@@ -68,6 +68,8 @@
Jan Kratochvil 3f32311
 
Jan Kratochvil 3f32311
 /* Macro for the expected version of the ARMv8-A debug architecture.  */
Jan Kratochvil 3f32311
 #define AARCH64_DEBUG_ARCH_V8 0x6
Jan Kratochvil 3f32311
+#define AARCH64_DEBUG_ARCH_V8_1 0x7
Jan Kratochvil 3f32311
+#define AARCH64_DEBUG_ARCH_V8_2 0x8
Jan Kratochvil 3f32311
 
Jan Kratochvil 3f32311
 /* ptrace expects control registers to be formatted as follows:
Jan Kratochvil 3f32311