Incorrect addresses for stack variables i Variables window

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Incorrect addresses for stack variables i Variables window

1,142 Views
ericfornstedt
Contributor III

Hi,

We have recently switched from NXP PPC Compiler to a GCC compiler and have an issue with the Variables window when debugging. For some reason the visual representation of addresses for local variables in a function is wrong (i.e have the wrong offset from stack pointer) and therefore the values of the variables cannot be viewed properly. Everything else works as expected when debugging, and the actual code executes as expected, it's only the visual representation of local variables that is wrong.

We stepped into the assembly code to try to see what happens. Before we switched compiler, things look alright and the first instruction in a function which setup the local stack also modify the addresses in the Variables window to the correct offset. The addresses to the right in the picture below is correct and the ones used by the program when it executes.

Correct behaviourCorrect behaviour

When the program has been compiled with GCC the behavior changes. As seen in the picture below the addresses in the Variable window is correct before the first instruction is executed, and incorrect after the execution. The addresses becomes offset by the size of the local stack. Again, the program executes normally and the addresses seen to the left in the picture below are the ones used in the actual assembly code (stack pointer + offset). 

Incorrect behaviourIncorrect behaviour

How can this happen? Why are the local stack variables incorrect (or not setup) when entering a function in the first case and already setup correctly when entering a function in the second case? The function's first instruction then offsets the local variable addresses in the Variable window with the size of the local stack in both cases.

Global variables are displayed correctly in both cases, this issue only applies to local variables.

Debug symbols are included in the .elf-file in both cases, and as stated above everything else regarding debugging is working properly. Is there an NXP specific debug symbol or similar needed by CodeWarrior that might not be included when building with GCC, or what can cause this behaviour?

BR
/ Eric

0 Kudos
3 Replies

843 Views
ericfornstedt
Contributor III

Any ideas on this? We're still struggling with this issue.

0 Kudos

1,098 Views
yipingwang
NXP TechSupport
NXP TechSupport

Which version CodeWarrior are you using?

Which processor are you using?

0 Kudos

1,094 Views
ericfornstedt
Contributor III

Sorry, I forgot to mention that.

We're using CodeWarrior for Power Architecture, Version: 10.5.1, Build Id:160128 and the P2020 processor.

0 Kudos