6418N/A# Patch required for Solaris.
6418N/A# Will contribute upstream if possible.
6418N/A
6418N/A--- gdb-7.11-orig/gdb/sparc-sol2-nat.c Tue Feb 9 19:19:39 2016
6418N/A+++ gdb-7.11/gdb/sparc-sol2-nat.c Fri Mar 25 14:22:51 2016
6418N/A@@ -24,13 +24,11 @@
2074N/A #include "gregset.h"
2074N/A
2074N/A #include "sparc-tdep.h"
2074N/A+#include "sparc64-tdep.h"
2074N/A #include "target.h"
6418N/A+
6418N/A #include "procfs.h"
2074N/A
2074N/A-/* This file provids the (temporary) glue between the Solaris SPARC
2074N/A- target dependent code and the machine independent SVR4 /proc
2074N/A- support. */
6418N/A-
2074N/A /* Solaris 7 (Solaris 2.7, SunOS 5.7) and up support two process data
2074N/A models, the traditional 32-bit data model (ILP32) and the 64-bit
6418N/A data model (LP64). The format of /proc depends on the data model
6418N/A@@ -48,47 +46,51 @@
2074N/A Note that a 32-bit GDB won't be able to debug a 64-bit target
2074N/A process using /proc on Solaris. */
2074N/A
2074N/A-#if (defined (__arch64__) || \
2074N/A- (defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)))
6418N/A+static int from_corefile = -1;
6418N/A
2074N/A-#include "sparc64-tdep.h"
2074N/A-
2074N/A-#define sparc_supply_gregset sparc64_supply_gregset
2074N/A-#define sparc_supply_fpregset sparc64_supply_fpregset
2074N/A-#define sparc_collect_gregset sparc64_collect_gregset
2074N/A-#define sparc_collect_fpregset sparc64_collect_fpregset
2074N/A-
6418N/A-#define sparc_sol2_gregmap sparc64_sol2_gregmap
6418N/A-#define sparc_sol2_fpregmap sparc64_sol2_fpregmap
2074N/A-
2074N/A-#else
2074N/A-
2074N/A-#define sparc_supply_gregset sparc32_supply_gregset
2074N/A-#define sparc_supply_fpregset sparc32_supply_fpregset
2074N/A-#define sparc_collect_gregset sparc32_collect_gregset
2074N/A-#define sparc_collect_fpregset sparc32_collect_fpregset
2074N/A-
6418N/A-#define sparc_sol2_gregmap sparc32_sol2_gregmap
6418N/A-#define sparc_sol2_fpregmap sparc32_sol2_fpregmap
2074N/A-
2074N/A-#endif
6418N/A-
2074N/A void
2074N/A supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
2074N/A {
6418N/A- sparc_supply_gregset (&sparc_sol2_gregmap, regcache, -1, gregs);
2074N/A+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
2074N/A+ int pointer_size = gdbarch_ptr_bit (gdbarch);
2074N/A+
2074N/A+ if (from_corefile == -1)
2074N/A+ from_corefile = regcache_from_corefile (regcache);
2074N/A+
2074N/A+ if ((pointer_size == 32) && (from_corefile == 1))
6418N/A+ sparc32_supply_gregset (&sparc32_sol2_gregmap, regcache, -1, gregs);
2074N/A+ else
6418N/A+ sparc64_supply_gregset (&sparc64_sol2_gregmap, regcache, -1, gregs);
2074N/A }
2074N/A
2074N/A void
2074N/A supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
2074N/A {
6418N/A- sparc_supply_fpregset (&sparc_sol2_fpregmap, regcache, -1, fpregs);
2074N/A+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
2074N/A+ int pointer_size = gdbarch_ptr_bit (gdbarch);
2074N/A+
2074N/A+ if (from_corefile == -1)
2074N/A+ from_corefile = regcache_from_corefile (regcache);
2074N/A+
2074N/A+ if ((pointer_size == 32) && (from_corefile == 1))
6418N/A+ sparc32_supply_fpregset (&sparc32_sol2_fpregmap, regcache, -1, fpregs);
2074N/A+ else
6418N/A+ sparc64_supply_fpregset (&sparc64_sol2_fpregmap, regcache, -1, fpregs);
2074N/A }
2074N/A
2074N/A void
2074N/A fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
2074N/A {
6418N/A- sparc_collect_gregset (&sparc_sol2_gregmap, regcache, regnum, gregs);
2074N/A+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
2074N/A+ int pointer_size = gdbarch_ptr_bit (gdbarch);
2074N/A+
2074N/A+ if (from_corefile == -1)
2074N/A+ from_corefile = regcache_from_corefile (regcache);
2074N/A+
2074N/A+ if ((pointer_size == 32) && (from_corefile == 1))
6418N/A+ sparc32_collect_gregset (&sparc32_sol2_gregmap, regcache, regnum, gregs);
2074N/A+ else
6418N/A+ sparc64_collect_gregset (&sparc64_sol2_gregmap, regcache, regnum, gregs);
2074N/A }
2074N/A
2074N/A void
6418N/A@@ -95,7 +97,16 @@
2074N/A fill_fpregset (const struct regcache *regcache,
2074N/A prfpregset_t *fpregs, int regnum)
2074N/A {
6418N/A- sparc_collect_fpregset (&sparc_sol2_fpregmap, regcache, regnum, fpregs);
2074N/A+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
2074N/A+ int pointer_size = gdbarch_ptr_bit (gdbarch);
2074N/A+
2074N/A+ if (from_corefile == -1)
2074N/A+ from_corefile = regcache_from_corefile (regcache);
2074N/A+
2074N/A+ if ((pointer_size == 32) && (from_corefile == 1))
6418N/A+ sparc32_collect_fpregset (&sparc32_sol2_fpregmap, regcache, regnum, fpregs);
2074N/A+ else
6418N/A+ sparc64_collect_fpregset (&sparc64_sol2_fpregmap, regcache, regnum, fpregs);
2074N/A }
2074N/A
2074N/A /* Provide a prototype to silence -Wmissing-prototypes. */
2074N/A@@ -112,3 +123,4 @@
2074N/A #endif
2074N/A add_target (t);
2074N/A }
2074N/A+