GDB (xrefs)
Loading...
Searching...
No Matches
aarch64-nat.h
Go to the documentation of this file.
1/* Native-dependent code for AArch64.
2
3 Copyright (C) 2011-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#ifndef AARCH64_NAT_H
21#define AARCH64_NAT_H
22
23#include "breakpoint.h"
25#include "target.h"
26
27/* Hardware-assisted breakpoints and watchpoints. */
28
29/* Initialize platform-independent state for hardware-assisted
30 breakpoints and watchpoints. */
31
33
34/* Return the debug register state for process PID. If no existing
35 state is found for this process, return nullptr. */
36
38
39/* Return the debug register state for process PID. If no existing
40 state is found for this process, create new state. */
41
43
44/* Remove any existing per-process debug state for process PID. */
45
47
48/* Helper for the "stopped_data_address" target method. Returns TRUE
49 if a hardware watchpoint trap at ADDR_TRAP matches a set
50 watchpoint. The address of the matched watchpoint is returned in
51 *ADDR_P. */
52
54 CORE_ADDR addr_trap, CORE_ADDR *addr_p);
55
56/* Helper functions used by aarch64_nat_target below. See their
57 definitions. */
58
59int aarch64_can_use_hw_breakpoint (enum bptype type, int cnt, int othertype);
60int aarch64_insert_watchpoint (CORE_ADDR addr, int len,
61 enum target_hw_bp_type type,
62 struct expression *cond);
63int aarch64_remove_watchpoint (CORE_ADDR addr, int len,
64 enum target_hw_bp_type type,
65 struct expression *cond);
67 struct bp_target_info *bp_tgt);
69 struct bp_target_info *bp_tgt);
71
72/* Convenience template mixin used to add aarch64 watchpoints support to a
73 target. */
74
75template <typename BaseTarget>
76struct aarch64_nat_target : public BaseTarget
77{
78 /* Hook in common aarch64 hardware watchpoints/breakpoints support. */
79
80 int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override
81 { return aarch64_can_use_hw_breakpoint (type, cnt, othertype); }
82
83 int region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) override
84 { return aarch64_region_ok_for_watchpoint (addr, len); }
85
86 int insert_watchpoint (CORE_ADDR addr, int len,
87 enum target_hw_bp_type type,
88 struct expression *cond) override
89 { return aarch64_insert_watchpoint (addr, len, type, cond); }
90
91 int remove_watchpoint (CORE_ADDR addr, int len,
92 enum target_hw_bp_type type,
93 struct expression *cond) override
94 { return aarch64_remove_watchpoint (addr, len, type, cond); }
95
97 struct bp_target_info *bp_tgt) override
98 { return aarch64_insert_hw_breakpoint (gdbarch, bp_tgt); }
99
101 struct bp_target_info *bp_tgt) override
102 { return aarch64_remove_hw_breakpoint (gdbarch, bp_tgt); }
103
104 bool watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
105 int length) override
106 { return start <= addr && start + length - 1 >= addr; }
107};
108
109#endif /* AARCH64_NAT_H */
int aarch64_region_ok_for_watchpoint(CORE_ADDR addr, int len)
int aarch64_stopped_by_hw_breakpoint()
void aarch64_initialize_hw_point()
struct aarch64_debug_reg_state * aarch64_lookup_debug_reg_state(pid_t pid)
Definition aarch64-nat.c:39
struct aarch64_debug_reg_state * aarch64_get_debug_reg_state(pid_t pid)
Definition aarch64-nat.c:51
bool aarch64_stopped_data_address(const struct aarch64_debug_reg_state *state, CORE_ADDR addr_trap, CORE_ADDR *addr_p)
int aarch64_can_use_hw_breakpoint(enum bptype type, int cnt, int othertype)
Definition aarch64-nat.c:75
void aarch64_remove_debug_reg_state(pid_t pid)
Definition aarch64-nat.c:59
int aarch64_insert_watchpoint(CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond)
int aarch64_insert_hw_breakpoint(struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
int aarch64_remove_watchpoint(CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond)
int aarch64_remove_hw_breakpoint(struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
bptype
Definition breakpoint.h:84
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
Definition gnu-nat.c:1791
int remove_hw_breakpoint(struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) override
int insert_hw_breakpoint(struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) override
Definition aarch64-nat.h:96
int remove_watchpoint(CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) override
Definition aarch64-nat.h:91
bool watchpoint_addr_within_range(CORE_ADDR addr, CORE_ADDR start, int length) override
int insert_watchpoint(CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) override
Definition aarch64-nat.h:86
int can_use_hw_breakpoint(enum bptype type, int cnt, int othertype) override
Definition aarch64-nat.h:80
int region_ok_for_hw_watchpoint(CORE_ADDR addr, int len) override
Definition aarch64-nat.h:83