首页 > 解决方案 > Clion 调试会话:/proc/self/cwd 中的断点定位

问题描述

我在 linux (rh6) 版本 2019.3.2 上运行 Clion IDE。

运行调试会话时,我在项目源文件(例如 /path/to/myproject/myFile.cpp)中设置的断点被忽略 - 当我运行调试会话时,它们从红点变为灰色的“禁用”符号.

我意识到(通过使用“异常中断”功能)在调试会话期间,源文件是从 /proc/self/cwd/ 看到的,并且断点与该位置而不是原始文件相关联,因此我最终得到编辑器中的两个选项卡引用相同的源文件。我在 /proc/self/cwd/myFile.cpp 中设置的断点被命中。

Clion 是如何提出源重复的?有谁知道解决这个问题的方法?

请注意,我在 IDE 之外构建并使用 CMakeLists.txt 纯粹作为项目文件(以获得导航/包含分辨率)。我有一个 add_custom_target() 语句可以创建调试目标。

我的 CMakeLists.txt(已简化,因此易于理解):

cmake_minimum_required(VERSION 3.7)
project(MyProject)

set(SOURCE_FILES
        Source1.C
        Source1.H
        Source2.C #has a main method
        Source2.H
)

add_library(libMyProject STATIC ${SOURCE_FILES}) # that's so the source files are visible by Clion (to get syntax highlighting etc)
add_custom_target(myProject_exe) # The executable I am trying to debug. I am building using bazel from outside Clion so I need to make the IDE aware of that custom target

标签: debuggingclion

解决方案


推荐阅读