public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed 1/3] gdb: add arc-newlib-tdep.c to ALL_TARGET_OBS
@ 2021-11-16  2:40 Simon Marchi
  2021-11-16  2:40 ` [pushed 2/3] gdb: remove unused variables in xtensa-linux-nat.c Simon Marchi
  2021-11-16  2:40 ` [pushed 3/3] gdb: adjust gdbarch_tdep calls in nat files Simon Marchi
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Marchi @ 2021-11-16  2:40 UTC (permalink / raw)
  To: gdb-patches

This file is currently not compiled in an --enable-targets=all build,
but it should be.  Add it to ALL_TARGET_OBS.

Update the gdbarch_tdep call that commit 345bd07cce33 ("gdb: fix
gdbarch_tdep ODR violation") forgot to update.

Change-Id: I86248a01493eea5e70186e9c46a298ad3994b034
---
 gdb/Makefile.in       | 1 +
 gdb/arc-newlib-tdep.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index f71537f65958..a51d63755ef9 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -724,6 +724,7 @@ ALL_64_TARGET_OBS = \
 ALL_TARGET_OBS = \
 	aarch32-tdep.o \
 	arc-linux-tdep.o \
+	arc-newlib-tdep.o \
 	arc-tdep.o \
 	arch/aarch32.o \
 	arch/arc.o \
diff --git a/gdb/arc-newlib-tdep.c b/gdb/arc-newlib-tdep.c
index 325e11b39a2d..b11fe226389a 100644
--- a/gdb/arc-newlib-tdep.c
+++ b/gdb/arc-newlib-tdep.c
@@ -36,7 +36,7 @@ arc_newlib_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   arc_newlib_debug_printf ("Initialization.");
 
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  arc_gdbarch_tdep *tdep = (arc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* Offset of original PC in longjmp jump buffer (in registers).  Value of PC
      offset can be found in newlib/libc/machine/arc/setjmp.S.  */
-- 
2.33.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pushed 2/3] gdb: remove unused variables in xtensa-linux-nat.c
  2021-11-16  2:40 [pushed 1/3] gdb: add arc-newlib-tdep.c to ALL_TARGET_OBS Simon Marchi
@ 2021-11-16  2:40 ` Simon Marchi
  2021-11-16  2:40 ` [pushed 3/3] gdb: adjust gdbarch_tdep calls in nat files Simon Marchi
  1 sibling, 0 replies; 10+ messages in thread
From: Simon Marchi @ 2021-11-16  2:40 UTC (permalink / raw)
  To: gdb-patches

While build-testing this file, the compiler complained about these two
unused variables, remove them.

Change-Id: I3c54f779f12c16ef6184af58aca75eaad042ce4e
---
 gdb/xtensa-linux-nat.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index 54f1a0df0fe6..7bc1689b9f5d 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -204,7 +204,6 @@ fetch_gregs (struct regcache *regcache, int regnum)
 {
   int tid = regcache->ptid ().lwp ();
   gdb_gregset_t regs;
-  int areg;
   
   if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
     {
@@ -223,7 +222,6 @@ store_gregs (struct regcache *regcache, int regnum)
 {
   int tid = regcache->ptid ().lwp ();
   gdb_gregset_t regs;
-  int areg;
 
   if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
     {
-- 
2.33.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pushed 3/3] gdb: adjust gdbarch_tdep calls in nat files
  2021-11-16  2:40 [pushed 1/3] gdb: add arc-newlib-tdep.c to ALL_TARGET_OBS Simon Marchi
  2021-11-16  2:40 ` [pushed 2/3] gdb: remove unused variables in xtensa-linux-nat.c Simon Marchi
@ 2021-11-16  2:40 ` Simon Marchi
  2021-11-17 14:42   ` [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes Andreas Arnez
  1 sibling, 1 reply; 10+ messages in thread
From: Simon Marchi @ 2021-11-16  2:40 UTC (permalink / raw)
  To: gdb-patches

Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") forgot to
update the gdbarch_tdep calls in the native files other than x86-64
Linux.  This patch updates them all (to the best of my knowledge).
These are the files I was able to build-test:

  aarch64-linux-nat.c
  amd64-bsd-nat.c
  arm-linux-nat.c
  ppc-linux-nat.c
  windows-nat.c
  xtensa-linux-nat.c

And these are the ones I could not build-test:

  aix-thread.c
  arm-netbsd-nat.c
  ppc-fbsd-nat.c
  ppc-netbsd-nat.c
  ia64-tdep.c (the part that needs libunwind)
  ppc-obsd-nat.c
  rs6000-nat.c

If there are still some build problems related to gdbarch_tdep in them,
they should be pretty obvious to fix.

Change-Id: Iaa3d791a850e4432973757598e634e3da6061428
---
 gdb/aarch64-linux-nat.c |  19 ++++---
 gdb/aix-thread.c        |  31 ++++++------
 gdb/amd64-bsd-nat.c     |   4 +-
 gdb/arm-linux-nat.c     |   8 +--
 gdb/arm-netbsd-nat.c    |   8 +--
 gdb/ia64-tdep.c         |   3 +-
 gdb/ppc-fbsd-nat.c      |   4 +-
 gdb/ppc-linux-nat.c     |  22 ++++-----
 gdb/ppc-netbsd-nat.c    |   6 +--
 gdb/ppc-obsd-nat.c      |   4 +-
 gdb/rs6000-nat.c        |   6 +--
 gdb/windows-nat.c       |   2 +-
 gdb/xtensa-linux-nat.c  | 106 ++++++++++++++++++++--------------------
 13 files changed, 118 insertions(+), 105 deletions(-)

diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index c7cbebbc3517..aa42365d25d0 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -454,7 +454,8 @@ store_sveregs_to_thread (struct regcache *regcache)
 static void
 fetch_pauth_masks_from_thread (struct regcache *regcache)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  aarch64_gdbarch_tdep *tdep
+    = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   int ret;
   struct iovec iovec;
   uint64_t pauth_regset[2] = {0, 0};
@@ -479,7 +480,8 @@ fetch_pauth_masks_from_thread (struct regcache *regcache)
 static void
 fetch_mteregs_from_thread (struct regcache *regcache)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  aarch64_gdbarch_tdep *tdep
+    = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   int regno = tdep->mte_reg_base;
 
   gdb_assert (regno != -1);
@@ -503,7 +505,8 @@ fetch_mteregs_from_thread (struct regcache *regcache)
 static void
 store_mteregs_to_thread (struct regcache *regcache)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  aarch64_gdbarch_tdep *tdep
+    = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   int regno = tdep->mte_reg_base;
 
   gdb_assert (regno != -1);
@@ -531,7 +534,8 @@ void
 aarch64_linux_nat_target::fetch_registers (struct regcache *regcache,
 					   int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  aarch64_gdbarch_tdep *tdep
+    = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
 
   if (regno == -1)
     {
@@ -573,7 +577,8 @@ void
 aarch64_linux_nat_target::store_registers (struct regcache *regcache,
 					   int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  aarch64_gdbarch_tdep *tdep
+    = (aarch64_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
 
   if (regno == -1)
     {
@@ -1052,7 +1057,9 @@ aarch64_linux_nat_target::thread_architecture (ptid_t ptid)
      return it if the current vector length matches the one in the tdep.  */
   inferior *inf = find_inferior_ptid (this, ptid);
   gdb_assert (inf != NULL);
-  if (vq == gdbarch_tdep (inf->gdbarch)->vq)
+  aarch64_gdbarch_tdep *tdep
+    = (aarch64_gdbarch_tdep *) gdbarch_tdep (inf->gdbarch);
+  if (vq == tdep->vq)
     return inf->gdbarch;
 
   /* We reach here if the vector length for the thread is different from its
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index a604320d666d..77691293bb04 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -1113,7 +1113,8 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
 static void
 supply_gprs64 (struct regcache *regcache, uint64_t *vals)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  ppc_gdbarch_tdep *tdep
+    = (ppc_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
@@ -1135,7 +1136,7 @@ static void
 supply_fprs (struct regcache *regcache, double *vals)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int regno;
 
   /* This function should never be called on architectures without
@@ -1153,7 +1154,7 @@ supply_fprs (struct regcache *regcache, double *vals)
 static int
 special_register_p (struct gdbarch *gdbarch, int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   return regno == gdbarch_pc_regnum (gdbarch)
       || regno == tdep->ppc_ps_regnum
@@ -1176,7 +1177,7 @@ supply_sprs64 (struct regcache *regcache,
 	       uint32_t fpscr)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   regcache->raw_supply (gdbarch_pc_regnum (gdbarch), (char *) &iar);
   regcache->raw_supply (tdep->ppc_ps_regnum, (char *) &msr);
@@ -1198,7 +1199,7 @@ supply_sprs32 (struct regcache *regcache,
 	       uint32_t fpscr)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   regcache->raw_supply (gdbarch_pc_regnum (gdbarch), (char *) &iar);
   regcache->raw_supply (tdep->ppc_ps_regnum, (char *) &msr);
@@ -1221,7 +1222,7 @@ static void
 fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int status, i;
   pthdb_context_t ctx;
 
@@ -1276,7 +1277,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
 			  pthdb_tid_t tid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   uint64_t gprs64[ppc_num_gprs];
   uint32_t gprs32[ppc_num_gprs];
   double fprs[ppc_num_fprs];
@@ -1378,7 +1379,8 @@ aix_thread_target::fetch_registers (struct regcache *regcache, int regno)
 static void
 fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  ppc_gdbarch_tdep *tdep
+    = (ppc_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
@@ -1390,7 +1392,8 @@ fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
 static void 
 fill_gprs32 (const struct regcache *regcache, uint32_t *vals)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  ppc_gdbarch_tdep *tdep
+    = (ppc_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
@@ -1404,7 +1407,7 @@ static void
 fill_fprs (const struct regcache *regcache, double *vals)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int regno;
 
   /* This function should never be called on architectures without
@@ -1428,7 +1431,7 @@ fill_sprs64 (const struct regcache *regcache,
 	     uint32_t *fpscr)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* Verify that the size of the size of the IAR buffer is the
      same as the raw size of the PC (in the register cache).  If
@@ -1462,7 +1465,7 @@ fill_sprs32 (const struct regcache *regcache,
 	     uint32_t *fpscr)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* Verify that the size of the size of the IAR buffer is the
      same as the raw size of the PC (in the register cache).  If
@@ -1499,7 +1502,7 @@ static void
 store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int status, i;
   pthdb_context_t ctx;
   uint32_t int32;
@@ -1589,7 +1592,7 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
 			  pthdb_tid_t tid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   uint64_t gprs64[ppc_num_gprs];
   uint32_t gprs32[ppc_num_gprs];
   double fprs[ppc_num_fprs];
diff --git a/gdb/amd64-bsd-nat.c b/gdb/amd64-bsd-nat.c
index 3e0c29a22f7b..1720c84ea068 100644
--- a/gdb/amd64-bsd-nat.c
+++ b/gdb/amd64-bsd-nat.c
@@ -60,7 +60,7 @@ amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
   struct gdbarch *gdbarch = regcache->arch ();
   ptid_t ptid = regcache->ptid ();
 #if defined(PT_GETFSBASE) || defined(PT_GETGSBASE)
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 #endif
 
   if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
@@ -136,7 +136,7 @@ amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum)
   struct gdbarch *gdbarch = regcache->arch ();
   ptid_t ptid = regcache->ptid ();
 #if defined(PT_SETFSBASE) || defined(PT_SETGSBASE)
-  const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 #endif
 
   if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 880ac0da0440..5ae16e19943e 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -339,7 +339,7 @@ fetch_vfp_regs (struct regcache *regcache)
   gdb_byte regbuf[ARM_VFP3_REGS_SIZE];
   int ret, tid;
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* Get the thread id for the ptrace call.  */
   tid = regcache->ptid ().lwp ();
@@ -368,7 +368,7 @@ store_vfp_regs (const struct regcache *regcache)
   gdb_byte regbuf[ARM_VFP3_REGS_SIZE];
   int ret, tid;
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* Get the thread id for the ptrace call.  */
   tid = regcache->ptid ().lwp ();
@@ -413,7 +413,7 @@ void
 arm_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   if (-1 == regno)
     {
@@ -450,7 +450,7 @@ void
 arm_linux_nat_target::store_registers (struct regcache *regcache, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   if (-1 == regno)
     {
diff --git a/gdb/arm-netbsd-nat.c b/gdb/arm-netbsd-nat.c
index e2b84f2f5962..0d1884648acd 100644
--- a/gdb/arm-netbsd-nat.c
+++ b/gdb/arm-netbsd-nat.c
@@ -50,7 +50,7 @@ static arm_netbsd_nat_target the_arm_netbsd_nat_target;
 static void
 arm_supply_vfpregset (struct regcache *regcache, struct fpreg *fpregset)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   if (tdep->vfp_register_count == 0)
     return;
 
@@ -97,7 +97,7 @@ fetch_fp_register (struct regcache *regcache, int regno)
       return;
     }
 
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   if (regno == ARM_FPSCR_REGNUM && tdep->vfp_register_count != 0)
     regcache->raw_supply (ARM_FPSCR_REGNUM, (char *) &vfp.vfp_fpscr);
   else if (regno >= ARM_D0_REGNUM
@@ -279,7 +279,7 @@ store_fp_register (const struct regcache *regcache, int regno)
       return;
     }
 
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   if (regno == ARM_FPSCR_REGNUM && tdep->vfp_register_count != 0)
     regcache->raw_collect (ARM_FPSCR_REGNUM, (char *) &vfp.vfp_fpscr);
   else if (regno >= ARM_D0_REGNUM
@@ -301,7 +301,7 @@ store_fp_register (const struct regcache *regcache, int regno)
 static void
 store_fp_regs (const struct regcache *regcache)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
+  arm_gdbarch_tdep *tdep = (arm_gdbarch_tdep *) gdbarch_tdep (regcache->arch ());
   int lwp = regcache->ptid ().lwp ();
   if (tdep->vfp_register_count == 0)
     return;
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 08c5d6a72efa..829909dab186 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -2485,6 +2485,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
   unw_word_t bsp, sof, cfm, psr, ip;
   struct frame_info *this_frame = (struct frame_info *) arg;
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  ia64_gdbarch_tdep *tdep = (ia64_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   
   /* We never call any libunwind routines that need to write registers.  */
   gdb_assert (!write);
@@ -2506,7 +2507,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
 	   the current register frame.  */
 	bsp = get_frame_register_unsigned (this_frame, IA64_BSP_REGNUM);
 	cfm = get_frame_register_unsigned (this_frame, IA64_CFM_REGNUM);
-	sof = gdbarch_tdep (gdbarch)->size_of_register_frame (this_frame, cfm);
+	sof = tdep->size_of_register_frame (this_frame, cfm);
 	*val = ia64_rse_skip_regs (bsp, -sof);
 	break;
 
diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c
index 533e70daba50..a6320a6829a8 100644
--- a/gdb/ppc-fbsd-nat.c
+++ b/gdb/ppc-fbsd-nat.c
@@ -100,7 +100,7 @@ fill_fpregset (const struct regcache *regcache,
 static int
 getfpregs_supplies (struct gdbarch *gdbarch, int regno)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating
 	 point registers.  Traditionally, GDB's register set has still
@@ -185,7 +185,7 @@ static int
 ppcfbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int i, regnum;
 
   /* The stack pointer shouldn't be zero.  */
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 06a30efeaef4..9bd940c85a02 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -649,7 +649,7 @@ static int
 ppc_register_u_addr (struct gdbarch *gdbarch, int regno)
 {
   int u_addr = -1;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
      interface, and not the wordsize of the program's ABI.  */
   int wordsize = sizeof (long);
@@ -802,7 +802,7 @@ static void
 fetch_spe_register (struct regcache *regcache, int tid, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   struct gdb_evrregset_t evrregs;
 
   gdb_assert (sizeof (evrregs.evr[0])
@@ -911,7 +911,7 @@ static void
 fetch_register (struct regcache *regcache, int tid, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno);
   int bytes_transferred;
@@ -1156,7 +1156,7 @@ static void
 fetch_gp_regs (struct regcache *regcache, int tid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int i;
 
   if (have_ptrace_getsetregs)
@@ -1208,7 +1208,7 @@ static void
 fetch_fp_regs (struct regcache *regcache, int tid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int i;
 
   if (have_ptrace_getsetfpregs)
@@ -1226,7 +1226,7 @@ static void
 fetch_ppc_registers (struct regcache *regcache, int tid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   fetch_gp_regs (regcache, tid);
   if (tdep->ppc_fp0_regnum >= 0)
@@ -1425,7 +1425,7 @@ static void
 store_spe_register (const struct regcache *regcache, int tid, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   struct gdb_evrregset_t evrregs;
 
   gdb_assert (sizeof (evrregs.evr[0])
@@ -1477,7 +1477,7 @@ static void
 store_register (const struct regcache *regcache, int tid, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   /* This isn't really an address.  But ptrace thinks of it as one.  */
   CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno);
   int i;
@@ -1718,7 +1718,7 @@ static void
 store_gp_regs (const struct regcache *regcache, int tid, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int i;
 
   if (have_ptrace_getsetregs)
@@ -1780,7 +1780,7 @@ static void
 store_fp_regs (const struct regcache *regcache, int tid, int regno)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int i;
 
   if (have_ptrace_getsetfpregs)
@@ -1798,7 +1798,7 @@ static void
 store_ppc_registers (const struct regcache *regcache, int tid)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
  
   store_gp_regs (regcache, tid, -1);
   if (tdep->ppc_fp0_regnum >= 0)
diff --git a/gdb/ppc-netbsd-nat.c b/gdb/ppc-netbsd-nat.c
index 316fc781ae66..fa58fd76693f 100644
--- a/gdb/ppc-netbsd-nat.c
+++ b/gdb/ppc-netbsd-nat.c
@@ -52,7 +52,7 @@ static ppc_nbsd_nat_target the_ppc_nbsd_nat_target;
 static int
 getregs_supplies (struct gdbarch *gdbarch, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   return ((regnum >= tdep->ppc_gp0_regnum
 	   && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs)
@@ -68,7 +68,7 @@ getregs_supplies (struct gdbarch *gdbarch, int regnum)
 static int
 getfpregs_supplies (struct gdbarch *gdbarch, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating
      point registers.  Traditionally, GDB's register set has still
@@ -159,7 +159,7 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
   struct switchframe sf;
   struct callframe cf;
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   int i;
 
   /* The stack pointer shouldn't be zero.  */
diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c
index 53a679d3cac3..ff337009b172 100644
--- a/gdb/ppc-obsd-nat.c
+++ b/gdb/ppc-obsd-nat.c
@@ -54,7 +54,7 @@ static ppc_obsd_nat_target the_ppc_obsd_nat_target;
 static int
 getfpregs_supplies (struct gdbarch *gdbarch, int regnum)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   /* FIXME: jimb/2004-05-05: Some PPC variants don't have floating
      point registers.  Traditionally, GDB's register set has still
@@ -154,7 +154,7 @@ static int
 ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 {
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
   struct switchframe sf;
   struct callframe cf;
   int i, regnum;
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index 6d5996c2011d..c266c50777f2 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -111,7 +111,7 @@ static rs6000_nat_target the_rs6000_nat_target;
 static int
 regmap (struct gdbarch *gdbarch, int regno, int *isfloat)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   *isfloat = 0;
   if (tdep->ppc_gp0_regnum <= regno
@@ -313,7 +313,7 @@ rs6000_nat_target::fetch_registers (struct regcache *regcache, int regno)
 
   else
     {
-      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+      ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
       /* Read 32 general purpose registers.  */
       for (regno = tdep->ppc_gp0_regnum;
@@ -355,7 +355,7 @@ rs6000_nat_target::store_registers (struct regcache *regcache, int regno)
 
   else
     {
-      struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+      ppc_gdbarch_tdep *tdep = (ppc_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
       /* Write general purpose registers first.  */
       for (regno = tdep->ppc_gp0_regnum;
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index f3201295f31a..32b030fdb51a 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -475,7 +475,7 @@ windows_fetch_one_register (struct regcache *regcache,
 
   char *context_offset = context_ptr + mappings[r];
   struct gdbarch *gdbarch = regcache->arch ();
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   gdb_assert (!gdbarch_read_pc_p (gdbarch));
   gdb_assert (gdbarch_pc_regnum (gdbarch) >= 0);
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index 7bc1689b9f5d..abecb7aec746 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -62,56 +62,57 @@ fill_gregset (const struct regcache *regcache,
   int i;
   xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp;
   struct gdbarch *gdbarch = regcache->arch ();
+  xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
     regcache->raw_collect (gdbarch_pc_regnum (gdbarch), &regs->pc);
   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
     regcache->raw_collect (gdbarch_ps_regnum (gdbarch), &regs->ps);
 
-  if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
-    regcache->raw_collect (gdbarch_tdep (gdbarch)->wb_regnum,
+  if (regnum == tdep->wb_regnum || regnum == -1)
+    regcache->raw_collect (tdep->wb_regnum,
 			   &regs->windowbase);
-  if (regnum == gdbarch_tdep (gdbarch)->ws_regnum || regnum == -1)
-    regcache->raw_collect (gdbarch_tdep (gdbarch)->ws_regnum,
+  if (regnum == tdep->ws_regnum || regnum == -1)
+    regcache->raw_collect (tdep->ws_regnum,
 			   &regs->windowstart);
-  if (regnum == gdbarch_tdep (gdbarch)->lbeg_regnum || regnum == -1)
-    regcache->raw_collect (gdbarch_tdep (gdbarch)->lbeg_regnum,
+  if (regnum == tdep->lbeg_regnum || regnum == -1)
+    regcache->raw_collect (tdep->lbeg_regnum,
 			   &regs->lbeg);
-  if (regnum == gdbarch_tdep (gdbarch)->lend_regnum || regnum == -1)
-    regcache->raw_collect (gdbarch_tdep (gdbarch)->lend_regnum,
+  if (regnum == tdep->lend_regnum || regnum == -1)
+    regcache->raw_collect (tdep->lend_regnum,
 			   &regs->lend);
-  if (regnum == gdbarch_tdep (gdbarch)->lcount_regnum || regnum == -1)
-    regcache->raw_collect (gdbarch_tdep (gdbarch)->lcount_regnum,
+  if (regnum == tdep->lcount_regnum || regnum == -1)
+    regcache->raw_collect (tdep->lcount_regnum,
 			   &regs->lcount);
-  if (regnum == gdbarch_tdep (gdbarch)->sar_regnum || regnum == -1)
-    regcache->raw_collect (gdbarch_tdep (gdbarch)->sar_regnum,
+  if (regnum == tdep->sar_regnum || regnum == -1)
+    regcache->raw_collect (tdep->sar_regnum,
 			   &regs->sar);
-  if (regnum == gdbarch_tdep (gdbarch)->threadptr_regnum || regnum == -1)
-    regcache->raw_collect (gdbarch_tdep (gdbarch)->threadptr_regnum,
+  if (regnum == tdep->threadptr_regnum || regnum == -1)
+    regcache->raw_collect (tdep->threadptr_regnum,
 			   &regs->threadptr);
-  if (regnum >=gdbarch_tdep (gdbarch)->ar_base
-      && regnum < gdbarch_tdep (gdbarch)->ar_base
-		    + gdbarch_tdep (gdbarch)->num_aregs)
+  if (regnum >=tdep->ar_base
+      && regnum < tdep->ar_base
+		    + tdep->num_aregs)
     regcache->raw_collect (regnum,
-			   &regs->ar[regnum - gdbarch_tdep (gdbarch)->ar_base]);
+			   &regs->ar[regnum - tdep->ar_base]);
   else if (regnum == -1)
     {
-      for (i = 0; i < gdbarch_tdep (gdbarch)->num_aregs; ++i)
-	regcache->raw_collect (gdbarch_tdep (gdbarch)->ar_base + i,
+      for (i = 0; i < tdep->num_aregs; ++i)
+	regcache->raw_collect (tdep->ar_base + i,
 			       &regs->ar[i]);
     }
-  if (regnum >= gdbarch_tdep (gdbarch)->a0_base
-      && regnum < gdbarch_tdep (gdbarch)->a0_base + C0_NREGS)
+  if (regnum >= tdep->a0_base
+      && regnum < tdep->a0_base + C0_NREGS)
     regcache->raw_collect (regnum,
 			   &regs->ar[(4 * regs->windowbase + regnum
-				      - gdbarch_tdep (gdbarch)->a0_base)
-			  % gdbarch_tdep (gdbarch)->num_aregs]);
+				      - tdep->a0_base)
+			  % tdep->num_aregs]);
   else if (regnum == -1)
     {
       for (i = 0; i < C0_NREGS; ++i)
-	regcache->raw_collect (gdbarch_tdep (gdbarch)->a0_base + i,
+	regcache->raw_collect (tdep->a0_base + i,
 			       (&regs->ar[(4 * regs->windowbase + i)
-				% gdbarch_tdep (gdbarch)->num_aregs]));
+				% tdep->num_aregs]));
     }
 }
 
@@ -123,56 +124,57 @@ supply_gregset_reg (struct regcache *regcache,
   xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp;
 
   struct gdbarch *gdbarch = regcache->arch ();
+  xtensa_gdbarch_tdep *tdep = (xtensa_gdbarch_tdep *) gdbarch_tdep (gdbarch);
 
   if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == -1)
     regcache->raw_supply (gdbarch_pc_regnum (gdbarch), &regs->pc);
   if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
     regcache->raw_supply (gdbarch_ps_regnum (gdbarch), &regs->ps);
 
-  if (regnum == gdbarch_tdep (gdbarch)->wb_regnum || regnum == -1)
-    regcache->raw_supply (gdbarch_tdep (gdbarch)->wb_regnum,
+  if (regnum == tdep->wb_regnum || regnum == -1)
+    regcache->raw_supply (tdep->wb_regnum,
 			  &regs->windowbase);
-  if (regnum == gdbarch_tdep (gdbarch)->ws_regnum || regnum == -1)
-    regcache->raw_supply (gdbarch_tdep (gdbarch)->ws_regnum,
+  if (regnum == tdep->ws_regnum || regnum == -1)
+    regcache->raw_supply (tdep->ws_regnum,
 			  &regs->windowstart);
-  if (regnum == gdbarch_tdep (gdbarch)->lbeg_regnum || regnum == -1)
-    regcache->raw_supply (gdbarch_tdep (gdbarch)->lbeg_regnum,
+  if (regnum == tdep->lbeg_regnum || regnum == -1)
+    regcache->raw_supply (tdep->lbeg_regnum,
 			  &regs->lbeg);
-  if (regnum == gdbarch_tdep (gdbarch)->lend_regnum || regnum == -1)
-    regcache->raw_supply (gdbarch_tdep (gdbarch)->lend_regnum,
+  if (regnum == tdep->lend_regnum || regnum == -1)
+    regcache->raw_supply (tdep->lend_regnum,
 			  &regs->lend);
-  if (regnum == gdbarch_tdep (gdbarch)->lcount_regnum || regnum == -1)
-    regcache->raw_supply (gdbarch_tdep (gdbarch)->lcount_regnum,
+  if (regnum == tdep->lcount_regnum || regnum == -1)
+    regcache->raw_supply (tdep->lcount_regnum,
 			  &regs->lcount);
-  if (regnum == gdbarch_tdep (gdbarch)->sar_regnum || regnum == -1)
-    regcache->raw_supply (gdbarch_tdep (gdbarch)->sar_regnum,
+  if (regnum == tdep->sar_regnum || regnum == -1)
+    regcache->raw_supply (tdep->sar_regnum,
 			  &regs->sar);
-  if (regnum == gdbarch_tdep (gdbarch)->threadptr_regnum || regnum == -1)
-    regcache->raw_supply (gdbarch_tdep (gdbarch)->threadptr_regnum,
+  if (regnum == tdep->threadptr_regnum || regnum == -1)
+    regcache->raw_supply (tdep->threadptr_regnum,
 			  &regs->threadptr);
-  if (regnum >=gdbarch_tdep (gdbarch)->ar_base
-      && regnum < gdbarch_tdep (gdbarch)->ar_base
-		    + gdbarch_tdep (gdbarch)->num_aregs)
+  if (regnum >=tdep->ar_base
+      && regnum < tdep->ar_base
+		    + tdep->num_aregs)
     regcache->raw_supply (regnum,
-			  &regs->ar[regnum - gdbarch_tdep (gdbarch)->ar_base]);
+			  &regs->ar[regnum - tdep->ar_base]);
   else if (regnum == -1)
     {
-      for (i = 0; i < gdbarch_tdep (gdbarch)->num_aregs; ++i)
-	regcache->raw_supply (gdbarch_tdep (gdbarch)->ar_base + i,
+      for (i = 0; i < tdep->num_aregs; ++i)
+	regcache->raw_supply (tdep->ar_base + i,
 			      &regs->ar[i]);
     }
-  if (regnum >= gdbarch_tdep (gdbarch)->a0_base
-      && regnum < gdbarch_tdep (gdbarch)->a0_base + C0_NREGS)
+  if (regnum >= tdep->a0_base
+      && regnum < tdep->a0_base + C0_NREGS)
     regcache->raw_supply (regnum,
 			  &regs->ar[(4 * regs->windowbase + regnum
-				     - gdbarch_tdep (gdbarch)->a0_base)
-			 % gdbarch_tdep (gdbarch)->num_aregs]);
+				     - tdep->a0_base)
+			 % tdep->num_aregs]);
   else if (regnum == -1)
     {
       for (i = 0; i < C0_NREGS; ++i)
-	regcache->raw_supply (gdbarch_tdep (gdbarch)->a0_base + i,
+	regcache->raw_supply (tdep->a0_base + i,
 			      &regs->ar[(4 * regs->windowbase + i)
-					% gdbarch_tdep (gdbarch)->num_aregs]);
+					% tdep->num_aregs]);
     }
 }
 
-- 
2.33.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes
  2021-11-16  2:40 ` [pushed 3/3] gdb: adjust gdbarch_tdep calls in nat files Simon Marchi
@ 2021-11-17 14:42   ` Andreas Arnez
  2021-11-17 14:47     ` Simon Marchi
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Arnez @ 2021-11-17 14:42 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches

On Mon, Nov 15 2021, Simon Marchi via Gdb-patches wrote:

> Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") forgot to
> update the gdbarch_tdep calls in the native files other than x86-64
> Linux.  This patch updates them all (to the best of my knowledge).
> These are the files I was able to build-test:
>
>   aarch64-linux-nat.c
>   amd64-bsd-nat.c
>   arm-linux-nat.c
>   ppc-linux-nat.c
>   windows-nat.c
>   xtensa-linux-nat.c
>
> And these are the ones I could not build-test:
>
>   aix-thread.c
>   arm-netbsd-nat.c
>   ppc-fbsd-nat.c
>   ppc-netbsd-nat.c
>   ia64-tdep.c (the part that needs libunwind)
>   ppc-obsd-nat.c
>   rs6000-nat.c

Hm, I wonder why s390-linux-nat.c is missing from both lists.  That's
not intentional, right?

> If there are still some build problems related to gdbarch_tdep in them,
> they should be pretty obvious to fix.

Yeah, the s390x native build was broken by the original commit as well.
I pushed the (obvious) patch below to fix this.

---- 8< ----
From 0df670bbe009d3b57f5dbf9599913ad06013ec4e Mon Sep 17 00:00:00 2001
From: Andreas Arnez <arnez@linux.ibm.com>
Date: Wed, 17 Nov 2021 11:46:36 +0100
Subject: [PATCH] [gdb/build, s390x] Fix build after gdbarch_tdep changes

Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") changes a
declaration in s390-tdep.h from

   struct gdbarch_tdep { ... };

to

   struct s390_gdbarch_tdep : gdbarch_tdep { ... };

and now requires that gdbarch_tdep has been declared before.  Which is
usually the case, except when compiling s390-linux-nat.c, where
s390-tdep.h is included before gdbarch.h.  Thus the s390x build errors out
with the compiler complaining about a missing class name after the colon.

Fix this in s390-linux-nat.c, by including gdbarch.h before s390-tdep.h.
---
 gdb/s390-linux-nat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index 8f6eb61505b..4c64a854803 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -29,6 +29,7 @@
 #include "regset.h"
 #include "nat/linux-ptrace.h"
 #include "gdbcmd.h"
+#include "gdbarch.h"
 
 #include "s390-tdep.h"
 #include "s390-linux-tdep.h"
@@ -43,7 +44,6 @@
 #include <algorithm>
 #include "inf-ptrace.h"
 #include "linux-tdep.h"
-#include "gdbarch.h"
 
 /* Per-thread arch-specific data.  */
 
-- 
2.23.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes
  2021-11-17 14:42   ` [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes Andreas Arnez
@ 2021-11-17 14:47     ` Simon Marchi
  2021-11-17 15:06       ` Tom Tromey
  2021-11-17 15:41       ` Andreas Arnez
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Marchi @ 2021-11-17 14:47 UTC (permalink / raw)
  To: Andreas Arnez, Simon Marchi via Gdb-patches

On 2021-11-17 9:42 a.m., Andreas Arnez wrote:
> On Mon, Nov 15 2021, Simon Marchi via Gdb-patches wrote:
>
>> Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") forgot to
>> update the gdbarch_tdep calls in the native files other than x86-64
>> Linux.  This patch updates them all (to the best of my knowledge).
>> These are the files I was able to build-test:
>>
>>   aarch64-linux-nat.c
>>   amd64-bsd-nat.c
>>   arm-linux-nat.c
>>   ppc-linux-nat.c
>>   windows-nat.c
>>   xtensa-linux-nat.c
>>
>> And these are the ones I could not build-test:
>>
>>   aix-thread.c
>>   arm-netbsd-nat.c
>>   ppc-fbsd-nat.c
>>   ppc-netbsd-nat.c
>>   ia64-tdep.c (the part that needs libunwind)
>>   ppc-obsd-nat.c
>>   rs6000-nat.c
>
> Hm, I wonder why s390-linux-nat.c is missing from both lists.  That's
> not intentional, right?

Because I was looking (grepping) for gdbarch_tdep calls to update, and
there are none in s390-linux-nat.c.  It still needed some fixing, as you
found out.

>
>> If there are still some build problems related to gdbarch_tdep in them,
>> they should be pretty obvious to fix.
>
> Yeah, the s390x native build was broken by the original commit as well.
> I pushed the (obvious) patch below to fix this.
>
> ---- 8< ----
> From 0df670bbe009d3b57f5dbf9599913ad06013ec4e Mon Sep 17 00:00:00 2001
> From: Andreas Arnez <arnez@linux.ibm.com>
> Date: Wed, 17 Nov 2021 11:46:36 +0100
> Subject: [PATCH] [gdb/build, s390x] Fix build after gdbarch_tdep changes
>
> Commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation") changes a
> declaration in s390-tdep.h from
>
>    struct gdbarch_tdep { ... };
>
> to
>
>    struct s390_gdbarch_tdep : gdbarch_tdep { ... };
>
> and now requires that gdbarch_tdep has been declared before.  Which is
> usually the case, except when compiling s390-linux-nat.c, where
> s390-tdep.h is included before gdbarch.h.  Thus the s390x build errors out
> with the compiler complaining about a missing class name after the colon.
>
> Fix this in s390-linux-nat.c, by including gdbarch.h before s390-tdep.h.
> ---
>  gdb/s390-linux-nat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
> index 8f6eb61505b..4c64a854803 100644
> --- a/gdb/s390-linux-nat.c
> +++ b/gdb/s390-linux-nat.c
> @@ -29,6 +29,7 @@
>  #include "regset.h"
>  #include "nat/linux-ptrace.h"
>  #include "gdbcmd.h"
> +#include "gdbarch.h"
>
>  #include "s390-tdep.h"
>  #include "s390-linux-tdep.h"
> @@ -43,7 +44,6 @@
>  #include <algorithm>
>  #include "inf-ptrace.h"
>  #include "linux-tdep.h"
> -#include "gdbarch.h"

I would have suggested that s390-tdep.h should include gdbarch.h, since
it now relies on being able to see the struct gdbarch definition.

Simon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes
  2021-11-17 14:47     ` Simon Marchi
@ 2021-11-17 15:06       ` Tom Tromey
  2021-11-17 15:41       ` Andreas Arnez
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2021-11-17 15:06 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Andreas Arnez, Simon Marchi

Simon> I would have suggested that s390-tdep.h should include gdbarch.h, since
Simon> it now relies on being able to see the struct gdbarch definition.

Me too, since normally (aside from defs.h) we try not to have ordering
requirements for headers.

Tom

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes
  2021-11-17 14:47     ` Simon Marchi
  2021-11-17 15:06       ` Tom Tromey
@ 2021-11-17 15:41       ` Andreas Arnez
  2021-11-17 16:45         ` Simon Marchi
  2021-11-18 15:14         ` Tom Tromey
  1 sibling, 2 replies; 10+ messages in thread
From: Andreas Arnez @ 2021-11-17 15:41 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Simon Marchi via Gdb-patches

On Wed, Nov 17 2021, Simon Marchi wrote:

[...]

> I would have suggested that s390-tdep.h should include gdbarch.h, since
> it now relies on being able to see the struct gdbarch definition.

Hm, sorry.  My intention was just to get the build breakage out of the
way as quickly as possible, but I agree that this is a good idea.

Is the patch below OK?

---- 8< ----
From abe1bec38982a20666d832f3eeb528d97a83341d Mon Sep 17 00:00:00 2001
From: Andreas Arnez <arnez@li-32acfd01-53a8-11cb-b225-9c4f961b6dbf.ibm.com>
Date: Wed, 17 Nov 2021 16:32:28 +0100
Subject: [PATCH] [gdb/tdep, s390x] Include gdbarch.h in s390-tdep.h

Since commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation"),
s390-tdep.h requires that gdbarch.h has been included before, specifically
for the declaration of gdbarch_tdep.  Thus expclicitly include gdbarch.h
in s390-tdep.h to fulfill that requirement.
---
 gdb/s390-tdep.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
index 191977ecf50..dec3cebe53b 100644
--- a/gdb/s390-tdep.h
+++ b/gdb/s390-tdep.h
@@ -20,6 +20,7 @@
 #ifndef S390_TDEP_H
 #define S390_TDEP_H
 
+#include "gdbarch.h"
 #include "prologue-value.h"
 
 enum s390_abi_kind
-- 
2.33.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes
  2021-11-17 15:41       ` Andreas Arnez
@ 2021-11-17 16:45         ` Simon Marchi
  2021-11-17 17:39           ` Andreas Arnez
  2021-11-18 15:14         ` Tom Tromey
  1 sibling, 1 reply; 10+ messages in thread
From: Simon Marchi @ 2021-11-17 16:45 UTC (permalink / raw)
  To: Andreas Arnez; +Cc: Simon Marchi via Gdb-patches

On 2021-11-17 10:41 a.m., Andreas Arnez wrote:
> On Wed, Nov 17 2021, Simon Marchi wrote:
>
> [...]
>
>> I would have suggested that s390-tdep.h should include gdbarch.h, since
>> it now relies on being able to see the struct gdbarch definition.
>
> Hm, sorry.  My intention was just to get the build breakage out of the
> way as quickly as possible

Yes, and thanks for doing that.

> Is the patch below OK?
>
> ---- 8< ----
> From abe1bec38982a20666d832f3eeb528d97a83341d Mon Sep 17 00:00:00 2001
> From: Andreas Arnez <arnez@li-32acfd01-53a8-11cb-b225-9c4f961b6dbf.ibm.com>
> Date: Wed, 17 Nov 2021 16:32:28 +0100
> Subject: [PATCH] [gdb/tdep, s390x] Include gdbarch.h in s390-tdep.h
>
> Since commit 345bd07cce33 ("gdb: fix gdbarch_tdep ODR violation"),
> s390-tdep.h requires that gdbarch.h has been included before, specifically
> for the declaration of gdbarch_tdep.  Thus expclicitly include gdbarch.h
> in s390-tdep.h to fulfill that requirement.
> ---
>  gdb/s390-tdep.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
> index 191977ecf50..dec3cebe53b 100644
> --- a/gdb/s390-tdep.h
> +++ b/gdb/s390-tdep.h
> @@ -20,6 +20,7 @@
>  #ifndef S390_TDEP_H
>  #define S390_TDEP_H
>
> +#include "gdbarch.h"
>  #include "prologue-value.h"
>
>  enum s390_abi_kind

LGTM.  I am preparing a patch that updates all header files that I
touched to include gdbarch.h, so that would include s390-tdep.h, but
feel free to push your patch if you want.

Simon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes
  2021-11-17 16:45         ` Simon Marchi
@ 2021-11-17 17:39           ` Andreas Arnez
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Arnez @ 2021-11-17 17:39 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Simon Marchi via Gdb-patches

On Wed, Nov 17 2021, Simon Marchi wrote:

[...]

> LGTM.  I am preparing a patch that updates all header files that I
> touched to include gdbarch.h, so that would include s390-tdep.h, but
> feel free to push your patch if you want.

If you're preparing such a common patch anyway, that'll cover it,
thanks!

--
Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes
  2021-11-17 15:41       ` Andreas Arnez
  2021-11-17 16:45         ` Simon Marchi
@ 2021-11-18 15:14         ` Tom Tromey
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2021-11-18 15:14 UTC (permalink / raw)
  To: Andreas Arnez via Gdb-patches; +Cc: Simon Marchi, Andreas Arnez

Andreas> Hm, sorry.  My intention was just to get the build breakage out of the
Andreas> way as quickly as possible, but I agree that this is a good idea.

FAOD this is always fine, and thank you for doing it.
We can always tweak things to be pedantically correct later.

Tom

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-11-18 15:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16  2:40 [pushed 1/3] gdb: add arc-newlib-tdep.c to ALL_TARGET_OBS Simon Marchi
2021-11-16  2:40 ` [pushed 2/3] gdb: remove unused variables in xtensa-linux-nat.c Simon Marchi
2021-11-16  2:40 ` [pushed 3/3] gdb: adjust gdbarch_tdep calls in nat files Simon Marchi
2021-11-17 14:42   ` [PUSHED] [gdb/build, s390x] Fix build after gdbarch_tdep changes Andreas Arnez
2021-11-17 14:47     ` Simon Marchi
2021-11-17 15:06       ` Tom Tromey
2021-11-17 15:41       ` Andreas Arnez
2021-11-17 16:45         ` Simon Marchi
2021-11-17 17:39           ` Andreas Arnez
2021-11-18 15:14         ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).