1 |
330 |
jeremybenn |
/* Native-dependent code for Solaris SPARC.
|
2 |
|
|
|
3 |
|
|
Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010
|
4 |
|
|
Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of GDB.
|
7 |
|
|
|
8 |
|
|
This program is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
This program is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
#include "defs.h"
|
22 |
|
|
#include "regcache.h"
|
23 |
|
|
|
24 |
|
|
#include <sys/procfs.h>
|
25 |
|
|
#include "gregset.h"
|
26 |
|
|
|
27 |
|
|
#include "sparc-tdep.h"
|
28 |
|
|
#include "target.h"
|
29 |
|
|
#include "procfs.h"
|
30 |
|
|
|
31 |
|
|
/* This file provids the (temporary) glue between the Solaris SPARC
|
32 |
|
|
target dependent code and the machine independent SVR4 /proc
|
33 |
|
|
support. */
|
34 |
|
|
|
35 |
|
|
/* Solaris 7 (Solaris 2.7, SunOS 5.7) and up support two process data
|
36 |
|
|
models, the traditional 32-bit data model (ILP32) and the 64-bit
|
37 |
|
|
data model (LP64). The format of /proc depends on the data model
|
38 |
|
|
of the observer (the controlling process, GDB in our case). The
|
39 |
|
|
Solaris header files conveniently define PR_MODEL_NATIVE to the
|
40 |
|
|
data model of the controlling process. If its value is
|
41 |
|
|
PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit
|
42 |
|
|
program.
|
43 |
|
|
|
44 |
|
|
GNU/Linux uses the same formats as Solaris for its core files (but
|
45 |
|
|
not for ptrace(2)). The GNU/Linux headers don't define
|
46 |
|
|
PR_MODEL_NATIVE though. Therefore we rely on the __arch64__ define
|
47 |
|
|
provided by GCC to determine the appropriate data model.
|
48 |
|
|
|
49 |
|
|
Note that a 32-bit GDB won't be able to debug a 64-bit target
|
50 |
|
|
process using /proc on Solaris. */
|
51 |
|
|
|
52 |
|
|
#if (defined (__arch64__) || \
|
53 |
|
|
(defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)))
|
54 |
|
|
|
55 |
|
|
#include "sparc64-tdep.h"
|
56 |
|
|
|
57 |
|
|
#define sparc_supply_gregset sparc64_supply_gregset
|
58 |
|
|
#define sparc_supply_fpregset sparc64_supply_fpregset
|
59 |
|
|
#define sparc_collect_gregset sparc64_collect_gregset
|
60 |
|
|
#define sparc_collect_fpregset sparc64_collect_fpregset
|
61 |
|
|
|
62 |
|
|
#define sparc_sol2_gregset sparc64_sol2_gregset
|
63 |
|
|
#define sparc_sol2_fpregset sparc64_sol2_fpregset
|
64 |
|
|
|
65 |
|
|
#else
|
66 |
|
|
|
67 |
|
|
#define sparc_supply_gregset sparc32_supply_gregset
|
68 |
|
|
#define sparc_supply_fpregset sparc32_supply_fpregset
|
69 |
|
|
#define sparc_collect_gregset sparc32_collect_gregset
|
70 |
|
|
#define sparc_collect_fpregset sparc32_collect_fpregset
|
71 |
|
|
|
72 |
|
|
#define sparc_sol2_gregset sparc32_sol2_gregset
|
73 |
|
|
#define sparc_sol2_fpregset sparc32_sol2_fpregset
|
74 |
|
|
|
75 |
|
|
#endif
|
76 |
|
|
|
77 |
|
|
void
|
78 |
|
|
supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
|
79 |
|
|
{
|
80 |
|
|
sparc_supply_gregset (&sparc_sol2_gregset, regcache, -1, gregs);
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
void
|
84 |
|
|
supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
|
85 |
|
|
{
|
86 |
|
|
sparc_supply_fpregset (regcache, -1, fpregs);
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
void
|
90 |
|
|
fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
|
91 |
|
|
{
|
92 |
|
|
sparc_collect_gregset (&sparc_sol2_gregset, regcache, regnum, gregs);
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
void
|
96 |
|
|
fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs, int regnum)
|
97 |
|
|
{
|
98 |
|
|
sparc_collect_fpregset (regcache, regnum, fpregs);
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
102 |
|
|
extern initialize_file_ftype _initialize_sparc_sol2_nat;
|
103 |
|
|
|
104 |
|
|
void
|
105 |
|
|
_initialize_sparc_sol2_nat (void)
|
106 |
|
|
{
|
107 |
|
|
struct target_ops *t;
|
108 |
|
|
|
109 |
|
|
t = procfs_target ();
|
110 |
|
|
#ifdef NEW_PROC_API /* Solaris 6 and above can do HW watchpoints */
|
111 |
|
|
procfs_use_watchpoints (t);
|
112 |
|
|
#endif
|
113 |
|
|
add_target (t);
|
114 |
|
|
}
|