如何为没有任何可执行文件的项目启动 Xcode 调试器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2020405/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:03:13  来源:igfitidea点击:

How to start Xcode debugger for a project without any executable?

xcodedebugging

提问by sorin

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.

我有一个正在构建库的 Xcode 项目,我希望能够在主应用程序加载库时对其进行调试。

Runand Debugoptions 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.

RunDebug“运行”菜单中的选项被禁用,如果我尝试使用附加到处理选项,我会得到"No launchable executable present at path". 在查看 Active Executable 时,我看到了但我不知道如何告诉 xcode 运行/调试什么。

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.

那么我应该如何调试应用程序呢?我正在寻找类似于 Visual Studio 的项目配置的东西,但我还没有找到这个选项。

采纳答案by bbum

Add a custom executable to your project.

向您的项目添加自定义可执行文件。

It is under the Project -> New Custom Executable...menu item.

它位于Project -> New Custom Executable...菜单项下。

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.

一个额外的有用提示;在 Xcode 的构建首选项中设置一个通用的产品目录。这会将用于构建应用程序的符号文件与您的应用程序放在同一目录中(假设您的主应用程序是您构建的应用程序),因此,您将能够逐步浏览库和应用程序中的框架。

回答by Izhaki

For those using Xcode 4:

对于使用 Xcode 4 的用户:

Project > Scheme > Edit Scheme...

项目 > 方案 > 编辑方案...

Select the Run phase > Info

选择运行阶段 > 信息

And set an Executable

并设置一个可执行文件