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.

addr2line for CGT?



hi all

 

does anyone know of a tool similar to the addr2line utility? or found a way to extract that information using one of the CGT utilities?

the addr2line utility converts an address to a line number/file pair, but unfortunately only works with ELF files (and the CGT output COFF).

cheers,

sam

 

for reference:

nobss@WS3055:~/$ addr2line -h
Usage: addr2line [option(s)] [addr(s)]
 Convert addresses into line number/file name pairs.
 If no addresses are specified on the command line, they will be read from stdin
 The options are:
  @<file>                Read options from <file>
  -b --target=<bfdname>  Set the binary file format
  -e --exe=<executable>  Set the input file name (default is a.out)
  -i --inlines           Unwind inlined functions
  -j --section=<name>    Read section-relative offsets instead of addresses
  -s --basenames         Strip directory names
  -f --functions         Show function names
  -C --demangle[=style]  Demangle function names
  -h --help              Display this information
  -v --version           Display the program's version

addr2line: supported targets: elf64-x86-64 elf32-i386 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
Report bugs to <http://www.sourceware.org/bugzilla/>

 

  • The GNU addr2line utility does work on TI compiler produced ELF files.  At this time, only the ARM compiler can produce ELF files.  You can to build for EABI with the option --abi=eabi.  The C6000 compiler has a beta release available which supports EABI, and a production release is coming soon.

    TI compilers, by default, produce COFF files.  The GNU addr2line utility does not work on such files.  There is no utility from TI which produces the same output as addr2line.  You can get similar information using --func_info option of the OFD utility.  Here is an example using ofd470 from the ARM toolset:

    % ofd470 --func_info file.out
    "C_MEMCPY","./memcpy32.asm",0x00003674,0x000037f4,384
    "FD_CMP","./fd_cmp32.asm",0x00003f34,0x00003ff4,192
    "FD_DIV","./fd_div32.asm",0x000034e4,0x00003674,400
    "FD_MUL","./fd_mul32.asm",0x000037f4,0x0000391c,296
    "FD_SUB","./fd_add32.asm",0x00003138,0x0000334c,532
    "FD_TOI","./fd_toi32.asm",0x00004610,0x0000466c,92
    "HOSTclock","SHARED/trgdrv.c",0x00002ae0,0x00002b58,120
    "HOSTclose","SHARED/trgdrv.c",0x00002a60,0x00002ae0,128
    ...
    

    The output is in CSV form, which can be loaded directly into Excel.  Each row describes one function.  The columns are: function name, file name, start address, end address, size

    Thanks and regards,

    -George

  • thanks george

    i am aware of the alternatives, i'm already using ofd6x for that purpose but wanted more accuracy within a function. EABI is not an option since we need to link against a legacy library which we're unable to rebuild

    cheers,

    sam