When I trace the code in debugger, I get <optimized out> for some variables

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RaNo_3455531
Level 1
Level 1
Welcome!

I am trying to view the content of a variable in WICED SDK in debug mode

I reduced the compiler optimization to -O0 in the file: wiced_toolchain_ARM_GNU.mk file (located under \tools\makefiles)

Here is a snapshot of the screen during the debugging session:

pastedImage_2.png

I really appreciate any help.

Thanks,

Ramzi

0 Likes
1 Solution
Anonymous
Not applicable

You can try using the volatile qualifier with the variable. For example, volatile size_t fill. That might help.

View solution in original post

2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Optimized out means that the variable is kept in a register so that the debugger cannot access it. When you have the choice you may set the compiler optimization level to "none".

Bob

Anonymous
Not applicable

You can try using the volatile qualifier with the variable. For example, volatile size_t fill. That might help.