2024-01-23 12:31 PM
Hi, I am running a debug session for a project and am running into a pretty baffling problem where values I load into an array are seemingly getting erased by a tools error.
I have a class that has an array as one of its members, that gets filled with pointers to UI objects. This has worked for me on numerous other projects.
I had to update to CubeIDE 1.14.1 recently, and suddenly the array values are getting erased as soon as any of the class methods are called. As you can see here, the array shows all the correct values, but then once the class method service_all() is called, the array values get deleted:
Before:
After (before any part of the service_all() method is even executed!):
I have optimization disabled for this part of the source code. Any idea what is causing this? It's completely baffling and has ground development to a complete halt.
Solved! Go to Solution.
2024-01-23 01:05 PM
I don't really have an explanation, but to help debug you can set a hardware watchpoint on ui_ctrls[0], which will break when the program edits that memory. Perhaps an IRQ or another task is firing.
Examining the memory directly at 0x24005248 with the Memory Viewer may be helpful to confirm/deny what the Expressions window is telling you.
Examining the disassembly may show clues as well.
2024-01-23 01:05 PM
I don't really have an explanation, but to help debug you can set a hardware watchpoint on ui_ctrls[0], which will break when the program edits that memory. Perhaps an IRQ or another task is firing.
Examining the memory directly at 0x24005248 with the Memory Viewer may be helpful to confirm/deny what the Expressions window is telling you.
Examining the disassembly may show clues as well.
2024-01-23 02:04 PM
Okay thanks, putting the hardware watchpoint on ui_ctrls[0] let me track down the error. Values were being written to an array past its bounds by a loop. Will keep that trick in mind for future debugging.