2020-02-04 07:09 PM
Not sure whether this is a GDB or Eclipse behavior, or "feature" of debug info created by gcc compiler...
Debugger in CubeIDE and Atollic refuses to display pointers to volatile.
For example:
volatile char *ptr = some_func();
It always says that such pointers are optimized out.
Very annoying.
Debugger rightly refuses to dereference ptr - but ptr itself is NOT volatile!
Another debugger annoyance: consider a loop in one source line, like this:
while ( foo == 0) {}
When debugger tries to step over (F6) such line and the loop won't exit, the pause button (||) becomes unavailable and it's impossible to break in.
The only available action is to stop debug session altogether.
Optimization is either off or "optimize for debug" - neither helps
Regards,
Pavel
2020-02-05 10:54 AM
More debugger annoyances:
Debug (launch) settings dialog looks in CubeIDE way differently from Atollic.
I need to specify a non-standard entry address, and CubeIDE has a special field for this.
But in my system the address is not fixed, it should be read from the image after it been loaded.
In Atollic, this can be done with set $pc command in the debugger script, like:
set $pc=*(0x08010104)
In CubeIDE this works as well, but sometimes fails with
Error in final launch sequence:
Failed to execute MI command:
set $pc=*(0x08120204)
Error message from debugger back end:
Selected thread is running.
After this, need to replug the debugger cable and wait some time. Very annoying as well.
-- pa
2020-02-16 05:44 AM
IMHO the debugger in CubeIDE is notably less stable than in old good Atollic.
Even though the Eclipse part, toolchain etc. are newer and greater.
-- pa
2020-02-16 06:57 AM
> refuses to display pointers to volatile.
Hmm. Thats a compiler decision. Are you using optimization level -O0 ?
Try making the volatile variable static or add an attribute
volatile char *i __attribute__ ((used)) = rand();
Optimization level is always a compromize between speed, space (limited flash) and debuggability.
while ( foo == 0) {}
Hmm, break || works for me (STM32CubeIDE 1.2.1).
Sometimes I switch to instruction level debugging before entering such a tight loop.
2020-02-16 11:50 AM
Thank you Frank. I'll re-test with latest CubeIDE. Was sure I'm using -O0.
Do you use ST GDB or Open OCD with CubeIDE? Linux or Windows?
-- pa
2020-02-16 12:38 PM
ST GDB. Just tested openOCD (without recompilation) and it can access the local volatile variable, strange.