Open WittonBell opened 7 months ago
@WittonBell To clarify, you are using clang.exe
and what generator?
In the code, we have two checks that use a cppvsdbg debug type, and that is when the compiler ends with cl.exe and then when the msvc linker is being used (i.e. it ends with link.exe or ld.lld.exe. Here and here.
Is this assumption incorrect? Or is something happening where we are erroneously checking this? Any more information you can provide would help us investigate. Thanks.
@gcampbell-msft cmake
generator is Ninja
.
It is a simple c project, cmake call ninja to use clang.exe
to build project.
@WittonBell Thank you for your feedback, in order to better address your question, could you provide us with the project you have reproduced? Thank you in advance!
@Yingzi1234 我前面有提供代码,你可以使用我前述复现步骤中的代码。
@WittonBell According to your steps, I get the same result as you in "DEBUG CONSOLE", but the breakpoints in my main.c file can be hit! My reproduction steps are below, could you please check if they are correct for me? If this is incorrect, would you be able to provide us with a recording? This would be very helpful for us to investigate your question
Repro steps:
Actual result:
@Yingzi1234 看了你的GIF,你实际使用的是VS中的Clang,并非MinGW中的Clang,要复现问题需要使用MinGW中的Clang编译器。
按理说,使用不同的工具链,应该使用相应的调试器才对,比如使用MinGW中的GCC,应该默认使用MinGW中的GDB调试器;使用MinGW中的Clang,应该默认使用MinGW中的LLDB调试器;使用VS的CL编译器,才默认使用VS的调试器。
This problem can still be reproduced today using latest clang 18.1.8 (mingw). A workround is to use CodeLLVM plugin to configure lldb
.
This is my launch.json
and it works for me.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug with LLDB",
"type": "lldb",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
}
]
}
直到刚才我使用clang 18.1.8 (mingw)仍然能复现这一问题。
Sorry, I found that the debug button in the status bar is provided by the ms-vscode.cpptools
plugin, which should be it's problem. However, the latest version still has this issue.
The debug button in the status bar is from CMake Tools and ms-vscode.cpptools.
env: VSCode 1.87.2 c/c++ v1.19.6 CMakeTools v1.17.17 cmake 3.29 clang 18.1.1
repro step:
int main(int argc, char *argv[]) { printf("test\n"); while (1) {
} return 0; }
cmake_minimum_required(VERSION 3.25.0) project(x)
add_compile_options( -gdwarf-4 ) aux_source_directory(. SRC) add_executable(${PROJECT_NAME} ${SRC})