]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
gdbserver: introduce support to show the AVX registers.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 24 May 2012 21:33:17 +0000 (21:33 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 24 May 2012 21:33:17 +0000 (21:33 +0000)
This implies to change the interface between the
arch independent gdbserver files and the arch dependent files
as AVX implies a choice of xml files at run time.

In valgrind-low-amd64.c, the xml files and the nr of registers
are different depending on AVX support or not.

Other platforms still have a fully static nr of registers.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12581

19 files changed:
coregrind/Makefile.am
coregrind/m_gdbserver/64bit-avx-valgrind-s1.xml [new file with mode: 0644]
coregrind/m_gdbserver/64bit-avx-valgrind-s2.xml [new file with mode: 0644]
coregrind/m_gdbserver/64bit-avx.xml [new file with mode: 0644]
coregrind/m_gdbserver/amd64-avx-coresse-valgrind.xml [new file with mode: 0644]
coregrind/m_gdbserver/amd64-avx-coresse.xml [new file with mode: 0644]
coregrind/m_gdbserver/amd64-avx-linux-valgrind.xml [new file with mode: 0644]
coregrind/m_gdbserver/amd64-avx-linux.xml [new file with mode: 0644]
coregrind/m_gdbserver/server.c
coregrind/m_gdbserver/target.c
coregrind/m_gdbserver/target.h
coregrind/m_gdbserver/valgrind-low-amd64.c
coregrind/m_gdbserver/valgrind-low-arm.c
coregrind/m_gdbserver/valgrind-low-ppc32.c
coregrind/m_gdbserver/valgrind-low-ppc64.c
coregrind/m_gdbserver/valgrind-low-s390x.c
coregrind/m_gdbserver/valgrind-low-x86.c
coregrind/m_gdbserver/valgrind_low.h
docs/xml/manual-core-adv.xml

index 2cc83b982f5b4f923295578c0246db83c751ccb0..5d0462cbc01e76c61e940788127780255de97067 100644 (file)
@@ -469,6 +469,9 @@ GDBSERVER_XML_FILES = \
        m_gdbserver/32bit-sse-valgrind-s1.xml \
        m_gdbserver/32bit-sse-valgrind-s2.xml \
        m_gdbserver/32bit-sse.xml \
+       m_gdbserver/64bit-avx-valgrind-s2.xml \
+       m_gdbserver/64bit-avx-valgrind-s1.xml \
+       m_gdbserver/64bit-avx.xml \
        m_gdbserver/64bit-core-valgrind-s1.xml \
        m_gdbserver/64bit-core-valgrind-s2.xml \
        m_gdbserver/64bit-core.xml \
@@ -478,6 +481,10 @@ GDBSERVER_XML_FILES = \
        m_gdbserver/64bit-sse-valgrind-s1.xml \
        m_gdbserver/64bit-sse-valgrind-s2.xml \
        m_gdbserver/64bit-sse.xml \
+       m_gdbserver/amd64-avx-coresse-valgrind.xml \
+       m_gdbserver/amd64-avx-coresse.xml \
+       m_gdbserver/amd64-avx-linux-valgrind.xml \
+       m_gdbserver/amd64-avx-linux.xml \
        m_gdbserver/amd64-coresse-valgrind.xml \
        m_gdbserver/amd64-linux-valgrind.xml \
        m_gdbserver/arm-core-valgrind-s1.xml \
diff --git a/coregrind/m_gdbserver/64bit-avx-valgrind-s1.xml b/coregrind/m_gdbserver/64bit-avx-valgrind-s1.xml
new file mode 100644 (file)
index 0000000..cc2bb59
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010-2012 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.i386.avx.valgrind.s1">
+  <reg name="ymm0hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm1hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm2hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm3hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm4hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm5hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm6hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm7hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm8hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm9hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm10hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm11hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm12hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm13hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm14hs1" bitsize="128" type="uint128"/>
+  <reg name="ymm15hs1" bitsize="128" type="uint128"/>
+</feature>
diff --git a/coregrind/m_gdbserver/64bit-avx-valgrind-s2.xml b/coregrind/m_gdbserver/64bit-avx-valgrind-s2.xml
new file mode 100644 (file)
index 0000000..f82cb16
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010-2012 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.i386.avx.valgrind.s2">
+  <reg name="ymm0hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm1hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm2hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm3hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm4hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm5hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm6hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm7hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm8hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm9hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm10hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm11hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm12hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm13hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm14hs2" bitsize="128" type="uint128"/>
+  <reg name="ymm15hs2" bitsize="128" type="uint128"/>
+</feature>
diff --git a/coregrind/m_gdbserver/64bit-avx.xml b/coregrind/m_gdbserver/64bit-avx.xml
new file mode 100644 (file)
index 0000000..838bd6a
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010-2012 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.i386.avx">
+  <reg name="ymm0h" bitsize="128" type="uint128"/>
+  <reg name="ymm1h" bitsize="128" type="uint128"/>
+  <reg name="ymm2h" bitsize="128" type="uint128"/>
+  <reg name="ymm3h" bitsize="128" type="uint128"/>
+  <reg name="ymm4h" bitsize="128" type="uint128"/>
+  <reg name="ymm5h" bitsize="128" type="uint128"/>
+  <reg name="ymm6h" bitsize="128" type="uint128"/>
+  <reg name="ymm7h" bitsize="128" type="uint128"/>
+  <reg name="ymm8h" bitsize="128" type="uint128"/>
+  <reg name="ymm9h" bitsize="128" type="uint128"/>
+  <reg name="ymm10h" bitsize="128" type="uint128"/>
+  <reg name="ymm11h" bitsize="128" type="uint128"/>
+  <reg name="ymm12h" bitsize="128" type="uint128"/>
+  <reg name="ymm13h" bitsize="128" type="uint128"/>
+  <reg name="ymm14h" bitsize="128" type="uint128"/>
+  <reg name="ymm15h" bitsize="128" type="uint128"/>
+</feature>
diff --git a/coregrind/m_gdbserver/amd64-avx-coresse-valgrind.xml b/coregrind/m_gdbserver/amd64-avx-coresse-valgrind.xml
new file mode 100644 (file)
index 0000000..2b75715
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!-- AMD64 - core and sse.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+  <architecture>i386:x86-64</architecture>
+  <xi:include href="64bit-core.xml"/>
+  <xi:include href="64bit-sse.xml"/>
+  <xi:include href="64bit-avx.xml"/>
+  <xi:include href="64bit-core-valgrind-s1.xml"/>
+  <xi:include href="64bit-sse-valgrind-s1.xml"/>
+  <xi:include href="64bit-avx-valgrind-s1.xml"/>
+  <xi:include href="64bit-core-valgrind-s2.xml"/>
+  <xi:include href="64bit-sse-valgrind-s2.xml"/>
+  <xi:include href="64bit-avx-valgrind-s2.xml"/>
+</target>
diff --git a/coregrind/m_gdbserver/amd64-avx-coresse.xml b/coregrind/m_gdbserver/amd64-avx-coresse.xml
new file mode 100644 (file)
index 0000000..c46b318
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!-- AMD64 - core and sse and avx.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+  <architecture>i386:x86-64</architecture>
+  <xi:include href="64bit-core.xml"/>
+  <xi:include href="64bit-sse.xml"/>
+  <xi:include href="64bit-avx.xml"/>
+</target>
diff --git a/coregrind/m_gdbserver/amd64-avx-linux-valgrind.xml b/coregrind/m_gdbserver/amd64-avx-linux-valgrind.xml
new file mode 100644 (file)
index 0000000..d692664
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!-- AMD64 with avx - Includes Linux-only special "register".  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+  <architecture>i386:x86-64</architecture>
+  <osabi>GNU/Linux</osabi>
+  <xi:include href="64bit-core.xml"/>
+  <xi:include href="64bit-sse.xml"/>
+  <xi:include href="64bit-linux.xml"/>
+  <xi:include href="64bit-avx.xml"/>
+  <xi:include href="64bit-core-valgrind-s1.xml"/>
+  <xi:include href="64bit-sse-valgrind-s1.xml"/>
+  <xi:include href="64bit-linux-valgrind-s1.xml"/>
+  <xi:include href="64bit-avx-valgrind-s1.xml"/>
+  <xi:include href="64bit-core-valgrind-s2.xml"/>
+  <xi:include href="64bit-sse-valgrind-s2.xml"/>
+  <xi:include href="64bit-linux-valgrind-s2.xml"/>
+  <xi:include href="64bit-avx-valgrind-s2.xml"/>
+</target>
diff --git a/coregrind/m_gdbserver/amd64-avx-linux.xml b/coregrind/m_gdbserver/amd64-avx-linux.xml
new file mode 100644 (file)
index 0000000..3fea2e4
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2010 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!-- AMD64 with avx - Includes Linux-only special "register".  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+  <architecture>i386:x86-64</architecture>
+  <osabi>GNU/Linux</osabi>
+  <xi:include href="64bit-core.xml"/>
+  <xi:include href="64bit-sse.xml"/>
+  <xi:include href="64bit-linux.xml"/>
+  <xi:include href="64bit-avx.xml"/>
+</target>
index 58fb2295ac484c21e1c093641cb8d96628d13d94..661041ed76a4dd999c138ef66b18406d1033ccff 100644 (file)
@@ -532,8 +532,7 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
       }
    }
 
