This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
How can I add variables that are in a function to the Debug / Expressions list?
I have no problem adding and removing global variables to the Expressions watch window. I have no problem changing the format of global variables to the Expressions watch window.
I really need to monitor local variables that exist only in a function. I can make them global for debug purposes, but that is time consuming and prone to errors. And what if the function is in a header file.
I see a variables watch window, but it seems to be useless.
Any help would be greatly appreciated.
I am using CCS Version: 6.2.0.00050.
John,
What device are you using? Do you have the optimizer turned on?
In general both the Expressions view and Variables view should be able to show local variables if they are in scope. If the optimizer is turned on there is a good chance that they are being optimized out.
Does it ever work or just not for some variables?
Regards,
John
I am using a TMS320F28377D Delfino DSC with an XDS100v2 USB JTAG Emulator.
Optimization level is OFF.
I have been working with Code Composer Studio for about a year and there is still a lot I do not know.
I do not understand what you mean by "if they are in scope".
Global Variables, those declared outside of a function, always work in the expressions list.
I have never been able to see a local variable, declared inside of a function, in either the expressions or variables windows.
John,
By in scope I mean is the program counter in the function where the variable is in scope:
Here I am in main() so i and j and in scope but c is not:
Here I am in john() so c and count are in scope but i and j are not:
The global variable is always in scope as it is allocated in data memory. The local variables are on the stack and only available when in scope.
Is there a project that you can share that shows the problem you are seeing?
Regards,
John
I have read Debug Handbook for CCS, and GSG:Debugging projects v5 and I have not seen the method you are describing. No information about program counter.
When I place a breakpoint in my function I see variables without names or values. But I am able to add local variable to expression list.
When I suspend the program I do not have access to the functions
Where can I find more information about placing program counter?
So I have to set a breakpoint and halt the program to look at local variables?
Yes, I am using "DELAY_US();" a lot and it usually stops there if I suspend the program.
When I launch the program it halts at MAIN automatically as shown below. But the Variables list does not show name or value, only (x)=
The first picture from my last post showed the Variables list when I placed a breakpoint in my function "Read_Data". When I did that I could add the local variables to the Expressions list.