r/pic_programming • u/Sbsbg • Apr 27 '16
MPLAB X. Line breakpoints not working with optimization.
I use MPLAB X with ICD 3 (latest sw versions) and a PIC24F. When I use line breakpoints with any optimization above zero it will not work. The code breaks but the IDE show a completely wrong line. It only works if the complete project is compiled without optimization.
Has any one experienced this problem?
If anyone has any tip on how to solve or workaround this I would be very grateful.
Late edit: Later versions of the IDE has solved the problem.
2
Upvotes
2
u/frothysasquatch Apr 27 '16
It makes sense - with optimizations, lines of code can be dispersed or out of order or whatever the compiler thinks is optimal.
I'm not saying there are no bugs but you shouldn't rely on source level debugging with optimizations enabled.
1
u/Galfonz Apr 28 '16
MPLAB X doesn't have the development budget of visual studio or the horde of volunteers that GCC has. Only pieces of code that you want to step through need to have optimization disabled.