-   if ( (valgrind_target_xml() != NULL 
-         || valgrind_shadow_target_xml() != NULL)
+   if (valgrind_target_xml(VG_(clo_vgdb_shadow_registers)) != NULL
         && strncmp ("qXfer:features:read:", arg_own_buf, 20) == 0) {
       CORE_ADDR ofs;
       unsigned int len, doc_len;
@@ -549,19 +548,11 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
       }
       
       if (strcmp (annex, "target.xml") == 0) {
-         annex = NULL; // to replace it by the corresponding filename.
-
-         /* If VG_(clo_vgdb_shadow_registers), try to use
-            shadow_target_xml. Fallback to target_xml
-            if not defined. */
-         if (VG_(clo_vgdb_shadow_registers)) {
-            annex = valgrind_shadow_target_xml();
-            if (annex != NULL)
-               /* Ensure the shadow registers are initialized. */
-               initialize_shadow_low(True);
+         annex = valgrind_target_xml(VG_(clo_vgdb_shadow_registers));
+         if (annex != NULL && VG_(clo_vgdb_shadow_registers)) {
+            /* Ensure the shadow registers are initialized. */
+            initialize_shadow_low(True);
          }
-         if (annex == NULL)
-            annex = valgrind_target_xml();
          if (annex == NULL) {
             strcpy (arg_own_buf, "E00");
             return;
@@ -669,8 +660,7 @@ void handle_query (char *arg_own_buf, int *new_packet_len_p)
       if (VG_(client_auxv))
          strcat (arg_own_buf, ";qXfer:auxv:read+");
 
-      if (valgrind_target_xml() != NULL
-          || valgrind_shadow_target_xml() != NULL) {
+      if (valgrind_target_xml(VG_(clo_vgdb_shadow_registers)) != NULL) {
          strcat (arg_own_buf, ";qXfer:features:read+");
          /* if a new gdb connects to us, we have to reset the register
             set to the normal register sets to allow this new gdb to
index 0a4094e1d91c0c16ebcb309188b4457259572ac9..905efb929ffad529b84294e353c5fe2b51360349 100644 (file)
@@ -491,14 +491,9 @@ int valgrind_point (Bool insert, char type, CORE_ADDR addr, int len)
       return 1; /* error or unsupported */
 }
 
-char* valgrind_target_xml (void)
+char* valgrind_target_xml (Bool shadow_mode)
 {
-   return (char *) the_low_target.target_xml;
-}
-
-char* valgrind_shadow_target_xml (void)
-{
-   return (char *) the_low_target.shadow_target_xml;
+   return (*the_low_target.target_xml) (shadow_mode);
 }
 
 int valgrind_insert_watchpoint (char type, CORE_ADDR addr, int len)
index b5adda14b7f5757f661db927c5be041ca769528a..2cd41fd918d745aead4c54e679a293604ec797da 100644 (file)
@@ -58,12 +58,12 @@ extern void valgrind_initialize_target(void);
 extern void initialize_shadow_low (Bool shadow_mode);
 
 /* Returns the name of the xml target description file. 
-   returns NULL if no xml target description available. */
-extern char* valgrind_target_xml (void);
-
-/* Same but describes also the shadow registers. */
-extern char* valgrind_shadow_target_xml (void);
-
+   returns NULL if no xml target description available.
+   if shadow_mode, then returns the xml target description
+   with the shadow registers
+   else returns the xml target description only for
+   the normal registers. */
+extern char* valgrind_target_xml (Bool shadow_mode);
 
 
 /* -------------------------------------------------------------------------- */
index d46afec0f235ee5f1041ceb7a15ab4e13851ddcd..3d6d84553f9b27d94ae5e7e1306538e73d35184e 100644 (file)
@@ -27,7 +27,7 @@
 #include "regcache.h"
 
 #include "pub_core_aspacemgr.h"
-#include "pub_tool_machine.h"
+#include "pub_core_machine.h"
 #include "pub_core_threadstate.h"
 #include "pub_core_transtab.h"
 #include "pub_core_gdbserver.h" 
@@ -100,11 +100,29 @@ struct reg regs[] = {
   { "xmm15", 4128, 128 },
   { "mxcsr", 4256, 32  },
 #if defined(VGO_linux)
-  { "orig_rax", 4288, 64 }
+  { "orig_rax", 4288, 64 },
 #endif
+  { "ymm0h", 4352, 128 }, // The ymm?h registers only to be given to GDB
+  { "ymm1h", 4480, 128 }, // if Valgrind is running with AVX instructions.
+  { "ymm2h", 4608, 128 },
+  { "ymm3h", 4736, 128 },
+  { "ymm4h", 4864, 128 },
+  { "ymm5h", 4992, 128 },
+  { "ymm6h", 5120, 128 },
+  { "ymm7h", 5248, 128 },
+  { "ymm8h", 5376, 128 },
+  { "ymm9h", 5504, 128 },
+  { "ymm10h", 5632, 128 },
+  { "ymm11h", 5760, 128 },
+  { "ymm12h", 5888, 128 },
+  { "ymm13h", 6016, 128 },
+  { "ymm14h", 6144, 128 },
+  { "ymm15h", 6272, 128 }
 };
 static const char *expedite_regs[] = { "rbp", "rsp", "rip", 0 };
-#define num_regs (sizeof (regs) / sizeof (regs[0]))
+#define max_num_regs (sizeof (regs) / sizeof (regs[0]))
+static int dyn_num_regs; // if no AVX, we have to give less registers to gdb.
+
 
 static
 CORE_ADDR get_pc (void)
@@ -135,8 +153,8 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
                         transfer_direction dir, int size, Bool *mod)
 {
    ThreadState* tst = VG_(get_ThreadState)(tid);
-   int set = abs_regno / num_regs;
-   int regno = abs_regno % num_regs;
+   int set = abs_regno / dyn_num_regs;
+   int regno = abs_regno % dyn_num_regs;
    *mod = False;
 
    VexGuestAMD64State* amd64 = (VexGuestAMD64State*) get_arch (set, tst);
@@ -269,29 +287,83 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
       }
       break;
    case 57: *mod = False; break; // GDBTD???? VEX equivalent { "orig_rax"},
+   case 58: VG_(transfer) (&amd64->guest_YMM0[4],  buf, dir, size, mod); break;
+   case 59: VG_(transfer) (&amd64->guest_YMM1[4],  buf, dir, size, mod); break;
+   case 60: VG_(transfer) (&amd64->guest_YMM2[4],  buf, dir, size, mod); break;
+   case 61: VG_(transfer) (&amd64->guest_YMM3[4],  buf, dir, size, mod); break;
+   case 62: VG_(transfer) (&amd64->guest_YMM4[4],  buf, dir, size, mod); break;
+   case 63: VG_(transfer) (&amd64->guest_YMM5[4],  buf, dir, size, mod); break;
+   case 64: VG_(transfer) (&amd64->guest_YMM6[4],  buf, dir, size, mod); break;
+   case 65: VG_(transfer) (&amd64->guest_YMM7[4],  buf, dir, size, mod); break;
+   case 66: VG_(transfer) (&amd64->guest_YMM8[4],  buf, dir, size, mod); break;
+   case 67: VG_(transfer) (&amd64->guest_YMM9[4],  buf, dir, size, mod); break;
+   case 68: VG_(transfer) (&amd64->guest_YMM10[4], buf, dir, size, mod); break;
+   case 69: VG_(transfer) (&amd64->guest_YMM11[4], buf, dir, size, mod); break;
+   case 70: VG_(transfer) (&amd64->guest_YMM12[4], buf, dir, size, mod); break;
+   case 71: VG_(transfer) (&amd64->guest_YMM13[4], buf, dir, size, mod); break;
+   case 72: VG_(transfer) (&amd64->guest_YMM14[4], buf, dir, size, mod); break;
+   case 73: VG_(transfer) (&amd64->guest_YMM15[4], buf, dir, size, mod); break;
    default: vg_assert(0);
    }
 }
 
+static
+Bool have_avx(void)
+{
+   VexArch va;
+   VexArchInfo vai;
+   VG_(machine_get_VexArchInfo) (&va, &vai);
+   return (vai.hwcaps & VEX_HWCAPS_AMD64_AVX ? True : False);
+}
+static
+char* target_xml (Bool shadow_mode)
+{
+   if (shadow_mode) {
+#if defined(VGO_linux)
+      if (have_avx())
+         return "amd64-avx-linux-valgrind.xml";
+      else
+         return "amd64-linux-valgrind.xml";
+#else
+      if (have_avx())
+         return "amd64-avx-coresse-valgrind.xml";
+      else
+         return "amd64-coresse-valgrind.xml";
+#endif
+   } else {
+#if defined(VGO_linux)
+      if (have_avx())
+         return "amd64-avx-linux.xml";
+      else
+         return NULL;
+#else
+      if (have_avx())
+         return "amd64-avx-coresse.xml";
+      else
+         return NULL;
+#endif
+   }  
+}
+
 static struct valgrind_target_ops low_target = {
-   num_regs,
+   -1, // Must be computed at init time.
    regs,
    7, //RSP
    transfer_register,
    get_pc,
    set_pc,
    "amd64",
-   NULL, // target_xml not needed.
-#if defined(VGO_linux)
-   "amd64-linux-valgrind.xml"
-#else
-   "amd64-coresse-valgrind.xml"
-#endif
+   target_xml
 };
 
 void amd64_init_architecture (struct valgrind_target_ops *target)
 {
    *target = low_target;
-   set_register_cache (regs, num_regs);
+   if (have_avx())
+      dyn_num_regs = max_num_regs;
+   else
+      dyn_num_regs = max_num_regs - 16; // remove the AVX "high" registers.
+   target->num_regs = dyn_num_regs;
+   set_register_cache (regs, dyn_num_regs);
    gdbserver_expedite_regs = expedite_regs;
 }
index 5767793e9678488b9661d693a75f34c8a9a9d273..1c00a270f71b8db457f44bd5a09e1f5ef44a99db 100644 (file)
@@ -277,6 +277,16 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
    }
 }
 
