gdb.gdb.sparc-sol2-nat.c.patch revision 2074
2074N/A--- gdb-7.6/gdb/sparc-sol2-nat.c 2012-12-31 22:32:51.000000000 -0800
2074N/A+++ gdb-7.6/gdb/sparc-sol2-nat.c 2013-10-06 14:09:16.962861100 -0700
2074N/A@@ -24,12 +24,10 @@
2074N/A #include "gregset.h"
2074N/A
2074N/A #include "sparc-tdep.h"
2074N/A+#include "sparc64-tdep.h"
2074N/A #include "target.h"
2074N/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. */
2074N/A+#include "procfs.h"
2074N/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
2074N/A@@ -48,54 +46,67 @@
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)))
2074N/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-
2074N/A-#define sparc_sol2_gregset sparc64_sol2_gregset
2074N/A-#define sparc_sol2_fpregset sparc64_sol2_fpregset
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-
2074N/A-#define sparc_sol2_gregset sparc32_sol2_gregset
2074N/A-#define sparc_sol2_fpregset sparc32_sol2_fpregset
2074N/A-
2074N/A-#endif
2074N/A+static int from_corefile = -1;
2074N/A
2074N/A void
2074N/A supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
2074N/A {
2074N/A- sparc_supply_gregset (&sparc_sol2_gregset, 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))
2074N/A+ sparc32_supply_gregset (&sparc32_sol2_gregset, regcache, -1, gregs);
2074N/A+ else
2074N/A+ sparc64_supply_gregset (&sparc64_sol2_gregset, regcache, -1, gregs);
2074N/A }
2074N/A
2074N/A void
2074N/A supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
2074N/A {
2074N/A- sparc_supply_fpregset (&sparc_sol2_fpregset, 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))
2074N/A+ sparc32_supply_fpregset (&sparc32_sol2_fpregset, regcache, -1, fpregs);
2074N/A+ else
2074N/A+ sparc64_supply_fpregset (&sparc64_sol2_fpregset, 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 {
2074N/A- sparc_collect_gregset (&sparc_sol2_gregset, 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))
2074N/A+ sparc32_collect_gregset (&sparc32_sol2_gregset, regcache, regnum, gregs);
2074N/A+ else
2074N/A+ sparc64_collect_gregset (&sparc64_sol2_gregset, regcache, regnum, gregs);
2074N/A }
2074N/A
2074N/A void
2074N/A fill_fpregset (const struct regcache *regcache,
2074N/A prfpregset_t *fpregs, int regnum)
2074N/A {
2074N/A- sparc_collect_fpregset (&sparc_sol2_fpregset, 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))
2074N/A+ sparc32_collect_fpregset (&sparc32_sol2_fpregset, regcache, regnum, fpregs);
2074N/A+ else
2074N/A+ sparc64_collect_fpregset (&sparc64_sol2_fpregset, 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+