GDB (xrefs)
Loading...
Searching...
No Matches
gdb
riscv-fbsd-nat.c
Go to the documentation of this file.
1
/* Native-dependent code for FreeBSD/riscv.
2
3
Copyright (C) 2018-2023 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
#include "
target.h
"
23
24
#include <sys/types.h>
25
#include <sys/ptrace.h>
26
#include <machine/reg.h>
27
28
#include "
fbsd-nat.h
"
29
#include "
riscv-tdep.h
"
30
#include "
riscv-fbsd-tdep.h
"
31
#include "
inf-ptrace.h
"
32
33
struct
riscv_fbsd_nat_target
final
:
public
fbsd_nat_target
34
{
35
void
fetch_registers
(
struct
regcache
*,
int
)
override
;
36
void
store_registers
(
struct
regcache
*,
int
)
override
;
37
};
38
39
static
riscv_fbsd_nat_target
the_riscv_fbsd_nat_target
;
40
41
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
42
for all registers. */
43
44
void
45
riscv_fbsd_nat_target::fetch_registers
(
struct
regcache
*
regcache
,
46
int
regnum
)
47
{
48
if
(
regnum
== -1 ||
regnum
==
RISCV_ZERO_REGNUM
)
49
regcache
->
raw_supply_zeroed
(
RISCV_ZERO_REGNUM
);
50
fetch_register_set<struct reg>
(
regcache
,
regnum
,
PT_GETREGS
,
51
&
riscv_fbsd_gregset
);
52
fetch_register_set<struct fpreg>
(
regcache
,
regnum
,
PT_GETFPREGS
,
53
&
riscv_fbsd_fpregset
);
54
}
55
56
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
57
this for all registers. */
58
59
void
60
riscv_fbsd_nat_target::store_registers
(
struct
regcache
*
regcache
,
61
int
regnum
)
62
{
63
store_register_set<struct reg>
(
regcache
,
regnum
,
PT_GETREGS
,
PT_SETREGS
,
64
&
riscv_fbsd_gregset
);
65
store_register_set<struct fpreg>
(
regcache
,
regnum
,
PT_GETFPREGS
,
66
PT_SETFPREGS
, &
riscv_fbsd_fpregset
);
67
}
68
69
void
_initialize_riscv_fbsd_nat
();
70
void
71
_initialize_riscv_fbsd_nat
()
72
{
73
add_inf_child_target
(&
the_riscv_fbsd_nat_target
);
74
}
regnum
int regnum
Definition
aarch64-tdep.c:76
fbsd_nat_target
Definition
fbsd-nat.h:48
fbsd_nat_target::fetch_register_set
bool fetch_register_set(struct regcache *regcache, int regnum, int fetch_op, const struct regset *regset, int regbase, void *regs, size_t size)
Definition
fbsd-nat.c:2336
reg_buffer::raw_supply_zeroed
void raw_supply_zeroed(int regnum)
Definition
regcache.c:1110
regcache
Definition
regcache.h:338
defs.h
fbsd-nat.h
add_inf_child_target
void add_inf_child_target(inf_child_target *target)
Definition
inf-child.c:418
inf-ptrace.h
regcache.h
_initialize_riscv_fbsd_nat
void _initialize_riscv_fbsd_nat()
Definition
riscv-fbsd-nat.c:71
the_riscv_fbsd_nat_target
static riscv_fbsd_nat_target the_riscv_fbsd_nat_target
Definition
riscv-fbsd-nat.c:39
riscv_fbsd_fpregset
const struct regset riscv_fbsd_fpregset
Definition
riscv-fbsd-tdep.c:63
riscv_fbsd_gregset
const struct regset riscv_fbsd_gregset
Definition
riscv-fbsd-tdep.c:58
riscv-fbsd-tdep.h
riscv-tdep.h
RISCV_ZERO_REGNUM
@ RISCV_ZERO_REGNUM
Definition
riscv-tdep.h:30
riscv_fbsd_nat_target
Definition
riscv-fbsd-nat.c:34
riscv_fbsd_nat_target::store_registers
void store_registers(struct regcache *, int) override
Definition
riscv-fbsd-nat.c:60
riscv_fbsd_nat_target::fetch_registers
void fetch_registers(struct regcache *, int) override
Definition
riscv-fbsd-nat.c:45
target.h
Generated by
1.10.0