GDB (xrefs)

/tmp/gdb-8.1/gdb/alpha-linux-nat.c
Go to the documentation of this file.
1 /* Low level Alpha GNU/Linux interface, for GDB when running native.
2 Copyright (C) 2005-2018 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19 #include "defs.h"
20 #include "target.h"
21 #include "regcache.h"
22 #include "linux-nat.h"
23
24 #include "alpha-tdep.h"
25
26 #include "nat/gdb_ptrace.h"
27 #include <alpha/ptrace.h>
28
29 #include <sys/procfs.h>
30 #include "gregset.h"
31
32 /* The address of UNIQUE for ptrace. */
33 #define ALPHA_UNIQUE_PTRACE_ADDR 65
34
35
36 /* See the comment in m68k-tdep.c regarding the utility of these
37 functions. */
38
39 void
40 supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
41 {
42 const long *regp = (const long *)gregsetp;
43
44 /* PC is in slot 32, UNIQUE is in slot 33. */
45 alpha_supply_int_regs (regcache, -1, regp, regp + 31, regp + 32);
46 }
47
48 void
49 fill_gregset (const struct regcache *regcache,
50 gdb_gregset_t *gregsetp, int regno)
51 {
52 long *regp = (long *)gregsetp;
53
54 /* PC is in slot 32, UNIQUE is in slot 33. */
55 alpha_fill_int_regs (regcache, regno, regp, regp + 31, regp + 32);
56 }
57
58 /* Now we do the same thing for floating-point registers.
59 Again, see the comments in m68k-tdep.c. */
60
61 void
62 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
63 {
64 const long *regp = (const long *)fpregsetp;
65
66 /* FPCR is in slot 32. */
67 alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
68 }
69
70 void
71 fill_fpregset (const struct regcache *regcache,
72 gdb_fpregset_t *fpregsetp, int regno)
73 {
74 long *regp = (long *)fpregsetp;
75
76 /* FPCR is in slot 32. */
77 alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
78 }
79
80
81 static CORE_ADDR
82 alpha_linux_register_u_offset (struct gdbarch *gdbarch, int regno, int store_p)
83 {
84 if (regno == gdbarch_pc_regnum (gdbarch))
85 return PC;
86 if (regno == ALPHA_UNIQUE_REGNUM)
87 return ALPHA_UNIQUE_PTRACE_ADDR;
88 if (regno < gdbarch_fp0_regnum (gdbarch))
89 return GPR_BASE + regno;
90 else
91 return FPR_BASE + regno - gdbarch_fp0_regnum (gdbarch);
92 }
93
94 void
95 _initialize_alpha_linux_nat (void)
96 {
97 linux_nat_add_target (linux_trad_target (alpha_linux_register_u_offset));
98 }
gdbarch
Definition: gdbarch.c:127
PC
#define PC
Definition: mips-linux-tdep.h:32
alpha_supply_int_regs
void alpha_supply_int_regs(struct regcache *regcache, int regno, const void *r0_r30, const void *pc, const void *unique)
Definition: alpha-tdep.c:1496
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
alpha_fill_int_regs
void alpha_fill_int_regs(const struct regcache *regcache, int regno, void *r0_r30, void *pc, void *unique)
Definition: alpha-tdep.c:1521
defs.h
ALPHA_UNIQUE_REGNUM
#define ALPHA_UNIQUE_REGNUM
Definition: alpha-tdep.h:51
alpha_fill_fp_regs
void alpha_fill_fp_regs(const struct regcache *regcache, int regno, void *f0_f30, void *fpcr)
Definition: alpha-tdep.c:1555
supply_gregset
void supply_gregset(struct regcache *regcache, const gdb_gregset_t *gregsetp)
Definition: alpha-linux-nat.c:40
gdb_gregset_t
GDB_GREGSET_T gdb_gregset_t
Definition: gregset.h:34
regcache.h
fill_gregset
void fill_gregset(const struct regcache *regcache, gdb_gregset_t *gregsetp, int regno)
Definition: alpha-linux-nat.c:49
ALPHA_UNIQUE_PTRACE_ADDR
#define ALPHA_UNIQUE_PTRACE_ADDR
Definition: alpha-linux-nat.c:33
gdb_fpregset_t
GDB_FPREGSET_T gdb_fpregset_t
Definition: gregset.h:35
alpha_linux_register_u_offset
static CORE_ADDR alpha_linux_register_u_offset(struct gdbarch *gdbarch, int regno, int store_p)
Definition: alpha-linux-nat.c:82
supply_fpregset
void supply_fpregset(struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
Definition: alpha-linux-nat.c:62
linux_nat_add_target
void linux_nat_add_target(struct target_ops *t)
Definition: linux-nat.c:4804
fill_fpregset
void fill_fpregset(const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regno)
Definition: alpha-linux-nat.c:71
gregset.h
FPR_BASE
#define FPR_BASE
Definition: mips-linux-tdep.h:31
gdbarch_fp0_regnum
int gdbarch_fp0_regnum(struct gdbarch *gdbarch)
Definition: gdbarch.c:2197
target.h
regcache
Definition: regcache.h:232
gdb_ptrace.h
gdbarch_pc_regnum
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
Definition: gdbarch.c:2163
alpha_supply_fp_regs
void alpha_supply_fp_regs(struct regcache *regcache, int regno, const void *f0_f30, const void *fpcr)
Definition: alpha-tdep.c:1539
alpha-tdep.h
_initialize_alpha_linux_nat
void _initialize_alpha_linux_nat(void)
Definition: alpha-linux-nat.c:95
linux_trad_target
struct target_ops * linux_trad_target(CORE_ADDR(*register_u_offset)(struct gdbarch *, int, int))
Definition: linux-nat.c:4388
linux-nat.h