@@ -188,4 +188,7 @@ initialize_tdesc_aarch64 (void)
tdesc_create_reg (feature, "fpcr", 67, 1, NULL, 32, "int");
tdesc_aarch64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("aarch64.xml", tdesc_aarch64);
+#endif /* GDB_SELF_TEST */
}
@@ -72,4 +72,7 @@ initialize_tdesc_arc_arcompact (void)
tdesc_create_reg (feature, "status32", 35, 1, NULL, 32, "status32_type");
tdesc_arc_arcompact = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arc-arcompact.xml", tdesc_arc_arcompact);
+#endif /* GDB_SELF_TEST */
}
@@ -76,4 +76,7 @@ initialize_tdesc_arc_v2 (void)
tdesc_create_reg (feature, "status32", 35, 1, NULL, 32, "status32_type");
tdesc_arc_v2 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arc-v2.xml", tdesc_arc_v2);
+#endif /* GDB_SELF_TEST */
}
@@ -79,4 +79,7 @@ initialize_tdesc_arm_with_iwmmxt (void)
tdesc_create_reg (feature, "wCGR3", 47, 1, "vector", 32, "int");
tdesc_arm_with_iwmmxt = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arm/arm-with-iwmmxt.xml", tdesc_arm_with_iwmmxt);
+#endif /* GDB_SELF_TEST */
}
@@ -43,4 +43,7 @@ initialize_tdesc_arm_with_m_fpa_layout (void)
tdesc_create_reg (feature, "xpsr", 25, 1, NULL, 32, "int");
tdesc_arm_with_m_fpa_layout = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arm/arm-with-m-fpa-layout.xml", tdesc_arm_with_m_fpa_layout);
+#endif /* GDB_SELF_TEST */
}
@@ -53,4 +53,7 @@ initialize_tdesc_arm_with_m_vfp_d16 (void)
tdesc_create_reg (feature, "fpscr", 42, 1, "float", 32, "int");
tdesc_arm_with_m_vfp_d16 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arm/arm-with-m-vfp-d16.xml", tdesc_arm_with_m_vfp_d16);
+#endif /* GDB_SELF_TEST */
}
@@ -34,4 +34,7 @@ initialize_tdesc_arm_with_m (void)
tdesc_create_reg (feature, "xpsr", 25, 1, NULL, 32, "int");
tdesc_arm_with_m = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arm/arm-with-m.xml", tdesc_arm_with_m);
+#endif /* GDB_SELF_TEST */
}
@@ -71,4 +71,7 @@ initialize_tdesc_arm_with_neon (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.arm.neon");
tdesc_arm_with_neon = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arm/arm-with-neon.xml", tdesc_arm_with_neon);
+#endif /* GDB_SELF_TEST */
}
@@ -53,4 +53,7 @@ initialize_tdesc_arm_with_vfpv2 (void)
tdesc_create_reg (feature, "fpscr", 42, 1, "float", 32, "int");
tdesc_arm_with_vfpv2 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arm/arm-with-vfpv2.xml", tdesc_arm_with_vfpv2);
+#endif /* GDB_SELF_TEST */
}
@@ -69,4 +69,7 @@ initialize_tdesc_arm_with_vfpv3 (void)
tdesc_create_reg (feature, "fpscr", 58, 1, "float", 32, "int");
tdesc_arm_with_vfpv3 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("arm/arm-with-vfpv3.xml", tdesc_arm_with_vfpv3);
+#endif /* GDB_SELF_TEST */
}
@@ -282,7 +282,10 @@ initialize_tdesc_amd64_avx_avx512_linux (void)
tdesc_create_reg (feature, "zmm28h", 144, 1, NULL, 256, "v2ui128");
tdesc_create_reg (feature, "zmm29h", 145, 1, NULL, 256, "v2ui128");
tdesc_create_reg (feature, "zmm30h", 146, 1, NULL, 256, "v2ui128");
- tdesc_create_reg (feature, "zmm31h", 146, 1, NULL, 256, "v2ui128");
+ tdesc_create_reg (feature, "zmm31h", 147, 1, NULL, 256, "v2ui128");
tdesc_amd64_avx_avx512_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx-avx512-linux.xml", tdesc_amd64_avx_avx512_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -276,4 +276,7 @@ initialize_tdesc_amd64_avx_avx512 (void)
tdesc_create_reg (feature, "zmm31h", 144, 1, NULL, 256, "v2ui128");
tdesc_amd64_avx_avx512 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx-avx512.xml", tdesc_amd64_avx_avx512);
+#endif /* GDB_SELF_TEST */
}
@@ -174,4 +174,7 @@ initialize_tdesc_amd64_avx_linux (void)
tdesc_create_reg (feature, "ymm15h", 75, 1, NULL, 128, "uint128");
tdesc_amd64_avx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx-linux.xml", tdesc_amd64_avx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -323,7 +323,10 @@ initialize_tdesc_amd64_avx_mpx_avx512_pku_linux (void)
tdesc_create_reg (feature, "zmm31h", 153, 1, NULL, 256, "v2ui128");
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.pkeys");
- tdesc_create_reg (feature, "pkru", 152, 1, NULL, 32, "uint32");
+ tdesc_create_reg (feature, "pkru", 154, 1, NULL, 32, "uint32");
tdesc_amd64_avx_mpx_avx512_pku_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx-mpx-avx512-pku-linux.xml", tdesc_amd64_avx_mpx_avx512_pku_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -317,4 +317,7 @@ initialize_tdesc_amd64_avx_mpx_avx512_pku (void)
tdesc_create_reg (feature, "pkru", 151, 1, NULL, 32, "uint32");
tdesc_amd64_avx_mpx_avx512_pku = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx-mpx-avx512-pku.xml", tdesc_amd64_avx_mpx_avx512_pku);
+#endif /* GDB_SELF_TEST */
}
@@ -212,4 +212,7 @@ initialize_tdesc_amd64_avx_mpx_linux (void)
tdesc_create_reg (feature, "bndstatus", 81, 1, NULL, 64, "status");
tdesc_amd64_avx_mpx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx-mpx-linux.xml", tdesc_amd64_avx_mpx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -203,4 +203,7 @@ initialize_tdesc_amd64_avx_mpx (void)
tdesc_create_reg (feature, "bndstatus", 78, 1, NULL, 64, "status");
tdesc_amd64_avx_mpx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx-mpx.xml", tdesc_amd64_avx_mpx);
+#endif /* GDB_SELF_TEST */
}
@@ -165,4 +165,7 @@ initialize_tdesc_amd64_avx (void)
tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128");
tdesc_amd64_avx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-avx.xml", tdesc_amd64_avx);
+#endif /* GDB_SELF_TEST */
}
@@ -156,4 +156,7 @@ initialize_tdesc_amd64_linux (void)
tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int");
tdesc_amd64_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-linux.xml", tdesc_amd64_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -194,4 +194,7 @@ initialize_tdesc_amd64_mpx_linux (void)
tdesc_create_reg (feature, "bndstatus", 65, 1, NULL, 64, "status");
tdesc_amd64_mpx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-mpx-linux.xml", tdesc_amd64_mpx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -185,4 +185,7 @@ initialize_tdesc_amd64_mpx (void)
tdesc_create_reg (feature, "bndstatus", 62, 1, NULL, 64, "status");
tdesc_amd64_mpx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64-mpx.xml", tdesc_amd64_mpx);
+#endif /* GDB_SELF_TEST */
}
@@ -147,4 +147,7 @@ initialize_tdesc_amd64 (void)
tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr");
tdesc_amd64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/amd64.xml", tdesc_amd64);
+#endif /* GDB_SELF_TEST */
}
@@ -167,4 +167,7 @@ initialize_tdesc_i386_avx_avx512_linux (void)
tdesc_create_reg (feature, "zmm7h", 65, 1, NULL, 256, "v2ui128");
tdesc_i386_avx_avx512_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx-avx512-linux.xml", tdesc_i386_avx_avx512_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -162,4 +162,7 @@ initialize_tdesc_i386_avx_avx512 (void)
tdesc_create_reg (feature, "zmm7h", 64, 1, NULL, 256, "v2ui128");
tdesc_i386_avx_avx512 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx-avx512.xml", tdesc_i386_avx_avx512);
+#endif /* GDB_SELF_TEST */
}
@@ -146,4 +146,7 @@ initialize_tdesc_i386_avx_linux (void)
tdesc_create_reg (feature, "ymm7h", 49, 1, NULL, 128, "uint128");
tdesc_i386_avx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx-linux.xml", tdesc_i386_avx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -208,4 +208,7 @@ initialize_tdesc_i386_avx_mpx_avx512_pku_linux (void)
tdesc_create_reg (feature, "pkru", 72, 1, NULL, 32, "uint32");
tdesc_i386_avx_mpx_avx512_pku_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx-mpx-avx512-pku-linux.xml", tdesc_i386_avx_mpx_avx512_pku_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -203,4 +203,7 @@ initialize_tdesc_i386_avx_mpx_avx512_pku (void)
tdesc_create_reg (feature, "pkru", 71, 1, NULL, 32, "uint32");
tdesc_i386_avx_mpx_avx512_pku = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx-mpx-avx512-pku.xml", tdesc_i386_avx_mpx_avx512_pku);
+#endif /* GDB_SELF_TEST */
}
@@ -184,4 +184,7 @@ initialize_tdesc_i386_avx_mpx_linux (void)
tdesc_create_reg (feature, "bndstatus", 55, 1, NULL, 64, "status");
tdesc_i386_avx_mpx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx-mpx-linux.xml", tdesc_i386_avx_mpx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -179,4 +179,7 @@ initialize_tdesc_i386_avx_mpx (void)
tdesc_create_reg (feature, "bndstatus", 54, 1, NULL, 64, "status");
tdesc_i386_avx_mpx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx-mpx.xml", tdesc_i386_avx_mpx);
+#endif /* GDB_SELF_TEST */
}
@@ -141,4 +141,7 @@ initialize_tdesc_i386_avx (void)
tdesc_create_reg (feature, "ymm7h", 48, 1, NULL, 128, "uint128");
tdesc_i386_avx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-avx.xml", tdesc_i386_avx);
+#endif /* GDB_SELF_TEST */
}
@@ -136,4 +136,7 @@ initialize_tdesc_i386_linux (void)
tdesc_create_reg (feature, "mxcsr", 40, 1, "vector", 32, "i386_mxcsr");
tdesc_i386_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-linux.xml", tdesc_i386_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -75,4 +75,7 @@ initialize_tdesc_i386_mmx_linux (void)
tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int");
tdesc_i386_mmx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-mmx-linux.xml", tdesc_i386_mmx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -70,4 +70,7 @@ initialize_tdesc_i386_mmx (void)
tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int");
tdesc_i386_mmx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-mmx.xml", tdesc_i386_mmx);
+#endif /* GDB_SELF_TEST */
}
@@ -174,4 +174,7 @@ initialize_tdesc_i386_mpx_linux (void)
tdesc_create_reg (feature, "bndstatus", 47, 1, NULL, 64, "status");
tdesc_i386_mpx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-mpx-linux.xml", tdesc_i386_mpx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -169,4 +169,7 @@ initialize_tdesc_i386_mpx (void)
tdesc_create_reg (feature, "bndstatus", 46, 1, NULL, 64, "status");
tdesc_i386_mpx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386-mpx.xml", tdesc_i386_mpx);
+#endif /* GDB_SELF_TEST */
}
@@ -131,4 +131,7 @@ initialize_tdesc_i386 (void)
tdesc_create_reg (feature, "mxcsr", 40, 1, "vector", 32, "i386_mxcsr");
tdesc_i386 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/i386.xml", tdesc_i386);
+#endif /* GDB_SELF_TEST */
}
@@ -285,4 +285,7 @@ initialize_tdesc_x32_avx_avx512_linux (void)
tdesc_create_reg (feature, "zmm31h", 147, 1, NULL, 256, "v2ui128");
tdesc_x32_avx_avx512_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/x32-avx-avx512-linux.xml", tdesc_x32_avx_avx512_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -276,4 +276,7 @@ initialize_tdesc_x32_avx_avx512 (void)
tdesc_create_reg (feature, "zmm31h", 144, 1, NULL, 256, "v2ui128");
tdesc_x32_avx_avx512 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/x32-avx-avx512.xml", tdesc_x32_avx_avx512);
+#endif /* GDB_SELF_TEST */
}
@@ -174,4 +174,7 @@ initialize_tdesc_x32_avx_linux (void)
tdesc_create_reg (feature, "ymm15h", 75, 1, NULL, 128, "uint128");
tdesc_x32_avx_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/x32-avx-linux.xml", tdesc_x32_avx_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -165,4 +165,7 @@ initialize_tdesc_x32_avx (void)
tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128");
tdesc_x32_avx = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/x32-avx.xml", tdesc_x32_avx);
+#endif /* GDB_SELF_TEST */
}
@@ -156,4 +156,7 @@ initialize_tdesc_x32_linux (void)
tdesc_create_reg (feature, "gs_base", 59, 1, NULL, 64, "int");
tdesc_x32_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/x32-linux.xml", tdesc_x32_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -147,4 +147,7 @@ initialize_tdesc_x32 (void)
tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr");
tdesc_x32 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("i386/x32.xml", tdesc_x32);
+#endif /* GDB_SELF_TEST */
}
@@ -76,4 +76,7 @@ initialize_tdesc_microblaze_with_stack_protect (void)
tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
tdesc_microblaze_with_stack_protect = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("microblaze-with-stack-protect.xml", tdesc_microblaze_with_stack_protect);
+#endif /* GDB_SELF_TEST */
}
@@ -72,4 +72,7 @@ initialize_tdesc_microblaze (void)
tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
tdesc_microblaze = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("microblaze.xml", tdesc_microblaze);
+#endif /* GDB_SELF_TEST */
}
@@ -107,4 +107,7 @@ initialize_tdesc_mips_dsp_linux (void)
tdesc_create_reg (feature, "restart", 79, 1, "system", 32, "int");
tdesc_mips_dsp_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("mips-dsp-linux.xml", tdesc_mips_dsp_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -98,4 +98,7 @@ initialize_tdesc_mips_linux (void)
tdesc_create_reg (feature, "restart", 72, 1, "system", 32, "int");
tdesc_mips_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("mips-linux.xml", tdesc_mips_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -105,4 +105,7 @@ initialize_tdesc_mips64_dsp_linux (void)
tdesc_create_reg (feature, "restart", 79, 1, "system", 64, "int");
tdesc_mips64_dsp_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("mips64-dsp-linux.xml", tdesc_mips64_dsp_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -96,4 +96,7 @@ initialize_tdesc_mips64_linux (void)
tdesc_create_reg (feature, "restart", 72, 1, "system", 64, "int");
tdesc_mips64_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("mips64-linux.xml", tdesc_mips64_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -89,4 +89,7 @@ initialize_tdesc_nds32 (void)
tdesc_create_reg (feature, "ifc_lp", 67, 1, NULL, 32, "int");
tdesc_nds32 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("nds32.xml", tdesc_nds32);
+#endif /* GDB_SELF_TEST */
}
@@ -68,4 +68,7 @@ initialize_tdesc_nios2_linux (void)
tdesc_create_reg (feature, "mpuacc", 48, 1, NULL, 32, "uint32");
tdesc_nios2_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("nios2-linux.xml", tdesc_nios2_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -66,4 +66,7 @@ initialize_tdesc_nios2 (void)
tdesc_create_reg (feature, "mpuacc", 48, 1, NULL, 32, "uint32");
tdesc_nios2 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("nios2.xml", tdesc_nios2);
+#endif /* GDB_SELF_TEST */
}
@@ -90,4 +90,7 @@ initialize_tdesc_powerpc_32 (void)
tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int");
tdesc_powerpc_32 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-32.xml", tdesc_powerpc_32);
+#endif /* GDB_SELF_TEST */
}
@@ -94,4 +94,7 @@ initialize_tdesc_powerpc_32l (void)
tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int");
tdesc_powerpc_32l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-32l.xml", tdesc_powerpc_32l);
+#endif /* GDB_SELF_TEST */
}
@@ -164,4 +164,7 @@ initialize_tdesc_powerpc_403 (void)
tdesc_create_reg (feature, "pbu2", 142, 1, NULL, 32, "int");
tdesc_powerpc_403 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-403.xml", tdesc_powerpc_403);
+#endif /* GDB_SELF_TEST */
}
@@ -170,4 +170,7 @@ initialize_tdesc_powerpc_403gc (void)
tdesc_create_reg (feature, "tblu", 148, 1, NULL, 32, "int");
tdesc_powerpc_403gc = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-403gc.xml", tdesc_powerpc_403gc);
+#endif /* GDB_SELF_TEST */
}
@@ -133,4 +133,7 @@ initialize_tdesc_powerpc_405 (void)
tdesc_create_reg (feature, "usprg0", 161, 1, NULL, 32, "int");
tdesc_powerpc_405 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-405.xml", tdesc_powerpc_405);
+#endif /* GDB_SELF_TEST */
}
@@ -143,4 +143,7 @@ initialize_tdesc_powerpc_505 (void)
tdesc_create_reg (feature, "nri", 121, 1, NULL, 32, "int");
tdesc_powerpc_505 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-505.xml", tdesc_powerpc_505);
+#endif /* GDB_SELF_TEST */
}
@@ -147,4 +147,7 @@ initialize_tdesc_powerpc_601 (void)
tdesc_create_reg (feature, "rtcl", 126, 1, NULL, 32, "int");
tdesc_powerpc_601 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-601.xml", tdesc_powerpc_601);
+#endif /* GDB_SELF_TEST */
}
@@ -150,4 +150,7 @@ initialize_tdesc_powerpc_602 (void)
tdesc_create_reg (feature, "lt", 130, 1, NULL, 32, "int");
tdesc_powerpc_602 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-602.xml", tdesc_powerpc_602);
+#endif /* GDB_SELF_TEST */
}
@@ -150,4 +150,7 @@ initialize_tdesc_powerpc_603 (void)
tdesc_create_reg (feature, "rpa", 130, 1, NULL, 32, "int");
tdesc_powerpc_603 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-603.xml", tdesc_powerpc_603);
+#endif /* GDB_SELF_TEST */
}
@@ -150,4 +150,7 @@ initialize_tdesc_powerpc_604 (void)
tdesc_create_reg (feature, "sda", 128, 1, NULL, 32, "int");
tdesc_powerpc_604 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-604.xml", tdesc_powerpc_604);
+#endif /* GDB_SELF_TEST */
}
@@ -90,4 +90,7 @@ initialize_tdesc_powerpc_64 (void)
tdesc_create_reg (feature, "fpscr", 70, 1, "float", 32, "int");
tdesc_powerpc_64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-64.xml", tdesc_powerpc_64);
+#endif /* GDB_SELF_TEST */
}
@@ -94,4 +94,7 @@ initialize_tdesc_powerpc_64l (void)
tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int");
tdesc_powerpc_64l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-64l.xml", tdesc_powerpc_64l);
+#endif /* GDB_SELF_TEST */
}
@@ -200,4 +200,7 @@ initialize_tdesc_powerpc_7400 (void)
tdesc_create_reg (feature, "vrsave", 152, 1, "vector", 32, "int");
tdesc_powerpc_7400 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-7400.xml", tdesc_powerpc_7400);
+#endif /* GDB_SELF_TEST */
}
@@ -163,4 +163,7 @@ initialize_tdesc_powerpc_750 (void)
tdesc_create_reg (feature, "thrm3", 142, 1, NULL, 32, "int");
tdesc_powerpc_750 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-750.xml", tdesc_powerpc_750);
+#endif /* GDB_SELF_TEST */
}
@@ -187,4 +187,7 @@ initialize_tdesc_powerpc_860 (void)
tdesc_create_reg (feature, "md_dbram1", 165, 1, NULL, 32, "int");
tdesc_powerpc_860 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-860.xml", tdesc_powerpc_860);
+#endif /* GDB_SELF_TEST */
}
@@ -152,4 +152,7 @@ initialize_tdesc_powerpc_altivec32 (void)
tdesc_create_reg (feature, "vrsave", 104, 1, "vector", 32, "int");
tdesc_powerpc_altivec32 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-altivec32.xml", tdesc_powerpc_altivec32);
+#endif /* GDB_SELF_TEST */
}
@@ -156,4 +156,7 @@ initialize_tdesc_powerpc_altivec32l (void)
tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
tdesc_powerpc_altivec32l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-altivec32l.xml", tdesc_powerpc_altivec32l);
+#endif /* GDB_SELF_TEST */
}
@@ -152,4 +152,7 @@ initialize_tdesc_powerpc_altivec64 (void)
tdesc_create_reg (feature, "vrsave", 104, 1, "vector", 32, "int");
tdesc_powerpc_altivec64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-altivec64.xml", tdesc_powerpc_altivec64);
+#endif /* GDB_SELF_TEST */
}
@@ -156,4 +156,7 @@ initialize_tdesc_powerpc_altivec64l (void)
tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
tdesc_powerpc_altivec64l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-altivec64l.xml", tdesc_powerpc_altivec64l);
+#endif /* GDB_SELF_TEST */
}
@@ -158,4 +158,7 @@ initialize_tdesc_powerpc_cell32l (void)
tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
tdesc_powerpc_cell32l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-cell32l.xml", tdesc_powerpc_cell32l);
+#endif /* GDB_SELF_TEST */
}
@@ -158,4 +158,7 @@ initialize_tdesc_powerpc_cell64l (void)
tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
tdesc_powerpc_cell64l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-cell64l.xml", tdesc_powerpc_cell64l);
+#endif /* GDB_SELF_TEST */
}
@@ -91,4 +91,7 @@ initialize_tdesc_powerpc_e500 (void)
tdesc_create_reg (feature, "spefscr", 74, 1, NULL, 32, "int");
tdesc_powerpc_e500 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-e500.xml", tdesc_powerpc_e500);
+#endif /* GDB_SELF_TEST */
}
@@ -95,4 +95,7 @@ initialize_tdesc_powerpc_e500l (void)
tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int");
tdesc_powerpc_e500l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-e500l.xml", tdesc_powerpc_e500l);
+#endif /* GDB_SELF_TEST */
}
@@ -94,4 +94,7 @@ initialize_tdesc_powerpc_isa205_32l (void)
tdesc_create_reg (feature, "trap", 72, 1, NULL, 32, "int");
tdesc_powerpc_isa205_32l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-isa205-32l.xml", tdesc_powerpc_isa205_32l);
+#endif /* GDB_SELF_TEST */
}
@@ -94,4 +94,7 @@ initialize_tdesc_powerpc_isa205_64l (void)
tdesc_create_reg (feature, "trap", 72, 1, NULL, 64, "int");
tdesc_powerpc_isa205_64l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-isa205-64l.xml", tdesc_powerpc_isa205_64l);
+#endif /* GDB_SELF_TEST */
}
@@ -156,4 +156,7 @@ initialize_tdesc_powerpc_isa205_altivec32l (void)
tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
tdesc_powerpc_isa205_altivec32l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-isa205-altivec32l.xml", tdesc_powerpc_isa205_altivec32l);
+#endif /* GDB_SELF_TEST */
}
@@ -156,4 +156,7 @@ initialize_tdesc_powerpc_isa205_altivec64l (void)
tdesc_create_reg (feature, "vrsave", 106, 1, "vector", 32, "int");
tdesc_powerpc_isa205_altivec64l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-isa205-altivec64l.xml", tdesc_powerpc_isa205_altivec64l);
+#endif /* GDB_SELF_TEST */
}
@@ -190,4 +190,7 @@ initialize_tdesc_powerpc_isa205_vsx32l (void)
tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
tdesc_powerpc_isa205_vsx32l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-isa205-vsx32l.xml", tdesc_powerpc_isa205_vsx32l);
+#endif /* GDB_SELF_TEST */
}
@@ -190,4 +190,7 @@ initialize_tdesc_powerpc_isa205_vsx64l (void)
tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
tdesc_powerpc_isa205_vsx64l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-isa205-vsx64l.xml", tdesc_powerpc_isa205_vsx64l);
+#endif /* GDB_SELF_TEST */
}
@@ -186,4 +186,7 @@ initialize_tdesc_powerpc_vsx32 (void)
tdesc_create_reg (feature, "vs31h", 136, 1, NULL, 64, "uint64");
tdesc_powerpc_vsx32 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-vsx32.xml", tdesc_powerpc_vsx32);
+#endif /* GDB_SELF_TEST */
}
@@ -190,4 +190,7 @@ initialize_tdesc_powerpc_vsx32l (void)
tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
tdesc_powerpc_vsx32l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-vsx32l.xml", tdesc_powerpc_vsx32l);
+#endif /* GDB_SELF_TEST */
}
@@ -186,4 +186,7 @@ initialize_tdesc_powerpc_vsx64 (void)
tdesc_create_reg (feature, "vs31h", 136, 1, NULL, 64, "uint64");
tdesc_powerpc_vsx64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-vsx64.xml", tdesc_powerpc_vsx64);
+#endif /* GDB_SELF_TEST */
}
@@ -190,4 +190,7 @@ initialize_tdesc_powerpc_vsx64l (void)
tdesc_create_reg (feature, "vs31h", 138, 1, NULL, 64, "uint64");
tdesc_powerpc_vsx64l = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/powerpc-vsx64l.xml", tdesc_powerpc_vsx64l);
+#endif /* GDB_SELF_TEST */
}
@@ -91,4 +91,7 @@ initialize_tdesc_rs6000 (void)
tdesc_create_reg (feature, "fpscr", 71, 1, "float", 32, "int");
tdesc_rs6000 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("rs6000/rs6000.xml", tdesc_rs6000);
+#endif /* GDB_SELF_TEST */
}
@@ -75,4 +75,7 @@ initialize_tdesc_s390_linux32 (void)
tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 32, "uint32");
tdesc_s390_linux32 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-linux32.xml", tdesc_s390_linux32);
+#endif /* GDB_SELF_TEST */
}
@@ -76,4 +76,7 @@ initialize_tdesc_s390_linux32v1 (void)
tdesc_create_reg (feature, "last_break", 52, 0, "system", 32, "code_ptr");
tdesc_s390_linux32v1 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-linux32v1.xml", tdesc_s390_linux32v1);
+#endif /* GDB_SELF_TEST */
}
@@ -77,4 +77,7 @@ initialize_tdesc_s390_linux32v2 (void)
tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32");
tdesc_s390_linux32v2 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-linux32v2.xml", tdesc_s390_linux32v2);
+#endif /* GDB_SELF_TEST */
}
@@ -91,4 +91,7 @@ initialize_tdesc_s390_linux64 (void)
tdesc_create_reg (feature, "orig_r2", 67, 1, "system", 32, "uint32");
tdesc_s390_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-linux64.xml", tdesc_s390_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -92,4 +92,7 @@ initialize_tdesc_s390_linux64v1 (void)
tdesc_create_reg (feature, "last_break", 68, 0, "system", 32, "code_ptr");
tdesc_s390_linux64v1 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-linux64v1.xml", tdesc_s390_linux64v1);
+#endif /* GDB_SELF_TEST */
}
@@ -93,4 +93,7 @@ initialize_tdesc_s390_linux64v2 (void)
tdesc_create_reg (feature, "system_call", 69, 1, "system", 32, "uint32");
tdesc_s390_linux64v2 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-linux64v2.xml", tdesc_s390_linux64v2);
+#endif /* GDB_SELF_TEST */
}
@@ -115,4 +115,7 @@ initialize_tdesc_s390_te_linux64 (void)
tdesc_create_reg (feature, "tr15", 89, 1, "tdb", 64, "uint64");
tdesc_s390_te_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-te-linux64.xml", tdesc_s390_te_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -185,4 +185,7 @@ initialize_tdesc_s390_tevx_linux64 (void)
tdesc_create_reg (feature, "v31", 121, 1, NULL, 128, "vec128");
tdesc_s390_tevx_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-tevx-linux64.xml", tdesc_s390_tevx_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -163,4 +163,7 @@ initialize_tdesc_s390_vx_linux64 (void)
tdesc_create_reg (feature, "v31", 101, 1, NULL, 128, "vec128");
tdesc_s390_vx_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390-vx-linux64.xml", tdesc_s390_vx_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -75,4 +75,7 @@ initialize_tdesc_s390x_linux64 (void)
tdesc_create_reg (feature, "orig_r2", 51, 1, "system", 64, "uint64");
tdesc_s390x_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390x-linux64.xml", tdesc_s390x_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -76,4 +76,7 @@ initialize_tdesc_s390x_linux64v1 (void)
tdesc_create_reg (feature, "last_break", 52, 0, "system", 64, "code_ptr");
tdesc_s390x_linux64v1 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390x-linux64v1.xml", tdesc_s390x_linux64v1);
+#endif /* GDB_SELF_TEST */
}
@@ -77,4 +77,7 @@ initialize_tdesc_s390x_linux64v2 (void)
tdesc_create_reg (feature, "system_call", 53, 1, "system", 32, "uint32");
tdesc_s390x_linux64v2 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390x-linux64v2.xml", tdesc_s390x_linux64v2);
+#endif /* GDB_SELF_TEST */
}
@@ -99,4 +99,7 @@ initialize_tdesc_s390x_te_linux64 (void)
tdesc_create_reg (feature, "tr15", 73, 1, "tdb", 64, "uint64");
tdesc_s390x_te_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390x-te-linux64.xml", tdesc_s390x_te_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -169,4 +169,7 @@ initialize_tdesc_s390x_tevx_linux64 (void)
tdesc_create_reg (feature, "v31", 105, 1, NULL, 128, "vec128");
tdesc_s390x_tevx_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390x-tevx-linux64.xml", tdesc_s390x_tevx_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -147,4 +147,7 @@ initialize_tdesc_s390x_vx_linux64 (void)
tdesc_create_reg (feature, "v31", 85, 1, NULL, 128, "vec128");
tdesc_s390x_vx_linux64 = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("s390x-vx-linux64.xml", tdesc_s390x_vx_linux64);
+#endif /* GDB_SELF_TEST */
}
@@ -53,4 +53,7 @@ initialize_tdesc_tic6x_c62x_linux (void)
tdesc_create_reg (feature, "PC", 33, 1, NULL, 32, "code_ptr");
tdesc_tic6x_c62x_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("tic6x-c62x-linux.xml", tdesc_tic6x_c62x_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -51,4 +51,7 @@ initialize_tdesc_tic6x_c62x (void)
tdesc_create_reg (feature, "PC", 33, 1, NULL, 32, "code_ptr");
tdesc_tic6x_c62x = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("tic6x-c62x.xml", tdesc_tic6x_c62x);
+#endif /* GDB_SELF_TEST */
}
@@ -87,4 +87,7 @@ initialize_tdesc_tic6x_c64x_linux (void)
tdesc_create_reg (feature, "B31", 65, 1, NULL, 32, "uint32");
tdesc_tic6x_c64x_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("tic6x-c64x-linux.xml", tdesc_tic6x_c64x_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -85,4 +85,7 @@ initialize_tdesc_tic6x_c64x (void)
tdesc_create_reg (feature, "B31", 65, 1, NULL, 32, "uint32");
tdesc_tic6x_c64x = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("tic6x-c64x.xml", tdesc_tic6x_c64x);
+#endif /* GDB_SELF_TEST */
}
@@ -92,4 +92,7 @@ initialize_tdesc_tic6x_c64xp_linux (void)
tdesc_create_reg (feature, "RILC", 68, 1, NULL, 32, "uint32");
tdesc_tic6x_c64xp_linux = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("tic6x-c64xp-linux.xml", tdesc_tic6x_c64xp_linux);
+#endif /* GDB_SELF_TEST */
}
@@ -90,4 +90,7 @@ initialize_tdesc_tic6x_c64xp (void)
tdesc_create_reg (feature, "RILC", 68, 1, NULL, 32, "uint32");
tdesc_tic6x_c64xp = result;
+#if GDB_SELF_TEST
+ selftests::record_xml_tdesc ("tic6x-c64xp.xml", tdesc_tic6x_c64xp);
+#endif /* GDB_SELF_TEST */
}
@@ -468,6 +468,101 @@ tdesc_osabi (const struct target_desc *target_desc)
return target_desc->osabi;
}
+/* Return true if REG1 and REG2 are identical. */
+
+static bool
+tdesc_reg_equals (const struct tdesc_reg *reg1,
+ const struct tdesc_reg *reg2)
+{
+ return (strcmp (reg1->name, reg2->name) == 0
+ && reg1->target_regnum == reg2->target_regnum
+ && reg1->save_restore == reg2->save_restore
+ && reg1->bitsize == reg2->bitsize
+ && (reg1->group == reg2->group
+ || strcmp (reg1->group, reg2->group) == 0)
+ && strcmp (reg1->type, reg2->type) == 0);
+}
+
+/* Return true if TYPE1 and TYPE2 are identical. */
+
+static bool
+tdesc_type_equals (const struct tdesc_type *type1,
+ const struct tdesc_type *type2)
+{
+ return (strcmp (type1->name, type2->name) == 0
+ && type1->kind == type2->kind);
+}
+
+/* Return true if FEATURE1 and FEATURE2 are identical. */
+
+static bool
+tdesc_feature_equals (const struct tdesc_feature *feature1,
+ const struct tdesc_feature *feature2)
+{
+ if (feature1 == feature2)
+ return true;
+
+ if (strcmp (feature1->name, feature2->name) != 0)
+ return false;
+
+ struct tdesc_reg *reg;
+
+ for (int ix = 0;
+ VEC_iterate (tdesc_reg_p, feature1->registers, ix, reg);
+ ix++)
+ {
+ struct tdesc_reg *reg2
+ = VEC_index (tdesc_reg_p, feature2->registers, ix);
+
+ if (!tdesc_reg_equals (reg, reg2))
+ return false;
+ }
+
+ struct tdesc_type *type;
+
+ for (int ix = 0;
+ VEC_iterate (tdesc_type_p, feature1->types, ix, type);
+ ix++)
+ {
+ struct tdesc_type *type2
+ = VEC_index (tdesc_type_p, feature2->types, ix);
+
+ if (!tdesc_type_equals (type, type2))
+ return false;
+ }
+
+ return true;
+}
+
+bool
+tdesc_equals (const struct target_desc *tdesc1,
+ const struct target_desc *tdesc2)
+{
+ if (tdesc1->arch != tdesc2->arch)
+ return false;
+
+ if (tdesc1->osabi != tdesc2->osabi)
+ return false;
+
+ if (VEC_length (tdesc_feature_p, tdesc1->features)
+ != VEC_length (tdesc_feature_p, tdesc2->features))
+ return false;
+
+ struct tdesc_feature *feature;
+
+ for (int ix = 0;
+ VEC_iterate (tdesc_feature_p, tdesc1->features, ix, feature);
+ ix++)
+ {
+ struct tdesc_feature *feature2
+ = VEC_index (tdesc_feature_p, tdesc2->features, ix);
+
+ if (!tdesc_feature_equals (feature, feature2))
+ return false;
+ }
+ return true;
+}
+
/* Return 1 if this target description includes any registers. */
@@ -1734,6 +1829,12 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
error (_("The current target description did not come from an XML file."));
filename = lbasename (target_description_filename);
+ std::string filename_after_features (target_description_filename);
+ auto loc = filename_after_features.rfind ("/features/");
+
+ if (loc != std::string::npos)
+ filename_after_features = filename_after_features.substr (loc + 10);
+
function = (char *) alloca (strlen (filename) + 1);
for (inp = filename, outp = function; *inp != '\0'; inp++)
if (*inp == '.')
@@ -1979,9 +2080,64 @@ feature = tdesc_create_feature (result, \"%s\");\n",
}
printf_unfiltered (" tdesc_%s = result;\n", function);
+
+ printf_unfiltered ("#if GDB_SELF_TEST\n");
+ printf_unfiltered (" selftests::record_xml_tdesc (\"%s\", tdesc_%s);\n",
+ filename_after_features.data (), function);
+ printf_unfiltered ("#endif /* GDB_SELF_TEST */\n");
printf_unfiltered ("}\n");
}
+#if GDB_SELF_TEST
+#include "selftest.h"
+
+namespace selftests {
+
+static std::vector<std::pair<std::string, const struct target_desc *>> lists;
+
+void
+record_xml_tdesc (std::string xml_file, const struct target_desc *tdesc)
+{
+ lists.emplace_back (xml_file, tdesc);
+}
+
+/* Test these GDB builtin target descriptions are identical to these which
+ are generated by the corresponding xml files. */
+
+static void
+xml_builtin_tdesc_test (void)
+{
+ std::string feature_dir (ldirname (__FILE__));
+ struct stat st;
+
+ /* Look for the features directory. If the directory of __FILE__ can't
+ be found, __FILE__ is a file name with relative path. Guess that
+ GDB is executed in testsuite directory like ../gdb, because I don't
+ expect that GDB is invoked somewhere else and run self tests. */
+ if (stat (feature_dir.data (), &st) < 0)
+ {
+ feature_dir.insert (0, SLASH_STRING);
+ feature_dir.insert (0, "..");
+
+ /* If still can't find the path, something is wrong. */
+ SELF_CHECK (stat (feature_dir.data (), &st) == 0);
+ }
+
+ feature_dir = feature_dir + SLASH_STRING + "features";
+
+ for (auto const &e : lists)
+ {
+ std::string tdesc_xml = (feature_dir + SLASH_STRING + e.first);
+ const struct target_desc *tdesc
+ = file_read_description_xml (tdesc_xml.data ());
+
+ SELF_CHECK (tdesc != NULL);
+ SELF_CHECK (tdesc_equals (tdesc, e.second));
+ }
+}
+}
+#endif /* GDB_SELF_TEST */
+
/* Provide a prototype to silence -Wmissing-prototypes. */
extern initialize_file_ftype _initialize_target_descriptions;
@@ -2022,4 +2178,8 @@ GDB will read the description from the target."),
add_cmd ("c-tdesc", class_maintenance, maint_print_c_tdesc_cmd, _("\
Print the current target description as a C source file."),
&maintenanceprintlist);
+
+#if GDB_SELF_TEST
+ register_self_test (selftests::xml_builtin_tdesc_test);
+#endif
}
@@ -162,6 +162,12 @@ enum gdb_osabi tdesc_osabi (const struct target_desc *);
int tdesc_compatible_p (const struct target_desc *,
const struct bfd_arch_info *);
+/* Compare target descriptions TDESC1 and TDESC2, return true if they
+ are identical. */
+
+bool tdesc_equals (const struct target_desc *tdesc1,
+ const struct target_desc *tdesc2);
+
/* Return the string value of a property named KEY, or NULL if the
property was not specified. */
@@ -253,4 +259,14 @@ void tdesc_create_reg (struct tdesc_feature *feature, const char *name,
int regnum, int save_restore, const char *group,
int bitsize, const char *type);
+#if GDB_SELF_TEST
+namespace selftests {
+
+/* Record the target description TDESC generated by XML_FILE. */
+
+void record_xml_tdesc (std::string xml_file,
+ const struct target_desc *tdesc);
+}
+#endif
+
#endif /* TARGET_DESCRIPTIONS_H */