Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alan Hayward <Alan.Hayward@arm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: nd <nd@arm.com>, Alan Hayward <Alan.Hayward@arm.com>
Subject: [PATCH v2 2/5] Arm: Use feature target descriptions
Date: Thu, 11 Jul 2019 13:46:00 -0000	[thread overview]
Message-ID: <20190711134436.47896-3-alan.hayward@arm.com> (raw)
In-Reply-To: <20190711134436.47896-1-alan.hayward@arm.com>

In arm arm_create_target_description and
aarch32_create_target_description create feature based target descriptions
instead of returning the old style descriptions.

Ensure the descriptions are created in exactly the same way as the old xml
files.

Remove the old initialize calls.

Note this fixes the gdbserver build for AArch64.

gdb/ChangeLog:

2019-07-11  Alan Hayward  <alan.hayward@arm.com>

	* arch/aarch32.c (aarch32_create_target_description): Create
	target descriptions using features.
	* arch/arm.c (arm_create_target_description)
	(arm_create_mprofile_target_description): Likewise.
	* arm-tdep.c (_initialize_arm_tdep): Remove tdesc init calls.
---
 gdb/arch/aarch32.c | 18 +++++++++++--
 gdb/arch/arm.c     | 67 +++++++++++++++++++++++++++++++---------------
 gdb/arm-tdep.c     | 17 ------------
 3 files changed, 62 insertions(+), 40 deletions(-)

diff --git a/gdb/arch/aarch32.c b/gdb/arch/aarch32.c
index f3cb8c7855..f15096e592 100644
--- a/gdb/arch/aarch32.c
+++ b/gdb/arch/aarch32.c
@@ -18,12 +18,26 @@
 #include "common/common-defs.h"
 #include "aarch32.h"
 
-extern struct target_desc *tdesc_arm_with_neon;
+#include "../features/arm/arm-core.c"
+#include "../features/arm/arm-vfpv3.c"
 
 /* See aarch32.h.  */
 
 target_desc *
 aarch32_create_target_description ()
 {
-  return tdesc_arm_with_neon;
+  target_desc *tdesc = allocate_target_description ();
+
+#ifndef IN_PROCESS_AGENT
+  set_tdesc_architecture (tdesc, "arm");
+#endif
+
+  long regnum = 0;
+
+  regnum = create_feature_arm_arm_core (tdesc, regnum);
+  /* Create a vfpv3 feature, then a blank NEON feature.  */
+  regnum = create_feature_arm_arm_vfpv3 (tdesc, regnum);
+  tdesc_create_feature (tdesc, "org.gnu.gdb.arm.neon");
+
+  return tdesc;
 }
diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c
index 769d280a52..ea03dd1685 100644
--- a/gdb/arch/arm.c
+++ b/gdb/arch/arm.c
@@ -21,16 +21,12 @@
 #include "gdbsupport/common-regcache.h"
 #include "arm.h"
 
-extern struct target_desc *tdesc_arm_with_vfpv2;
-extern struct target_desc *tdesc_arm_with_vfpv3;
-extern struct target_desc *tdesc_arm_with_iwmmxt;
-
-/* Temporary ifdef.  Will be removed when target descriptions are switched.  */
-#ifndef GDBSERVER
-extern struct target_desc *tdesc_arm_with_m;
-extern struct target_desc *tdesc_arm_with_m_vfp_d16;
-extern struct target_desc *tdesc_arm_with_m_fpa_layout;
-#endif
+#include "../features/arm/arm-core.c"
+#include "../features/arm/arm-vfpv2.c"
+#include "../features/arm/arm-vfpv3.c"
+#include "../features/arm/xscale-iwmmxt.c"
+#include "../features/arm/arm-m-profile.c"
+#include "../features/arm/arm-m-profile-with-fpa.c"
 
 /* See arm.h.  */
 
