Blame SOURCES/gdb-rhbz1363635-aarch64-armv8182.patch

01917d
commit 49ecef2a7da2ee9df4ae675f99b70518fbf1bb23
01917d
Author: Andrew Pinski <apinski@cavium.com>
01917d
Date:   Sat Jul 23 09:56:44 2016 -0700
01917d
01917d
    Fix ARMv8.1/v8.2 for hw watchpoint and breakpoint
01917d
    
01917d
    The problem here is ARMv8.1 (and ARMv8.2) define a
01917d
    different debug version than ARMv8 (7 and 8 respectively).
01917d
    This fixes hw watchpoints and breakpoints by checking
01917d
    for those debug versions too.
01917d
    
01917d
    Committed as obvious after a test on aarch64-linux-gnu
01917d
    (on a ThunderX machine which has ARMv8.1 support enabled).
01917d
    
01917d
    ChangeLog:
01917d
    	* nat/aarch64-linux-hw-point.c
01917d
    	(aarch64_linux_get_debug_reg_capacity): Handle
01917d
    	ARMv8.1 and ARMv8.2 debug versions.
01917d
    	* nat/aarch64-linux-hw-point.h
01917d
    	(AARCH64_DEBUG_ARCH_V8_1): New define.
01917d
    	(AARCH64_DEBUG_ARCH_V8_2): New define.
01917d
    
01917d
    Signed-off-by: Andrew Pinski <apinski@cavium.com>
01917d
01917d
### a/gdb/ChangeLog
01917d
### b/gdb/ChangeLog
01917d
## -1,3 +1,12 @@
01917d
+2016-07-23  Andrew Pinski  <apinski@cavium.com>
01917d
+
01917d
+	* nat/aarch64-linux-hw-point.c
01917d
+	(aarch64_linux_get_debug_reg_capacity): Handle
01917d
+	ARMv8.1 and ARMv8.2 debug versions.
01917d
+	* nat/aarch64-linux-hw-point.h
01917d
+	(AARCH64_DEBUG_ARCH_V8_1): New define.
01917d
+	(AARCH64_DEBUG_ARCH_V8_2): New define.
01917d
+
01917d
 2016-06-30  Руслан Ижбулатов  <lrn1986@gmail.com>
01917d
 
01917d
 	PR gdb/14529
01917d
Index: gdb-7.6.1/gdb/aarch64-linux-nat.c
01917d
===================================================================
01917d
--- gdb-7.6.1.orig/gdb/aarch64-linux-nat.c	2016-08-03 23:00:09.338705164 +0200
01917d
+++ gdb-7.6.1/gdb/aarch64-linux-nat.c	2016-08-03 23:00:55.016092435 +0200
01917d
@@ -110,6 +110,8 @@
01917d
 
01917d
 /* Macro for the expected version of the ARMv8-A debug architecture.  */
01917d
 #define AARCH64_DEBUG_ARCH_V8 0x6
01917d
+#define AARCH64_DEBUG_ARCH_V8_1 0x7
01917d
+#define AARCH64_DEBUG_ARCH_V8_2 0x8
01917d
 
01917d
 /* Number of hardware breakpoints/watchpoints the target supports.
01917d
    They are initialized with values obtained via the ptrace calls
01917d
@@ -789,7 +791,9 @@
01917d
 
01917d
   /* Get hardware watchpoint register info.  */
01917d
   if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_HW_WATCH, &iov) == 0
01917d
-      && AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8)
01917d
+      && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2))
01917d
     {
01917d
       aarch64_num_wp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
01917d
       if (aarch64_num_wp_regs > AARCH64_HWP_MAX_NUM)
01917d
@@ -809,7 +813,9 @@
01917d
 
01917d
   /* Get hardware breakpoint register info.  */
01917d
   if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_HW_BREAK, &iov) == 0
01917d
-      && AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8)
01917d
+      && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2))
01917d
     {
01917d
       aarch64_num_bp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
01917d
       if (aarch64_num_bp_regs > AARCH64_HBP_MAX_NUM)
01917d
Index: gdb-7.6.1/gdb/gdbserver/linux-aarch64-low.c
01917d
===================================================================
01917d
--- gdb-7.6.1.orig/gdb/gdbserver/linux-aarch64-low.c	2016-08-03 23:00:08.117694812 +0200
01917d
+++ gdb-7.6.1/gdb/gdbserver/linux-aarch64-low.c	2016-08-03 23:02:00.471647393 +0200
01917d
@@ -1187,6 +1187,8 @@
01917d
 #define AARCH64_DEBUG_NUM_SLOTS(x) ((x) & 0xff)
01917d
 #define AARCH64_DEBUG_ARCH(x) (((x) >> 8) & 0xff)
01917d
 #define AARCH64_DEBUG_ARCH_V8 0x6
01917d
+#define AARCH64_DEBUG_ARCH_V8_1 0x7
01917d
+#define AARCH64_DEBUG_ARCH_V8_2 0x8
01917d
 
01917d
 static void
01917d
 aarch64_arch_setup (void)
01917d
@@ -1203,7 +1205,9 @@
01917d
 
01917d
   /* Get hardware watchpoint register info.  */
01917d
   if (ptrace (PTRACE_GETREGSET, pid, NT_ARM_HW_WATCH, &iov) == 0
01917d
-      && AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8)
01917d
+      && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2))
01917d
     {
01917d
       aarch64_num_wp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
01917d
       if (aarch64_num_wp_regs > AARCH64_HWP_MAX_NUM)
01917d
@@ -1223,7 +1227,9 @@
01917d
 
01917d
   /* Get hardware breakpoint register info.  */
01917d
   if (ptrace (PTRACE_GETREGSET, pid, NT_ARM_HW_BREAK, &iov) == 0
01917d
-      && AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8)
01917d
+      && (AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_1
01917d
+	  || AARCH64_DEBUG_ARCH (dreg_state.dbg_info) == AARCH64_DEBUG_ARCH_V8_2))
01917d
     {
01917d
       aarch64_num_bp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
01917d
       if (aarch64_num_bp_regs > AARCH64_HBP_MAX_NUM)