vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

vscode c++ debugger starts and stops immediately without stopping at breakpoints

Open marcoschou opened this issue 3 years ago • 1 comments

Environment

  • OS : Windows 10
  • VS Code: 1.71
  • C/C++ extension: 1.12.4
  • GDB / LLDB version: Cygwin 11.2-1

Bug Summary and Steps to Reproduce

Bug Summary: The debugger starts and stops immediately after hitting first breakpoint. In the debug console I can see the following information: Thread 1 "HelloWorld" hit Breakpoint 1, main () at C:\Users\z004mfzw\Documents\CppExamples\HelloWorld\HelloWorld.cpp:4 Loaded '/cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/KERNEL32.DLL'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/KERNELBASE.dll'. Symbols loaded. Loaded '/usr/bin/cygstdc++-6.dll'. Symbols loaded. Loaded '/usr/bin/cygwin1.dll'. Symbols loaded. Loaded '/usr/bin/cyggcc_s-seh-1.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/advapi32.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/msvcrt.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/sechost.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/RPCRT4.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/SYSTEM32/CRYPTBASE.DLL'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/bcryptPrimitives.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/system32/tmumh/20019/AddOn/8.53.0.1128/TmUmEvt64.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/PSAPI.DLL'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/USER32.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/win32u.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/GDI32.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/gdi32full.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/msvcp_win.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/ucrtbase.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/System32/IMM32.DLL'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/system32/tmumh/20019/TmMon/2.8.0.1054/tmmon64.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/system32/netapi32.dll'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/SYSTEM32/SAMCLI.DLL'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/SYSTEM32/LOGONCLI.DLL'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/SYSTEM32/NETUTILS.DLL'. Symbols loaded. Loaded '/cygdrive/c/WINDOWS/SYSTEM32/SAMLIB.dll'. Symbols loaded. [Thread 3712.0x16f4 exited with code 0] [Thread 3712.0x3718 exited with code 0] [Thread 3712.0x4f20 exited with code 0] [Thread 3712.0x4d90 exited with code 0] [Thread 3712.0xfdc exited with code 0] [Thread 3712.0x2ce0 exited with code 0] [Inferior 1 (process 3712) exited normally] The program 'c:\Users\z004mfzw\Documents\CppExamples\HelloWorld\HelloWorld.exe' has exited with code 0 (0x00000000).

Steps to reproduce: Install vs code with gdb compiler from cygwin 64 on windows. Create a simple HelloWorld application. Set a breakpoint. Start debugger.

Debugger Configurations

Tasks.json:
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++.exe build active file",
			"command": "C:\\cygwin64\\bin\\g++.exe",
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"${file}",
				"-o",
				"${fileDirname}\\${fileBasenameNoExtension}.exe"
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": "build",
		}
	]
}

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\cygwin64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file"
        }
    ]
}

Debugger Logs

See txt file attached

Other Extensions

No response

Additional Information

DebugConsole.txt

marcoschou avatar Sep 08 '22 07:09 marcoschou

Looks like an issue with Cygwin Path Mapper:

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1626) ->1011^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000010040108d",func="main()",file="C:\\Users\\z004mfzw\\Documents\\CppExamples\\HelloWorld\\HelloWorld.cpp",fullname="/cygdrive/c/Users/z004mfzw/Documents/CppExamples/HelloWorld/C:\\Users\\z004mfzw\\Documents\\CppExamples\\HelloWorld\\HelloWorld.cpp",line="4",thread-groups=["i1"],times="0",original-location="main"}\r\n"},"seq":224}

Investigating

WardenGnaw avatar Sep 12 '22 21:09 WardenGnaw

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.

github-actions[bot] avatar Mar 12 '23 11:03 github-actions[bot]