Skip to content

Supporting debugging could be really helpful for new people #35

@joshring

Description

@joshring

I got debugging to work, but it's a bit of workaround, see https://github.com/joshring/c3-debugging

Debugging currently works quite nicely with the C or C++ extension from microsoft but you must enable
File->Preferences->Settings and set "debug.allowBreakpointsEverywhere"

Then add file: .vscode/launch.json

File content:

{
    // 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": "gdb with C++ devtools",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/your_project_exe_name",
            "args": [],
            "cwd": "${workspaceFolder}/build",
            "environment": [],
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            "setupCommands": [
                {
                    "text": "-enable-pretty-printing",
                }
            ],
            "preLaunchTask": "c3cbuild",
            "stopAtEntry": true,
        }
    ]
}

Add file .vscode/tasks.json

File content:

{
    "version": "2.0.0",
    "type":"shell",
    "tasks": [
        {
            "type": "shell",
            "command": "c3c",
            "args": ["build"],
            "label": "c3cbuild",
            "presentation": {
                "echo": true,
		"reveal": "never",
		"focus": false,
		"panel": "dedicated",
		"showReuseMessage": false,
		"clear": false,
		"revealProblems": "onProblem",
		"close": true
            },
            "problemMatcher": {
                "owner": "c3c",
                "fileLocation": [
                    "relative",
                    "${workspaceFolder}"
                ],
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+)\\s+(Warning|Error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        }
    ]
}

Alternatively it seems the extension itself can support debugging and automate the above, which seems interesting
https://code.visualstudio.com/api/extension-guides/debugger-extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions