aboutsummaryrefslogtreecommitdiff
path: root/gdb/features/i386
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-07-26 14:39:54 +0100
committerYao Qi <yao.qi@linaro.org>2017-07-26 14:39:54 +0100
commitea03d0d3c32b22aeddfeb139a4a515f7e5961347 (patch)
tree93bd39d275e82ffe4e66a7ca209540aa031c29f9 /gdb/features/i386
parent25aa13e522c595cbdbb3868f1daa434a17ba2ab2 (diff)
downloadgdb-ea03d0d3c32b22aeddfeb139a4a515f7e5961347.zip
gdb-ea03d0d3c32b22aeddfeb139a4a515f7e5961347.tar.gz
gdb-ea03d0d3c32b22aeddfeb139a4a515f7e5961347.tar.bz2
Lazily and dynamically create i386-linux target descriptions
Instead of using pre-generated target descriptions, this patch changes GDB to lazily and dynamically create target descriptions according to the target hardware capability (xcr0 in i386). This support any combination of target features. Some reg in target description has "regnum" attribute, so its register number is got from the attribute value instead from sequential allocation. <reg name="xmm0" bitsize="128" type="vec128" regnum="32"/> when target description is created, it should match the regnum, so this patch adds a new field m_next_regnum to track it, if attribute number is greater than the m_next_regnum, print the code to set register number explicitly. gdb: 2017-07-26 Yao Qi <yao.qi@linaro.org> * i386-linux-tdep.c: Don't include features/i386/i386-*linux.c. Include features/i386/32bit-*.c. (i386_linux_read_description): Generate target description if it doesn't exist. (_initialize_i386_linux_tdep): Don't call _initialize_tdesc_i386 functions. * features/i386/32bit-linux.c: Re-generated. * features/i386/32bit-sse.c: Likewise. * target-descriptions.c (print_c_feature::visit): Print code to set register number if needed. (print_c_feature) <m_next_regnum>: New field.
Diffstat (limited to 'gdb/features/i386')
-rw-r--r--gdb/features/i386/32bit-linux.c1
-rw-r--r--gdb/features/i386/32bit-sse.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/gdb/features/i386/32bit-linux.c b/gdb/features/i386/32bit-linux.c
index 686a2f1..1b50882 100644
--- a/gdb/features/i386/32bit-linux.c
+++ b/gdb/features/i386/32bit-linux.c
@@ -9,6 +9,7 @@ create_feature_i386_32bit_linux (struct target_desc *result, long regnum)
struct tdesc_feature *feature;
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux");
+ regnum = 41;
tdesc_create_reg (feature, "orig_eax", regnum++, 1, NULL, 32, "int");
return regnum;
}
diff --git a/gdb/features/i386/32bit-sse.c b/gdb/features/i386/32bit-sse.c
index 032623e..c0684fb 100644
--- a/gdb/features/i386/32bit-sse.c
+++ b/gdb/features/i386/32bit-sse.c
@@ -61,6 +61,7 @@ create_feature_i386_32bit_sse (struct target_desc *result, long regnum)
tdesc_add_flag (type, 12, "PM");
tdesc_add_flag (type, 15, "FZ");
+ regnum = 32;
tdesc_create_reg (feature, "xmm0", regnum++, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm1", regnum++, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm2", regnum++, 1, NULL, 128, "vec128");