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: DSS getAddress in C++ code

Tool/software: Code Composer Studio

Hi,

My code is C++ based, using the TI simulator, and I am trying to set a breakpoint on an ASM label inside a class function, and:

-        Read a local variable address

-        Read a private class variable address

 

I am able to set the breakpoint, but upon trying to read the variable addresses it’s as if they were not in scope.

My code looks something like this (compiled with no optimization):

 

myClass.h:

 

class MyClass

{

private:

       int m_Var;

public:

       MyClass() : m_Var(0) {}

       void calc(void)

       {

               int local = 0;

               local++;

               asm(" .global dump\ndump: "); //label for breakpoint

                 local++;

        }

}

 

My DSS script looks like this:

 

var script = ScriptingEnvironment.instance();

ds = script.getServer("DebugServer.1");

var ds;

ds.setConfig(...); //simulator

var debugSession0 = ds.openSession(".*_0");

debugSession0.target.connect();

debugSession0.memory.loadProgram(...);

var pcsave = debugSession0.symbol.getAddress("dump");

debugSession0.breakpoint.add(pcsave);

debugSession0.target.run();

 

debugSession0.target.waitForHalt();

if(debugSession0.expression.evaluate("PC") == pcsave)

{

       print(pcsave)

       var my_address = debugSession0.symbol.getAddress("local");

       print(my_address);

       var my_address = debugSession0.symbol.getAddress("this->m_Var"); //tried with (*this).m_Var as well, and with .expression.evaluate

       print(my_address);

       debugSession0.target.run();

}

 

 

Presumably the debugger should see both variables as the breakpoint stops at the label and they should be in scope, but I am getting „Unable to get address for symbol” errors from DSS.

 

Can you please help me with this issue?

  • Hello,
    You can't do it using the getAddress DSS API. But you can GEL to evaluate the expression:

    var my_address = debugSession0.expression.evaluate("&m_Var")

    or

    var my_address = debugSession0.expression.evaluate("&rect.m_Var")

    depending on the scope

    Thanks
    ki
  • Hi Ki-Soo,

    I have tried with .expression.evaluate as well, but it still acts as if it was not in scope. Can you please verify if it should be in scope in this case?

    Thanks,

    Daniel

  • Yes it will work. Where are you halted when you call expression.evaluate ?