microsoft / microsoft/vscode-cpptools
The debugger doesn't hit the breakpoints set in Editor
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Environment
- OS and version: WIndows 11
- VS Code: 1.91.1 (system setup)
- C/C++ extension: 1.20.5
- OS and version of remote machine (if applicable):
- GDB / LLDB version: GNU gdb (GDB) 14.2 (installed by msys2)
Bug Summary and Steps to Reproduce
Bug Summary:
Let's take the code below (test.cpp) as an example.
#include <iostream>
int main()
{
std::cout << "Line 5" << std::endl;
std::cout << "Line 6" << std::endl;
return 0;
}
I marked all the 3 lines (line 5, 6, and 7) of main func as breakpoints. After that, I pushed F5. However, not only did the program print it's output in the "DEBUG CONSOLE" rather than either "TERMINAL" or a system terminal, but also it ran smoothly from the start to the end, without stopping at any one of the 3 breakpoints. Actually, in the output info in "DEBUG CONSOLE" there's a line saying "Thread 1 "test" hit Breakpoint 1, 0x000000010040108d in main ()", but the debugger didn't do this literally. It just skipped every breakpoints.
Steps to reproduce:
- In the environment given above.
- With thie configurations given below.
- Just create a simple HelloWorld C++ code and push
F5. - The breakpoints turn grey and say, "Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained."
Debugger Configurations
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "D:\\msys64\\usr\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-std=c++14",
"-Wall",
"-Wextra",
"-g"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: D:\\msys64\\usr\\bin\\g++.exe"
}
]
}
launch.json
{
"configurations": [
{
"name": "C/C++: g++.exe build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"internalConsoleOptions": "neverOpen",
"MIMode": "gdb",
"miDebuggerPath": "D:\\msys64\\usr\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": false
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
],
"version": "2.0.0"
}
Debugger Logs
=thread-group-added,id="i1"
GNU gdb (GDB) 14.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-msys".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
[New Thread 12480.0x1a18]
[New Thread 12480.0x1524]
[New Thread 12480.0x55c4]
[New Thread 12480.0x5b94]
Thread 1 "test" hit Breakpoint 1, 0x000000010040108d in main ()
Loaded '/c/Windows/SYSTEM32/ntdll.dll'. Symbols loaded.
Loaded '/c/Windows/System32/KERNEL32.DLL'. Symbols loaded.
Loaded '/c/Windows/System32/KERNELBASE.dll'. Symbols loaded.
Loaded '/usr/bin/msys-2.0.dll'. Symbols loaded.
Loaded '/usr/bin/msys-stdc++-6.dll'. Symbols loaded.
Loaded '/usr/bin/msys-gcc_s-seh-1.dll'. Symbols loaded.
Loaded '/c/Windows/System32/advapi32.dll'. Symbols loaded.
Loaded '/c/Windows/System32/msvcrt.dll'. Symbols loaded.
Loaded '/c/Windows/System32/sechost.dll'. Symbols loaded.
Loaded '/c/Windows/System32/bcrypt.dll'. Symbols loaded.
Loaded '/c/Windows/System32/RPCRT4.dll'. Symbols loaded.
Loaded '/c/Windows/SYSTEM32/CRYPTBASE.DLL'. Symbols loaded.
Loaded '/c/Windows/System32/bcryptPrimitives.dll'. Symbols loaded.
Loaded '/c/Windows/system32/netapi32.dll'. Symbols loaded.
Loaded '/c/Windows/SYSTEM32/SAMCLI.DLL'. Symbols loaded.
Loaded '/c/Windows/System32/ucrtbase.dll'. Symbols loaded.
Loaded '/c/Windows/SYSTEM32/SAMLIB.dll'. Symbols loaded.
Loaded '/c/Windows/SYSTEM32/NETUTILS.DLL'. Symbols loaded.
Loaded '/c/Windows/System32/ws2_32.dll'. Symbols loaded.
Loaded '/c/Windows/system32/mswsock.dll'. Symbols loaded.
Line 5
Line 6
[Thread 12480.0x3218 exited with code 0]
[Thread 12480.0x1524 exited with code 0]
[Thread 12480.0x1a18 exited with code 0]
[Thread 12480.0x55c4 exited with code 0]
[Inferior 1 (process 12480) exited normally]
The program 'e:\Coding\Programs\test.exe' has exited with code 0 (0x00000000).
The two lines of output would not be printed here when I disabled the extension "C/C++ Compile Run".
Other Extensions
- Better C++ Syntax
- C/C++ Compile Run
- C/C++ Themes
- GlassIt-VSC
- One Dark Pro
- Vim
Notably when I disabled "C/C++ Compile Run", the code would run in a system terminal. However, even if I leave only "C/C++" enabled, the debugger still did not hit the breakpoints literally.
Additional Information
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con le configurazioni tasks.json e launch.json segnalate e riproduci il problema usando l'esempio test.cpp fornito e i log del debugger, prima con abilitata solo l'estensione C/C++. Confronta lo stato dei breakpoint in grigio e il comportamento della console di debug con le impostazioni configurate di GDB e launch; l'attività è completata quando i breakpoint segnalati vengono risolti e l'esecuzione si arresta su di essi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, vscode
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100