Other Parts Discussed in Thread: CCSTUDIO, TEST2
|
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.
|
Correct symbols are loaded and I have no problem getting addresses for global variables with same method in the script.
Doing the reverse returns the correct symbol name "max_num_fault_entries". I verified this in Rhino.
var max_num_fault_entries_symbol = debugSession.symbol.lookupSymbol(1, 0x0000c3de);
I am running Version: 8.3.1.00004 of CCS if that matters.
The FAE suggested I try to add the module name in front of the variable, but that did not work either. Might be I do not know the exact syntax.
Can you provide a reproducible test case? I don't need the full application. Something stripped down as simple as possible, but that can reproduce the issue, would be good.
Ki,
Here an an example simplified C file. I don't have a script to match this.
Thanks,
Stuart
volatile static int test; volatile int test2; /** * main.c */ int main(void) { while (1) { ++test; ++test2; } return 0; }
I have seen the script work once or twice this morning. And now never again.
I am starting to think is something with the scripting console and perhaps the .js script file.
I use loadJSFile to run the script in the scripting console.
I am not able to use the unloadJSFile command without it complaining is not finding the file.
When issuing restart command, scripting console and CCS just hangs.
I am pasting the complete script file, maybe there is something wrong I am doing there.
====================================================================
The simplified script below works reliably...
Question now is what exactly is the problem with the full script.
========================================================
I tried the example main.c without issue.
When at main, enter the below command in the scripting console:
js:> activeDS.symbol.getAddress("test2")
It should return the address (as an integer value). Does that work? If so, then it may be an issue with your script
Ki,
You will see in my main.c example, "test2" is NOT static. Paul is not having an issue with non-static globals. He is however having a problem with static globals, in this case, from my example, a variable called "test".
I put "test" and "test2" in the example so that I could contrast them with the TI CGT objdump tools. BTW, the compiler is TI C2000 CGT.
Thanks,
Stuart
Ki,
Upon further thought, my example is probably too simplified. I probably need to have the static variable in another compilation unit (*.c file) from where my current program counter context is to reproduce the issue. Otherwise, the debugger will see the static variable as in scope, even if it is static.
Thoughts?
Stuart
Ki,
I moved the static variable into its own compilation unit. I can reproduce the issue (static variable out of scope).
extern void test_method(void); /** * main.c */ int main(void) { while (1) { test_method(); } return 0; }
volatile static int test; volatile int test2; void test_method(void) { ++test; ++test2; }
Yes that would be expected since 'test' is out of scope. If Paul is trying to access the variable "as-is" while the variable is out of scope, that would explain the script failure.
Ki,
I agree. In the watch expression window, we can use the '<filename>'::<variable name> syntax to "scope" the access of static variables. Can we do something similar in the scripting console to give it the scope necessary to find the static variable?
Thanks,
Stuart
Ki,
This is interesting. It does seem to work for me. Paul, can you evaluate this on your end to see if it meets your need?
Thanks,
Stuart
I will try this soon. My remote computer is acting up and needs a reboot.
But I am still wondering why getting the static variable symbol in the simplified script works.
Sweet. That worked. Thanks.
So do not try "getAddress" with static variables is the lesson ?
One more thing before I mark this issue Resolved...
Where do I find the documentation on specifying the filename in front of the static variable ?
Paul Motora1 said:So do not try "getAddress" with static variables is the lesson ?
I would need to confirm this but it appears that getAddress would require the variable to be in scope.
expression.evaluate allows you to use GEL to workaround this limitation.
Paul Motora1 said:I looked in DSS_API documentation but could not find this detail.
It would not be in the DSS API documentation since expression.evaluate is simply a way to call GEL expressions. You can reference the GEL documentation in the CCS User's Guide:
https://software-dl.ti.com/ccs/esd/documents/users_guide/gel/namespace.html#gel-namespace
Thanks
ki