C++ Debug breakpoint doesn't work with linked libraries built with the application in VSCode when using `-Og` compilation flag/option.
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- cmake, cpp, vscode
調査の方向性
提供されている launch.json、tasks.json、トップレベルの CMakeLists.txt から始め、GDB と -Og フラグを使用して Arithmetic.cpp:299 の保留中のブレークポイントを再現します。Console および DataStructuresAlgorithms.Core ターゲットのビルド中にデバッガーログを比較します。ブレークポイントがコンパイル済みコードに解決され、静的リンクされたライブラリ内でヒットすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 6.2k
- フォーク
- 1.7k
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 58
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/vscode-cpptools のほかの issue
-
bug Language Service regression
microsoft/vscode-cpptools#14795 · コメント 1 件 · 担当者 1 名 ·
-
bug Language Service parser
microsoft/vscode-cpptools#14794 · コメント 1 件 · 担当者 1 名 ·
-
more info needed
microsoft/vscode-cpptools#14793 · コメント 2 件 · 担当者 1 名 ·
-
more info needed
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
microsoft/vscode-cpptools#14787 · コメント 1 件 · 担当者 1 名 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries オープンbug fixed Language Service regression
microsoft/vscode-cpptools#14779 · コメント 1 件 · 担当者 1 名 ·
microsoft/vscode-cpptools の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
TanStack/tanstack.com#1293 ·