0

I'm writing an OS awareness plugin. I need to read a symbol name to get the tasklist. In our system, the OS is running on 2 different cores, so that the symbol name which I want to read is presented on 2 different cores with the same symbol name. When I call T32 API to get the symbol address by passing the symbol name, it says "Symbol not found".

I tried giving the complete symbol path but still it is failing.

Is there a way to get the symbol address when the same symbol name is present on 2 different cores?

Thank you.

Sat
  • 11
  • 2
  • A symbol is usually a location in a memory. It is normally not related to a core. Or do you cores have physically dedicated memory? – Holger Jun 02 '20 at 16:42
  • I agree that symbol is a location in memory. Now the problem, I'm facing is there are 2 memory addresses with the same symbol name. T32 Extended API to get the symbol address for this symbol name is failing with 'Symbol not found'. – Sat Jun 04 '20 at 02:37

1 Answers1

0

If you have two symbols with the same name (but pointing to different memory locations), it is totally the correct approach, to use the fully qualified symbol path names for both memory locations.

To find the fully symbol path names open the TRACE32 GUI, load your application and open the window sYmbol.Browse.sYmbol (via the command line or via Menu>View>Symbols>Browse). In the window sYmbol.Browse.sYmbol replace the last asterisk in the upper left corner by the name of your symbol. This should look like this: Window sYmbol.Browse.sYmbol In my case the symbol is called "mcount". As you can see I have it twice.

Now move the slider in the left lower corner (left to the horizontal scroll bar) to the right and you will see the fully qualified symbol name: Window sYmbol.Browse.sYmbol opened The columns labeled with "path" and "symbol" show now together the fully qualified symbol names.

In my example the full symbol name of my first variable is \\sieve\itm\mcount, which means that this symbol comes from the module "itm" in the ELF file "sieve". (A module is a compilation unit aka. an object-file)

If you have two symbols with the same name in the same ELF which are in two different modules, which also have the same name, TRACE32 will extend the module name by parts of the file path to have again unique symbol path names.

Alternatively you can also replace the module name by the file path (of the underlying source file) in double-quotes. E.g. like this: \\sieve\"C:\project\src\itm.c"\mcount

Finally use the fully qualified symbol name with the API function T32_GetSymbol() to get the symbol's address via the remote API. E.g.: Like this

int main(void)
{
    const char *symbol = "\\\\sieve\\itm\\mcount";
    uint32_t address, size, reserved;

    T32_Config( "NODE=", "localhost");
    if ( T32_Init() != T32_OK )
        exit(-1);
    if (T32_Attach(1) != T32_OK)
        exit(-2);

    if (T32_GetSymbol (symbol, &address, &size, &reserved) == T32_OK)
        printf("Symbol %-30s is at address 0x%08X with size %d\n", symbol, address, size);

    T32_Exit();
    return 0;
};
Holger
  • 3,920
  • 1
  • 13
  • 35