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.

Information on dem470.exe

Hi,

I'm looking for documentation about the demangling application dem470.exe. I'd like to use it to demangle the name I get from the dwarf output of the compiler (TI ARM 4.9.0).

Thanks.

 

David.

  • Documentation for the demangler is in Chapter 8 of the TMS470 Compiler Users Guide.

  • Hi AartiG,

                 I looked at the document you pointed out and there is a small section about demangling names. Unfortunately it seems to have problem with the dem470.exe because if I use the exact same example as in the documentation the result is different and contains mistakes...

    Here's what I get:

    TMS470 C++ Demangler                    v4.9.0
    Tools Copyright (c) 1996-2011           Texas Instruments Incorporated
    alories_in_a_banana():
    ;* --------------------------------------------------------------------------*
    SUB.W #4,SP
    MOV.W SP,r12 ; |10|
    ADD.W #2,r12 ; |10|
    CALL #banana::_ct() ; |10|
    ; |10|
    MOV.W SP,r12 ; |11|
    ADD.W #2,r12 ; |11|
    CALL #banana::alories() ; |11|
    ; |11|
    MOV.W r12,0(SP) ; |11|
    MOV.W SP,r12 ; |11|
    ADD.W #2,r12 ; |11|
    MOV.W #2,r13 ; |11|
    CALL #banana::_dt() ; |11|
    ; |11|
    MOV.W 0(SP),r12 ; |11|
    ADD.W #4,SP
    RET

     

    If you see the "c" from calories is missing in the function name and the _dt was not translate into a ~ for destructor.

    Moreover, the documentation state few option that is not available with my dem470.exe such as -v, --abi  and -u.

     

    Thanks

     

  • I cannot reproduce what you show above.  Please show the options you use when running the compiler (cl470) and demangler (dem470).

    Thanks and regards,

    -George

  • Hi George,

    First thing: do you confirm that some option described in the document is not available in the help of dem470.exe?

    Second, I'm doing the following:

    "C:\Program Files\Texas Instruments\CCS v5.1\ccsv5\tools\compiler\tms470\bin\dem470.exe" -o res1.txt test1.xml

    where test1.xml contains:

    calories_in_a_banana__Fv:
    ;* --------------------------------------------------------------------------*
    SUB.W #4,SP
    MOV.W SP,r12 ; |10|
    ADD.W #2,r12 ; |10|
    CALL #__ct__6bananaFv ; |10|
    ; |10|
    MOV.W SP,r12 ; |11|
    ADD.W #2,r12 ; |11|
    CALL #calories__6bananaFv ; |11|
    ; |11|
    MOV.W r12,0(SP) ; |11|
    MOV.W SP,r12 ; |11|
    ADD.W #2,r12 ; |11|
    MOV.W #2,r13 ; |11|
    CALL #__dt__6bananaFv ; |11|
    ; |11|
    MOV.W 0(SP),r12 ; |11|
    ADD.W #4,SP
    RET

    and res1.txt is the output:

    TMS470 C++ Demangler                    v4.9.0
    Tools Copyright (c) 1996-2011           Texas Instruments Incorporated
    alories_in_a_banana():
    ;* --------------------------------------------------------------------------*
    SUB.W #4,SP
    MOV.W SP,r12 ; |10|
    ADD.W #2,r12 ; |10|
    CALL #banana::_ct() ; |10|
    ; |10|
    MOV.W SP,r12 ; |11|
    ADD.W #2,r12 ; |11|
    CALL #banana::alories() ; |11|
    ; |11|
    MOV.W r12,0(SP) ; |11|
    MOV.W SP,r12 ; |11|
    ADD.W #2,r12 ; |11|
    MOV.W #2,r13 ; |11|
    CALL #banana::_dt() ; |11|
    ; |11|
    MOV.W 0(SP),r12 ; |11|
    ADD.W #4,SP
    RET

    I'm not using cl470.exe.

     

  • David Henri said:
    do you confirm that some option described in the document is not available in the help of dem470.exe?

    Yes.  The -h option of dem470 does not show all of the available options.  I filed SDSCM00041780 in the SDOWP system to have this fixed.  Feel free to track that with the SDOWP link in my sig.  Note all the available options are described in the compiler manual.

    David Henri said:
    I'm not using cl470.exe.

    And that's why the demangler is not working.  It is only designed and tested to work the the TI ARM compiler.  It probably does work with other toolsets, provided you build for EABI and use the dem470 --abi=eabi option.  But it appears you are not building for EABI.

    Thanks and regards,

    -George

  • Hi George,

    It seems there is a misunderstanding. I read the chapter pointed out by AartiG in the previous post and this document gives a piece of c++ code that is compiled into assembly (most likely using cl470.exe) and the assembly output is given in the document, then the assembly containing mangled function name is passed through the dem470.exe to demangle it and the final result is shown. So I'm not using the cl470.exe because I'm using directly the assembly output given in the document and I try to demangle it using dem470.exe.

    I'm attaching a zip file of what I'm doing.8484.Dem470Test.rar

    Simply execute the DemanglerTest1.bat it will generates the wrong outputs I'm talking about in previous post.

     

    Is it possible the demangler dem470.exe is able to demangle only function names and not mangled variables names?

     

    Thanks.

  • David Henri said:
    Is it possible the demangler dem470.exe is able to demangle only function names and not mangled variables names?

    Is it possible the demangler dem470.exe is able to demangle only function names and not mangled variables types?

     

    Thanks

  • The answer on this one is pretty strange.  I'm hard put to think of a weirder response than this one here ...

    The example you refer to is not even ARM assembly code.  It is MSP430 assembly code.  Some error in producing the book causes the wrong example to appear.  I will file a CQ to have this fixed.  And sorry for the confusion.  

    I compiled the C++ source from the example with cl470, then I demangled that.  I assure you, that works with no problems.

    Thanks and regards,

    -George