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.

CCS/TMS570LS0432: How to jump to the line of the source code using DSS API?

Part Number: TMS570LS0432

Tool/software: Code Composer Studio

Hello, during the debugging I need to jump to the desired line of the source code (the same as "Move to Line" in CSS editor) using Java Script with DSS API (calls of GEL is possible). I have not found the required instruction within API. Of course the address of the line could be seen within object code and then set PC register to it, using something like

debugSession.expression.evaluate("PC = 0x0001DF64")

But this approach is not suitable for my goals. I do not know how to receive the address of the line within the Java Script.

So is it possible to do only knowing the line number in the source code file?

Thanks in advance!

 

  • Hello,

    Egor Jakimenko said:

    Of course the address of the line could be seen within object code and then set PC register to it, using something like

    debugSession.expression.evaluate("PC = 0x0001DF64")

    A better option would be:

    debugSession.memory.writeRegister("PC", 0x0001DF64)

    Egor Jakimenko said:

    But this approach is not suitable for my goals. I do not know how to receive the address of the line within the Java Script.

    So is it possible to do only knowing the line number in the source code file?

    Not directly. There are a few more roundabout ways that comes to mind.

    The first is to have a label at the desired source line. Then you can look up the address of that label

    var addr = debugSession.symbol.getAddress("label");

    debugSession.memory.writeRegister("PC", addr);

    Another option is to set a source line breakpoint at that address. The you can get the address for that breakpoint by reading the breakpoint properties (see the "BreakpointProperties" class in the DSS API doc).

    Thanks

    ki

  • Ki, thanks for support,

    Ki said:

    The first is to have a label at the desired source line. Then you can look up the address of that label

    The source code must not be modified, so adding label is not possible.

    Ki said:

    Another option is to set a source line breakpoint at that address. The you can get the address for that breakpoint by reading the breakpoint properties (see the "BreakpointProperties" class in the DSS API doc).

    As I understand the breakpoint properties are created with "breakpoint.createProperties" and all properties set there. However I could only set address directly

    props = debugSession.breakpoint.createProperties()

    props.setString("Hardware Configuration.Location",0x1df64)

    But it does not accept the file & line, like

    props.setString("Hardware Configuration.Location","../v_src/Application/StartUp/SystemInit/SystemInit.c, line 63")

    If I set breakpoint directly

    debugSession.breakpoint.add("../v_src/Application/StartUp/SystemInit/SystemInit.c", 63)

    I don't know how to get properties of created breakpoint. Is it possible?

  • Upd:

    I've just found the method to set source and line: setSourceLocation.

    But I still do not understand how to read properties from breakpoint.

    The following instruction

    addr = props.getString("Hardware Configuration.Type.Location.Address")

    Causes an error - Could not find property Address

    So how to get the address in this case?

  • Egor Jakimenko said:

    But I still do not understand how to read properties from breakpoint.

    The following instruction

    addr = props.getString("Hardware Configuration.Type.Location.Address")

    Try getNumeric and remove the "Address" at the end of the property string)

    addr = props.getNumeric("Hardware Configuration.Type.Location");    

    Thanks

    ki

  • Ki,

    Yes, it works this way.

    Thank you very much!