+static
+char* target_xml (Bool shadow_mode)
+{
+   if (shadow_mode) {
+      return "arm-with-vfpv3-valgrind.xml";
+   } else {
+      return "arm-with-vfpv3.xml";
+   }  
+}
+
 static struct valgrind_target_ops low_target = {
    num_regs,
    regs,
@@ -285,8 +295,7 @@ static struct valgrind_target_ops low_target = {
    get_pc,
    set_pc,
    "arm",
-   "arm-with-vfpv3.xml",
-   "arm-with-vfpv3-valgrind.xml"
+   target_xml
 };
 
 void arm_init_architecture (struct valgrind_target_ops *target)
index a7e282ed645036a444af929fccbded9611aa9fb2..fccdb6462524f0a24ee7c46c169ef741f165dd53 100644 (file)
@@ -322,6 +322,16 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
    }
 }
 
+static
+char* target_xml (Bool shadow_mode)
+{
+   if (shadow_mode) {
+      return "powerpc-altivec32l-valgrind.xml";
+   } else {
+      return "powerpc-altivec32l.xml";
+   }  
+}
+
 static struct valgrind_target_ops low_target = {
    num_regs,
    regs,
@@ -330,8 +340,7 @@ static struct valgrind_target_ops low_target = {
    get_pc,
    set_pc,
    "ppc32",
-   "powerpc-altivec32l.xml",
-   "powerpc-altivec32l-valgrind.xml"
+   target_xml
 };
 
 void ppc32_init_architecture (struct valgrind_target_ops *target)
index f2fdbecc8b116a32e4105b5990feb6f94854e120..6f1075768b024161908a396b30d757ee650b1516 100644 (file)
@@ -319,6 +319,16 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
    }
 }
 
