DSS - Launching CCS from DSS
Debug Server Scripting and Code Composer Studio version 4 and greater are both built upon the same Debug Server foundation. It is possible, within the same instance of a Java Runtime, to invoke both DSS and CCS and have both tools share the same Debug Server instance. Hence,it is possible to attach CCS to a running debug session created by DSS. The result is that target state is reflected in both tools. This is useful if target debug visibility (via GUI) is needed when running a DSS script.
NOTE 2: Some of the screenshots show an older version of CCSv4, hence the screenshots may be slightly outdated (but are still relevant)
NOTE 3: There are several differences in behavior depending on your CCS version. Please take note of the various subheading that are version specific
Setup steps for CCSv4.x up to CCSv5.2
If you are using a CCS version greater than 5.2 then this subsection can be skipped.
First we're going to need to make a small change to 'dss.bat' and the script we'll be debugging. If you have your own batch file / shell script you need to make a similar change.
- Open dss.bat and locate the section called LAUNCH_SCRIPT
- Edit the string %RHINO_SHELL% to be %RHINO_DEBUGGER%
See this section of the DSS topic for more information.
Setup steps for all versions
- Next edit the script you wish to debug by adding a call to open a "CCSSession". Opening a "CCSSession" will launch an instance of CCS, which will be used to provide visibility into the target being debugged by the DSS script, and have it share the same debug context. The call to do this is:
This can be added anywhere after the ScriptingEnvironment is created:
// Create our scripting environment object - which is the // main entry point into any script and the factory for // creating other Scriptable Servers and Sessions var script = ScriptingEnvironment.instance(); // Open a CCS Session to bring up the CCS GUI which will share the same debug context script.getServer("CCSServer.1").openSession(".*");
- Launch the Rhino Debugger:
- CCSv4.x to CCSv5.2:
> dss <scriptname>.js
- CCSv5.3 and later:
> dss -dss.debug <scriptname>.js
- Set a breakpoint on the line after the call to open a CCSSession. This is necessary because CCS is launched within the same JVM, but on a separate thread and the calling script has no way of knowing when the IDE is loaded.
- Run to the breakpoint by clicking "Go" or hitting "F5"
- Within a few seconds the CCS IDE should appear.
Debugging steps for CCSv4.x up to CCSv5.1
- Launch a Debug Session for the same exact target that is currently being used by DSS. It is important that the target specified in the *.ccxml file used by CCSv4 is the same as the target specified by the *.ccxml file used by DSS. For information on the Target Setup utility in CCSv4 and launching a Debug Session, see the examples captured here. If there is a mismatch between the target configurations, the following error will be reported:
Debugging steps for CCSv5.2 and greater
NOTE: There may be an issue where CCS will launch in the 'Resource' perspective. You will need to manually open the 'CCS Debug' perspective. Otherwise you will not see any action in the CCS GUI as your script executes. To open the 'CCS Debug' perspective, go to 'Window -> Open Perspective -> Other..' and then select 'CCS Debug' from the list of perspectives.
CCS versions 5.2 and greater come with an example script on how to launch CCS from a DSS script. The example script is located in:
- CCSv5: <INSTALL DIR>\ccsv5\ccs_base\scripting\examples\DebugServerExamples
- CCSv6: <INSTALL DIR>\ccsv6\ccs_base\scripting\examples\DebugServerExamples
- CCSv7: <INSTALL DIR>\ccsv7\ccs_base\scripting\examples\DebugServerExamples
The example script name is 'CCSSession.js'.
To run the example:
- Open command prompt
- Browse to the location of the 'CCSSession.js' script
- Run the script in debug mode to launch in the Rhino Debugger
- Windows: > ..\..\bin\dss.bat -dss.debug CCSSession.js
- Set a breakpoint in 'CCSSession.js' at line 27
- Run the script in the debugger until it reaches the breakpoint (Press 'Go' button)
- Wait until CCS GUI appears. Make sure it is in the 'CCS Debug' perspective (See the NOTE in the section above under 'Debugging steps for CCSv5.2 and greater')
- Continue to single step through the script and watch as the CCS GUI is automated by the script
Running from a Java Application
If you are using DSS from a Java application and you wish to launch CCS, you will need to add the following JAR file to your CLASSPATH before running the Java application:
You must also be using JDK version 6 or earlier.
Note that this feature is NOT supported with CCSv5 and greater.