C++ Debug breakpoint doesn't work with linked libraries built with the application in VSCode when using `-Og` compilation flag/option.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- cmake, cpp, vscode
- Lĩnh vực
- build-system, developer-experience, devtools
Hướng nghiên cứu
Bắt đầu với launch.json, tasks.json được cung cấp và CMakeLists.txt ở cấp cao nhất, sau đó tái hiện breakpoint đang chờ cho Arithmetic.cpp:299 bằng GDB và các cờ -Og. So sánh nhật ký của trình gỡ lỗi khi build các target Console và DataStructuresAlgorithms.Core; hoàn tất khi breakpoint được phân giải thành mã đã biên dịch và được hit bên trong thư viện liên kết tĩnh.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- OS and version: Ubuntu 25.10
- VS Code: 1.114.0
- C/C++ extension: 1.5.1
- OS and version of remote machine (if applicable):
- GDB / LLDB version: 16.3
Bug Summary and Steps to Reproduce
Bug Summary:
Breakpoints set inside a statically linked library built with the same C++ application in the same source tree are greyed out and not hit.
Steps to reproduce:
Console.cpp CMakeLists.txt:
target_link_libraries(${PROJECT_NAME} PRIVATE
MyLibrary.Core
)
top-level CMakeLists.txt:
set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_BUILD_TYPE "Debug")
# ###############################################################################
# Global compiler options
# https://stackoverflow.com/questions/79444534/vscode-cmake-configure-does-not-generate-cmakecache-txt-from-cmakelists-txt
# CMAKE_CXX_COMPILER_ID is set only at the project() call, when CMake actually detect compilers.
# ###############################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
message("-- Setting GNU options from CMakeLists.txt")
set(CMAKE_CXX_FLAGS "-std=gnu++26 -fdiagnostics-color=always" CACHE STRING "CXX build flags" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -ggdb3 -Og -g3" CACHE STRING "Debug build flags" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG" CACHE STRING "Release build flags" FORCE)
endif()
Debugger Configurations
launch.json:
{
"name": "C++ Launch (Console)",
"type": "cppdbg",
"request": "launch",
"preLaunchTask": "CMake: build all",
"postDebugTask": "",
"program": "${workspaceFolder}/Debug/Console",
"cwd": "${workspaceFolder}/build",
"stopAtEntry": false,
"externalConsole": false,
"launchCompleteCommand": "exec-run",
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
},
"args": [],
"setupCommands": [
{
"description": "Disable MI-async",
"text": "set mi-async off",
"ignoreFailures": true
},
{
"description": "Enable auto-load for all paths. Considered a security risk. See link for details: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Auto_002dloading-safe-path.html",
"text": "set auto-load safe-path /",
"ignoreFailures": true
},
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
},
{
"description": "Do not display function arguments when printing a stack frame",
"text": "set print frame-arguments none",
"ignoreFailures": true
}
]
},
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "CMake: build all",
"command": "build",
"targets": [
"all"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": ["$gcc"],
"detail": "CMake build all"
},
{
"type": "cmake",
"label": "CMake: build Console",
"command": "build",
"targets": [
"Console"
],
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": ["$gcc"],
"detail": "CMake build Console"
},
{
"type": "cmake",
"label": "CMake: build Core",
"command": "build",
"targets": [
"DataStructuresAlgorithms.Core"
],
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": ["$gcc"],
"detail": "CMake build Core"
},
{
"type": "cmake",
"label": "CMake: build Tests",
"command": "build",
"targets": [
"DataStructuresAlgorithms.Tests"
],
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": ["$gcc"],
"detail": "CMake build Tests"
},
]
}
Debugger Logs
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (590) DebuggerPid=583206\n"},"seq":185}
1: (590) DebuggerPid=583206
<-- C (setBreakpoints-4): {"command":"setBreakpoints","arguments":{"source":{"name":"Arithmetic.cpp","path":"/usr/src/DataStructuresAlgorithms/src/Arithmetic.cpp"},"lines":[299,323],"breakpoints":[{"line":299},{"line":323}],"sourceModified":false},"type":"request","seq":4}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (604) <-1016-break-insert -f Arithmetic.cpp:299\n"},"seq":188}
1: (604) <-1016-break-insert -f Arithmetic.cpp:299
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (701) ->&\"No compiled code for line 299 in file \\\"Arithmetic.cpp\\\".\\n\"\n"},"seq":190}
1: (701) ->&"No compiled code for line 299 in file \"Arithmetic.cpp\".\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (702) ->1016^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"Arithmetic.cpp:299\",times=\"0\",original-location=\"Arithmetic.cpp:299\"}\n"},"seq":192}
1: (702) ->1016^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="Arithmetic.cpp:299",times="0",original-location="Arithmetic.cpp:299"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (702) ->(gdb)\n"},"seq":194}
Other Extensions
No response
Additional Information
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 6.2k
- Fork
- 1.7k
- Merge trung bình
- 1 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 58
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/vscode-cpptools
-
bug Language Service regression
microsoft/vscode-cpptools#14795 · 1 bình luận · 1 người được giao ·
-
bug Language Service parser
microsoft/vscode-cpptools#14794 · 1 bình luận · 1 người được giao ·
-
more info needed
microsoft/vscode-cpptools#14793 · 2 bình luận · 1 người được giao ·
-
more info needed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/vscode-cpptools#14787 · 1 bình luận · 1 người được giao ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Đang mởbug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 bình luận · 1 người được giao ·
Tất cả issue của microsoft/vscode-cpptools
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/claude-code#96687 ·
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
AOSSIE-Org/DebateAI#582 · 2 bình luận ·