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

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
lesto
Posts: 55
Joined: Thu May 22, 2014 11:27 am

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

Post 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.
Last edited by lesto on Sun May 25, 2014 3:26 pm, edited 1 time in total.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: eclipse cdt + openocd degug wrong code/simbol

Post by Giovanni »

You need to compile without optimizations if you need an accurate debugging session: -O0 in the Makefile.

Giovanni
lesto
Posts: 55
Joined: Thu May 22, 2014 11:27 am

Re: eclipse cdt + openocd degug wrong code/simbol

Post 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.
colin
Posts: 149
Joined: Thu Dec 22, 2011 7:44 pm

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

Post 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.
Post Reply