+static
+char* target_xml (Bool shadow_mode)
+{
+   if (shadow_mode) {
+      return "powerpc-altivec64l-valgrind.xml";
+   } else {
+      return "powerpc-altivec64l.xml";
+   }  
+}
+
 static struct valgrind_target_ops low_target = {
    num_regs,
    regs,
@@ -327,8 +337,7 @@ static struct valgrind_target_ops low_target = {
    get_pc,
    set_pc,
    "ppc64",
-   "powerpc-altivec64l.xml",
-   "powerpc-altivec64l-valgrind.xml"
+   target_xml
 };
 
 void ppc64_init_architecture (struct valgrind_target_ops *target)
index aae9355150f7f7f36eb8cf7ec542987c12188009..15d216249effe8cd7a9a8238d48ec230af646b93 100644 (file)
@@ -187,6 +187,16 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
    }
 }
 
+static
+char* target_xml (Bool shadow_mode)
+{
+   if (shadow_mode) {
+      return "s390x-generic-valgrind.xml";
+   } else {
+      return "s390x-generic.xml";
+   }  
+}
+
 static struct valgrind_target_ops low_target = {
    num_regs,
    regs,
@@ -195,8 +205,7 @@ static struct valgrind_target_ops low_target = {
    get_pc,
    set_pc,
    "s390x",
-   "s390x-generic.xml",
-   "s390x-generic-valgrind.xml"
+   target_xml
 };
 
 void s390x_init_architecture (struct valgrind_target_ops *target)
index 991b8bd70e2b7282385c9e48abf8727fdad2b7c4..50d31931937a8a2ef3b1d0b2fa5e1072bb066d17 100644 (file)
@@ -243,6 +243,20 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
    }
 }
 
