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: CCS LoadSymbolWithOffset

Tool/software: Code Composer Studio

Hello,

loadWithOffset

public void loadWithOffset(java.lang.String fileName,
                           long codeStart,
                           long dataStart)
                    throws ScriptingException
Loads the specified program's symbols into the debugger's symbol manager. Any existing symbols on the target will be unloaded. Symbols associated with the program's code sections will be added starting at codeStart while the program's data sections will be added starting at dataStart.

Parameters:
fileName - (String) the name of the file to load symbols from. Relative paths are permitted, use ScripingEnvironment.setCurrentDirectory(String) to change the current working directory.
codeStart - (long) the starting address to start adding the program's symbols
dataStart - (long) the starting address to start adding the data's symbols
Throws:
ScriptingException

loadWithRelativeOffset

public void loadWithRelativeOffset(java.lang.String fileName,
                                   long codeOffset,
                                   long dataOffset)
                            throws ScriptingException
Adds the specified program's symbols into the debugger's symbol manager. Any existing symbols on the target will be unloaded. Symbols associated with the program's code sections will be moved by codeOffset while the program's data sections will be moved by dataOffset.

Parameters:
fileName - (String) the name of the file to load symbols from. Relative paths are permitted, use ScripingEnvironment.setCurrentDirectory(String) to change the current working directory.
codeOffset - (long) the offset to move the program's code section
dataOffset - (long) the offset to move the program's data section
Throws:
ScriptingException

Can we concrete examples for using these two loading functions? Does the "address" and "offset" refer to in the .elf file or in the physical memory of the processor? And there is a lack of "length" specification like fread, so how many symbols do we load, or all the way down to the end of the ".out" file? There is a lack of fine-grain control here.

Dave

  • The addresses/ offsets refer the addresses in the target.

    section 1  text  0x8000

    section 2 text   0x9000

    section 3 data  0x2000

    section 4 data 0x1500

    loadWithOffset ("a.out", 0x6000, 0x1000 ) will load the sections to the target as follows:

    section 1  text  0x6000      // section 1 has the smallest address among all the text sections.

    section 2 text   0x7000      // 0x7000 = 0x6000  + (0x9000 - 0x8000)

    section 3 data  0x1500      // 0x1500 = 0x1000 + ( 0x2000 - 0x1500)

    section 4 data 0x1000      // section 4 has the smallest address among all the data sections.

    loadWithRelativeOffset ("a.out", 0x1000, 0x500 ) will load the sections to the target as follows:

    section 1  text  0x9000      // 0x9000 = 0x8000 + 0x1000.

    section 2 text   0xA000      // 0xA000 = 0x9000  + 0x1000.

    section 3 data  0x2000      // 0x2000 = 0x1500 + 0x500

    section 4 data 0x1500      // 0x15000 = 0x1000 + 0x500

    To have a finer control, use showSection.

    -Raymond

  • Thanks.

    But we see that there are usually dozens of symbols, including extra .bss, .stack, dwarf .debug_info, .debug_line, and .symtab and many others.
    If these two functions only load .text and .data sections, then
    (1) good side: they keep like .stack intact, so they do not corrupt runtime environment
    (2) bad side: they may cause section overlap, say if the new .text or .data is longer; and debug information may be obsolete with respect to the newly loaded sections.

    I intend to give up on this. But before that, please confirm with these suspicions.
  • loadwithoffset/loadwithrelativeoffset not only relocates the .text/.data sections but also relocate the .debug_* information.
    So the debug info is fixed up properly.