Skip to content

Debug in VS CodeΒ #4

@Fudanyrd

Description

@Fudanyrd

Hi. I have figured out a way to debug kernel8.elf in vscode. Hopefully this will be useful.

In .vscode/tasks.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc build active file",
            "command": "make",
            "args": [],
            "options": {
                "cwd": "${workspaceFolder}/build/"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

In .vscode/launch.json:

{
    "configurations": [
        {
            "name": "C/C++: gcc build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/src/kernel8.elf",
            "args": [
            ],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}/build/",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "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
                },
                {
                    "description": "set architecture",
                    "text": "set architecture aarch64",
                    "ignoreFailures": false
                },
                {
                    "description": "set gdb port",
                    "text": "target remote localhost:1234",
                    "ignoreFailures": false
                },
                {
                    "description": "set kernel position",
                    "text": "file ${workspaceFolder}/build/src/kernel8.elf",
                    "ignoreFailures": false
                },
            ],
            "preLaunchTask": "C/C++: gcc build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ],
    "version": "2.0.0"
}

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