Use symbol_set_language to set a symbol's language
[deliverable/binutils-gdb.git] / gdb / alpha-linux-nat.c
CommitLineData
10d6c8cd 1/* Low level Alpha GNU/Linux interface, for GDB when running native.
42a4f53d 2 Copyright (C) 2005-2019 Free Software Foundation, Inc.
10d6c8cd
DJ
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
a9762ec7 8 the Free Software Foundation; either version 3 of the License, or
10d6c8cd
DJ
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
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
10d6c8cd
DJ
18
19#include "defs.h"
4de283e4
TT
20#include "target.h"
21#include "regcache.h"
22#include "linux-nat-trad.h"
b02f9d57 23
4de283e4 24#include "alpha-tdep.h"
7a27b85f 25#include "gdbarch.h"
4de283e4
TT
26
27#include "nat/gdb_ptrace.h"
b02f9d57 28#include <alpha/ptrace.h>
d55e5aa6 29
4de283e4 30#include <sys/procfs.h>
b02f9d57
UW
31#include "gregset.h"
32
b02f9d57
UW
33/* The address of UNIQUE for ptrace. */
34#define ALPHA_UNIQUE_PTRACE_ADDR 65
35
f6ac5f3d
PA
36class alpha_linux_nat_target final : public linux_nat_trad_target
37{
38protected:
39 /* Override linux_nat_trad_target methods. */
40 CORE_ADDR register_u_offset (struct gdbarch *gdbarch,
41 int regno, int store_p) override;
42};
43
44static alpha_linux_nat_target the_alpha_linux_nat_target;
b02f9d57 45
0963b4bd
MS
46/* See the comment in m68k-tdep.c regarding the utility of these
47 functions. */
b02f9d57
UW
48
49void
7f7fe91e 50supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
b02f9d57 51{
7f7fe91e 52 const long *regp = (const long *)gregsetp;
b02f9d57 53
efc72ef5 54 /* PC is in slot 32, UNIQUE is in slot 33. */
7f7fe91e 55 alpha_supply_int_regs (regcache, -1, regp, regp + 31, regp + 32);
b02f9d57
UW
56}
57
58void
7f7fe91e
UW
59fill_gregset (const struct regcache *regcache,
60 gdb_gregset_t *gregsetp, int regno)
b02f9d57 61{
efc72ef5 62 long *regp = (long *)gregsetp;
b02f9d57 63
efc72ef5 64 /* PC is in slot 32, UNIQUE is in slot 33. */
7f7fe91e 65 alpha_fill_int_regs (regcache, regno, regp, regp + 31, regp + 32);
b02f9d57
UW
66}
67
0963b4bd
MS
68/* Now we do the same thing for floating-point registers.
69 Again, see the comments in m68k-tdep.c. */
b02f9d57
UW
70
71void
7f7fe91e 72supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
b02f9d57 73{
7f7fe91e 74 const long *regp = (const long *)fpregsetp;
b02f9d57
UW
75
76 /* FPCR is in slot 32. */
7f7fe91e 77 alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
b02f9d57
UW
78}
79
80void
7f7fe91e
UW
81fill_fpregset (const struct regcache *regcache,
82 gdb_fpregset_t *fpregsetp, int regno)
b02f9d57 83{
efc72ef5 84 long *regp = (long *)fpregsetp;
b02f9d57
UW
85
86 /* FPCR is in slot 32. */
7f7fe91e 87 alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
b02f9d57
UW
88}
89
f6ac5f3d
PA
90CORE_ADDR
91alpha_linux_nat_target::register_u_offset (struct gdbarch *gdbarch,
92 int regno, int store_p)
910122bf 93{
ec7cc0e8 94 if (regno == gdbarch_pc_regnum (gdbarch))
b02f9d57
UW
95 return PC;
96 if (regno == ALPHA_UNIQUE_REGNUM)
97 return ALPHA_UNIQUE_PTRACE_ADDR;
ec7cc0e8 98 if (regno < gdbarch_fp0_regnum (gdbarch))
b02f9d57
UW
99 return GPR_BASE + regno;
100 else
ec7cc0e8 101 return FPR_BASE + regno - gdbarch_fp0_regnum (gdbarch);
910122bf 102}
10d6c8cd 103
10d6c8cd
DJ
104void
105_initialize_alpha_linux_nat (void)
106{
f6ac5f3d 107 linux_target = &the_alpha_linux_nat_target;
d9f719f1 108 add_inf_child_target (&the_alpha_linux_nat_target);
10d6c8cd 109}
This page took 0.811337 seconds and 4 git commands to generate.