GDB hangs when pasting into the terminal before a `scanf` call
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- c, typescript, vscode
- Área
- devtools
Línea de trabajo
Comience reproduciendo el programa C proporcionado con VS Code 1.77.3, C/C++ extension 1.14.5 y MinGW-W64 GDB 13.1, siguiendo la secuencia de pegado en la terminal y ejecución paso a paso. Compare el comportamiento con el TDM-GCC GDB mencionado en el informe e inspeccione cómo el depurador gestiona la entrada estándar pegada. Se considera terminado cuando se haya identificado si la extension o GDB causa el bloqueo y se haya confirmado el comportamiento después del fix correspondiente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
}
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.2k
- Forks
- 1.7k
- Merge medio
- 14 h 46 min
- PR fusionados (30 d)
- 61
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/vscode-cpptools
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Abiertobug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 asignado ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 comentario · 1 asignado ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 64/100
microsoft/vscode-cpptools#14769 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
microsoft/vscode-cpptools#14768 · 1 comentario ·
Todos los issues de microsoft/vscode-cpptools
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
area:tools bug good first issue help wanted priority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
newrelic-experimental/preflight#793 · 1 comentario ·
-
bug 🐞
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
BasedHardware/omi#15320 ·