File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -1642,7 +1642,15 @@ static int cortexar_breakwatch_set(target_s *const target, breakwatch_s *const b
16421642{
16431643 cortexar_priv_s * const priv = (cortexar_priv_s * )target -> priv ;
16441644
1645- switch (breakwatch -> type ) {
1645+ /*
1646+ * Redirect soft to hard breakpoints (until soft breakpoints are working?)
1647+ * GDB automatically selects soft breakpoints when an address is in RAM. This
1648+ * code is needed to allow breakpoints to work when the break type can't be
1649+ * configured in a GDB frontend (eg: in cortex-debug for VSCode).
1650+ */
1651+ target_breakwatch_e bw_type = breakwatch -> type == TARGET_BREAK_SOFT ? TARGET_BREAK_HARD : breakwatch -> type ;
1652+
1653+ switch (bw_type ) {
16461654 case TARGET_BREAK_HARD : {
16471655 /* First try and find a unused breakpoint slot */
16481656 size_t breakpoint = 0 ;
@@ -1694,7 +1702,15 @@ static int cortexar_breakwatch_clear(target_s *const target, breakwatch_s *const
16941702{
16951703 cortexar_priv_s * const priv = (cortexar_priv_s * )target -> priv ;
16961704
1697- switch (breakwatch -> type ) {
1705+ /*
1706+ * Redirect soft to hard breakpoints (until soft breakpoints are working?)
1707+ * GDB automatically selects soft breakpoints when an address is in RAM. This
1708+ * code is needed to allow breakpoints to work when the break type can't be
1709+ * configured in a GDB frontend (eg: in cortex-debug for VSCode).
1710+ */
1711+ target_breakwatch_e bw_type = breakwatch -> type == TARGET_BREAK_SOFT ? TARGET_BREAK_HARD : breakwatch -> type ;
1712+
1713+ switch (bw_type ) {
16981714 case TARGET_BREAK_HARD : {
16991715 /* Clear the breakpoint slot this used */
17001716 const size_t breakpoint = breakwatch -> reserved [0 ];
You can’t perform that action at this time.
0 commit comments