components/gdb/patches/gdb.gdb.sparc-sol2-nat.c.patch
branchs11-update
changeset 2814 dff3ca0071d6
child 6420 65948e9e205b
equal deleted inserted replaced
2813:db0bfa0fa498 2814:dff3ca0071d6
       
     1 --- gdb-7.6/gdb/sparc-sol2-nat.c	2012-12-31 22:32:51.000000000 -0800
       
     2 +++ gdb-7.6/gdb/sparc-sol2-nat.c	2013-10-06 14:09:16.962861100 -0700
       
     3 @@ -24,12 +24,10 @@
       
     4  #include "gregset.h"
       
     5  
       
     6  #include "sparc-tdep.h"
       
     7 +#include "sparc64-tdep.h"
       
     8  #include "target.h"
       
     9 -#include "procfs.h"
       
    10  
       
    11 -/* This file provids the (temporary) glue between the Solaris SPARC
       
    12 -   target dependent code and the machine independent SVR4 /proc
       
    13 -   support.  */
       
    14 +#include "procfs.h"
       
    15  
       
    16  /* Solaris 7 (Solaris 2.7, SunOS 5.7) and up support two process data
       
    17     models, the traditional 32-bit data model (ILP32) and the 64-bit
       
    18 @@ -48,54 +46,67 @@
       
    19     Note that a 32-bit GDB won't be able to debug a 64-bit target
       
    20     process using /proc on Solaris.  */
       
    21  
       
    22 -#if (defined (__arch64__) || \
       
    23 -     (defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)))
       
    24 -
       
    25 -#include "sparc64-tdep.h"
       
    26 -
       
    27 -#define sparc_supply_gregset sparc64_supply_gregset
       
    28 -#define sparc_supply_fpregset sparc64_supply_fpregset
       
    29 -#define sparc_collect_gregset sparc64_collect_gregset
       
    30 -#define sparc_collect_fpregset sparc64_collect_fpregset
       
    31 -
       
    32 -#define sparc_sol2_gregset sparc64_sol2_gregset
       
    33 -#define sparc_sol2_fpregset sparc64_sol2_fpregset
       
    34 -
       
    35 -#else
       
    36 -
       
    37 -#define sparc_supply_gregset sparc32_supply_gregset
       
    38 -#define sparc_supply_fpregset sparc32_supply_fpregset
       
    39 -#define sparc_collect_gregset sparc32_collect_gregset
       
    40 -#define sparc_collect_fpregset sparc32_collect_fpregset
       
    41 -
       
    42 -#define sparc_sol2_gregset sparc32_sol2_gregset
       
    43 -#define sparc_sol2_fpregset sparc32_sol2_fpregset
       
    44 -
       
    45 -#endif
       
    46 +static int from_corefile = -1;
       
    47  
       
    48  void
       
    49  supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
       
    50  {
       
    51 -  sparc_supply_gregset (&sparc_sol2_gregset, regcache, -1, gregs);
       
    52 +  struct gdbarch *gdbarch = get_regcache_arch (regcache);
       
    53 +  int pointer_size = gdbarch_ptr_bit (gdbarch);
       
    54 +
       
    55 +  if (from_corefile == -1)
       
    56 +    from_corefile = regcache_from_corefile (regcache);
       
    57 +
       
    58 +  if ((pointer_size == 32) && (from_corefile == 1))
       
    59 +    sparc32_supply_gregset (&sparc32_sol2_gregset, regcache, -1, gregs);
       
    60 +  else
       
    61 +    sparc64_supply_gregset (&sparc64_sol2_gregset, regcache, -1, gregs);
       
    62  }
       
    63  
       
    64  void
       
    65  supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
       
    66  {
       
    67 -  sparc_supply_fpregset (&sparc_sol2_fpregset, regcache, -1, fpregs);
       
    68 +  struct gdbarch *gdbarch = get_regcache_arch (regcache);
       
    69 +  int pointer_size = gdbarch_ptr_bit (gdbarch);
       
    70 +
       
    71 +  if (from_corefile == -1)
       
    72 +    from_corefile = regcache_from_corefile (regcache);
       
    73 +
       
    74 +  if ((pointer_size == 32) && (from_corefile == 1))
       
    75 +    sparc32_supply_fpregset (&sparc32_sol2_fpregset, regcache, -1, fpregs);
       
    76 +  else
       
    77 +    sparc64_supply_fpregset (&sparc64_sol2_fpregset, regcache, -1, fpregs);
       
    78  }
       
    79  
       
    80  void
       
    81  fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
       
    82  {
       
    83 -  sparc_collect_gregset (&sparc_sol2_gregset, regcache, regnum, gregs);
       
    84 +  struct gdbarch *gdbarch = get_regcache_arch (regcache);
       
    85 +  int pointer_size = gdbarch_ptr_bit (gdbarch);
       
    86 +
       
    87 +  if (from_corefile == -1)
       
    88 +    from_corefile = regcache_from_corefile (regcache);
       
    89 +
       
    90 +  if ((pointer_size == 32) && (from_corefile == 1))
       
    91 +    sparc32_collect_gregset (&sparc32_sol2_gregset, regcache, regnum, gregs);
       
    92 +  else
       
    93 +    sparc64_collect_gregset (&sparc64_sol2_gregset, regcache, regnum, gregs);
       
    94  }
       
    95  
       
    96  void
       
    97  fill_fpregset (const struct regcache *regcache,
       
    98  	       prfpregset_t *fpregs, int regnum)
       
    99  {
       
   100 -  sparc_collect_fpregset (&sparc_sol2_fpregset, regcache, regnum, fpregs);
       
   101 +  struct gdbarch *gdbarch = get_regcache_arch (regcache);
       
   102 +  int pointer_size = gdbarch_ptr_bit (gdbarch);
       
   103 +
       
   104 +  if (from_corefile == -1)
       
   105 +    from_corefile = regcache_from_corefile (regcache);
       
   106 +
       
   107 +  if ((pointer_size == 32) && (from_corefile == 1))
       
   108 +    sparc32_collect_fpregset (&sparc32_sol2_fpregset, regcache, regnum, fpregs);
       
   109 +  else
       
   110 +    sparc64_collect_fpregset (&sparc64_sol2_fpregset, regcache, regnum, fpregs);
       
   111  }
       
   112  
       
   113  /* Provide a prototype to silence -Wmissing-prototypes.  */
       
   114 @@ -112,3 +123,4 @@
       
   115  #endif
       
   116    add_target (t);
       
   117  }
       
   118 +