]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Use visitor pattern for "maint print c-tdesc"
authorYao Qi <yao.qi@linaro.org>
Thu, 25 May 2017 15:08:44 +0000 (16:08 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 20 Jun 2017 10:34:10 +0000 (11:34 +0100)
commit7b162e155c0c39cad83d7542a61918114d130407
tree93e198d4e33d62132fba7a1ff32ae678ada32d71
parent7432117013f61a4ad87ff803d043672888d43aa7
Use visitor pattern for "maint print c-tdesc"

Target description can be modeled as a tree, the target description
is the root node, features are children nodes, registers and types are
grand-children nodes.  So command "maint print c-tdesc" in effect
traverse/visit each node, and print them in c.  This can be
implemented by visitor pattern, this is the first reason.  Secondly,
I want to this command prints c files in a different way for some
specific xml files, but still print c files the same way for the rest
of xml files.  Third, I even want to print xml files from target
descriptions, so that GDBserver can use it to reply GDB's query
qXfer:features:read:target.xml.

After this change, all features/*.c should be re-generated, but
this patch only includes part changes features/*.c files.

gdb:

2017-05-25  Yao Qi  <yao.qi@linaro.org>

* target-descriptions.c (tdesc_element_visitor): New class.
(tdesc_element): New class.
(tdesc_reg): Inherit from tdesc_element.
(tdesc_reg::accept): New function.
(tdesc_type): Inherit from tdesc_element.
(tdesc_type::accept): New function.
(tdesc_feature): Inherit from tdesc_element.
(tdesc_feature::accept): New function.
(target_desc): Inherit from tdesc_element.
(target_desc::target_desc): New.
(target_desc::~target_desc): New.
(target_desc::accept): New.
(allocate_target_description): Use new.
(free_target_description): Use delete.
(print_c_tdesc): New class.
(maint_print_c_tdesc_cmd): Adjust.

* features/i386/i386-avx-avx512-linux.c: Re-generated.
* features/i386/i386-avx-linux.c: Re-generated.
* features/i386/i386-avx-mpx-avx512-pku-linux.c: Re-generated.
* features/i386/i386-avx-mpx-linux.c: Re-generated.
* features/i386/i386-linux.c: Re-generated.
* features/i386/i386-mmx-linux.c: Re-generated.
15 files changed:
gdb/features/i386/i386-avx-avx512-linux.c
gdb/features/i386/i386-avx-avx512.c
gdb/features/i386/i386-avx-linux.c
gdb/features/i386/i386-avx-mpx-avx512-pku-linux.c
gdb/features/i386/i386-avx-mpx-avx512-pku.c
gdb/features/i386/i386-avx-mpx-linux.c
gdb/features/i386/i386-avx-mpx.c
gdb/features/i386/i386-avx.c
gdb/features/i386/i386-linux.c
gdb/features/i386/i386-mmx-linux.c
gdb/features/i386/i386-mmx.c
gdb/features/i386/i386-mpx-linux.c
gdb/features/i386/i386-mpx.c
gdb/features/i386/i386.c
gdb/target-descriptions.c