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 #include "helper/command.h"
15 #include "image.h"
16 
17 struct target;
18 
22 };
23 
26 };
27 
28 struct breakpoint {
30  uint32_t asid;
31  unsigned int length;
32  enum breakpoint_type type;
33  bool is_set;
34  unsigned int number;
35  uint8_t *orig_instr;
36  struct breakpoint *next;
37  uint32_t unique_id;
39 };
40 
41 #define WATCHPOINT_IGNORE_DATA_VALUE_MASK (~(uint64_t)0)
42 
43 struct watchpoint {
45  unsigned int length;
46  uint64_t mask;
47  uint64_t value;
48  enum watchpoint_rw rw;
49  bool is_set;
50  unsigned int number;
51  struct watchpoint *next;
52  int unique_id;
53 };
54 
55 int breakpoint_add(struct target *target,
56  target_addr_t address, unsigned int length, enum breakpoint_type type);
58  uint32_t asid, unsigned int length, enum breakpoint_type type);
60  target_addr_t address, uint32_t asid, unsigned int length,
61  enum breakpoint_type type);
64 
66 
67 static inline void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int hw_number)
68 {
69  breakpoint->is_set = true;
70  breakpoint->number = hw_number;
71 }
72 
73 COMMAND_HELPER(detect_breakpoints_in_section, struct target *target,
74  struct imagesection section);
75 
76 int watchpoint_add(struct target *target,
77  target_addr_t address, unsigned int length,
78  enum watchpoint_rw rw, uint64_t value, uint64_t mask);
81 
82 /* report type and address of just hit watchpoint */
83 int watchpoint_hit(struct target *target, enum watchpoint_rw *rw,
85 
86 static inline void watchpoint_set(struct watchpoint *watchpoint, unsigned int number)
87 {
88  watchpoint->is_set = true;
90 }
91 
92 #define ERROR_BREAKPOINT_NOT_FOUND (-1600)
93 #define ERROR_WATCHPOINT_NOT_FOUND (-1601)
94 #define ERROR_BREAKPOINT_DUPLICATED (-1602)
95 #define ERROR_BREAKPOINT_OVERLAPPED (-1603)
96 
97 #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
COMMAND_HELPER(detect_breakpoints_in_section, struct target *target, struct imagesection section)
Definition: breakpoints.c:40
int breakpoint_remove(struct target *target, target_addr_t address)
Definition: breakpoints.c:363
int watchpoint_hit(struct target *target, enum watchpoint_rw *rw, target_addr_t *address)
Definition: breakpoints.c:644
breakpoint_type
Definition: breakpoints.h:19
@ BKPT_HARD
Definition: breakpoints.h:20
@ BKPT_SOFT
Definition: breakpoints.h:21
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:233
int context_breakpoint_add(struct target *target, uint32_t asid, unsigned int length, enum breakpoint_type type)
Definition: breakpoints.c:253
static void watchpoint_set(struct watchpoint *watchpoint, unsigned int number)
Definition: breakpoints.h:86
static void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int hw_number)
Definition: breakpoints.h:67
int watchpoint_remove_all(struct target *target)
Definition: breakpoints.c:484
int breakpoint_remove_all(struct target *target)
Definition: breakpoints.c:479
int hybrid_breakpoint_add(struct target *target, target_addr_t address, uint32_t asid, unsigned int length, enum breakpoint_type type)
Definition: breakpoints.c:274
struct breakpoint * breakpoint_find(struct target *target, target_addr_t address)
Definition: breakpoints.c:489
watchpoint_rw
Definition: breakpoints.h:24
@ WPT_ACCESS
Definition: breakpoints.h:25
@ WPT_READ
Definition: breakpoints.h:25
@ WPT_WRITE
Definition: breakpoints.h:25
uint32_t address
Starting address. Sector aligned.
Definition: dw-spi-helper.h:0
enum esirisc_reg_num number
Definition: esirisc.c:87
uint8_t type
Definition: esp_usb_jtag.c:0
uint8_t length
Definition: esp_usb_jtag.c:1
uint8_t mask
Definition: parport.c:70
int linked_brp
Definition: breakpoints.h:38
struct breakpoint * next
Definition: breakpoints.h:36
unsigned int length
Definition: breakpoints.h:31
uint8_t * orig_instr
Definition: breakpoints.h:35
enum breakpoint_type type
Definition: breakpoints.h:32
uint32_t unique_id
Definition: breakpoints.h:37
bool is_set
Definition: breakpoints.h:33
unsigned int number
Definition: breakpoints.h:34
uint32_t asid
Definition: breakpoints.h:30
target_addr_t address
Definition: breakpoints.h:29
Definition: target.h:119
uint64_t mask
Definition: breakpoints.h:46
enum watchpoint_rw rw
Definition: breakpoints.h:48
bool is_set
Definition: breakpoints.h:49
struct watchpoint * next
Definition: breakpoints.h:51
unsigned int length
Definition: breakpoints.h:45
uint64_t value
Definition: breakpoints.h:47
int unique_id
Definition: breakpoints.h:52
unsigned int number
Definition: breakpoints.h:50
target_addr_t address
Definition: breakpoints.h:44
uint64_t target_addr_t
Definition: types.h:279