简体   繁体   中英

Xcode 4 external build project and debugging

I've got a makefile based project set up that builds my code on multiple platforms. On my Mac I want to use Xcode for debugging though. I've set up an Xcode as an External Build Project I can run the application from within Xcode. The output is shown in Xcode and if the app crashes it drops in to the debugger, but when running the debugger cannot locate the source files, so I just see assembly output. How can I tell Xcode where to locate the source?

I also cannot set breakpoints, but I think that this is all the same problem.

I was able to fix the issue of not stopping at breakpoints by setting a custom working directory for the executable. Before this change I was able to build successfully using the external scons system from Xcode 4. My code would run when called from XCode but breakpoints would be ignored.

Then in XCode, Go to Product -> Edit Scheme... CHeck 'use custom working directory' and I set this to the same directory as the executable.

Breakpoints then started working.

  1. Ensure -g is included in the compiler options in the makefile.
  2. Set a custom working directory in the scheme, set the executable if this hasn't already been set.
  3. Ensure that the project isn't pulling in dylibs that haven't been compiled with -g. You might need a build step to run make install if the project builds dylibs as well as the main target.
  4. Make sure that "strip" isn't being called. There are environment vars that xcode set that allow you to keep a working makefile when used outside xcode.

Just had this problem and this worked (Xcode 4.6) (got source debugging and working breakpoints)

In "Project Navigator" (the file-folder icon just below the "Run" button), right click and select "Add Files To your-project ". Browse to the top level folder where you would normally run the external build, and click Add.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM