microsoft / microsoft/vscode-cpptools

Debugger pauses unexpectedly and also has SegFaults and unknown signals which only occur during debugging

Open
#12,418 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Windows
  • VS Code: 1.90.2
  • C/C++ extension: 1.20.5
  • GDB / LLDB version: 14.1
Bug Summary and Steps to Reproduce

Bug Summary:

When running the debugger, random segmentation faults have begun occuring, and the debugger will also stop on lines which do not have any breakpoint. This has only begin happening recently (within the last week), beforehand I was able to run the debugger without any issues.

I have tried rebuilding, reverting to an older version of the extension and of vscode, and switching to an older version of my source code. The same segmentation fault issue has been persistent on all of these.
It is not the same code which causes the segmentation fault either, it seems to occur randomly on any code (including system libraries)

Debugger Configurations
"name": "debug config",
        "type": "cppdbg",
        "request": "launch",
        "program": "app.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\tools\\mingw32\\bin\\gdb.exe",
        "preLaunchTask": "make debug",
        "setupCommands": [
          {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          },
          {
            "text": "set charset UTF-8"
          },
          {
            "description": "Set Disassembly Flavor to Intel",
            "text": "-gdb-set disassembly-flavor intel",
            "ignoreFailures": true
          }
        ],
Debugger Logs
An example error

1: (4015) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (4015) ->(gdb)\r\n"},"seq":1628}
1: (4015) ->(gdb)
--> R (stackTrace-12): {"type":"response","request_seq":12,"success":true,"command":"stackTrace","body":{"stackFrames":[{"id":1000,"name":"ntdll.dll!ntdll!RtlGetCurrentServiceSessionId","line":0,"column":0,"instructionPointerReference":"0x776f0957","moduleId":1},{"id":1001,"name":"[Unknown/Just-In-Time compiled code]","line":0,"column":0,"instructionPointerReference":"0xd95398a4"},{"id":1002,"name":"ntdll.dll!ntdll!RtlRemovePropertyStore","line":0,"column":0,"instructionPointerReference":"0x77730add","moduleId":1},{"id":1003,"name":"ntdll.dll!ntdll!RtlFreeHeap","line":0,"column":0,"instructionPointerReference":"0x776ef706","moduleId":1},{"id":1004,"name":"ntdll.dll!ntdll!RtlRegisterSecureMemoryCacheCallback","line":0,"column":0,"instructionPointerReference":"0x77786716","moduleId":1},{"id":1005,"name":"ntdll.dll!ntdll!RtlGetCurrentServiceSessionId","line":0,"column":0,"instructionPointerReference":"0x776ef846","moduleId":1},{"id":1006,"name":"[Unknown/Just-In-Time compiled code]","line":0,"column":0,"instructionPointerReference":"0x04242a70"},{"id":1007,"name":"ntdll.dll!ntdll!RtlRemovePropertyStore","line":0,"column":0,"instructionPointerReference":"0x77730add","moduleId":1},{"id":1008,"name":"ntdll.dll!ntdll!RtlFreeHeap","line":0,"column":0,"instructionPointerReference":"0x776ef706","moduleId":1},{"id":1009,"name":"mfedeeprem32.dll!mfedeeprem32!UnitTestInitialise","line":0,"column":0,"instructionPointerReference":"0x652fed1a","moduleId":37},{"id":1010,"name":"mfedeeprem32.dll!mfedeeprem32!UnitTestInitialise","line":0,"column":0,"instructionPointerReference":"0x652fddb5","moduleId":37},{"id":1011,"name":"mfedeeprem32.dll!mfedeeprem32!UnitTestInitialise","line":0,"column":0,"instructionPointerReference":"0x652fbd07","moduleId":37},{"id":1012,"name":"ntdll.dll!ntdll!RtlNumberOfSetBitsUlongPtr","line":0,"column":0,"instructionPointerReference":"0x77731ea6","moduleId":1},{"id":1013,"name":"ntdll.dll!ntdll!LdrShutdownThread","line":0,"column":0,"instructionPointerReference":"0x776e6cda","moduleId":1},{"id":1014,"name":"[Unknown/Just-In-Time compiled code]","line":0,"column":0,"instructionPointerReference":"0x00000001"}],"totalFrames":15},"seq":1630}
<--   C (threads-13): {"command":"threads","type":"request","seq":13}
--> R (threads-13): {"type":"response","request_seq":13,"success":true,"command":"threads","body":{"threads":[{"id":1,"name":" [1]"},{"id":2,"name":" [2]"},{"id":3,"name":" [3]"},{"id":4,"name":" [4]"},{"id":5,"name":"MojoThread [5]"},{"id":6,"name":" [6]"},{"id":7,"name":" [7]"},{"id":8,"name":" [8]"},{"id":9,"name":" [9]"},{"id":17,"name":" [17]"},{"id":18,"name":" [18]"},{"id":19,"name":" [19]"}]},"seq":1633}
Other Extensions

llvm-vs-code-extensions.vscode-clangd
CS128.cs128-clang-tidy

issue persists with these disabled

Additional Information

I am writing a C Webview2 application and building with mingw,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the supplied Windows, VS Code, C/C++ extension, GDB, MinGW, and cppdbg configuration. Compare the debugger logs and stack frames when it pauses unexpectedly or reports a segmentation fault, then narrow the behavior to a minimal reproducible C WebView2 application. Done means the cause is identified and the fix can be verified against the reported symptoms.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, vscode
Domain
devtools
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.