使用conan包 - 调试软件包
本文是基于对conan官方文档Debugging packages的翻译而来, 更详细的信息可以去查阅conan官方文档。
This section shows how to setup your project and manage dependencies (i.e., install existing packages) with Conan.
本节将介绍如何使用 Conan 设置项目和管理依赖关系(即安装现有软件包)。
主目录 conan Using packages
- Installing dependencies
- Requires
- Generators
- Options
- Using profiles
- Workflows
- Single configuration
- Multi configuration
- Debugging packages
Debugging packages
In order to run a debug session and step into the source code, the debugger needs to find the source files (or pdb files ones for Visual Studio), for Mac and Unix system the location of these files is stored inside the library itself.
为了运行调试会话并进入源代码,调试器需要找到源文件(或 Visual Studio 的 pdb 文件),对于 Mac 和 Unix 系统,这些文件的位置存储在库本身中。
Usually Conan packages don’t include these files and if they do, the path to the local cache might be different: in a typical scenario the packages are generated in a CI machine and the debug session will take place in the developers one, so the path to the sources won’t be the same.
通常 Conan 软件包不包含这些文件,如果包含,本地缓存的路径也可能不同:在典型情况下,软件包是在 CI 机器上生成的,而调试会话将在开发人员的机器上进行,因此源代码的路径不会相同。
The only rule of thumb is to compile the library we want to debug in the developer machine, and thanks to Conan this is straightforward:
唯一的经验法则是在开发者机器中编译我们要调试的库,多亏了 Conan,这一点非常简单:
conan install <reference> --build <name> --profile <debug_profile>
This command will trigger the build of the library locally in the developer’s machine, so the binaries will point to the sources where they are actually located and the debugger will find them.
该命令将在开发人员的机器上触发本地库的构建,因此二进制文件将指向它们实际所在的源代码,调试器也能找到它们。
Note
Keep updated as we are investigating more integrated solutions using hooks and for the major IDEs, Visual Studio and CLion.
我们正在研究更多使用hooks的integrated solutions,以及主要集成开发环境(Visual Studio 和 CLion)的集成解决方案,请随时更新。