Fix RELOC_FOR_GLOBAL_SYMBOLS macro so that it can cope with user defined symbols...
[binutils-gdb.git] / gdb / riscv-fbsd-nat.c
blobbc9d613d207f51c4d25673f324343861419339c9
1 /* Native-dependent code for FreeBSD/riscv.
3 Copyright (C) 2018-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #include "regcache.h"
21 #include "target.h"
23 #include <sys/types.h>
24 #include <sys/ptrace.h>
25 #include <machine/reg.h>
27 #include "fbsd-nat.h"
28 #include "riscv-tdep.h"
29 #include "riscv-fbsd-tdep.h"
30 #include "inf-ptrace.h"
32 struct riscv_fbsd_nat_target final : public fbsd_nat_target
34 void fetch_registers (struct regcache *, int) override;
35 void store_registers (struct regcache *, int) override;
38 static riscv_fbsd_nat_target the_riscv_fbsd_nat_target;
40 /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
41 for all registers. */
43 void
44 riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache,
45 int regnum)
47 if (regnum == -1 || regnum == RISCV_ZERO_REGNUM)
48 regcache->raw_supply_zeroed (RISCV_ZERO_REGNUM);
49 fetch_register_set<struct reg> (regcache, regnum, PT_GETREGS,
50 &riscv_fbsd_gregset);
51 fetch_register_set<struct fpreg> (regcache, regnum, PT_GETFPREGS,
52 &riscv_fbsd_fpregset);
55 /* Store register REGNUM back into the inferior. If REGNUM is -1, do
56 this for all registers. */
58 void
59 riscv_fbsd_nat_target::store_registers (struct regcache *regcache,
60 int regnum)
62 store_register_set<struct reg> (regcache, regnum, PT_GETREGS, PT_SETREGS,
63 &riscv_fbsd_gregset);
64 store_register_set<struct fpreg> (regcache, regnum, PT_GETFPREGS,
65 PT_SETFPREGS, &riscv_fbsd_fpregset);
68 void _initialize_riscv_fbsd_nat ();
69 void
70 _initialize_riscv_fbsd_nat ()
72 add_inf_child_target (&the_riscv_fbsd_nat_target);