From 25aa13e522c595cbdbb3868f1daa434a17ba2ab2 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 26 Jul 2017 14:24:08 +0100 Subject: Generate c for feature instead of tdesc This patch changes Makefile and command "maint print c-files" so that GDB can print c files for features instead target description. Previously, we feed GDB a target description xml file, which generate c files including multiple features. With this patch, in Makefile, we wrap each feature xml file, and create a temp target description which include only one feature. Then, adjust the target description printer for them, and print a c function for each given feature, so that we can use these c functions later to create target description in a flexible way. gdb: 2017-07-26 Yao Qi * features/Makefile (CFILES): Rename with TDESC_CFILES. (FEATURE_XMLFILES): New. (FEATURE_CFILES): New. New rules. (clean-cfiles): Remove generated c files. * features/i386/32bit-avx.c: Generated. * features/i386/32bit-avx512.c: Generated. * features/i386/32bit-core.c: Generated. * features/i386/32bit-linux.c: Generated. * features/i386/32bit-mpx.c: Generated. * features/i386/32bit-pkeys.c: Generated. * features/i386/32bit-sse.c: Generated. * target-descriptions.c: Include algorithm. (tdesc_element_visitor): Add method visit_end. (print_c_tdesc): Implement visit_end. (print_c_tdesc:: m_filename_after_features): Move it to protected. (print_c_feature): New class. (maint_print_c_tdesc_cmd): Use print_c_feature if XML file name starts with "i386/32bit-". --- gdb/features/i386/32bit-linux.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gdb/features/i386/32bit-linux.c (limited to 'gdb/features/i386/32bit-linux.c') diff --git a/gdb/features/i386/32bit-linux.c b/gdb/features/i386/32bit-linux.c new file mode 100644 index 0000000..686a2f1 --- /dev/null +++ b/gdb/features/i386/32bit-linux.c @@ -0,0 +1,14 @@ +/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: + Original: 32bit-linux.xml */ + +#include "target-descriptions.h" + +static int +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"); + tdesc_create_reg (feature, "orig_eax", regnum++, 1, NULL, 32, "int"); + return regnum; +} -- cgit v1.1