How to see assembly listing of compiler output
How to see assembly listing of compiler output
I would like to see an assembly listing file for some (or all) of the .cpp files in my project to make sure the compiler output will give me adequate performance. Ideally, this would be a mixed listing showing the high level code embedded in the assembly listing, but just the assembly would be OK. I have tried using assembler directives in my gnu C and gnu c++ compiler options (-Wa, aln) and I can see the assembly list going past in the console, but no files are generated. I can't find any further information in the GNU documents provided by NB, and other hints found on the web only show how to use a command line option on a single input file. Is there a way to get assembly listing files from a make?
Re: How to see assembly listing of compiler output
Try this:
Start a debug build and connect with the debugger. Once in the debug perspective, click on Window->Show View->Other and select Debug->Disassembly. It will pop up a new window the assembler code. At this point, you can even choose to step through assmbler code.
Start a debug build and connect with the debugger. Once in the debug perspective, click on Window->Show View->Other and select Debug->Disassembly. It will pop up a new window the assembler code. At this point, you can even choose to step through assmbler code.
Forrest Stanley
Project Engineer
NetBurner, Inc
NetBurner Learn Articles: http://www.netburner.com/learn
Project Engineer
NetBurner, Inc
NetBurner Learn Articles: http://www.netburner.com/learn
Re: How to see assembly listing of compiler output
I am aware that I can step through code and look at the dis-assembly window once the project builds completely, and I have hardware to download to, etc. Other tools I have used, such as CodeWarrior and CodeComposer, let you compile and get a dis-assembly listing of a single file without building the entire project or needing hardware. This is somewhat more handy than bulding and downloading the project repeatedly to tune the source code syntax, local vairables vs pointers, case statements vs jump tables, etc. Since it appears that the assembler does have the option to output a mixed listing, I was just hoping there was an easier way.
Re: How to see assembly listing of compiler output
I've poured through the gcc manual a few times, mostly hoping it'd somehow show up but gcc doesn't have a compile through assembly option that I can find.
Re: How to see assembly listing of compiler output
Hi,
In the GNU package installed with the NNDK there is a command line tool that prints out the generated disassembly code from an elf file. Open a command window to the directory that contains the project .elf generated from the make. Then type:
m68k-elf-objdump -S Your_Project.elf >AssemblerOutput.txt
This will create a text file in the directory that contains a pretty readable version of assembly in Your_Project.elf. Most of your C/C++ function names and variables will still be used in the code which is nice. If you want to experiment with the other options type:
m68k-elf-objdump -?
-Larry
In the GNU package installed with the NNDK there is a command line tool that prints out the generated disassembly code from an elf file. Open a command window to the directory that contains the project .elf generated from the make. Then type:
m68k-elf-objdump -S Your_Project.elf >AssemblerOutput.txt
This will create a text file in the directory that contains a pretty readable version of assembly in Your_Project.elf. Most of your C/C++ function names and variables will still be used in the code which is nice. If you want to experiment with the other options type:
m68k-elf-objdump -?
-Larry
Re: How to see assembly listing of compiler output
Found one at the following link. Search for "how to make a list file"
http://www.netburner.com/support/techni ... ments.html
http://www.netburner.com/support/techni ... ments.html
Re: How to see assembly listing of compiler output
Thanks for the suggestions on using the objdump utility. With the -S and -G options, it does provide a useable assembly listing, although the high level source code is not embedded. It even works on individual source files (.od extension) in the project output folder, although jumps will be stubbed since it has not linked. The text file is generated much more quickly for a single file. The listing will give a feeling for how much code is being generated per function, although it looks like downloading and debugging with the disasembly view, as you originally suggested, is the best option overall.