GDB (API)
/home/stan/gdb/src/gdb/sparc-sol2-nat.c
Go to the documentation of this file.
00001 /* Native-dependent code for Solaris SPARC.
00002 
00003    Copyright (C) 2003-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #include "defs.h"
00021 #include "regcache.h"
00022 
00023 #include <sys/procfs.h>
00024 #include "gregset.h"
00025 
00026 #include "sparc-tdep.h"
00027 #include "target.h"
00028 #include "procfs.h"
00029 
00030 /* This file provids the (temporary) glue between the Solaris SPARC
00031    target dependent code and the machine independent SVR4 /proc
00032    support.  */
00033 
00034 /* Solaris 7 (Solaris 2.7, SunOS 5.7) and up support two process data
00035    models, the traditional 32-bit data model (ILP32) and the 64-bit
00036    data model (LP64).  The format of /proc depends on the data model
00037    of the observer (the controlling process, GDB in our case).  The
00038    Solaris header files conveniently define PR_MODEL_NATIVE to the
00039    data model of the controlling process.  If its value is
00040    PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit
00041    program.
00042 
00043    GNU/Linux uses the same formats as Solaris for its core files (but
00044    not for ptrace(2)).  The GNU/Linux headers don't define
00045    PR_MODEL_NATIVE though.  Therefore we rely on the __arch64__ define
00046    provided by GCC to determine the appropriate data model.
00047 
00048    Note that a 32-bit GDB won't be able to debug a 64-bit target
00049    process using /proc on Solaris.  */
00050 
00051 #if (defined (__arch64__) || \
00052      (defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)))
00053 
00054 #include "sparc64-tdep.h"
00055 
00056 #define sparc_supply_gregset sparc64_supply_gregset
00057 #define sparc_supply_fpregset sparc64_supply_fpregset
00058 #define sparc_collect_gregset sparc64_collect_gregset
00059 #define sparc_collect_fpregset sparc64_collect_fpregset
00060 
00061 #define sparc_sol2_gregset sparc64_sol2_gregset
00062 #define sparc_sol2_fpregset sparc64_sol2_fpregset
00063 
00064 #else
00065 
00066 #define sparc_supply_gregset sparc32_supply_gregset
00067 #define sparc_supply_fpregset sparc32_supply_fpregset
00068 #define sparc_collect_gregset sparc32_collect_gregset
00069 #define sparc_collect_fpregset sparc32_collect_fpregset
00070 
00071 #define sparc_sol2_gregset sparc32_sol2_gregset
00072 #define sparc_sol2_fpregset sparc32_sol2_fpregset
00073 
00074 #endif
00075 
00076 void
00077 supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
00078 {
00079   sparc_supply_gregset (&sparc_sol2_gregset, regcache, -1, gregs);
00080 }
00081 
00082 void
00083 supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
00084 {
00085   sparc_supply_fpregset (&sparc_sol2_fpregset, regcache, -1, fpregs);
00086 }
00087 
00088 void
00089 fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
00090 {
00091   sparc_collect_gregset (&sparc_sol2_gregset, regcache, regnum, gregs);
00092 }
00093 
00094 void
00095 fill_fpregset (const struct regcache *regcache,
00096                prfpregset_t *fpregs, int regnum)
00097 {
00098   sparc_collect_fpregset (&sparc_sol2_fpregset, regcache, regnum, fpregs);
00099 }
00100 
00101 /* Provide a prototype to silence -Wmissing-prototypes.  */
00102 extern initialize_file_ftype _initialize_sparc_sol2_nat;
00103 
00104 void
00105 _initialize_sparc_sol2_nat (void)
00106 {
00107   struct target_ops *t;
00108 
00109   t = procfs_target ();
00110 #ifdef NEW_PROC_API     /* Solaris 6 and above can do HW watchpoints.  */
00111   procfs_use_watchpoints (t);
00112 #endif
00113   add_target (t);
00114 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines