2024-03-06 03:35 PM
I can no longer use breakpoints. When I insert 1 I get the banner complaining about too many breakpoints. I've cleared debug configurations, breakpoints, restarted, but the problem persists. I even went to the debugger console and inserted a single breakpoint there manually but it still inserted multiple breakpoints.
Here is the log from the debugger console. My typings are in bold. Initially there is a single temporary breakpoint but when I try to insert one, it inserts 64 breakpoints! What is going on and how do I fix it?
2024-03-07 01:05 AM - edited 2024-03-07 01:37 AM
Hello @RChap.1
First let me thank you for posting.
Could you please indicate which STM32CubeIDE version , STM32 board and OS that you are using in order to push further the investigation.
I will be waiting for your feedback .
Thx
Ghofrane
2024-03-07 02:39 AM
Version: Version: 1.14.1
Custom board with STM32L4R5ZIT-6 micro
Custom OS.
I've isolated the issue. It has to do with a macro that is used to create an atomic region of code. The breakpoint somehow decides that multiple breakpoints are necessary.
Here is a snippet of code with the macro and some example code:
#define ENTER_REGION() \
{ \
bool int_interrupt_enabled = __get_PRIMASK(); \
if (int_interrupt_enabled) __disable_irq();
#define LEAVE_REGION() \
if (int_interrupt_enabled) __enable_irq(); \
}
#define ENTER_SAFE_REGION() ENTER_REGION()
#define LEAVE_SAFE_REGION() LEAVE_REGION()
#define safe(code) \
ENTER_SAFE_REGION() \
code \
LEAVE_SAFE_REGION()
void record_event(const char * e) {
if (playback == false)
safe(record(e);)
}
If I set breakpoints on the two lines in the function record_event() [19,20], I end up with 3 breakpoints. This is from the debugger console:
info br
4 breakpoint keep y 0x0803b93c in record_event at tea.c:19
5 breakpoint keep y <MULTIPLE>
5.1 y 0x0803b950 in record_event at tea.c:20
5.2 y 0x0803b96e in record at tea.c:20
2024-03-07 11:06 PM
Macros seem to be a problem in general. I set a breakpoint on line 4 with the BLACK_HOLE() macro and I get multiple breakpoints. This represents the extracted code under examination:
#define BLACK_HOLE(reason) system_failure(reason)
if (m == 0)
BLACK_HOLE(ACTION_NULL);
if (m == no_action)
In the breakpoints panel it only shows up as 1 breakpoint. The only way to know that there are multiple breakpoints is to use the debugger console:
info br
1 breakpoint keep y <MULTIPLE>
1.1 y 0x0803ae3a in actionRun at tea.c:4
1.2 y 0x0803aef0 in actionRun at tea.c:4
1.3 y 0x0803b0bc in actionRun at tea.c:4
1.4 y 0x0803b83a in actionRun at tea.c:4
The memory span from the first breakpoint to the last breakpoint is 2560 bytes and is curious. Seems like a large memory span for a breakpoint for a single function call. I checked the breakpoint addresses in the .map file to find out what functions they were in and only the 4th breakpoint (1.4) is in the function actionRun. The other 3 breakpoints are in different functions elsewhere in the file and will cause phantom breakpoints to happen. Which I was also noticing.