diff options
author | Shahab Vahedi <shahab@synopsys.com> | 2020-07-09 17:43:13 +0200 |
---|---|---|
committer | Shahab Vahedi <shahab@synopsys.com> | 2020-08-25 17:31:26 +0200 |
commit | 995d3a197d7a7c0212efb6ee723dc470ab3d3a82 (patch) | |
tree | b6a11792e5b0f79854411639964b10a4939f22bc /gdb/features | |
parent | 8cac2b318b1bf14d468b769187a8233a1220c48e (diff) | |
download | fsf-binutils-gdb-995d3a197d7a7c0212efb6ee723dc470ab3d3a82.zip fsf-binutils-gdb-995d3a197d7a7c0212efb6ee723dc470ab3d3a82.tar.gz fsf-binutils-gdb-995d3a197d7a7c0212efb6ee723dc470ab3d3a82.tar.bz2 |
arc: Add ARCv2 XML target along with refactoring
A few changes have been made to make the register support simpler,
more flexible and extendible. The trigger for most of these changes
are the remarks [1] made earlier for v2 of this patch. The noticeable
improvements are:
- The arc XML target features are placed under gdb/features/arc
- There are two cores (based on ISA) and one auxiliary feature:
v1-core: ARC600, ARC601, ARC700
v2-core: ARC EM, ARC HS
aux: common in both
- The XML target features represent a minimalistic sane set of
registers irrespective of application (baremetal or linux).
- A concept of "feature" class has been introduced in the code.
The "feature" object is constructed from BFD and GDBARCH data.
It contains necessary information (ISA and register size) to
determine which XML target feature to use.
- A new structure (ARC_REGISTER_FEATURE) is added that allows
providing index, names, and the necessity of registers. This
simplifies the sanity checks and future extendibility.
- Documnetation has been updated to reflect ARC features better.
- Although the feature names has changed, there still exists
backward compatibility with older names through
find_obsolete_[core,aux]_names() functions.
The last two points were inspired from RiscV port.
[1]
https://sourceware.org/pipermail/gdb-patches/2020-May/168511.html
gdb/ChangeLog:
* arch/arc.h
(arc_gdbarch_features): New class to stir the selection of target XML.
(arc_create_target_description): Use FEATURES to choose XML target.
(arc_lookup_target_description): Use arc_create_target_description
to create _new_ target descriptions or return the already created
ones if the FEATURES is the same.
* arch/arc.c: Implementation of prototypes described above.
* gdb/arc-tdep.h (arc_regnum enum): Add more registers.
(arc_gdbarch_features_init): Initialize the FEATURES struct.
* arc-tdep.c (*_feature_name): Make feature names consistent.
(arc_register_feature): A new struct to hold information about
registers of a particular target/feature.
(arc_check_tdesc_feature): Check if XML provides registers in
compliance with ARC_REGISTER_FEATURE structs.
(arc_update_acc_reg_names): Add aliases for r58 and r59.
(determine_*_reg_feature_set): Which feature name to look for.
(arc_gdbarch_features_init): Given MACH and ABFD, initialize FEATURES.
(mach_type_to_arc_isa): Convert from a set of binutils machine types
to expected ISA enums to be used in arc_gdbarch_features structs.
* features/Makefile (FEATURE_XMLFILES): Add new files.
* gdb/features/arc/v1-aux.c: New file.
* gdb/features/arc/v1-aux.xml: Likewise.
* gdb/features/arc/v1-core.c: Likewise.
* gdb/features/arc/v1-core.xml: Likewise.
* gdb/features/arc/v2-aux.c: Likewise.
* gdb/features/arc/v2-aux.xml: Likewise.
* gdb/features/arc/v2-core.c: Likewise.
* gdb/features/arc/v2-core.xml: Likewise.
* NEWS (Changes since GDB 9): Announce obsolence of old feature names.
gdb/doc/ChangeLog:
* gdb.texinfo (Synopsys ARC): Update the documentation for ARC
Features.
gdb/testsuite/ChangeLog:
* gdb.arch/arc-tdesc-cpu.xml: Use new feature names.
Diffstat (limited to 'gdb/features')
-rw-r--r-- | gdb/features/Makefile | 8 | ||||
-rw-r--r-- | gdb/features/arc/v1-aux.c (renamed from gdb/features/arc/aux-arcompact.c) | 9 | ||||
-rw-r--r-- | gdb/features/arc/v1-aux.xml (renamed from gdb/features/arc/aux-arcompact.xml) | 7 | ||||
-rw-r--r-- | gdb/features/arc/v1-core.c (renamed from gdb/features/arc/core-arcompact.c) | 8 | ||||
-rw-r--r-- | gdb/features/arc/v1-core.xml (renamed from gdb/features/arc/core-arcompact.xml) | 4 | ||||
-rw-r--r-- | gdb/features/arc/v2-aux.c (renamed from gdb/features/arc/aux-v2.c) | 9 | ||||
-rw-r--r-- | gdb/features/arc/v2-aux.xml (renamed from gdb/features/arc/aux-v2.xml) | 5 | ||||
-rw-r--r-- | gdb/features/arc/v2-core.c (renamed from gdb/features/arc/core-v2.c) | 7 | ||||
-rw-r--r-- | gdb/features/arc/v2-core.xml (renamed from gdb/features/arc/core-v2.xml) | 7 |
9 files changed, 35 insertions, 29 deletions
diff --git a/gdb/features/Makefile b/gdb/features/Makefile index d0af9a4..6896038 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -201,10 +201,10 @@ $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl FEATURE_XMLFILES = aarch64-core.xml \ aarch64-fpu.xml \ aarch64-pauth.xml \ - arc/core-v2.xml \ - arc/aux-v2.xml \ - arc/core-arcompact.xml \ - arc/aux-arcompact.xml \ + arc/v1-core.xml \ + arc/v1-aux.xml \ + arc/v2-core.xml \ + arc/v2-aux.xml \ arm/arm-core.xml \ arm/arm-fpa.xml \ arm/arm-m-profile.xml \ diff --git a/gdb/features/arc/aux-arcompact.c b/gdb/features/arc/v1-aux.c index d8e8c74..d154076 100644 --- a/gdb/features/arc/aux-arcompact.c +++ b/gdb/features/arc/v1-aux.c @@ -1,14 +1,14 @@ /* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: - Original: aux-arcompact.xml */ + Original: v1-aux.xml */ #include "gdbsupport/tdesc.h" static int -create_feature_arc_aux_arcompact (struct target_desc *result, long regnum) +create_feature_arc_v1_aux (struct target_desc *result, long regnum) { struct tdesc_feature *feature; - feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); + feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux"); tdesc_type_with_fields *type_with_fields; type_with_fields = tdesc_create_flags (feature, "status32_type", 4); tdesc_add_flag (type_with_fields, 0, "H"); @@ -27,5 +27,8 @@ create_feature_arc_aux_arcompact (struct target_desc *result, long regnum) tdesc_create_reg (feature, "pc", regnum++, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "status32", regnum++, 1, NULL, 32, "status32_type"); + tdesc_create_reg (feature, "lp_start", regnum++, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "lp_end", regnum++, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "bta", regnum++, 1, NULL, 32, "code_ptr"); return regnum; } diff --git a/gdb/features/arc/aux-arcompact.xml b/gdb/features/arc/v1-aux.xml index bf68112..091808b 100644 --- a/gdb/features/arc/aux-arcompact.xml +++ b/gdb/features/arc/v1-aux.xml @@ -6,7 +6,7 @@ notice and this notice are preserved. --> <!DOCTYPE target SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.arc.aux-minimal"> +<feature name="org.gnu.gdb.arc.aux"> <flags id="status32_type" size="4"> <field name="H" start="0" end="0"/> <field name="E" start="1" end="2"/> @@ -19,10 +19,13 @@ <field name="N" start="10" end="10"/> <field name="Z" start="11" end="11"/> <field name="L" start="12" end="12"/> - <field name="R" start="13" end="13"/> + <field name="R" start="13" end="13"/> <field name="SE" start="14" end="14"/> </flags> <reg name="pc" bitsize="32" type="code_ptr"/> <reg name="status32" bitsize="32" type="status32_type"/> + <reg name="lp_start" bitsize="32" type="code_ptr"/> + <reg name="lp_end" bitsize="32" type="code_ptr"/> + <reg name="bta" bitsize="32" type="code_ptr"/> </feature> diff --git a/gdb/features/arc/core-arcompact.c b/gdb/features/arc/v1-core.c index 7d9a4b2..df51d47 100644 --- a/gdb/features/arc/core-arcompact.c +++ b/gdb/features/arc/v1-core.c @@ -1,14 +1,14 @@ /* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: - Original: core-arcompact.xml */ + Original: v1-core.xml */ #include "gdbsupport/tdesc.h" static int -create_feature_arc_core_arcompact (struct target_desc *result, long regnum) +create_feature_arc_v1_core (struct target_desc *result, long regnum) { struct tdesc_feature *feature; - feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core.arcompact"); + feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core"); tdesc_create_reg (feature, "r0", regnum++, 1, NULL, 32, "int"); tdesc_create_reg (feature, "r1", regnum++, 1, NULL, 32, "int"); tdesc_create_reg (feature, "r2", regnum++, 1, NULL, 32, "int"); @@ -38,8 +38,6 @@ create_feature_arc_core_arcompact (struct target_desc *result, long regnum) tdesc_create_reg (feature, "gp", regnum++, 1, NULL, 32, "data_ptr"); tdesc_create_reg (feature, "fp", regnum++, 1, NULL, 32, "data_ptr"); tdesc_create_reg (feature, "sp", regnum++, 1, NULL, 32, "data_ptr"); - tdesc_create_reg (feature, "ilink1", regnum++, 1, NULL, 32, "code_ptr"); - tdesc_create_reg (feature, "ilink2", regnum++, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "blink", regnum++, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "lp_count", regnum++, 1, NULL, 32, "uint32"); tdesc_create_reg (feature, "pcl", regnum++, 1, NULL, 32, "code_ptr"); diff --git a/gdb/features/arc/core-arcompact.xml b/gdb/features/arc/v1-core.xml index 9209891..68d04bd 100644 --- a/gdb/features/arc/core-arcompact.xml +++ b/gdb/features/arc/v1-core.xml @@ -6,7 +6,7 @@ notice and this notice are preserved. --> <!DOCTYPE target SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.arc.core.arcompact"> +<feature name="org.gnu.gdb.arc.core"> <reg name="r0" bitsize="32"/> <reg name="r1" bitsize="32"/> <reg name="r2" bitsize="32"/> @@ -40,8 +40,6 @@ <reg name="sp" bitsize="32" type="data_ptr"/> <!-- Code pointers. --> - <reg name="ilink1" bitsize="32" type="code_ptr"/> - <reg name="ilink2" bitsize="32" type="code_ptr"/> <reg name="blink" bitsize="32" type="code_ptr"/> <!-- Here goes extension core registers: r32 - r59 --> diff --git a/gdb/features/arc/aux-v2.c b/gdb/features/arc/v2-aux.c index 6290b9b..7b38e37 100644 --- a/gdb/features/arc/aux-v2.c +++ b/gdb/features/arc/v2-aux.c @@ -1,14 +1,14 @@ /* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: - Original: aux-v2.xml */ + Original: v2-aux.xml */ #include "gdbsupport/tdesc.h" static int -create_feature_arc_aux_v2 (struct target_desc *result, long regnum) +create_feature_arc_v2_aux (struct target_desc *result, long regnum) { struct tdesc_feature *feature; - feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal"); + feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux"); tdesc_type_with_fields *type_with_fields; type_with_fields = tdesc_create_flags (feature, "status32_type", 4); tdesc_add_flag (type_with_fields, 0, "H"); @@ -31,5 +31,8 @@ create_feature_arc_aux_v2 (struct target_desc *result, long regnum) tdesc_create_reg (feature, "pc", regnum++, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "status32", regnum++, 1, NULL, 32, "status32_type"); + tdesc_create_reg (feature, "lp_start", regnum++, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "lp_end", regnum++, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "bta", regnum++, 1, NULL, 32, "code_ptr"); return regnum; } diff --git a/gdb/features/arc/aux-v2.xml b/gdb/features/arc/v2-aux.xml index 2701fad..5d81e24 100644 --- a/gdb/features/arc/aux-v2.xml +++ b/gdb/features/arc/v2-aux.xml @@ -6,7 +6,7 @@ notice and this notice are preserved. --> <!DOCTYPE target SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.arc.aux-minimal"> +<feature name="org.gnu.gdb.arc.aux"> <flags id="status32_type" size="4"> <field name="H" start="0" end="0"/> <field name="E" start="1" end="4"/> @@ -29,4 +29,7 @@ <reg name="pc" bitsize="32" type="code_ptr"/> <reg name="status32" bitsize="32" type="status32_type"/> + <reg name="lp_start" bitsize="32" type="code_ptr"/> + <reg name="lp_end" bitsize="32" type="code_ptr"/> + <reg name="bta" bitsize="32" type="code_ptr"/> </feature> diff --git a/gdb/features/arc/core-v2.c b/gdb/features/arc/v2-core.c index d37da99..1c3ef1a 100644 --- a/gdb/features/arc/core-v2.c +++ b/gdb/features/arc/v2-core.c @@ -1,14 +1,14 @@ /* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro: - Original: core-v2.xml */ + Original: v2-core.xml */ #include "gdbsupport/tdesc.h" static int -create_feature_arc_core_v2 (struct target_desc *result, long regnum) +create_feature_arc_v2_core (struct target_desc *result, long regnum) { struct tdesc_feature *feature; - feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core.v2"); + feature = tdesc_create_feature (result, "org.gnu.gdb.arc.core"); tdesc_create_reg (feature, "r0", regnum++, 1, NULL, 32, "int"); tdesc_create_reg (feature, "r1", regnum++, 1, NULL, 32, "int"); tdesc_create_reg (feature, "r2", regnum++, 1, NULL, 32, "int"); @@ -38,7 +38,6 @@ create_feature_arc_core_v2 (struct target_desc *result, long regnum) tdesc_create_reg (feature, "gp", regnum++, 1, NULL, 32, "data_ptr"); tdesc_create_reg (feature, "fp", regnum++, 1, NULL, 32, "data_ptr"); tdesc_create_reg (feature, "sp", regnum++, 1, NULL, 32, "data_ptr"); - tdesc_create_reg (feature, "ilink", regnum++, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "r30", regnum++, 1, NULL, 32, "int"); tdesc_create_reg (feature, "blink", regnum++, 1, NULL, 32, "code_ptr"); tdesc_create_reg (feature, "lp_count", regnum++, 1, NULL, 32, "uint32"); diff --git a/gdb/features/arc/core-v2.xml b/gdb/features/arc/v2-core.xml index 1b17968..2a2561e 100644 --- a/gdb/features/arc/core-v2.xml +++ b/gdb/features/arc/v2-core.xml @@ -6,7 +6,7 @@ notice and this notice are preserved. --> <!DOCTYPE target SYSTEM "gdb-target.dtd"> -<feature name="org.gnu.gdb.arc.core.v2"> +<feature name="org.gnu.gdb.arc.core"> <reg name="r0" bitsize="32"/> <reg name="r1" bitsize="32"/> <reg name="r2" bitsize="32"/> @@ -42,12 +42,11 @@ <!-- Code pointers. R30 is general purpose, but it used to be ILINK2 in ARCompact, thus its odd position in between of special purpose registers. GCC does't use this register, so it isn't a member of a general group. --> - <reg name="ilink" bitsize="32" type="code_ptr"/> <reg name="r30" bitsize="32" group=""/> <reg name="blink" bitsize="32" type="code_ptr"/> - <!-- Here goes extension core registers: r32 - r57. --> - <!-- Here goes ACCL/ACCH registers, r58, r59. --> + <!-- Extension core registers: r32 - r57. --> + <!-- ACCL/ACCH registers: r58, r59. --> <!-- Loop counter. --> <reg name="lp_count" bitsize="32" type="uint32"/> |