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.

how to set a breakpoint by file name and line number in condition of not launching ccs

Other Parts Discussed in Thread: SYSBIOS, CCSTUDIO, TMS320C6678

I want to set a breakpoint by using dss API, so I add a line of code in the javascript program like below:

debugSession.breakpoint.add("hello.c",20);

This approach is effective when i start up  ccs in the script. but if i don't  launch  it, the javascript program execution will terminate at the

"debugSession.breakpoint.add("hello.c",20)"  line.

Could you please help me know the reason and how to use the API(int add(java.lang.String sFile, int nLine)) in condition of not launching ccs.

Thanks.

  • Hello,
    An exception was likely thrown, thus terminating the script. Can you post the exception message thrown?

    Thanks
    ki
  • Thank you for your reply, ki
    Recently, I'm interested in DSS API, so I read the DS_API Documentation and tried to invoke these API in javascript,
    But i encountered some problems. I'll detailedly describe the problems to you here.I hope to get your help.
    1.My target board is the Ti C6678 Multi-core DSP.

    2.The C source code is as follows.

    1 /*
    2 * ======== hello.c ========
    3 * The hello example serves as a basic sanity check program for SYS/BIOS. It
    4 * demonstrates how to print the string "hello world" to stdout.
    5 */
    6
    7 #include <xdc/std.h>
    8
    9 #include <xdc/runtime/System.h>
    10 #include <ti/sysbios/BIOS.h>
    11
    12 /*
    13 * ======== main ========
    14 */
    15 Int main()
    16 {
    17 int i,j;
    18 i=0;
    19 j=0;
    20 for(;j<10;j++)
    21 i=j;
    22 System_printf("hello world\n");
    23 /*
    24 * normal BIOS programs, would call BIOS_start() to enable interrupts
    25 * and start the scheduler and kick BIOS into gear. But, this program
    26 * is a simple sanity test and calls BIOS_exit() instead.
    27 */
    28 BIOS_exit(0); /* terminates program and dumps SysMin output */
    29 return(0);
    30 }

    3. I wrote a javascript program invoking the DSS API to debug the C code above.The javascript program can be successfully executed. The code is as follows.

    // Import the DSS packages into our namespace to save on typing
    importPackage(Packages.com.ti.debug.engine.scripting);
    importPackage(Packages.com.ti.ccstudio.scripting.environment);
    importPackage(Packages.com.ti.dvt.engine.scripting);
    importPackage(Packages.java.lang);

    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable ervers and Sessions
    var script = ScriptingEnvironment.instance();
    script.traceBegin("CCSSession.xml", "DefaultStylesheet.xsl");

    // Log everything
    script.traceSetConsoleLevel(TraceLevel.ALL);
    script.traceSetFileLevel(TraceLevel.ALL);
    script.traceWrite("configuration finished");

    // Start up CCS
    ccsServer = script.getServer("CCSServer.1");
    ccsSession = ccsServer.openSession(".*");

    // Start up the debugger with the C6678 simulator; it will start up the session in CCS
    var debugServer = script.getServer("DebugServer.1");
    debugServer.setConfig("C:/ti/ccsv5/ccs_base/scripting/examples/hello_TMS320C6678/targetConfigs/TMS320C6678.ccxml");
    var debugSession0 = debugServer.openSession("Texas Instruments XDS100v1 USB Emulator/C66xx_0");

    //Connecting with the target
    debugSession0.target.connect();

    //Load a program
    debugSession0.memory.loadProgram("C:/ti/ccsv5/ccs_base/scripting/examples/hello_TMS320C6678/Debug/hello_TMS320C6678.out");

    //Setting a breakpoint in the C source code
    debugSession0.breakpoint.add("C:/ti/ccsv5/ccs_base/scripting/examples/hello_TMS320C6678/hello.c",22);

    //Running the C program
    debugSession0.target.run();

    //Reading the value of the local variable from memory,such as reading the variable "j" and "i"
    var address0 = debugSession0.symbol.getAddress("j");
    var result0 = debugSession0.memory.readData(0, address0, 32);
    var address1 = debugSession0.symbol.getAddress("i");
    var result1 = debugSession0.memory.readData(0, address1, 32);

    //Recording data
    script.traceWrite("data0 = "+result0);
    script.traceWrite("data1 = "+result1);

    //Terminating debug session
    debugSession0.terminate();

    //Stopping debug server
    debugServer.stop();

    // stop the Logging
    script.traceSetConsoleLevel(TraceLevel.INFO);
    script.traceWrite("TEST SUCCEEDED!");
    script.traceEnd();

    // Terminate CCS
    ccsSession.terminate();
    ccsServer.stop();

    4. Now i comment out these code like below:
    //ccsServer = script.getServer("CCSServer.1");
    //ccsSession = ccsServer.openSession(".*");

    Then the javascript program will terminate at the "debugSession0.breakpoint.add("C:/ti/ccsv5/ccs_base/scripting/examples/hello_TMS320C6678/hello.c",22);" line .
    The system will throw the following error message :

    add: ENTRY sFile: C:/ti/ccsv5/ccs_base/scripting/examples/hello_TMS320C6678/hell
    o.c nLine: 22
    add: Getting breakpoint manager
    add: Assigning source-line location
    createAtLocation: Creating new breakpoint
    addAndEnable: Adding breakpoint
    addAndEnable: Enabling breakpoint
    SEVERE: Breakpoint 33 could not be enabled. No code is associated with "C:/ti/cc
    sv5/ccs_base/scripting/examples/hello_TMS320C6678/hello.c", line 22 in any loade
    d symbols
    org.mozilla.javascript.WrappedException: Wrapped com.ti.ccstudio.scripting.envir
    onment.ScriptingException: Breakpoint 33 could not be enabled. No code is associ
    ated with "C:/ti/ccsv5/ccs_base/scripting/examples/hello_TMS320C6678/hello.c", l
    ine 22 in any loaded symbols (CCSS.js#26)
    at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:16
    93)
    at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
    at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:20
    4)
    at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)

    at org.mozilla.javascript.gen.c1._c0(CCSS.js:26)
    at org.mozilla.javascript.gen.c1.call(CCSS.js)

    I couldn't have found out the cause of the error so far. Could you tell me how to use the API(int add(java.lang.String sFile, int nLine)) in condition of not launching ccs ?

    Thanks.

  • Hello,

    The cause of the error is described in the exception message:

    hao li said:
    SEVERE: Breakpoint 33 could not be enabled. No code is associated with "C:/ti/cc
    sv5/ccs_base/scripting/examples/hello_TMS320C6678/hello.c", line 22 in any loade
    d symbols

    Basically, the symbols for the program you loaded does not have any source file association with the hello.c file you described in the above path. Is there indeed a "hello.c" in the path mentioned above? Did you create and build the project in "C:/ti/ccsv5/ccs_base/scripting/examples/" or did you copy the project folder there after your created and built the project?

    Thanks

    ki

  • Hello,

    I copied the whole project folder to the path "C:/ti/ccsv5/ccs_base/scripting/examples/" after creating and building the project in ccs IDE.
    The debugging for this project can be successful in ccs IDE, but can not be by using javascript without the code of starting up ccs. the javascript program will terminate at the "debugSession0.breakpoint.add("C:/ti/ccsv5/ccs_base/scripting/examples/hello_TMS320C6678/hello.c",22);" line , then throwing the error above.

    Thanks

  • As mentioned earlier, the issue is that the debugger is unable to associate the source file specified in the debug symbols from the one you are specifying with the breakpoint.add function. Can you provide your project (source + out file also)?

    Thanks
    ki
  • Thank you very much for your patient answer, ki

    I'll send you the compressed complete project file named "project.rar" and the javascript file named "Debugging.rar" used to debug the project. Hopefully these files will be useful to you for analysing my problem.

    Thanks.

    project.rar

    Debugging.rar