Skip to content

Commit 956a3a8

Browse files
committed
cortexar: force hard breakpoints
* As software breakpoints are not yet implemented, force hard breakpoints on cortexar targets
1 parent 3ed5c26 commit 956a3a8

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/target/cortexar.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ static const uint16_t cortexar_spsr_encodings[5] = {
312312
/* Instruction Cache Invalidate ALL to Unification */
313313
#define CORTEXAR_ICIALLU 15U, ENCODE_CP_REG(7U, 5U, 0U, 0U)
314314
/* Data Cache Clean + Invalidate by Set/Way to Unification */
315+
#define CORTEXAR_DCCSW 15U, ENCODE_CP_REG(7U, 10U, 0U, 2U)
316+
/* Data Cache Clean + Invalidate by Set/Way to Unification */
315317
#define CORTEXAR_DCCISW 15U, ENCODE_CP_REG(7U, 14U, 0U, 2U)
316318
/* Address Translate Stage 1 Current state PL1 Read */
317319
#define CORTEXAR_ATS1CPR 15U, ENCODE_CP_REG(7U, 8U, 0U, 0U)
@@ -1642,7 +1644,15 @@ static int cortexar_breakwatch_set(target_s *const target, breakwatch_s *const b
16421644
{
16431645
cortexar_priv_s *const priv = (cortexar_priv_s *)target->priv;
16441646

1645-
switch (breakwatch->type) {
1647+
/*
1648+
* Redirect soft to hard breakpoints (until soft breakpoints are working?)
1649+
* GDB automatically selects soft breakpoints when an address is in RAM. This
1650+
* code is needed to allow breakpoints to work when the break type can't be
1651+
* configured in a GDB frontend (eg: in cortex-debug for VSCode).
1652+
*/
1653+
target_breakwatch_e bw_type = breakwatch->type == TARGET_BREAK_SOFT ? TARGET_BREAK_HARD : breakwatch->type;
1654+
1655+
switch (bw_type) {
16461656
case TARGET_BREAK_HARD: {
16471657
/* First try and find a unused breakpoint slot */
16481658
size_t breakpoint = 0;
@@ -1694,7 +1704,15 @@ static int cortexar_breakwatch_clear(target_s *const target, breakwatch_s *const
16941704
{
16951705
cortexar_priv_s *const priv = (cortexar_priv_s *)target->priv;
16961706

1697-
switch (breakwatch->type) {
1707+
/*
1708+
* Redirect soft to hard breakpoints (until soft breakpoints are working?)
1709+
* GDB automatically selects soft breakpoints when an address is in RAM. This
1710+
* code is needed to allow breakpoints to work when the break type can't be
1711+
* configured in a GDB frontend (eg: in cortex-debug for VSCode).
1712+
*/
1713+
target_breakwatch_e bw_type = breakwatch->type == TARGET_BREAK_SOFT ? TARGET_BREAK_HARD : breakwatch->type;
1714+
1715+
switch (bw_type) {
16981716
case TARGET_BREAK_HARD: {
16991717
/* Clear the breakpoint slot this used */
17001718
const size_t breakpoint = breakwatch->reserved[0];

0 commit comments

Comments
 (0)