xcodemacosoptimization

Application plugin fails at any optimization level other than -o0 OSX


I am running into a very odd problem when building an application plugin under XCode4. (Apple LLVM 4.2 ) The project in question builds a plugin file for an external application, which is basically a bundle, but with a different extension. The plugin itself is doing some manipulation of video streams and has some pretty high throughput requirements, hence the need for decently optimized code.

BUT, as soon as I enable any optimization level other than None [-O0], the application takes forever to load my plugin, and as a result my plugin never gets used. From my debugging so far i cannot see any obvious location where my code is failing, or taking a different path compared to the un-optimized version of the code. Earlier versions of the code used to compile fine using optimization under Xcode3, however the addition of new features require more performance, and not using optimization is no longer acceptable.

So i am hoping someone can provide some tips on debugging / tracking down this issue? It is all pretty standard C++, with some pthreads stuff. Sadly i have not developed debugging skills or techniques for this particular situation.

The host application does provide a sample project, which does compile fine with optimizations turned on. However i am looking for debugging techniques methods, OTHER than simply rebuilding my project line by line to try and find the offending code.

Thanks in advance,

James.

PS. Be nice this is my first post here. great resource btw.


Solution

  • I think cobbal has already provided a suitable answer, ie. try enabling optimization on a file by file basis.

    I have tried this, and now i have have the plugin compiling the file containing the CPU intensive code getting compiled with optimizations, i have also discovered which file contains the offending code.

    Selective enabling of compile options on a file by file basis, can be a powerful debugging tool.

    So thanks cobbal.

    (not sure how to give him any credit for providing the correct answer)