GDB hangs when pasting into the terminal before a `scanf` call
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- c, typescript, vscode
- Ambito
- devtools
Direzione di ricerca
Iniziate riproducendo il programma C fornito con VS Code 1.77.3, C/C++ extension 1.14.5 e MinGW-W64 GDB 13.1, seguendo la sequenza di incolla nel terminale ed esecuzione passo-passo. Confrontate il comportamento con il TDM-GCC GDB menzionato nel report e analizzate la gestione da parte del debugger dell'input standard incollato. Il lavoro è completato quando è stato identificato se il blocco è causato dall'extension o da GDB e il comportamento dopo il fix pertinente è stato confermato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- OS and version: Windows 10 19044.2846
- VS Code: 1.77.3
- C/C++ extension: 1.14.5
- OS and version of remote machine (if applicable): None
- GDB / LLDB version: GNU gdb (GDB for MinGW-W64 x86_64, built by Brecht Sanders) 13.1
Bug Summary and Steps to Reproduce
Bug Summary: When using the GDB from MinGW-W64 and debugging a program, if I paste some input into the terminal before the control flow reaches a scanf call, the debugger hangs after the scanf call as if it's stuck in an infinite loop.
Steps to reproduce:
- Download GCC 12.2.0 + LLVM/Clang/LLD/LLDB 16.0.0 + MinGW-w64 10.0.0 (UCRT) - release 5 for Win64 from winlibs.com.
- Debug this program
#include <stdio.h>
int main(void)
{
size_t height = 0, width = 0;
scanf("%zu %zu", &height, &width);
int maze[height][width];
}
with the play button and select the compiler you just downloaded, with a breakpoint at line 6(at the scanf). No launch.json or task.json required.
- When the execution stops at line 6, paste this line into the terminal:
1 1
- Press step over and observe that the debugger just hangs.
Debugger Configurations
None
Debugger Logs
=thread-group-added,id="i1"
GNU gdb (GDB for MinGW-W64 x86_64, built by Brecht Sanders) 13.1
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-w64-mingw32".
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 14560.0x49dc]
Thread 1 hit Breakpoint 1, 0x00007ff6fdaf17ea in main () at D:\Desktop\C\College\Portal\Portal1.c:4
4 {
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 'C:\WINDOWS\System32\ucrtbase.dll'. Symbols loaded.
Thread 1 hit Breakpoint 2, main () at D:\Desktop\C\College\Portal\Portal1.c:6
6 scanf("%zu %zu", &height, &width);
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
Other Extensions
No response
Additional Information
This problem doesn't occur if I use the GDB that came with TDM-GCC 10.3.0.
settings.json:
{
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"editor.formatOnType": false,
"editor.cursorSmoothCaretAnimation": "on",
"editor.fontFamily": "Monocraft",
"editor.fontSize": 15,
"editor.fontLigatures": true,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 0,
"terminal.integrated.fontFamily": "Monocraft",
"terminal.integrated.fontSize": 11,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"workbench.statusBar.visible": true,
"editor.smoothScrolling": true,
"editor.cursorBlinking": "smooth",
"security.workspace.trust.untrustedFiles": "open",
"workbench.editor.untitled.hint": "hidden",
"files.autoGuessEncoding": true,
"python.analysis.typeCheckingMode": "strict",
"powermode.enabled": false,
"redhat.telemetry.enabled": true,
"diffEditor.ignoreTrimWhitespace": false,
"editor.inlineSuggest.enabled": true,
"security.workspace.trust.startupPrompt": "always",
"security.workspace.trust.banner": "always",
"security.workspace.trust.enabled": false,
"workbench.iconTheme": "material-icon-theme",
"files.associations": {
"*.txt": "log"
},
"json.maxItemsComputed": 32648,
"[cpp]": {
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"editor.renderWhitespace": "none",
"editor.bracketPairColorization.enabled": false,
"code-runner.executorMap": {
"c": "cd $dir && gcc \"$fileName\" -o (\"$fileNameWithoutExt\" + \".exe\") -std=c17 -Wall -Wextra -pedantic -O2 && & (\"$dir$fileNameWithoutExt\" + \".exe\")",
"cpp": "cd $dir && g++ \"$fileName\" -o (\"$fileNameWithoutExt\" + \".exe\") -std=c++17 -Wall -Wextra -pedantic -O2 && & (\"$dir$fileNameWithoutExt\" + \".exe\")"
},
"code-runner.executorMapByFileExtension": {
".m": "cd $dir && matlab -batch \"$fileNameWithoutExt\""
},
"code-runner.runInTerminal": true,
"code-runner.clearPreviousOutput": false,
"code-runner.preserveFocus": false,
"terminal.integrated.enableMultiLinePasteWarning": false,
"[c]": {
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.cursorBlinking": true,
"[matlab]": {
"editor.defaultFormatter": "AffenWiesel.matlab-formatter"
},
"matlab.lintOnSave": true,
"matlab.mlintpath": "D:\\MATLAB\\bin\\win64\\mlint.exe",
"explorer.confirmDelete": false,
"C_Cpp.default.cStandard": "c17",
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.errorSquiggles": "disabled",
"C_Cpp.default.compilerArgs": [
"-Wall",
"-Wextra",
"-pedantic"
],
"C_Cpp.loggingLevel": "Debug",
"debug.onTaskErrors": "showErrors",
"clangd.path": "c:\\Users\\User\\AppData\\Roaming\\Code\\User\\globalStorage\\llvm-vs-code-extensions.vscode-clangd\\install\\15.0.3\\clangd_15.0.3\\bin\\clangd.exe",
"C_Cpp.intelliSenseEngine": "default",
"C_Cpp.autocomplete": "disabled",
"editor.inlayHints.enabled": "off",
"workbench.colorTheme": "Dracula",
"doxdocgen.generic.commandSuggestion": true,
"doxdocgen.c.triggerSequence": "///",
"doxdocgen.generic.commandSuggestionAddPrefix": true,
"clangd.detectExtensionConflicts": false,
"clangd.fallbackFlags": [
"-Weverything",
"-Wno-used-but-marked-unused",
"-Wno-declaration-after-statement",
"-Wno-vla",
"-Wno-missing-prototypes",
"-Wno-c++98-compat",
"-IC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/include",
"-IC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../include",
"-IC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/include-fixed",
"-IC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/include",
"-nostdinc",
"-target",
"x86_64-pc-windows-gnu"
],
"clangd.arguments": ["--log=verbose"],
"editor.acceptSuggestionOnEnter": "off",
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"editor.largeFileOptimizations": false,
"terminal.integrated.scrollback": 32768,
"editor.tokenColorCustomizations": { // Disables italics
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"comment.line",
"constant",
"constant.character",
"constant.character.escape",
"constant.numeric",
"constant.numeric.integer",
"constant.numeric.float",
"constant.numeric.hex",
"constant.numeric.octal",
"constant.other",
"constant.regexp",
"constant.rgb-value",
"emphasis",
"entity",
"entity.name",
"entity.name.class",
"entity.name.function",
"entity.name.method",
"entity.name.section",
"entity.name.selector",
"entity.name.tag",
"entity.name.type",
"entity.other",
"entity.other.attribute-name",
"entity.other.inherited-class",
"invalid",
"invalid.deprecated",
"invalid.illegal",
"keyword",
"keyword.control",
"keyword.operator",
"keyword.operator.new",
"keyword.operator.assignment",
"keyword.operator.arithmetic",
"keyword.operator.logical",
"keyword.other",
"markup",
"markup.bold",
"markup.changed",
"markup.deleted",
"markup.heading",
"markup.inline.raw",
"markup.inserted",
"markup.italic",
"markup.list",
"markup.list.numbered",
"markup.list.unnumbered",
"markup.other",
"markup.quote",
"markup.raw",
"markup.underline",
"markup.underline.link",
"meta",
"meta.block",
"meta.cast",
"meta.class",
"meta.function",
"meta.function-call",
"meta.preprocessor",
"meta.return-type",
"meta.selector",
"meta.tag",
"meta.type.annotation",
"meta.type",
"punctuation.definition.string.begin",
"punctuation.definition.string.end",
"punctuation.separator",
"punctuation.separator.continuation",
"punctuation.terminator",
"storage",
"storage.modifier",
"storage.type",
"string",
"string.interpolated",
"string.other",
"string.quoted",
"string.quoted.double",
"string.quoted.other",
"string.quoted.single",
"string.quoted.triple",
"string.regexp",
"string.unquoted",
"strong",
"support",
"support.class",
"support.constant",
"support.function",
"support.other",
"support.type",
"support.type.property-name",
"support.variable",
"variable",
"variable.language",
"variable.name",
"variable.other",
"variable.other.readwrite",
"variable.parameter"
],
"settings": {
"fontStyle": ""
}
}
]
},
"settingsSync.ignoredSettings": [
"editor.fontSize"
],
"files.maxMemoryForLargeFilesMB": 16384,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"[latex]": {
"editor.defaultFormatter": "James-Yu.latex-workshop"
},
"latex-workshop.latex.recipes": [
{
"name": "latexmk (xelatex)",
"tools": [
"cd",
"xelatexmk"
]
}
],
"latex-workshop.latex.tools": [
{
"name": "xelatexmk",
"command": "latexmk",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-xelatex",
"-outdir=%OUTDIR%",
"%DOC%"
],
"env": {}
},
{
"name": "cd",
"command": "cd",
"args": [
"%DIR%"
]
}
],
"latex-workshop.latex.recipe.default": "latexmk (xelatex)",
"latex-workshop.message.error.show": false,
"latex-workshop.message.warning.show": false,
"latex-workshop.message.information.show": false,
"editor.unicodeHighlight.allowedLocales": {
"zh-hant": true
},
"workbench.startupEditor": "none",
"cmake.configureOnOpen": false,
"editor.minimap.enabled": false,
"codesnap.showWindowControls": false,
"codesnap.containerPadding": "0",
"codesnap.transparentBackground": true,
"codesnap.backgroundColor": "#FFFFFF",
"codesnap.boxShadow": "none",
"update.showReleaseNotes": false,
"git.autofetch": true,
"git.enableSmartCommit": true,
"gitlens.views.commits.showBranchComparison": false,
"gitlens.views.showRelativeDateMarkers": false,
"git.confirmSync": false
}
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
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.
Altre issue di microsoft/vscode-cpptools
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Apertabug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 assegnatario ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 commento · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 64/100
microsoft/vscode-cpptools#14769 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
microsoft/vscode-cpptools#14768 · 1 commento ·
Tutte le issue di microsoft/vscode-cpptools
Issue simili
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
-
code-quality refactoring
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
langchain-ai/deepagents#6450 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
vercel/react-tweet#225 ·