+static
+char* target_xml (Bool shadow_mode)
+{
+   if (shadow_mode) {
+#if defined(VGO_linux)
+   return "i386-linux-valgrind.xml";
+#else
+   return "i386-coresse-valgrind.xml";
+#endif
+   } else {
+      return NULL;
+   }  
+}
+
 static struct valgrind_target_ops low_target = {
    num_regs,
    regs,
@@ -251,12 +265,7 @@ static struct valgrind_target_ops low_target = {
    get_pc,
    set_pc,
    "i386",
-   NULL, // target_xml not needed.
-#if defined(VGO_linux)
-   "i386-linux-valgrind.xml"
-#else
-   "i386-coresse-valgrind.xml"
-#endif
+   target_xml
 };
 
 void x86_init_architecture (struct valgrind_target_ops *target)
index e89c2dcfde4b576035fc3268c143359481f42db8..29dafcdd8203d1631da5436e41cb7ede92c4d33d 100644 (file)
@@ -54,17 +54,17 @@ struct valgrind_target_ops
       or NULL not to answer.  */
    const char *arch_string;
    
-   /* Description of the set of registers.
+   /* Returns the target xml description of the set of registers.
       For some architectures (e.g. arm), it is mandatory
       to give a description of the registers, otherwise
       gdb does not understand the reply to the 'g' packet
-      (which is used to get the registers). */
-   const char *target_xml;
+      (which is used to get the registers).
+      If shadow_mode, returns a target xml description
+      including the two shadow registers sets.
+      This is mandatory to use the option --vgdb-shadow-registers=yes. 
+      Returns NULL if there is no target xml file*/
+   char* (*target_xml) (Bool shadow_mode);
 
-   /* Same as target_xml, but describes also the two shadow
-      registers set.
-      This is mandatory to use the option --vgdb-shadow-registers=yes. */
-   const char *shadow_target_xml;
 };
 
 extern void x86_init_architecture (struct valgrind_target_ops *target);
