GDB (xrefs)

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