Page 1 of 1

[solved]eclipse cdt + openocd degug wrong code/simbol

Posted: Sun May 25, 2014 2:52 pm
by lesto
hi,
i'm using a stm32f3discovery. I am compiling a really basic code, it works, but the debug windows seems broken; variable value seems wrong, but for sure actial code evidentation is wrong, as it "cicle" where there is no loop, and souch. break point seems to folow the evidentation and not the underling code.

i'm on linux with arm-none-eabi, and the same debug configuration used without chibios work just fine.

Re: eclipse cdt + openocd degug wrong code/simbol

Posted: Sun May 25, 2014 2:56 pm
by Giovanni
You need to compile without optimizations if you need an accurate debugging session: -O0 in the Makefile.

Giovanni

Re: eclipse cdt + openocd degug wrong code/simbol

Posted: Sun May 25, 2014 3:26 pm
by lesto
it work!
thatk you. Could I suggest to chenge default makefile for demo to -O0, or add a comment about this? (i know probably this is basic concept for many )

BTW checked, my others's project makefile was using -Og -g3, but i will stick to -O0 for the debug session.

Re: [solved]eclipse cdt + openocd degug wrong code/simbol

Posted: Fri May 30, 2014 10:37 pm
by colin
Using gcc's -O3 option is extermely aggressive; it will move code around and inline all sorts of things that you don't expect. Honestly I never have had trouble with -O1 causing debugging problems. I would probably recommend using -O1 as the base level optimization rather than -O0 unless you find it's still causing confusion. Using -O0 can actually be problematic in some cases, maybe someone else here can recall times where -O0 caused stack overflows or other weird behavior. I think the ChibiOS/RT idle thread may be one place such a problem can occur.