Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: cortexar hardware breakpoints #1894

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/target/cortexar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,15 @@ static int cortexar_breakwatch_set(target_s *const target, breakwatch_s *const b
{
cortexar_priv_s *const priv = (cortexar_priv_s *)target->priv;

switch (breakwatch->type) {
/*
* Redirect soft to hard breakpoints (until soft breakpoints are working?)
* GDB automatically selects soft breakpoints when an address is in RAM. This
* code is needed to allow breakpoints to work when the break type can't be
* configured in a GDB frontend (eg: in cortex-debug for VSCode).
*/
target_breakwatch_e bw_type = breakwatch->type == TARGET_BREAK_SOFT ? TARGET_BREAK_HARD : breakwatch->type;

switch (bw_type) {
case TARGET_BREAK_HARD: {
/* First try and find a unused breakpoint slot */
size_t breakpoint = 0;
Expand Down Expand Up @@ -1694,7 +1702,15 @@ static int cortexar_breakwatch_clear(target_s *const target, breakwatch_s *const
{
cortexar_priv_s *const priv = (cortexar_priv_s *)target->priv;

switch (breakwatch->type) {
/*
* Redirect soft to hard breakpoints (until soft breakpoints are working?)
* GDB automatically selects soft breakpoints when an address is in RAM. This
* code is needed to allow breakpoints to work when the break type can't be
* configured in a GDB frontend (eg: in cortex-debug for VSCode).
*/
target_breakwatch_e bw_type = breakwatch->type == TARGET_BREAK_SOFT ? TARGET_BREAK_HARD : breakwatch->type;

switch (bw_type) {
case TARGET_BREAK_HARD: {
/* Clear the breakpoint slot this used */
const size_t breakpoint = breakwatch->reserved[0];
Expand Down
Loading