index efde71102feb47de470d0dcfc474346038840c63..46d33ee353601098e21cc4907dd71d836350f1ce 100644 (file)
@@ -700,6 +700,25 @@ $3 = 0
 values instead of float values, as it is expected that these
 shadow values are mostly used for memcheck validity bits. </para>
 
+<para>Intel/amd64 AVX registers <computeroutput>ymm0</computeroutput>
+to <computeroutput>ymm15</computeroutput> have also their shadow
+registers. However, GDB presents the shadow values using two
+"half" registers. For example, the half shadow registers for 
+<computeroutput>ymm9</computeroutput> are
+<computeroutput>xmm9s1</computeroutput> (lower half for set 1),
+<computeroutput>ymm9hs1</computeroutput> (upper half for set 1),
+<computeroutput>xmm9s2</computeroutput> (lower half for set 2),
+<computeroutput>ymm9hs2</computeroutput> (upper half for set 2).
+Note the inconsistent notation for the names of the half registers:
+the lower part starts with an <computeroutput>x</computeroutput>,
+the upper part starts with an <computeroutput>y</computeroutput>
+and has an <computeroutput>h</computeroutput> before the shadow postfix.
+</para>
+<para>The special presentation of the AVX shadow registers is due
+to the fact that GDB retrieves independently the lower and upper half
+of the <computeroutput>ymm</computeroutput> registers. GDB however
+does not know that the shadow half registers have to be shown combined.
+</para>
 </sect2>