OpenOCD
breakpoints.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2005 by Dominic Rath *
5  * Dominic.Rath@gmx.de *
6  ***************************************************************************/
7 
8 #ifndef OPENOCD_TARGET_BREAKPOINTS_H
9 #define OPENOCD_TARGET_BREAKPOINTS_H
10 
11 #include <stdint.h>
12 
13 #include "helper/types.h"
14 
15 struct target;
16 
20 };
21 
24 };
25 
26 struct breakpoint {
28  uint32_t asid;
29  unsigned int length;
30  enum breakpoint_type type;
31  bool is_set;
32  unsigned int number;
33  uint8_t *orig_instr;
34  struct breakpoint *next;
35  uint32_t unique_id;
37 };
38 
39 #define WATCHPOINT_IGNORE_DATA_VALUE_MASK (~(uint64_t)0)
40 
41 struct watchpoint {
43  unsigned int length;
44  uint64_t mask;
45  uint64_t value;
46  enum watchpoint_rw rw;
47  bool is_set;
48  unsigned int number;
49  struct watchpoint *next;
50  int unique_id;
51 };
52 
54 int breakpoint_add(struct target *target,
55  target_addr_t address, unsigned int length, enum breakpoint_type type);
57  uint32_t asid, unsigned int length, enum breakpoint_type type);
59  target_addr_t address, uint32_t asid, unsigned int length,
60  enum breakpoint_type type);
63 
65 
66 static inline void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int hw_number)
67 {
68  breakpoint->is_set = true;
69  breakpoint->number = hw_number;
70 }
71 
73 int watchpoint_add(struct target *target,
74  target_addr_t address, unsigned int length,
75  enum watchpoint_rw rw, uint64_t value, uint64_t mask);
78 
79 /* report type and address of just hit watchpoint */
80 int watchpoint_hit(struct target *target, enum watchpoint_rw *rw,
82 
83 static inline void watchpoint_set(struct watchpoint *watchpoint, unsigned int number)
84 {
85  watchpoint->is_set = true;
87 }
88 
89 #define ERROR_BREAKPOINT_NOT_FOUND (-1600)
90 #define ERROR_WATCHPOINT_NOT_FOUND (-1601)
91 
92 #endif /* OPENOCD_TARGET_BREAKPOINTS_H */
int watchpoint_add(struct target *target, target_addr_t address, unsigned int length, enum watchpoint_rw rw, uint64_t value, uint64_t mask)
Definition: breakpoints.c:568
int breakpoint_remove(struct target *target, target_addr_t address)
Definition: breakpoints.c:344
int watchpoint_hit(struct target *target, enum watchpoint_rw *rw, target_addr_t *address)
Definition: breakpoints.c:661
breakpoint_type
Definition: breakpoints.h:17
@ BKPT_HARD
Definition: breakpoints.h:18
@ BKPT_SOFT
Definition: breakpoints.h:19
int watchpoint_remove(struct target *target, target_addr_t address)
Definition: breakpoints.c:605
int breakpoint_add(struct target *target, target_addr_t address, unsigned int length, enum breakpoint_type type)
Definition: breakpoints.c:208
int watchpoint_clear_target(struct target *target)
Definition: breakpoints.c:644
int context_breakpoint_add(struct target *target, uint32_t asid, unsigned int length, enum breakpoint_type type)
Definition: breakpoints.c:234
static void watchpoint_set(struct watchpoint *watchpoint, unsigned int number)
Definition: breakpoints.h:83
int breakpoint_clear_target(struct target *target)
Definition: breakpoints.c:468
static void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int hw_number)
Definition: breakpoints.h:66
int watchpoint_remove_all(struct target *target)
Definition: breakpoints.c:463
int breakpoint_remove_all(struct target *target)
Definition: breakpoints.c:458
int hybrid_breakpoint_add(struct target *target, target_addr_t address, uint32_t asid, unsigned int length, enum breakpoint_type type)
Definition: breakpoints.c:255
struct breakpoint * breakpoint_find(struct target *target, target_addr_t address)
Definition: breakpoints.c:489
watchpoint_rw
Definition: breakpoints.h:22
@ WPT_ACCESS
Definition: breakpoints.h:23
@ WPT_READ
Definition: breakpoints.h:23
@ WPT_WRITE
Definition: breakpoints.h:23
enum esirisc_reg_num number
Definition: esirisc.c:87
int mask
Definition: esirisc.c:1741
uint8_t type
Definition: esp_usb_jtag.c:0
uint8_t length
Definition: esp_usb_jtag.c:1
int linked_brp
Definition: breakpoints.h:36
struct breakpoint * next
Definition: breakpoints.h:34
unsigned int length
Definition: breakpoints.h:29
uint8_t * orig_instr
Definition: breakpoints.h:33
enum breakpoint_type type
Definition: breakpoints.h:30
uint32_t unique_id
Definition: breakpoints.h:35
bool is_set
Definition: breakpoints.h:31
unsigned int number
Definition: breakpoints.h:32
uint32_t asid
Definition: breakpoints.h:28
target_addr_t address
Definition: breakpoints.h:27
Definition: target.h:116
uint64_t mask
Definition: breakpoints.h:44
enum watchpoint_rw rw
Definition: breakpoints.h:46
bool is_set
Definition: breakpoints.h:47
struct watchpoint * next
Definition: breakpoints.h:49
unsigned int length
Definition: breakpoints.h:43
uint64_t value
Definition: breakpoints.h:45
int unique_id
Definition: breakpoints.h:50
unsigned int number
Definition: breakpoints.h:48
target_addr_t address
Definition: breakpoints.h:42
uint64_t target_addr_t
Definition: types.h:335