* ppc-linux-nat.c (ppc_linux_read_description): New.
authorDaniel Jacobowitz <drow@false.org>
Mon, 15 Oct 2007 19:49:53 +0000 (19:49 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 15 Oct 2007 19:49:53 +0000 (19:49 +0000)
(_initialize_ppc_linux_nat): Set to_read_description.
* ppc-tdep.h (tdesc_powerpc_e500): Declare.

gdb/ChangeLog
gdb/ppc-linux-nat.c
gdb/ppc-tdep.h

index 38a3993053ec8c1aebf11c8a1e232578a2ca7b1c..c8f1e9ea3098432fdacd84370207b19ea2d4bd87 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * ppc-linux-nat.c (ppc_linux_read_description): New.
+       (_initialize_ppc_linux_nat): Set to_read_description.
+       * ppc-tdep.h (tdesc_powerpc_e500): Declare.
+
 2007-10-15  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * NEWS: Document target described register support for PowerPC.
index d86c9f855735df94603da802df890d19a70179e1..1e43640b51607bd05e8c7969847c647b2b2246fb 100644 (file)
@@ -940,6 +940,33 @@ fill_fpregset (const struct regcache *regcache,
                        fpregsetp, sizeof (*fpregsetp));
 }
 
+static const struct target_desc *
+ppc_linux_read_description (struct target_ops *ops)
+{
+  if (have_ptrace_getsetevrregs)
+    {
+      struct gdb_evrregset_t evrregset;
+      int tid = TIDGET (inferior_ptid);
+
+      if (tid == 0)
+       tid = PIDGET (inferior_ptid);
+
+      if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0)
+        return tdesc_powerpc_e500;
+      else
+        {
+          /* EIO means that the PTRACE_GETEVRREGS request isn't supported.  */
+          if (errno == EIO)
+           return NULL;
+         else
+            /* Anything else needs to be reported.  */
+            perror_with_name (_("Unable to fetch SPE registers"));
+       }
+    }
+
+  return NULL;
+}
+
 void _initialize_ppc_linux_nat (void);
 
 void
@@ -962,6 +989,8 @@ _initialize_ppc_linux_nat (void)
   t->to_stopped_by_watchpoint = ppc_linux_stopped_by_watchpoint;
   t->to_stopped_data_address = ppc_linux_stopped_data_address;
 
+  t->to_read_description = ppc_linux_read_description;
+
   /* Register the target.  */
   linux_nat_add_target (t);
   linux_nat_set_new_thread (t, ppc_linux_new_thread);
index 76fcf9e76ab590fabb1a2dbb93dfd5447de40c98..2b566dfb2543478f5f49eddd701ae85328a3b201 100644 (file)
@@ -227,4 +227,6 @@ enum {
 /* Estimate for the maximum number of instrctions in a function epilogue.  */
 #define PPC_MAX_EPILOGUE_INSTRUCTIONS  52
 
+extern struct target_desc *tdesc_powerpc_e500;
+
 #endif /* ppc-tdep.h */