O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Seeing the Generated Assembly Code

The real hard-core hackers can look at the assembly code generated by the compiler. Sometimes you need this to track down compiler problems or OS problems. Or you can browse around just for general amusement and education. To get the assembly code, compile with the -S flag, and the results will be put into an .s file based on the name of your source file. For instance, running

$​ ​g​c​c​ ​-​g​ ​-​W​a​l​l​ ​-​S​ ​p​r​e​p​r​o​c​T​e​s​t​.​m​

will create a preprocTest.s. If you want to assemble the resulting file, feed it to the compiler like this:

$​ ​g​c​c​ ​-​o​ ​p​r​e​p​r​o​c​T​e​s​t​ ​p​r​e​p​r​o​c​T​e​s​t​.​s​

Xcode 3 provides a Show Assembly Code item in the editor’s contextual menu so you can see what ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required