I have a Xcode project that is building a library and I want to be able to debug the library when it is loaded by the main application.
Run
and Debug
options from Run menu are disabled and if i try to use attach to process option I get "No launchable executable present at path"
. When looking at Active Executable I see but I don't know how to tell xcode what to run/debug.
So how should I debug the application? I'm looking for something similar to the project configuration of Visual Studio but I wasn't able to locate this option yet.
When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.
The “Debug executable” checkbox specifies whether or not you want to run with the debugger enabled. Once running, you can use Debug > Attach to Process on a process that has been launched with debugging disabled if needed. It seems like all this does is start your app with the debugger attached.
The Xcode debugger provides several methods to step through your code and inspect variables. You can precisely control execution of your code from a breakpoint, stepping into and out of called functions as necessary to determine where your bug occurs.
Add a custom executable to your project.
It is under the Project -> New Custom Executable... menu item.
From there, you can add your application as the custom executable and that will give you the ability to debug the application and the plug-in.
One additional helpful hint; in Xcode's build preferences set up a single common products directory. This will put the symbol files for building your application in the same directory as your application (assuming your main application is one you build) and, thus, you'll be able to step through frames in both your library and your application.
For those using Xcode 4:
Project > Scheme > Edit Scheme...
Select the Run phase > Info
And set an Executable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With