/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / debuging & local variable ?

Username:     
Password:     
             

Forum

# 1   2010-06-22 15:10:55 debuging & local variable ?

diabolo38
Member
Registered: 2010-03-12
Posts: 50

debuging & local variable ?

when i debug my code  locals variables in the watch/evaluate or on context display just  display junk ?
Also the  "locals" debug windows do not show up when selected form the menu view menu ?
Is this any normal ?

Not that My code is compiled with no optimization.

Offline

 

# 2   2010-06-22 15:43:02 debuging & local variable ?

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: debuging & local variable ?

In two words: use 'volatile'.

Debuger seems to miss the correct location of local variable during computation. I think this is because GCC uses registers to store them.

Offline

 

# 3   2010-06-22 16:52:18 debuging & local variable ?

diabolo38
Member
Registered: 2010-03-12
Posts: 50

Re: debuging & local variable ?

Forcing local variable with "volatile" is just unaceptable this will result in very slow and unoptimized code once debuging is finished (unless removing volatile the keyword )!

normaly If gcc is at o0 is is should not optimize anything so every single variable is on stack and every single access do access the  stack, also at o0 it should be any  strange things due to instruction scheduling and overs optimization ...

I've  use over mcu with gcc and sure code was almost not debugable at o2 and o3 but at 01 and further more o0 debugability  was fine... 
Look like with ride/circle even without optimizing the debuger is lost and debuging is almost impossible ...

Last edited by diabolo38 (2010-06-22 16:53:27)

Offline

 

# 4   2010-06-22 20:40:58 debuging & local variable ?

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: debuging & local variable ?

I never saw a code that could get wrong when adding volatile keyword. Removing volatile could hurt, but not adding it. So in your case you can debug a single function and once you know it's correct remove all volatile keywords from it. Thats exactly what i did to safely debug touchscreen handler in CircleOS.

On zero optimization level GCC still have to allocate registers and track their usage. It's just made with simple algorithm.

It might be a problem with RIDE. When using call stack (i have to turn it on manualy during every debug version) RIDE fails to restore the whole stack frame even with a simple program without interrupts.

Offline

 

# 5   2010-06-23 14:53:00 debuging & local variable ?

diabolo38
Member
Registered: 2010-03-12
Posts: 50

Re: debuging & local variable ?

i'v" been looking at assembly code and it confirm that variables are not optimized  i can see the str and ld from stack...  still not local variable is visible from the debuger. sad.

Offline

 

# 6   2010-06-24 06:50:52 debuging & local variable ?

behnaz
Member
Registered: 2007-11-16
Posts: 16

Re: debuging & local variable ?

Hi diabolo38,

What version of Ride7 environment and tools are you using?

Best regards,
Behnaz

Offline

 

# 7   2010-06-24 15:54:14 debuging & local variable ?

diabolo38
Member
Registered: 2010-03-12
Posts: 50

Re: debuging & local variable ?

Should be latest ride  7.28.10.0075 ...
I can now sometime (depending  on functions)  see correct local variables in the locals windows

I guess i must have been doing something wrong  that the local window did not show,
but I can't still  get  local variables reliably, it is actually quite annoying

Offline

 

Board footer