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.

symbols for structure elements

I am debugging an algorithm implementation that involves many large matrices on a c6678. They are contained in a structure and each element in the structure is a pointer to an array, like so:

typedef struct data
{
	double *y0;
	double *Qd;
	double *Fd;
	double *Qp;
}data;

When I manually debug I can see the elements just fine in the variables window (data->y0 etc), so there must be a symbol in the .out file right? The problem is I cannot seem to find these symols in the .out file using the nm6x utility.

I can see the structure itself:

nm6x -A -l test6.out |find "data"
[5679] |0x80874080|  128| GLOB|OBJT|HIDN|30|data

but not the elements:

nm6x -A -l test6.out |find "Qp"
*nothing found*

How do I lookup the elements, or force the linker to retain the symbols?

So why is this a problem? The matrices are quite large and very difficult to inspect in CCS. So, I am using DSS scripts to export the variables to files which I then read into Matlab. This is a really powerful tool and I am glad I found it except that I cannot access the variables I need. To save the variables using DSS you need to lookup their address like so:

var address = ds.symbol.getAddress("Qp")
ds.memory.saveRaw(PAGE_PROGRAM, address, "Qp.bin",40*40*2,64,false)

But that doesnt work because Qp is not in the symbol table. How can I access data.Qp?

I am not quite sure if this is a problem with DSS or more of a c6000 linker issue so I am going to post this in both sections. Thanks for the help.

  • It is important to recognize that this ...

    /* ex.c */
    typedef struct data
    {
    	double *y0;
    	double *Qd;
    	double *Fd;
    	double *Qp;
    }data;
    

    ... is a type, and not a variable.  That code does not define any data variables.  It only creates a user defined type named "data".  In fact, because of that type name, you cannot use it to define a variable named data.  Suppose ex.c continues on with this line ...

    data data;
    

    If you compile that you see ...

    % cl6x -mv6600 ex.c
    "ex.c", line 9: error: "data" has already been declared in the current scope
    1 error detected in the compilation of "ex.c".
    

    So, to make this example build I change it to ...

    /* ex.c */
    typedef struct data { double *y0; double *Qd; double *Fd; double *Qp; }dtype; /* change here */ dtype data;

    If I use nm6x on the ex.obj that results from building this file, then I see an entry for a variable named data very similar to what you show above.

    Abraham Goldsmith said:
    When I manually debug I can see the elements just fine in the variables window (data->y0 etc), so there must be a symbol in the .out file right?

    There is a variable named data.  But everything else CCS knows about data comes not from the symbol table, but from the type information. It is type information which tells CCS that data is a structure which contains 4 members, and the first one of those members is y0.

    This ...

    Abraham Goldsmith said:
    var address = ds.symbol.getAddress("Qp")

    ... fails because it looks only in the symbol table for a variable named Qp.  There isn't any symbol with that name.

    Thanks and regards,

    -George

  • Thanks George,

    I do realize that "data" in my previous example is a type. In the code I am debugging there is a variable, lets call it d, declared as follows:

    data d;

    Now, for the problem of accessing d.Qp from DSS, I understand your explanation.

    Could you suggest a method for accessing d.Qp using DSS? Or an alternative method for exporting this data in a flexible and automatic way?

  • This has turned into a CCS question.  Please follow the thread you started on this question in the CCS forum.

    Thanks and regards,

    -George