@@ -389,23 +385,41 @@ shifted_reg_val (struct regcache *regcache, unsigned long inst,
 target_desc *
 arm_create_target_description (arm_fp_type fp_type)
 {
+  target_desc *tdesc = allocate_target_description ();
+
+#ifndef IN_PROCESS_AGENT
+  if (fp_type == ARM_FP_TYPE_IWMMXT)
+    set_tdesc_architecture (tdesc, "iwmmxt");
+  else
+    set_tdesc_architecture (tdesc, "arm");
+#endif
+
+  long regnum = 0;
+
+  regnum = create_feature_arm_arm_core (tdesc, regnum);
+
   switch (fp_type)
     {
     case ARM_FP_TYPE_NONE:
-      return nullptr;
+      break;
 
     case ARM_FP_TYPE_VFPV2:
-      return tdesc_arm_with_vfpv2;
+      regnum = create_feature_arm_arm_vfpv2 (tdesc, regnum);
+      break;
 
     case ARM_FP_TYPE_VFPV3:
-      return tdesc_arm_with_vfpv3;
+      regnum = create_feature_arm_arm_vfpv3 (tdesc, regnum);
+      break;
 
     case ARM_FP_TYPE_IWMMXT:
-      return tdesc_arm_with_iwmmxt;
+      regnum = create_feature_arm_xscale_iwmmxt (tdesc, regnum);
+      break;
 
     default:
       error (_("Invalid Arm FP type: %d"), fp_type);
     }
+
+  return tdesc;
 }
 
 /* See arch/arm.h.  */
@@ -413,21 +427,32 @@ arm_create_target_description (arm_fp_type fp_type)
 target_desc *
 arm_create_mprofile_target_description (arm_m_profile_type m_type)
 {
+  target_desc *tdesc = allocate_target_description ();
+
+#ifndef IN_PROCESS_AGENT
+  set_tdesc_architecture (tdesc, "arm");
+#endif
+
+  long regnum = 0;
+
   switch (m_type)
     {
-/* Temporary ifdef.  Will be removed when target descriptions are switched.  */
-#ifndef GDBSERVER
     case ARM_M_TYPE_M_PROFILE:
-      return tdesc_arm_with_m;
+      regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
+      break;
 
     case ARM_M_TYPE_VFP_D16:
-      return tdesc_arm_with_m_fpa_layout;
+      regnum = create_feature_arm_arm_m_profile (tdesc, regnum);
+      regnum = create_feature_arm_arm_vfpv2 (tdesc, regnum);
+      break;
 
     case ARM_M_TYPE_WITH_FPA:
-      return tdesc_arm_with_m_vfp_d16;
-#endif
+      regnum = create_feature_arm_arm_m_profile_with_fpa (tdesc, regnum);
+      break;
+
     default:
       error (_("Invalid Arm M type: %d"), m_type);
     }
-}
 
+  return tdesc;
+}
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 1b19b72ca1..1d655eab5c 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -61,14 +61,6 @@
 #include "record-full.h"
 #include <algorithm>
 
-#include "features/arm/arm-with-m.c"
-#include "features/arm/arm-with-m-fpa-layout.c"
-#include "features/arm/arm-with-m-vfp-d16.c"
-#include "features/arm/arm-with-iwmmxt.c"
-#include "features/arm/arm-with-vfpv2.c"
-#include "features/arm/arm-with-vfpv3.c"
-#include "features/arm/arm-with-neon.c"
-
 #if GDB_SELF_TEST
 #include "gdbsupport/selftest.h"
 #endif
@@ -9451,15 +9443,6 @@ _initialize_arm_tdep (void)
 				  bfd_target_elf_flavour,
 				  arm_elf_osabi_sniffer);
 
-  /* Initialize the standard target descriptions.  */
-  initialize_tdesc_arm_with_m ();
-  initialize_tdesc_arm_with_m_fpa_layout ();
-  initialize_tdesc_arm_with_m_vfp_d16 ();
-  initialize_tdesc_arm_with_iwmmxt ();
-  initialize_tdesc_arm_with_vfpv2 ();
-  initialize_tdesc_arm_with_vfpv3 ();
-  initialize_tdesc_arm_with_neon ();
-
   /* Add root prefix command for all "set arm"/"show arm" commands.  */
   add_prefix_cmd ("arm", no_class, set_arm_command,
 		  _("Various ARM-specific commands."),
-- 
2.20.1 (Apple Git-117)


  reply	other threads:[~2019-07-11 13:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 13:45 [PATCH v2 0/5] " Alan Hayward
2019-07-11 13:46 ` Alan Hayward [this message]
2019-07-11 13:46 ` [PATCH v2 1/5] Arm: Add read_description read funcs and use in GDB Alan Hayward
2019-07-11 13:56   ` Simon Marchi
2019-07-11 13:58   ` Simon Marchi
2019-07-11 18:04     ` Alan Hayward
2019-07-11 14:19   ` Simon Marchi
2019-07-11 13:46 ` [PATCH v2 3/5] Arm: Add xml unit tests Alan Hayward
2019-07-11 13:46 ` [PATCH v2 4/5] Arm: Use read_description funcs in gdbserver Alan Hayward
2019-07-11 14:35   ` Simon Marchi
2019-07-11 13:46 ` [PATCH v2 5/5] Arm: Remove unused feature files and tests Alan Hayward
2019-07-19 15:08 ` [PATCH v2 0/5] Arm: Use feature target descriptions Alan Hayward

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190711134436.47896-3-alan.hayward@arm.com \
    --to=alan.hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox