Symbian
Symbian OS Library

FAQ-0643 How do I get ARM or THUMB assembler from my C++ files?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Debugging
Created: 08/19/99 Modified: 02/25/2002
Number: FAQ-0643
Platform: ER5, Symbian OS v6.0, Symbian OS v6.1

Question:
I've got a suspected compiler bug, so I need to get some assembler listings for either THUMB or ARMI assembler, plus a
standalone C++ source file which could be used to debug the compiler. How do I get these things easily?


Answer:
For v6.0 and above, and assuming you are using ABLD, the listing can be produced directly. For the example above, you would type
    abld listing armi urel thisdll thisfile
    and the assembler listing would be produced as thisfile.lis in the same directory as thisfile.cpp. If you don't specify "thisfile", ABLD will produce a listing for every source file in the specified MMP file.


    For earlier versions, and/or to generate .ii and .s files in order to report compiler bugs:

    Find the relevant source file, e.g. \compname\source\thisfile.cpp

    Then for Symbian OS v6.1 and earlier:
      1. Find the relevant MMP file, e.g. \compname\group\thisdll.mmp
      2. Run MAKMAKE locally to generate the appropriate makefile, e.g. "makmake thisdll armi" produces thisdll.armi
      3. Build the dll using the generated makefile, e.g. "nmake -f thisdll.armi urel"
      4. Edit the generated makefile to change "-pipe" into "-save-temps"
      5. Change the relevant source file by adding and removing a blank line
      6. Rebuild the dll using the modified makefile, e.g. "nmake -f thisdll.armi urel"
        For Symbian OS v7.0, as MAKMAKE generates GNU makefiles for ABIs that use gcc or the CodeWarrior compiler:

          1. Find the relevant MMP file, e.g. \compname\group\thisdll.mmp
          2. Run MAKMAKE locally to generate the appropriate makefile, e.g. "makmake thisdll armi" produces thisdll.armi
          3. Build the dll using the generated makefile, e.g. "make -f thisdll.armi urel"
          4. Edit the generated makefile to change "-pipe" into "-save-temps"
          5. Change the relevant source file by adding and removing a blank line
          6. Rebuild the dll using the modified makefile, e.g. "make -f thisdll.armi urel"
          This will generate files called thisfile.ii and thisfile.s in the current directory - the .ii file is the result of preprocessing the source file, so it includes all of the code which the compiler sees in one handy file (usually about 300K to 600K in size!). The .s file is the corresponding assembler source.

          If you have an instruction offset within a function, you probably need to compile the .s file, which you do by typing
            x:\epoc32\gcc\bin\as -adhln thisfile.s >thisfile.lis
            (assuming you are working on drive X). The assembler is generic so it will handle both ARM and THUMB assembler files without needing to be told which is which.