PSARC 2012/335 OpenSSH migration
PSARC 2013/115 Shared configuration for SunSSH & OpenSSH
15769261 SUNBT7135649 Deliver OpenSSH 6.0P1 in the userland gate (OpenSSH migration phase 2)
16306216 problem in UTILITY/OPENSSH
--- gdb-7.6/gdb/sparc-sol2-nat.c 2012-12-31 22:32:51.000000000 -0800
+++ gdb-7.6/gdb/sparc-sol2-nat.c 2013-10-06 14:09:16.962861100 -0700
@@ -24,12 +24,10 @@
#include "gregset.h"
#include "sparc-tdep.h"
+#include "sparc64-tdep.h"
#include "target.h"
-#include "procfs.h"
-/* This file provids the (temporary) glue between the Solaris SPARC
- target dependent code and the machine independent SVR4 /proc
- support. */
+#include "procfs.h"
/* Solaris 7 (Solaris 2.7, SunOS 5.7) and up support two process data
models, the traditional 32-bit data model (ILP32) and the 64-bit
@@ -48,54 +46,67 @@
Note that a 32-bit GDB won't be able to debug a 64-bit target
process using /proc on Solaris. */
-#if (defined (__arch64__) || \
- (defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)))
-
-#include "sparc64-tdep.h"
-
-#define sparc_supply_gregset sparc64_supply_gregset
-#define sparc_supply_fpregset sparc64_supply_fpregset
-#define sparc_collect_gregset sparc64_collect_gregset
-#define sparc_collect_fpregset sparc64_collect_fpregset
-
-#define sparc_sol2_gregset sparc64_sol2_gregset
-#define sparc_sol2_fpregset sparc64_sol2_fpregset
-
-#else
-
-#define sparc_supply_gregset sparc32_supply_gregset
-#define sparc_supply_fpregset sparc32_supply_fpregset
-#define sparc_collect_gregset sparc32_collect_gregset
-#define sparc_collect_fpregset sparc32_collect_fpregset
-
-#define sparc_sol2_gregset sparc32_sol2_gregset
-#define sparc_sol2_fpregset sparc32_sol2_fpregset
-
-#endif
+static int from_corefile = -1;
void
supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
{
- sparc_supply_gregset (&sparc_sol2_gregset, regcache, -1, gregs);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int pointer_size = gdbarch_ptr_bit (gdbarch);
+
+ if (from_corefile == -1)
+ from_corefile = regcache_from_corefile (regcache);
+
+ if ((pointer_size == 32) && (from_corefile == 1))
+ sparc32_supply_gregset (&sparc32_sol2_gregset, regcache, -1, gregs);
+ else
+ sparc64_supply_gregset (&sparc64_sol2_gregset, regcache, -1, gregs);
}
void
supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
{
- sparc_supply_fpregset (&sparc_sol2_fpregset, regcache, -1, fpregs);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int pointer_size = gdbarch_ptr_bit (gdbarch);
+
+ if (from_corefile == -1)
+ from_corefile = regcache_from_corefile (regcache);
+
+ if ((pointer_size == 32) && (from_corefile == 1))
+ sparc32_supply_fpregset (&sparc32_sol2_fpregset, regcache, -1, fpregs);
+ else
+ sparc64_supply_fpregset (&sparc64_sol2_fpregset, regcache, -1, fpregs);
}
void
fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
{
- sparc_collect_gregset (&sparc_sol2_gregset, regcache, regnum, gregs);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int pointer_size = gdbarch_ptr_bit (gdbarch);
+
+ if (from_corefile == -1)
+ from_corefile = regcache_from_corefile (regcache);
+
+ if ((pointer_size == 32) && (from_corefile == 1))
+ sparc32_collect_gregset (&sparc32_sol2_gregset, regcache, regnum, gregs);
+ else
+ sparc64_collect_gregset (&sparc64_sol2_gregset, regcache, regnum, gregs);
}
void
fill_fpregset (const struct regcache *regcache,
prfpregset_t *fpregs, int regnum)
{
- sparc_collect_fpregset (&sparc_sol2_fpregset, regcache, regnum, fpregs);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ int pointer_size = gdbarch_ptr_bit (gdbarch);
+
+ if (from_corefile == -1)
+ from_corefile = regcache_from_corefile (regcache);
+
+ if ((pointer_size == 32) && (from_corefile == 1))
+ sparc32_collect_fpregset (&sparc32_sol2_fpregset, regcache, regnum, fpregs);
+ else
+ sparc64_collect_fpregset (&sparc64_sol2_fpregset, regcache, regnum, fpregs);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
@@ -112,3 +123,4 @@
#endif
add_target (t);
}
+