microsoft / microsoft/vscode-cpptools

Gdb problems resuming and terminating (WSL + FreeRTOS)

Open
#3,740 5 comments 0 reactions 1 assignee View on GitHub

@pieandcakes is already working on this.

Since Jun 7, 2019.

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

Description

Describe the bug

  • OS and Version: Windows 10 Pro 1809 with Ubuntu WSL
  • VS Code Version: 1.35.0
  • C/C++ Extension Version: 0.23.1
  • A clear and concise description of what the bug is

I am developing a FreeRTOS project under Linux (WSL). I have followed the steps to get basic compile and run working: https://code.visualstudio.com/docs/cpp/config-wsl.

When debugging I can set a breakpoint but once hit I cannot resume. Debug console shows:

Thread 9 "AppLinux" received signal SIGTRAP, Trace/breakpoint trap.
<signal handler called>

Editor shows:
image

Additionally, even if I don't set any breakpoints when I try to stop debugging the process is not terminated. Both gdb and the app are still running and I need to kill them manually in task manager.

I suspect this is due to the way FreeRTOS handles interrupts. If I modify my program to avoid starting the FreeRTOS scheduler, or set a breakpoint before the scheduler is started things work fine. But I am at a loss how to resolve!

To Reproduce
Please include a code sample and launch.json configuration.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "monorepo Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/mnt/d/alfie/gb/monorepo/linux/app/AppLinux", // FIXME
            "args": ["-fThreading"],
            "stopAtEntry": false,
            "cwd": "/mnt/d/alfie/gb/monorepo/linux/app", // FIXME
            "environment": [],
            "externalConsole": true,
            "windows": {
                "MIMode": "gdb",
                "miDebuggerPath": "/usr/bin/gdb",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            },
            "pipeTransport": {
                "pipeCwd": "",
                "pipeProgram": "c:\\windows\\sysnative\\bash.exe",
                "pipeArgs": ["-c"],
                "debuggerPath": "/usr/bin/gdb"
            },
            "sourceFileMap": {
                "/mnt/d": "D:\\", // FIXME
                "/usr": "D:\\alfie" // FIXME
            }
        }
    ]
}

Steps to reproduce the behavior:
See above. I can provide a small example project including FreeRTOS if required.

Additional context
Logfile generated by starting debug with breakpoint enabled, hit breakpoint and attempt to resume.
logfile.txt

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.