microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.5k stars 1.55k forks source link

Freezes on input statements #10864

Closed Dru01 closed 4 months ago

Dru01 commented 1 year ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

When debugging a c++ program if the input is enter before a step over or step into a 'cin' statement the debuggers hangs/freezes/pause and doesn't continue neither let give any input in the internal terminal.

It's nice to use the integrated terminal and it'll be nice if i can debug some simple programs with the same terminal input over and over again, so I can simple paste it at the beginning.

Steps to reproduce:

  1. Create a .cpp file with the following code:
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int a, b, c, d;

    int N;
    N=1;

    cin >> a;
    cin >> b;
    c = a + b;
    cin >> d;
    cout << c + d;
    return 0;
}
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c17",
            "cppStandard": "gnu++17"
        }
    ],
    "version": 4
}
  1. Set a breakpoint before or in the same line of any of the cin statements.
  2. Run and Debug with g++.exe (mine is from msys)
  3. Paste the following input:
1
2
3
  1. Try to step_over/step_into.

Video:

https://user-images.githubusercontent.com/37126509/233818226-7a95daaf-062f-4aba-8863-36493ef4ee24.mp4

Debugger Configurations


{
    "tasks": [
        {
            "type": "shell",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\msys64\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
{
    "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": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "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
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file",
            "logging": { "engineLogging": true }
        }
    ],
    "version": "2.0.0"
}

### Debugger Logs

```shell
1: (62) LaunchOptions{"name":"C/C++: g++.exe build and debug active file","type":"cppdbg","request":"launch","program":"C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.exe","args":[],"stopAtEntry":false,"cwd":"C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test","environment":[],"externalConsole":false,"MIMode":"gdb","miDebuggerPath":"C:\\msys64\\mingw64\\bin\\gdb.exe","setupCommands":[{"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}],"preLaunchTask":"C/C++: g++.exe build active file","logging":{"engineLogging":true},"configSource":"workspaceFolder","detail":"preLaunchTask: C/C++: g++.exe build active file","existing":true,"debuggerEvent":"playButton","debugType":"debug","__sessionId":"93154e57-d5ec-4cfd-9fd7-63547836d42c"}
1: (116) Wait for connection completion.
1: (469) ->=thread-group-added,id="i1"
1: (470) ->~"GNU gdb (GDB) 13.1\n"
1: (470) ->~"Copyright (C) 2023 Free Software Foundation, Inc.\n"
1: (470) ->~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
1: (471) ->~"\nType \"show copying\" and \"show warranty\" for details.\n"
1: (471) ->~"This GDB was configured as \"x86_64-w64-mingw32\".\n"
1: (472) ->~"Type \"show configuration\" for configuration details.\n"
1: (472) ->~"For bug reporting instructions, please see:\n"
1: (473) ->~"<https://www.gnu.org/software/gdb/bugs/>.\n"
1: (473) ->~"Find the GDB manual and other documentation resources online at:\n    <"
1: (473) ->~"http://www.gnu.org/software/gdb/documentation/>.\n\n"
1: (473) ->~"For help, type \"help\".\n"
1: (473) ->~"Type \"apropos word\" to search for commands related to \"word\".\n"
1: (476) ->(gdb)
1: (479) <-1001-gdb-set mi-async on
1: (493) ->1001^done
1: (493) ->(gdb)
1: (494) ->&"\n"
1: (494) ->^done
1: (494) ->(gdb)
1: (496) 1001: elapsed time 17
1: (498) <-1002-interpreter-exec console "show configuration"
1: (510) ->~"This GDB was configured as follows:\n   configure --host="
1: (511) ->~"x86_64-w64-mingw32 --target=x86_64-w64-mingw32\n"
1: (511) ->~"\t     --with-auto-load-dir=$debugdir:$datadir/auto-load\n\t     --with-auto-load-safe-path="
1: (511) ->~"$debugdir:$datadir/auto-load\n"
1: (511) ->~"\t     --with-expat\n"
1: (511) ->~"\t     --with-gdb-datadir=/mingw64/share/gdb (relocatable)\n"
1: (512) ->~"\t     --with-jit-reader-dir=/mingw64/lib/gdb (relocatable)\n"
1: (512) ->~"\t     --without-libunwind-ia64\n"
1: (512) ->~"\t     --with-lzma\n"
1: (512) ->~"\t     --without-babeltrace\n"
1: (512) ->~"\t     --without-intel-pt\n"
1: (512) ->~"\t     --with-mpfr\n"
1: (513) ->~"\t     --with-xxhash\n"
1: (513) ->~"\t     --with-python=/mingw64 (relocatable)\n"
1: (513) ->~"\t     --with-python-libdir=/mingw64/lib (relocatable)\n"
1: (513) ->~"\t     --without-debuginfod\n"
1: (513) ->~"\t     --without-guile\n"
1: (514) ->~"\t     --disable-source-highlight\n"
1: (514) ->~"\t     --enable-threading\n"
1: (514) ->~"\t     --with-separate-debug-dir=/mingw64/lib/debug (relocatable)\n"
1: (514) ->~"\t     --with-system-gdbinit=/mingw64/etc/gdbinit (relocatable)\n"
1: (514) ->~"\n(\"Relocatable\" means the directory can be moved with the GDB installation\ntree, and GDB will still find it.)\n"
1: (515) ->1002^done
1: (515) ->(gdb)
1: (515) 1002: elapsed time 16
1: (515) ->&"\n"
1: (515) ->^done
1: (516) ->(gdb)
1: (530) <-1003-enable-pretty-printing
1: (543) ->1003^done
1: (543) 1003: elapsed time 13
1: (543) ->(gdb)
1: (543) <-1004-gdb-set disassembly-flavor intel
1: (544) ->&"\n"
1: (544) ->^done
1: (544) ->(gdb)
1: (560) ->1004^done
1: (560) 1004: elapsed time 16
1: (560) ->(gdb)
1: (560) <-1005-interpreter-exec console "set pagination off"
1: (560) ->&"\n"
1: (560) ->^done
1: (560) ->(gdb)
1: (576) ->=cmd-param-changed,param="pagination",value="off"
1: (577) ->1005^done
1: (577) 1005: elapsed time 16
1: (577) ->(gdb)
1: (577) <-1006-gdb-set auto-solib-add on
1: (577) ->&"\n"
1: (577) ->^done
1: (577) ->(gdb)
1: (601) ->1006^done
1: (601) 1006: elapsed time 24
1: (602) <-1007-gdb-set solib-search-path C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test;
1: (601) ->(gdb)
1: (602) ->&"\n"
1: (602) ->^done
1: (602) ->(gdb)
1: (617) ->1007^done
1: (618) 1007: elapsed time 16
1: (618) <-1008-environment-cd "C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test"
1: (618) ->(gdb)
1: (618) ->&"\n"
1: (618) ->^done
1: (618) ->(gdb)
1: (619) ->1008^done
1: (619) 1008: elapsed time 0
1: (619) ->(gdb)
1: (619) <-1009-file-exec-and-symbols "C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.exe"
1: (619) ->&"\n"
1: (619) ->^done
1: (619) ->(gdb)
1: (638) ->1009^done
1: (639) ->(gdb)
1: (639) 1009: elapsed time 20
1: (639) <-1010-interpreter-exec console "show architecture"
1: (639) ->&"\n"
1: (639) ->^done
1: (639) ->(gdb)
1: (639) ->~"The target architecture is set to \"auto\" (currently \"i386:x86-64\").\n"
1: (640) ->1010^done
1: (640) 1010: elapsed time 0
1: (640) ->(gdb)
1: (640) ->&"\n"
1: (640) ->^done
1: (640) ->(gdb)
1: (641) <-1011-exec-arguments 2>CON 1>CON <CON
1: (651) ->1011^done
1: (651) ->(gdb)
1: (651) 1011: elapsed time 10
1: (651) <-1012-break-insert -f main
1: (651) ->&"\n"
1: (651) ->^done
1: (652) ->(gdb)
1: (653) ->1012^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000140001464",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",thread-groups=["i1"],times="0",original-location="main"}
1: (653) ->(gdb)
1: (653) ->&"\n"
1: (653) ->^done
1: (653) ->(gdb)
1: (658) 1012: elapsed time 6
1: (662) Send Event AD7EngineCreateEvent
1: (664) Send Event AD7ProgramCreateEvent
1: (694) ShellPid=8444
1: (700) DebuggerPid=3288
1: (720) <-1013-break-insert -f A.cpp:10
1: (731) ->1013^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000000140001464",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",thread-groups=["i1"],times="0",original-location="A.cpp:10"}
1: (732) 1013: elapsed time 11
1: (732) ->(gdb)
1: (732) ->&"\n"
1: (732) ->^done
1: (732) ->(gdb)
1: (742) <-1014-symbol-list-lines "C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp"
1: (756) ->1014^done,lines=[{pc="0x0000000140001450",line="6"},{pc="0x000000014000145f",line="6"},{pc="0x0000000140001464",line="10"},{pc="0x000000014000146b",line="12"},{pc="0x0000000140001481",line="13"},{pc="0x0000000140001497",line="14"},{pc="0x000000014000149d",line="14"},{pc="0x00000001400014a2",line="15"},{pc="0x00000001400014b8",line="16"},{pc="0x00000001400014d1",line="17"},{pc="0x00000001400014d6",line="18"},{pc="0x00000001400014dc",line="0"},{pc="0x00000001400014fa",line="18"},{pc="0x0000000140001508",line="18"},{pc="0x0000000140001517",line="0"},{pc="0x0000000140001535",line="18"},{pc="0x000000014000153c",line="18"},{pc="0x0000000140001544",line="18"},{pc="0x000000014000155a",line="0"}]
1: (756) ->(gdb)
1: (756) ->&"\n"
1: (756) ->^done
1: (757) 1014: elapsed time 14
1: (757) ->(gdb)
1: (763) Send Event AD7BreakpointBoundEvent
1: (767) <-1015-break-insert -f A.cpp:12
1: (772) ->1015^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x000000014000146b",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="12",thread-groups=["i1"],times="0",original-location="A.cpp:12"}
1: (772) 1015: elapsed time 5
1: (772) ->(gdb)
1: (772) ->&"\n"
1: (772) ->^done
1: (773) Send Event AD7BreakpointBoundEvent
1: (773) ->(gdb)
1: (773) <-1016-break-insert -f A.cpp:16
1: (788) ->1016^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x00000001400014b8",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="16",thread-groups=["i1"],times="0",original-location="A.cpp:16"}
1: (789) 1016: elapsed time 15
1: (789) ->(gdb)
1: (789) Send Event AD7BreakpointBoundEvent
1: (789) ->&"\n"
1: (789) ->^done
1: (789) ->(gdb)
1: (838) Send Event AD7LoadCompleteEvent
=thread-group-added,id="i1"
GNU gdb (GDB) 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"
1: (849) <-1017-exec-run
1: (1514) ->=thread-group-started,id="i1",pid="16748"
1: (1514) ->=thread-created,id="1",group-id="i1"
1: (1517) ->=thread-created,id="2",group-id="i1"
1: (1517) ->~"[New Thread 16748.0x3238]\n"
1: (1517) <-1018-thread-info 1
1: (1517) ->=thread-created,id="3",group-id="i1"
1: (1518) ->~"[New Thread 16748.0x310c]\n"
1: (1518) ->=thread-created,id="4",group-id="i1"
1: (1518) ->~"[New Thread 16748.0x7f4]\n"
1: (1519) <-1019-thread-info 2
[New Thread 16748.0x3238]
1: (1520) <-1020-thread-info 3
[New Thread 16748.0x310c]
1: (1521) <-1021-thread-info 4
[New Thread 16748.0x7f4]
1: (1521) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff607581464",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",thread-groups=["i1"],times="0",original-location="main"}
1: (1522) ->=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff607581464",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",thread-groups=["i1"],times="0",original-location="A.cpp:10"}
1: (1522) ->=breakpoint-modified,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff60758146b",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="12",thread-groups=["i1"],times="0",original-location="A.cpp:12"}
1: (1522) ->=breakpoint-modified,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff6075814b8",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="16",thread-groups=["i1"],times="0",original-location="A.cpp:16"}
1: (1525) <-1022-symbol-list-lines "C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp"
1: (1526) <-1023-symbol-list-lines "C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp"
1: (1526) <-1024-symbol-list-lines "C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp"
1: (1526) ->=library-loaded,id="C:\\Windows\\SYSTEM32\\ntdll.dll",target-name="C:\\Windows\\SYSTEM32\\ntdll.dll",host-name="C:\\Windows\\SYSTEM32\\ntdll.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffa153f1000",to="0x00007ffa15603610"}]
1: (1527) ->=library-loaded,id="C:\\Windows\\System32\\kernel32.dll",target-name="C:\\Windows\\System32\\kernel32.dll",host-name="C:\\Windows\\System32\\kernel32.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffa13891000",to="0x00007ffa1395136c"}]
1: (1533) ->=library-loaded,id="C:\\Windows\\System32\\KernelBase.dll",target-name="C:\\Windows\\System32\\KernelBase.dll",host-name="C:\\Windows\\System32\\KernelBase.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffa129c1000",to="0x00007ffa12d5b76c"}]
1: (1534) ->=library-loaded,id="C:\\Windows\\System32\\msvcrt.dll",target-name="C:\\Windows\\System32\\msvcrt.dll",host-name="C:\\Windows\\System32\\msvcrt.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffa14b31000",to="0x00007ffa14bd6580"}]
1: (1534) ->=library-loaded,id="C:\\msys64\\mingw64\\bin\\libstdc++-6.dll",target-name="C:\\msys64\\mingw64\\bin\\libstdc++-6.dll",host-name="C:\\msys64\\mingw64\\bin\\libstdc++-6.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ff9a3751000",to="0x00007ff9a3942f14"}]
1: (1534) ->=library-loaded,id="C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll",target-name="C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll",host-name="C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ff9ecb01000",to="0x00007ff9ecb15060"}]
1: (1534) ->=library-loaded,id="C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll",target-name="C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll",host-name="C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ff9ecb21000",to="0x00007ff9ecb41060"}]
1: (1556) ->1017^running
1: (1556) ->*running,thread-id="all"
1: (1556) 1017: elapsed time 706
1: (1556) ->(gdb)
1: (1556) ->&"\n"
1: (1556) ->^done
1: (1556) ->(gdb)
1: (1560) ->=library-loaded,id="C:\\Windows\\SYSTEM32\\cryptbase.dll",target-name="C:\\Windows\\SYSTEM32\\cryptbase.dll",host-name="C:\\Windows\\SYSTEM32\\cryptbase.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffa11f71000",to="0x00007ffa11f7b044"}]
1: (1562) ->1018^done,threads=[{id="1",target-id="Thread 16748.0x234c",state="running"}]
1: (1562) ->(gdb)
1: (1562) 1018: elapsed time 45
1: (1564) Send Event AD7ProcessInfoUpdatedEvent
1: (1566) ->=library-loaded,id="C:\\Windows\\System32\\bcryptprimitives.dll",target-name="C:\\Windows\\System32\\bcryptprimitives.dll",host-name="C:\\Windows\\System32\\bcryptprimitives.dll",symbols-loaded="0",thread-group="i1",ranges=[{from="0x00007ffa12f91000",to="0x00007ffa1300a4ac"}]
1: (1568) ->&"\n"
1: (1568) ->^done
1: (1568) ->(gdb)
1: (1569) ->=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff607581464",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",thread-groups=["i1"],times="1",original-location="main"}
1: (1569) ->=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff607581464",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",thread-groups=["i1"],times="1",original-location="A.cpp:10"}
1: (1570) Send Event AD7ThreadCreateEvent
1: (1570) ->~"\n"
1: (1571) ->~"Thread 1 hit Breakpoint 1, main (argc=1, argv=0x6319a0) at C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp:10\n"
1: (1571) ->~"10\t    N=1;\n"
1: (1571) ->*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00007ff607581464",func="main",args=[{name="argc",value="1"},{name="argv",value="0x6319a0"}],file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",arch="i386:x86-64"},thread-id="1",stopped-threads="all"
1: (1571) ->1019^done,threads=[{id="2",target-id="Thread 16748.0x3238",frame={level="0",addr="0x00007ffa154928a4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\Windows\\SYSTEM32\\ntdll.dll",arch="i386:x86-64"},state="stopped"}]
1: (1571) ->(gdb)
1: (1572) ->&"\n"
1: (1572) ->^done
1: (1572) ->(gdb)
1: (1573) ->1020^done,threads=[{id="3",target-id="Thread 16748.0x310c",frame={level="0",addr="0x00007ffa154928a4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\Windows\\SYSTEM32\\ntdll.dll",arch="i386:x86-64"},state="stopped"}]
1: (1573) ->(gdb)
1: (1573) ->&"\n"
1: (1573) ->^done
1: (1573) ->(gdb)
1: (1574) ->1021^done,threads=[{id="4",target-id="Thread 16748.0x7f4",frame={level="0",addr="0x00007ffa154928a4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\Windows\\SYSTEM32\\ntdll.dll",arch="i386:x86-64"},state="stopped"}]
1: (1574) ->(gdb)
1: (1574) ->&"\n"
1: (1574) ->^done
1: (1574) ->(gdb)
1: (1574) ->1022^done,lines=[{pc="0x00007ff607581450",line="6"},{pc="0x00007ff60758145f",line="6"},{pc="0x00007ff607581464",line="10"},{pc="0x00007ff60758146b",line="12"},{pc="0x00007ff607581481",line="13"},{pc="0x00007ff607581497",line="14"},{pc="0x00007ff60758149d",line="14"},{pc="0x00007ff6075814a2",line="15"},{pc="0x00007ff6075814b8",line="16"},{pc="0x00007ff6075814d1",line="17"},{pc="0x00007ff6075814d6",line="18"},{pc="0x00007ff6075814dc",line="0"},{pc="0x00007ff6075814fa",line="18"},{pc="0x00007ff607581508",line="18"},{pc="0x00007ff607581517",line="0"},{pc="0x00007ff607581535",line="18"},{pc="0x00007ff60758153c",line="18"},{pc="0x00007ff607581544",line="18"},{pc="0x00007ff60758155a",line="0"}]
1: (1574) ->(gdb)
1: (1574) ->&"\n"
1: (1574) ->^done
1: (1574) ->(gdb)
1: (1574) ->1023^done,lines=[{pc="0x00007ff607581450",line="6"},{pc="0x00007ff60758145f",line="6"},{pc="0x00007ff607581464",line="10"},{pc="0x00007ff60758146b",line="12"},{pc="0x00007ff607581481",line="13"},{pc="0x00007ff607581497",line="14"},{pc="0x00007ff60758149d",line="14"},{pc="0x00007ff6075814a2",line="15"},{pc="0x00007ff6075814b8",line="16"},{pc="0x00007ff6075814d1",line="17"},{pc="0x00007ff6075814d6",line="18"},{pc="0x00007ff6075814dc",line="0"},{pc="0x00007ff6075814fa",line="18"},{pc="0x00007ff607581508",line="18"},{pc="0x00007ff607581517",line="0"},{pc="0x00007ff607581535",line="18"},{pc="0x00007ff60758153c",line="18"},{pc="0x00007ff607581544",line="18"},{pc="0x00007ff60758155a",line="0"}]
1: (1574) ->(gdb)
1: (1575) ->&"\n"
1: (1575) ->^done
1: (1575) ->(gdb)
1: (1575) ->1024^done,lines=[{pc="0x00007ff607581450",line="6"},{pc="0x00007ff60758145f",line="6"},{pc="0x00007ff607581464",line="10"},{pc="0x00007ff60758146b",line="12"},{pc="0x00007ff607581481",line="13"},{pc="0x00007ff607581497",line="14"},{pc="0x00007ff60758149d",line="14"},{pc="0x00007ff6075814a2",line="15"},{pc="0x00007ff6075814b8",line="16"},{pc="0x00007ff6075814d1",line="17"},{pc="0x00007ff6075814d6",line="18"},{pc="0x00007ff6075814dc",line="0"},{pc="0x00007ff6075814fa",line="18"},{pc="0x00007ff607581508",line="18"},{pc="0x00007ff607581517",line="0"},{pc="0x00007ff607581535",line="18"},{pc="0x00007ff60758153c",line="18"},{pc="0x00007ff607581544",line="18"},{pc="0x00007ff60758155a",line="0"}]
1: (1575) ->(gdb)
1: (1575) ->&"\n"
1: (1575) ->^done
1: (1575) ->(gdb)
1: (1576) <-1025-symbol-list-lines "C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp"

Thread 1 hit Breakpoint 1, main (argc=1, argv=0x6319a0) at C:\Users\batma\OneDrive\Documents\Developing\Competitive Programming\test\A.cpp:10
10      N=1;
1: (1590) <-1026-thread-info
1: (1592) 1019: elapsed time 73
1: (1592) ->1025^done,lines=[{pc="0x00007ff607581450",line="6"},{pc="0x00007ff60758145f",line="6"},{pc="0x00007ff607581464",line="10"},{pc="0x00007ff60758146b",line="12"},{pc="0x00007ff607581481",line="13"},{pc="0x00007ff607581497",line="14"},{pc="0x00007ff60758149d",line="14"},{pc="0x00007ff6075814a2",line="15"},{pc="0x00007ff6075814b8",line="16"},{pc="0x00007ff6075814d1",line="17"},{pc="0x00007ff6075814d6",line="18"},{pc="0x00007ff6075814dc",line="0"},{pc="0x00007ff6075814fa",line="18"},{pc="0x00007ff607581508",line="18"},{pc="0x00007ff607581517",line="0"},{pc="0x00007ff607581535",line="18"},{pc="0x00007ff60758153c",line="18"},{pc="0x00007ff607581544",line="18"},{pc="0x00007ff60758155a",line="0"}]
1: (1592) Send Event AD7ThreadCreateEvent
1: (1593) ->(gdb)
1: (1593) 1020: elapsed time 72
1: (1593) ->&"\n"
1: (1593) Send Event AD7ThreadCreateEvent
1: (1593) 1021: elapsed time 72
1: (1593) Send Event AD7ThreadCreateEvent
1: (1593) ->^done
1: (1593) 1022: elapsed time 68
1: (1593) ->(gdb)
1: (1594) ->1026^done,threads=[{id="1",target-id="Thread 16748.0x234c",frame={level="0",addr="0x00007ff607581464",func="main",args=[{name="argc",value="1"},{name="argv",value="0x6319a0"}],file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",arch="i386:x86-64"},state="stopped"},{id="2",target-id="Thread 16748.0x3238",frame={level="0",addr="0x00007ffa154928a4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\Windows\\SYSTEM32\\ntdll.dll",arch="i386:x86-64"},state="stopped"},{id="3",target-id="Thread 16748.0x310c",frame={level="0",addr="0x00007ffa154928a4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\Windows\\SYSTEM32\\ntdll.dll",arch="i386:x86-64"},state="stopped"},{id="4",target-id="Thread 16748.0x7f4",frame={level="0",addr="0x00007ffa154928a4",func="ntdll!ZwWaitForWorkViaWorkerFactory",args=[],from="C:\\Windows\\SYSTEM32\\ntdll.dll",arch="i386:x86-64"},state="stopped"}],current-thread-id="1"
1: (1594) ->(gdb)
1: (1594) Send Event AD7BreakpointUnboundEvent
1: (1594) Send Event AD7BreakpointBoundEvent
1: (1594) ->&"\n"
1: (1594) ->^done
1: (1595) ->(gdb)
1: (1595) 1023: elapsed time 68
1: (1595) Send Event AD7BreakpointUnboundEvent
1: (1595) Send Event AD7BreakpointBoundEvent
1: (1595) 1024: elapsed time 68
1: (1595) Send Event AD7BreakpointUnboundEvent
1: (1595) Send Event AD7BreakpointBoundEvent
1: (1595) 1025: elapsed time 19
1: (1595) 1026: elapsed time 4
1: (1602) <-1027-interpreter-exec console "info sharedlibrary"
1: (1612) ->~"From                To                  Syms Read   Shared Object Library\n"
1: (1612) ->~"0x00007ffa153f1000  0x00007ffa15603610  Yes         C:\\Windows\\SYSTEM32\\ntdll.dll\n"
1: (1613) ->~"0x00007ffa13891000  0x00007ffa1395136c  Yes         C:\\Windows\\System32\\kernel32.dll\n"
1: (1613) ->~"0x00007ffa129c1000  0x00007ffa12d5b76c  Yes         C:\\Windows\\System32\\KernelBase.dll\n"
1: (1613) ->~"0x00007ffa14b31000  0x00007ffa14bd6580  Yes         C:\\Windows\\System32\\msvcrt.dll\n"
1: (1613) ->~"0x00007ff9a3751000  0x00007ff9a3942f14  Yes         C:\\msys64\\mingw64\\bin\\libstdc++-6.dll\n"
1: (1613) ->~"0x00007ff9ecb01000  0x00007ff9ecb15060  Yes         C:\\msys64\\mingw64\\bin\\libwinpthread-1.dll\n"
1: (1613) ->~"0x00007ff9ecb21000  0x00007ff9ecb41060  Yes         C:\\msys64\\mingw64\\bin\\libgcc_s_seh-1.dll\n"
1: (1613) ->~"0x00007ffa11f71000  0x00007ffa11f7b044  Yes         C:\\Windows\\SYSTEM32\\cryptbase.dll\n"
1: (1614) ->~"0x00007ffa12f91000  0x00007ffa1300a4ac  Yes         C:\\Windows\\System32\\bcryptprimitives.dll\n"
1: (1614) ->1027^done
1: (1614) ->(gdb)
1: (1614) ->&"\n"
1: (1614) 1027: elapsed time 11
1: (1614) ->^done
1: (1614) ->(gdb)
1: (1616) Send Event AD7ModuleLoadEvent
Loaded 'C:\Windows\SYSTEM32\ntdll.dll'. Symbols loaded.
1: (1626) Send Event AD7ModuleLoadEvent
Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
1: (1627) Send Event AD7ModuleLoadEvent
Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
1: (1627) Send Event AD7ModuleLoadEvent
Loaded 'C:\Windows\System32\msvcrt.dll'. Symbols loaded.
1: (1627) Send Event AD7ModuleLoadEvent
Loaded 'C:\msys64\mingw64\bin\libstdc++-6.dll'. Symbols loaded.
1: (1627) Send Event AD7ModuleLoadEvent
Loaded 'C:\msys64\mingw64\bin\libwinpthread-1.dll'. Symbols loaded.
1: (1627) Send Event AD7ModuleLoadEvent
Loaded 'C:\msys64\mingw64\bin\libgcc_s_seh-1.dll'. Symbols loaded.
1: (1627) Send Event AD7ModuleLoadEvent
Loaded 'C:\Windows\SYSTEM32\cryptbase.dll'. Symbols loaded.
1: (1627) Send Event AD7ModuleLoadEvent
Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Symbols loaded.
1: (1631) <-1028-stack-list-frames 0 1000
1: (1657) ->1028^done,stack=[frame={level="0",addr="0x00007ff607581464",func="main",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="10",arch="i386:x86-64"}]
1: (1657) ->(gdb)
1: (1657) ->&"\n"
1: (1657) 1028: elapsed time 26
1: (1657) ->^done
1: (1658) ->(gdb)
1: (1663) <-1029-break-delete 1
1: (1673) ->1029^done
1: (1673) 1029: elapsed time 9
1: (1673) ->(gdb)
1: (1673) ->&"\n"
1: (1673) ->^done
1: (1674) ->(gdb)
1: (1674) Send Event AD7BreakpointEvent
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
1: (1715) <-1030-stack-list-arguments 0 0 0
1: (1722) ->1030^done,stack-args=[frame={level="0",args=[name="argc",name="argv"]}]
1: (1722) 1030: elapsed time 7
1: (1723) ->(gdb)
1: (1723) ->&"\n"
1: (1723) ->^done
1: (1723) ->(gdb)
1: (1725) <-1031-var-create - * "argc"
1: (1739) ->1031^done,name="var1",numchild="0",value="1",type="int",thread-id="1",has_more="0"
1: (1739) ->(gdb)
1: (1739) 1031: elapsed time 14
1: (1739) ->&"\n"
1: (1739) ->^done
1: (1740) ->(gdb)
1: (1740) <-1032-var-delete var1
1: (1755) ->1032^done,ndeleted="1"
1: (1755) 1032: elapsed time 15
1: (1755) ->(gdb)
1: (1755) ->&"\n"
1: (1755) <-1033-var-create - * "argv"
1: (1755) ->^done
1: (1756) ->(gdb)
1: (1771) ->1033^done,name="var2",numchild="1",value="0x6319a0",type="const char **",thread-id="1",has_more="0"
1: (1778) 1033: elapsed time 22
1: (1778) <-1034-var-delete var2
1: (1778) ->(gdb)
1: (1778) ->&"\n"
1: (1778) ->^done
1: (1778) ->(gdb)
1: (1795) ->1034^done,ndeleted="1"
1: (1795) 1034: elapsed time 17
1: (1795) ->(gdb)
1: (1796) ->&"\n"
1: (1796) ->^done
1: (1796) ->(gdb)
1: (2251) <-1035-stack-list-variables 0
1: (2253) ->1035^done,variables=[{name="argc",arg="1"},{name="argv",arg="1"},{name="a"},{name="b"},{name="c"},{name="d"},{name="N"}]
1: (2253) 1035: elapsed time 1
1: (2253) ->(gdb)
1: (2253) ->&"\n"
1: (2253) ->^done
1: (2253) ->(gdb)
1: (2256) <-1036-var-create - * "argc"
1: (2271) ->1036^done,name="var3",numchild="0",value="1",type="int",thread-id="1",has_more="0"
1: (2271) 1036: elapsed time 15
1: (2271) ->(gdb)
1: (2271) ->&"\n"
1: (2271) ->^done
1: (2271) ->(gdb)
1: (2272) <-1037-var-create - * "argv"
1: (2295) ->1037^done,name="var4",numchild="1",value="0x6319a0",type="const char **",thread-id="1",has_more="0"
1: (2295) 1037: elapsed time 22
1: (2295) ->(gdb)
1: (2295) <-1038-var-create - * "a"
1: (2295) ->&"\n"
1: (2295) ->^done
1: (2295) ->(gdb)
1: (2320) ->1038^done,name="var5",numchild="0",value="0",type="int",thread-id="1",has_more="0"
1: (2320) 1038: elapsed time 24
1: (2320) <-1039-var-create - * "b"
1: (2320) ->(gdb)
1: (2320) ->&"\n"
1: (2320) ->^done
1: (2321) ->(gdb)
1: (2321) ->1039^done,name="var6",numchild="0",value="6494632",type="int",thread-id="1",has_more="0"
1: (2321) 1039: elapsed time 1
1: (2321) <-1040-var-create - * "c"
1: (2321) ->(gdb)
1: (2322) ->&"\n"
1: (2322) ->^done
1: (2322) ->(gdb)
1: (2322) ->1040^done,name="var7",numchild="0",value="6494688",type="int",thread-id="1",has_more="0"
1: (2322) 1040: elapsed time 0
1: (2322) <-1041-var-create - * "d"
1: (2323) ->(gdb)
1: (2323) ->&"\n"
1: (2323) ->^done
1: (2323) ->(gdb)
1: (2323) ->1041^done,name="var8",numchild="0",value="0",type="int",thread-id="1",has_more="0"
1: (2323) 1041: elapsed time 1
1: (2323) ->(gdb)
1: (2323) <-1042-var-create - * "N"
1: (2334) ->&"\n"
1: (2334) ->^done
1: (2334) ->(gdb)
1: (2335) ->1042^done,name="var9",numchild="0",value="0",type="int",thread-id="1",has_more="0"
1: (2335) 1042: elapsed time 11
1: (2335) ->(gdb)
1: (2335) ->&"\n"
1: (2335) ->^done
1: (2335) ->(gdb)
1: (7433) <-1043-exec-next
1: (7457) ->1043^running
1: (7457) 1043: elapsed time 23
1: (7459) ->*running,thread-id="all"
1: (7459) ->(gdb)
1: (7460) ->=breakpoint-modified,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x00007ff60758146b",func="main(int, char const**)",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="12",thread-groups=["i1"],times="1",original-location="A.cpp:12"}
1: (7461) ->~"\n"

1: (7461) ->~"Thread 1 hit Breakpoint 3, main (argc=1, argv=0x6319a0) at C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp:12\n"
Thread 1 hit Breakpoint 3, main (argc=1, argv=0x6319a0) at C:\Users\batma\OneDrive\Documents\Developing\Competitive Programming\test\A.cpp:12
1: (7461) ->~"12\t    cin >> a;\n"
12      cin >> a;
1: (7461) ->*stopped,reason="breakpoint-hit",disp="keep",bkptno="3",frame={addr="0x00007ff60758146b",func="main",args=[{name="argc",value="1"},{name="argv",value="0x6319a0"}],file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="12",arch="i386:x86-64"},thread-id="1",stopped-threads="all"
1: (7461) ->&"\n"
1: (7461) ->^done
1: (7461) ->(gdb)
1: (7461) <-1044-stack-list-frames 0 1000
1: (7462) ->1044^done,stack=[frame={level="0",addr="0x00007ff60758146b",func="main",file="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",fullname="C:\\Users\\batma\\OneDrive\\Documents\\Developing\\Competitive Programming\\test\\A.cpp",line="12",arch="i386:x86-64"}]
1: (7462) 1044: elapsed time 0
1: (7462) ->(gdb)
1: (7462) <-1045-var-delete var3
1: (7462) ->&"\n"
1: (7462) ->^done
1: (7462) ->(gdb)
1: (7462) ->1045^done,ndeleted="1"
1: (7462) 1045: elapsed time 0
1: (7462) ->(gdb)
1: (7462) <-1046-var-delete var4
1: (7462) ->&"\n"
1: (7462) ->^done
1: (7462) ->(gdb)
1: (7463) ->1046^done,ndeleted="1"
1: (7463) 1046: elapsed time 0
1: (7463) <-1047-var-delete var5
1: (7463) ->(gdb)
1: (7463) ->&"\n"
1: (7463) ->^done
1: (7463) ->(gdb)
1: (7463) ->1047^done,ndeleted="1"
1: (7463) 1047: elapsed time 0
1: (7463) ->(gdb)
1: (7463) <-1048-var-delete var6
1: (7463) ->&"\n"
1: (7463) ->^done
1: (7463) ->(gdb)
1: (7463) ->1048^done,ndeleted="1"
1: (7463) 1048: elapsed time 0
1: (7463) ->(gdb)
1: (7463) <-1049-var-delete var7
1: (7463) ->&"\n"
1: (7463) ->^done
1: (7463) ->(gdb)
1: (7463) ->1049^done,ndeleted="1"
1: (7463) 1049: elapsed time 0
1: (7463) <-1050-var-delete var8
1: (7463) ->(gdb)
1: (7463) ->&"\n"
1: (7463) ->^done
1: (7463) ->(gdb)
1: (7463) ->1050^done,ndeleted="1"
1: (7463) 1050: elapsed time 0
1: (7463) ->(gdb)
1: (7463) <-1051-var-delete var9
1: (7463) ->&"\n"
1: (7464) ->^done
1: (7464) ->(gdb)
1: (7464) ->1051^done,ndeleted="1"
1: (7464) 1051: elapsed time 0
1: (7464) ->(gdb)
1: (7464) ->&"\n"
1: (7464) ->^done
1: (7464) ->(gdb)
1: (7464) Send Event AD7BreakpointEvent
1: (7500) <-1052-stack-list-arguments 0 0 0
1: (7500) ->1052^done,stack-args=[frame={level="0",args=[name="argc",name="argv"]}]
1: (7500) 1052: elapsed time 0
1: (7501) ->(gdb)
1: (7501) ->&"\n"
1: (7501) <-1053-var-create - * "argc"
1: (7501) ->^done
1: (7501) ->(gdb)
1: (7501) ->1053^done,name="var10",numchild="0",value="1",type="int",thread-id="1",has_more="0"
1: (7501) 1053: elapsed time 0
1: (7501) <-1054-var-delete var10
1: (7501) ->(gdb)
1: (7502) ->&"\n"
1: (7502) ->^done
1: (7502) ->(gdb)
1: (7502) ->1054^done,ndeleted="1"
1: (7502) 1054: elapsed time 0
1: (7502) ->(gdb)
1: (7502) <-1055-var-create - * "argv"
1: (7502) ->&"\n"
1: (7502) ->^done
1: (7502) ->(gdb)
1: (7502) ->1055^done,name="var11",numchild="1",value="0x6319a0",type="const char **",thread-id="1",has_more="0"
1: (7502) 1055: elapsed time 0
1: (7503) <-1056-var-delete var11
1: (7503) ->(gdb)
1: (7503) ->&"\n"
1: (7503) ->^done
1: (7503) ->(gdb)
1: (7503) ->1056^done,ndeleted="1"
1: (7503) 1056: elapsed time 0
1: (7503) ->(gdb)
1: (7503) ->&"\n"
1: (7503) ->^done
1: (7503) ->(gdb)
1: (7780) <-1057-exec-next
1: (7781) ->1057^running
1: (7781) 1057: elapsed time 0
1: (7781) ->*running,thread-id="all"
1: (7781) ->(gdb)
1: (7782) ->&"\n"
1: (7782) ->^done
1: (7782) ->(gdb)

Other Extensions

No response

Additional Information

No response

palapapa commented 1 year ago

This is very similar to my issue #10834 Btw how did you see the debugger log?

Dru01 commented 1 year ago

With "logging": { "engineLogging": false } statement. Here is the reference https://code.visualstudio.com/docs/cpp/enable-logging-cpp#_enable-logging-for-the-debug-adapter.

palapapa commented 1 year ago

FYI, I used to use TDM-GCC 10.3.0 and it didn't have this issue.

Dru01 commented 1 year ago

Oh okey... I do recall in an early version (compiler,extension,...) also didn't had this issue, but I can't remember which one. I recently had to reset my PC and ever since having this issue.

Dru01 commented 1 year ago

I tracked down it down to the version of gdb 13.1, installing gcc 11.2 version which comes with gdb 11.1 version it works perfectly fine. There's some incompability between gdb 13.1 and vscode or c++ extension.

Dru01 commented 1 year ago

Also everything works fine using an external terminal, or using wsl with integrated terminal with gdb 13.1.

Colengms commented 1 year ago

@WardenGnaw

Dru01 commented 1 year ago

@Colengms Is there any new on this?

Colengms commented 1 year ago

@WardenGnaw Andrew, could you respond to this issue?

Hi @Dru01 . I work primarily on the language service (non debugger) components of the extension. Andrew works on the debugger side, and should be able to assist.

WardenGnaw commented 1 year ago

Thank you for reporting this issue. We’ll let you know if we need more information to investigate it.

Dru01 commented 1 year ago

@WardenGnaw Andrew, could you respond to this issue?

Hi @Dru01 . I work primarily on the language service (non debugger) components of the extension. Andrew works on the debugger side, and should be able to assist.

Oh I see. Thank you for your reply, I appreciate it.

Dru01 commented 1 year ago

Thank you for reporting this issue. We’ll let you know if we need more information to investigate it.

No problem, I'm here for anything you required.

Dru01 commented 11 months ago

@WardenGnaw Do you have any news regarding this issue?

Dru01 commented 10 months ago

@sean-mcmanus Hi, it's been while since I open this issue and I haven't got any feedback, is there any way you can help me?

Dru01 commented 10 months ago

If it helps, I discovered two thigs @WardenGnaw.

Recapping as I stated the problem is somewhere between the integrated terminal of vscode and gdb (13.1 or newer). The problem is that if you enter an input in the integrated terminal of vscode before trying to debug the statement (by step over or step into) in charge of getting that input regardless is scanf or cin, it will get stuck somewhere.

After trying to do a step over or a step into that statement the call stack indicates that somethings is running, then when you paused the debugger (two times required to click on pause button, the first time does "nothing") the code stack for [1] will be:

ntdll.dll!ntdll!ZwDeviceIoControlFile (Unknown Source:0)
KernelBase.dll!KERNELBASE!GetConsoleScreenBufferInfoEx (Unknown Source:0)
KernelBase.dll!KERNELBASE!GetConsoleScreenBufferInfoEx (Unknown Source:0)
KernelBase.dll!KERNELBASE!GetConsoleMode (Unknown Source:0)
ucrtbase.dll!ucrtbase!log2f (Unknown Source:0)
ucrtbase.dll!ucrtbase!_read (Unknown Source:0)
ucrtbase.dll!ucrtbase!_fgetc_nolock (Unknown Source:0)
ucrtbase.dll!ucrtbase!fgetc (Unknown Source:0)
libstdc++-6.dll![Unknown/Just-In-Time compiled code] (Unknown Source:0)
main() (d:\La-Ultima-y-Nos-Vamos\Contests\ICPC\Latin_American_Regional_Contest\2023\MainTemplate copy.cpp:9)

And the debug console will output this:

0x00007fffa2593061 in ntdll!DbgBreakPoint () from C:\Windows\SYSTEM32\ntdll.dll

If you keep step over, you will receive something like this from the debugger.

Single stepping until exit from function ntdll!DbgBreakPoint,
which has no line number information.
Single stepping until exit from function ntdll!DbgUiRemoteBreakin,
which has no line number information.

To finally go to the next statement.

I don't know much, but I feel like there a miss check when input is entered while the debugger is running causing a mismatch between them, or my other theory is that there is something about ntdll from windows that is causing those break points, and the vs code debugger is pausing because of it.

I add a video for ilustration

https://github.com/microsoft/vscode-cpptools/assets/37126509/3024196f-da09-438d-a50d-ced640d8be46

github-actions[bot] commented 4 months ago

This issue has been closed as lower priority. We're sorry if this issue still impacts you but unfortunately we're not able to address this. We will accept a pull request from the community if it's applicable for this issue.