keiths / rpms / gdb

Forked from rpms/gdb 4 months ago
Clone
Blob Blame History Raw
https://bugzilla.redhat.com/show_bug.cgi?id=827600
Re: [PATCH] disable ptrace BookE interface for PowerPC server processors
http://sourceware.org/ml/gdb-patches/2012-05/msg01107.html
http://sourceware.org/ml/gdb-cvs/2012-05/msg00221.html

### src/gdb/ChangeLog	2012/05/31 18:44:47	1.14306
### src/gdb/ChangeLog	2012/05/31 22:07:29	1.14307
## -1,3 +1,9 @@
+2012-05-31  Edjunior Machado  <emachado@linux.vnet.ibm.com>
+
+	* ppc-linux-nat.c (have_ptrace_booke_interface): Disable ptrace
+	BookE interface for PowerPC server processors if not available
+	in the Linux Kernel.
+
 2012-05-31  Keith Seitz  <keiths@redhat.com>
 
 	* linespec.c (decode_objc): Add cleanup to free
--- src/gdb/ppc-linux-nat.c	2012/05/30 13:37:17	1.112
+++ src/gdb/ppc-linux-nat.c	2012/05/31 22:07:31	1.113
@@ -1421,17 +1421,20 @@
       /* Check for kernel support for BOOKE debug registers.  */
       if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &booke_debug_info) >= 0)
 	{
-	  have_ptrace_booke_interface = 1;
-	  max_slots_number = booke_debug_info.num_instruction_bps
-	    + booke_debug_info.num_data_bps
-	    + booke_debug_info.num_condition_regs;
-	}
-      else
-	{
-	  /* Old school interface and no BOOKE debug registers support.  */
-	  have_ptrace_booke_interface = 0;
-	  memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
+	  /* Check whether ptrace BOOKE interface is functional and
+	     provides any supported feature.  */
+	  if (booke_debug_info.features != 0)
+	    {
+	      have_ptrace_booke_interface = 1;
+	      max_slots_number = booke_debug_info.num_instruction_bps
+	        + booke_debug_info.num_data_bps
+	        + booke_debug_info.num_condition_regs;
+	      return have_ptrace_booke_interface;
+	    }
 	}
+      /* Old school interface and no BOOKE debug registers support.  */
+      have_ptrace_booke_interface = 0;
+      memset (&booke_debug_info, 0, sizeof (struct ppc_debug_info));
     }
 
   return have_ptrace_booke_interface;