{ "name": "debug", "displayName": "Kylin Native Debug", "description": "(Kylin Modified) GDB, LLDB & Mago-MI Debugger support for VSCode", "keywords": [ "KylinIdeDev", "KylinIdeDevDebug", "KylinIdeDevCYuYan", "KylinIdeDevCPlusPlus", "gdb", "lldb", "mago-mi", "native", "debug" ], "license": "public domain", "version": "0.1.3", "publisher": "KylinIDETeam", "icon": "images/icon.png", "engines": { "vscode": "^1.54.0" }, "main": "./out/src/frontend/extension", "activationEvents": [ "onDebug", "onCommand:code-debug.examineMemoryLocation", "onCommand:code-debug.getFileNameNoExt", "onCommand:code-debug.getFileBasenameNoExt", "onCommand:code-debug.startRecord", "onCommand:code-debug.stopRecord" ], "downloadUrl":"https://gitee.com/openkylin/extensions-repo/tree/master/KylinIDETeam/debug", "categories": [ "Debuggers" ], "repository": { "type": "git", "url": "https://github.com/WebFreak001/code-debug.git" }, "capabilities": { "untrustedWorkspaces": { "supported": true } }, "contributes": { "commands": [ { "command": "code-debug.examineMemoryLocation", "title": "Code-Debug: Examine memory location" }, { "command": "code-debug.startRecord", "title": "Code-Debug: Start reverse debugging", "icon": "$(debug-start)" }, { "command": "code-debug.stopRecord", "title": "Code-Debug: Stop reverse debugging", "icon": "$(debug-stop)" } ], "menus": { "editor/title": [ { "command": "code-debug.startRecord", "when": "code-debug.enableRecord && inDebugMode && debugState == stopped && debugType == 'gdb' && code-debug.enableStartRecord", "group": "navigation" }, { "command": "code-debug.stopRecord", "when": "code-debug.enableRecord && inDebugMode && debugState == stopped && debugType == 'gdb' && !code-debug.enableStartRecord", "group": "navigation" } ] }, "breakpoints": [ { "language": "c" }, { "language": "cpp" }, { "language": "d" }, { "language": "objective-c" }, { "language": "fortran" }, { "language": "fortran-modern" }, { "language": "fortran90" }, { "language": "fortran_free-form" }, { "language": "fortran_fixed-form" }, { "language": "rust" }, { "language": "pascal" }, { "language": "objectpascal" }, { "language": "ada" }, { "language": "nim" }, { "language": "arm" }, { "language": "asm" }, { "language": "vala" }, { "language": "crystal" }, { "language": "kotlin" }, { "language": "zig" } ], "debuggers": [ { "type": "gdb", "program": "./out/src/gdb.js", "runtime": "node", "label": "GDB", "languages": [ "c", "cpp", "d", "objective-c", "fortran", "fortran-modern", "fortran90", "fortran_free-form", "fortran_fixed-form", "rust", "pascal", "objectpascal", "ada", "nim", "arm", "asm", "vala", "crystal", "kotlin", "zig" ], "variables": { "FileBasenameNoExt": "code-debug.getFileBasenameNoExt", "FileNameNoExt": "code-debug.getFileNameNoExt" }, "configurationAttributes": { "launch": { "required": [ "target", "cwd" ], "properties": { "target": { "type": "string", "description": "Path of executable" }, "arguments": { "type": "string", "description": "Arguments to append after the executable. You can also use pipes." }, "terminal": { "type": "string", "description": "Leave this field undefined to keep program output in the vscode console at the bottom. If this is set to empty string the program will spawn in a new console using x-terminal-emulator on linux, otherwise with the specified terminal. On windows setting this to an empty string spawns the program in a console, but no other console is supported." }, "cwd": { "type": "string", "description": "project path" }, "gdbpath": { "type": "string", "description": "Path to the gdb executable or the command if in PATH", "default": "gdb" }, "env": { "type": "object", "description": "Environment overriding the gdb (and in turn also the process) environment", "default": null }, "debugger_args": { "type": "array", "description": "Additional arguments to pass to GDB", "default": [] }, "pathSubstitutions": { "type": "object", "description": "Help GDB find your source using path substitutions (GDB `substitute-path)` variable", "default": { "": "" } }, "valuesFormatting": { "type": "string", "description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any", "default": "parseText", "enum": [ "disabled", "parseText", "prettyPrinters" ] }, "printCalls": { "type": "boolean", "description": "Prints all GDB calls to the console", "default": false }, "showDevDebugOutput": { "type": "boolean", "description": "Prints all GDB responses to the console", "default": false }, "autorun": { "type": "array", "description": "GDB commands to run when starting to debug", "default": [] }, "stopAtEntry": { "type": [ "boolean", "string" ], "description": "Whether debugger should stop at application entry point", "default": false }, "ssh": { "required": [ "host", "user", "cwd" ], "type": "object", "description": "If this is set then the extension will connect to an ssh host and run GDB there", "properties": { "host": { "type": "string", "description": "Remote host name/ip to connect to" }, "port": { "type": [ "number", "string" ], "description": "Remote port number", "default": 22 }, "user": { "type": "string", "description": "Username to connect as" }, "password": { "type": "string", "description": "Plain text password (unsafe; if possible use keyfile instead)" }, "keyfile": { "type": "string", "description": "Absolute path to private key" }, "useAgent": { "type": "boolean", "description": "Auto-detect the running SSH agent (via SSH_AUTH_SOCK environment variable) and use it to perform authentication", "default": false }, "sourceFileMap": { "type": "object", "description": "Mapping of source paths (from GDB on ssh remote) to local (IDE) paths.", "default": { "": "" } }, "cwd": { "type": "string", "description": "Working directory for the debugger.\nIf `ssh.sourceFileMap` is not set, then this is also the project path on the remote for mapping with `cwd`." }, "forwardX11": { "type": "boolean", "description": "If true, the server will redirect x11 to the local host", "default": true }, "x11port": { "type": [ "number", "string" ], "description": "Port to redirect X11 data to (by default port = display + 6000)", "default": 6000 }, "x11host": { "type": "string", "description": "Hostname/ip to redirect X11 data to", "default": "localhost" }, "remotex11screen": { "type": "number", "description": "Screen to start the application on the remote side", "default": 0 }, "bootstrap": { "type": "string", "description": "Content will be executed on the SSH host before the debugger call." } } } } }, "attach": { "required": [ "target", "cwd" ], "properties": { "target": { "type": "string", "description": "PID of running program or program name or connection arguments (eg :2345) if remote is true" }, "remote": { "type": "boolean", "description": "If true this will connect to a gdbserver instead of attaching to a PID", "default": false }, "valuesFormatting": { "type": "string", "description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any", "default": "parseText", "enum": [ "disabled", "parseText", "prettyPrinters" ] }, "printCalls": { "type": "boolean", "description": "Prints all GDB calls to the console", "default": false }, "showDevDebugOutput": { "type": "boolean", "description": "Prints all GDB responses to the console", "default": false }, "executable": { "type": "string", "description": "Path of executable for debugging symbols" }, "gdbpath": { "type": "string", "description": "Path to the gdb executable or the command if in PATH", "default": "gdb" }, "env": { "type": "object", "description": "Environment overriding the gdb (and in turn also the process) environment", "default": null }, "debugger_args": { "type": "array", "description": "Additional arguments to pass to GDB", "default": [] }, "pathSubstitutions": { "type": "object", "description": "Help GDB find your source using path substitutions (GDB `substitute-path)` variable", "default": { "": "" } }, "cwd": { "type": "string", "description": "project path", "default": "${workspaceRoot}" }, "autorun": { "type": "array", "description": "GDB commands to run when starting to debug", "default": [] }, "stopAtConnect": { "type": "boolean", "description": "Whether debugger should stop after connecting to target", "default": false }, "stopAtEntry": { "type": [ "boolean", "string" ], "description": "Whether debugger should stop at application entry point", "default": false }, "ssh": { "required": [ "host", "cwd", "user" ], "type": "object", "description": "If this is set then the extension will connect to an ssh host and run GDB there", "properties": { "host": { "type": "string", "description": "Remote host name/ip to connect to" }, "port": { "type": [ "number", "string" ], "description": "Remote port number", "default": 22 }, "user": { "type": "string", "description": "Username to connect as" }, "password": { "type": "string", "description": "Plain text password (unsafe; if possible use keyfile instead)" }, "keyfile": { "type": "string", "description": "Absolute path to private key" }, "useAgent": { "type": "boolean", "description": "Auto-detect the running SSH agent (via SSH_AUTH_SOCK environment variable) and use it to perform authentication", "default": false }, "sourceFileMap": { "type": "object", "description": "Mapping of source paths (from GDB on ssh remote) to local (IDE) paths.", "default": { "": "" } }, "cwd": { "type": "string", "description": "Working directory for the debugger.\nIf `ssh.sourceFileMap` is not set, then this is also the project path on the remote for mapping with `cwd`." }, "forwardX11": { "type": "boolean", "description": "If true, the server will redirect x11 to the local host", "default": true }, "x11port": { "type": [ "number", "string" ], "description": "Port to redirect X11 data to (by default port = display + 6000)", "default": 6000 }, "x11host": { "type": "string", "description": "Hostname/ip to redirect X11 data to", "default": "localhost" }, "remotex11screen": { "type": "number", "description": "Screen to start the application on the remote side", "default": 0 }, "bootstrap": { "type": "string", "description": "Content will be executed on the SSH host before the debugger call." } } } } } }, "initialConfigurations": [ { "name": "Debug", "type": "gdb", "request": "launch", "target": "./bin/executable", "cwd": "${workspaceRoot}", "valuesFormatting": "parseText" } ], "configurationSnippets": [ { "label": "GDB: Launch Program", "description": "Starts the program using gdb", "body": { "type": "gdb", "request": "launch", "name": "${2:Launch Program}", "target": "${1:./bin/executable}", "cwd": "^\"\\${workspaceRoot}\"", "valuesFormatting": "parseText" } }, { "label": "GDB: Attach to PID", "description": "Attaches to a running program pid using gdb", "body": { "type": "gdb", "request": "attach", "name": "${2:Attach to PID}", "target": "${1:[PID]}", "cwd": "^\"\\${workspaceRoot}\"", "valuesFormatting": "parseText" } }, { "label": "GDB: Connect to gdbserver", "description": "Connects to a gdbserver for debugging", "body": { "type": "gdb", "request": "attach", "name": "${3:Attach to gdbserver}", "executable": "${1:./bin/executable}", "target": ":${2:2345}", "remote": true, "cwd": "^\"\\${workspaceRoot}\"", "valuesFormatting": "parseText" } }, { "label": "GDB: Launch over SSH", "description": "Remotely starts the program using gdb", "body": { "type": "gdb", "request": "launch", "name": "${6:Launch Program (SSH)}", "target": "${1:./bin/executable}", "cwd": "^\"\\${workspaceRoot}\"", "ssh": { "host": "${2:127.0.0.1}", "cwd": "${3:/tmp/working}", "keyfile": "${4:/home/my_user/.ssh/id_rsa}", "user": "${5:remote_user}", "sourceFileMap": { "${6:/home/remote_user/project/}": "^\"\\${workspaceRoot}\"" } }, "valuesFormatting": "parseText" } }, { "label": "GDB: Launch GUI over SSH with X11 forwarding", "description": "Remotely starts the program using gdb with X11 forwarding", "body": { "type": "gdb", "request": "launch", "name": "${6:Launch Program (SSH + X11)}", "target": "${1:./bin/executable}", "cwd": "^\"\\${workspaceRoot}\"", "ssh": { "host": "${2:127.0.0.1}", "cwd": "${3:/home/remote_user/project/}", "keyfile": "${4:/home/my_user/.ssh/id_rsa}", "user": "${5:remote_user}", "forwardX11": true, "x11host": "localhost", "x11port": 6000 }, "valuesFormatting": "parseText" } }, { "label": "GDB: Debug external embedded device", "description": "Debugs an embedded microcontroller supported by GDB by attaching over extended-remote", "body": { "type": "gdb", "request": "attach", "name": "${6:Debug Microcontroller}", "target": "extended-remote ${2:/dev/cu.usbmodem00000000}", "executable": "${1:./bin/executable.elf}", "cwd": "^\"\\${workspaceRoot}\"", "autorun": [ "monitor tpwr enable", "monitor swdp_scan", "attach 1", "load ${1:./bin/executable.elf}" ] }, "valuesFormatting": "parseText" } ] }, { "type": "lldb-mi", "program": "./out/src/lldb.js", "runtime": "node", "label": "LLDB", "languages": [ "c", "cpp", "d", "objective-c", "fortran", "fortran-modern", "fortran90", "fortran_free-form", "fortran_fixed-form", "rust", "pascal", "objectpascal", "ada", "nim", "arm", "asm", "vala", "crystal", "kotlin", "zig" ], "variables": { "FileBasenameNoExt": "code-debug.getFileBasenameNoExt", "FileNameNoExt": "code-debug.getFileNameNoExt" }, "configurationAttributes": { "launch": { "required": [ "target" ], "properties": { "target": { "type": "string", "description": "Path of executable" }, "arguments": { "type": "string", "description": "Arguments to append after the executable" }, "cwd": { "type": "string", "description": "project path" }, "lldbmipath": { "type": "string", "description": "Path to the lldb-mi executable or the command if in PATH", "default": "lldb-mi" }, "env": { "type": "object", "description": "Environment overriding the lldb-mi (and in turn also the process) environment", "default": null }, "debugger_args": { "type": "array", "description": "Additional arguments to pass to LLDB", "default": [] }, "pathSubstitutions": { "type": "object", "description": "Help LLDB find your source using path substitutions (LLDB `target.source-map)` variable", "default": { "": "" } }, "valuesFormatting": { "type": "string", "description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any", "default": "parseText", "enum": [ "disabled", "parseText", "prettyPrinters" ] }, "printCalls": { "type": "boolean", "description": "Prints all lldb calls to the console", "default": false }, "showDevDebugOutput": { "type": "boolean", "description": "Prints all lldb responses to the console", "default": false }, "autorun": { "type": "array", "description": "lldb commands to run when starting to debug", "default": [] }, "stopAtEntry": { "type": [ "boolean", "string" ], "description": "Whether debugger should stop at application entry point", "default": false }, "ssh": { "required": [ "host", "cwd", "user" ], "type": "object", "description": "If this is set then the extension will connect to an ssh host and run lldb there", "properties": { "host": { "type": "string", "description": "Remote host name/ip to connect to" }, "port": { "type": [ "number", "string" ], "description": "Remote port number", "default": 22 }, "user": { "type": "string", "description": "Username to connect as" }, "password": { "type": "string", "description": "Plain text password (unsafe; if possible use keyfile instead)" }, "keyfile": { "type": "string", "description": "Absolute path to private key" }, "useAgent": { "type": "boolean", "description": "Auto-detect the running SSH agent (via SSH_AUTH_SOCK environment variable) and use it to perform authentication", "default": false }, "sourceFileMap": { "type": "object", "description": "Mapping of source paths (from GDB on ssh remote) to local (IDE) paths.", "default": { "": "" } }, "cwd": { "type": "string", "description": "Working directory for the debugger.\nIf `ssh.sourceFileMap` is not set, then this is also the project path on the remote for mapping with `cwd`." }, "forwardX11": { "type": "boolean", "description": "If true, the server will redirect x11 to the local host", "default": true }, "x11host": { "type": "string", "description": "Hostname/ip to redirect X11 data to", "default": "localhost" }, "x11port": { "type": [ "number", "string" ], "description": "Port to redirect X11 data to (by default port = display + 6000)", "default": 6000 }, "remotex11screen": { "type": "number", "description": "Screen to start the application on the remote side", "default": 0 }, "bootstrap": { "type": "string", "description": "Content will be executed on the SSH host before the debugger call." } } } } }, "attach": { "required": [ "target" ], "properties": { "target": { "type": "string", "description": "PID of running program or program name" }, "valuesFormatting": { "type": "string", "description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any", "default": "parseText", "enum": [ "disabled", "parseText", "prettyPrinters" ] }, "printCalls": { "type": "boolean", "description": "Prints all LLDB calls to the console", "default": false }, "showDevDebugOutput": { "type": "boolean", "description": "Prints all LLDB responses to the console", "default": false }, "executable": { "type": "string", "description": "Path of executable for debugging symbols" }, "lldbmipath": { "type": "string", "description": "Path to the lldb-mi executable or the command if in PATH", "default": "lldb-mi" }, "env": { "type": "object", "description": "Environment overriding the lldb-mi (and in turn also the process) environment", "default": null }, "debugger_args": { "type": "array", "description": "Additional arguments to pass to LLDB", "default": [] }, "pathSubstitutions": { "type": "object", "description": "Help LLDB find your source using path substitutions (LLDB `target.source-map)` variable", "default": { "": "" } }, "cwd": { "type": "string", "description": "project path", "default": "${workspaceRoot}" }, "autorun": { "type": "array", "description": "lldb commands to run when starting to debug", "default": [] }, "stopAtConnect": { "type": "boolean", "description": "Whether debugger should stop after connecting to target", "default": false }, "stopAtEntry": { "type": [ "boolean", "string" ], "description": "Whether debugger should stop at application entry point", "default": false } } } }, "initialConfigurations": [ { "name": "Debug", "type": "lldb-mi", "request": "launch", "target": "./bin/executable", "cwd": "${workspaceRoot}", "valuesFormatting": "parseText" } ], "configurationSnippets": [ { "label": "LLDB: Launch Program", "description": "Starts the program using lldb-mi", "body": { "type": "lldb-mi", "request": "launch", "name": "${2:Launch Program}", "target": "${1:./bin/executable}", "cwd": "^\"\\${workspaceRoot}\"", "valuesFormatting": "parseText" } }, { "label": "LLDB: Attach to PID", "description": "Attaches to a running program pid using lldb-mi", "body": { "type": "lldb-mi", "request": "attach", "name": "${2:Attach to PID}", "target": "${1:[PID]}", "cwd": "^\"\\${workspaceRoot}\"", "valuesFormatting": "parseText" } }, { "label": "LLDB: Launch over SSH", "description": "Remotely starts the program using lldb-mi", "body": { "type": "lldb-mi", "request": "launch", "name": "${6:Launch Program (SSH)}", "target": "${1:./bin/executable}", "cwd": "^\"\\${workspaceRoot}\"", "ssh": { "host": "${2:127.0.0.1}", "cwd": "${3:/home/remote_user/project/}", "keyfile": "${4:/home/my_user/.ssh/id_rsa}", "user": "${5:remote_user}" }, "valuesFormatting": "parseText" } }, { "label": "LLDB: Launch GUI over SSH with X11 forwarding", "description": "Remotely starts the program using lldb-mi with X11 forwarding", "body": { "type": "lldb-mi", "request": "launch", "name": "${6:Launch Program (SSH + X11)}", "target": "${1:./bin/executable}", "cwd": "^\"\\${workspaceRoot}\"", "ssh": { "host": "${2:127.0.0.1}", "cwd": "${3:/home/remote_user/project/}", "keyfile": "${4:/home/my_user/.ssh/id_rsa}", "user": "${5:remote_user}", "forwardX11": true, "x11host": "localhost", "x11port": 6000 }, "valuesFormatting": "parseText" } } ] }, { "type": "mago-mi", "program": "./out/src/mago.js", "runtime": "node", "label": "Mago-MI", "variables": { "FileBasenameNoExt": "code-debug.getFileBasenameNoExt", "FileNameNoExt": "code-debug.getFileNameNoExt" }, "configurationAttributes": { "launch": { "required": [ "target" ], "properties": { "target": { "type": "string", "description": "Path of executable" }, "arguments": { "type": "string", "description": "Arguments to append after the executable" }, "cwd": { "type": "string", "description": "project path" }, "magomipath": { "type": "string", "description": "Path to the mago-mi executable or the command if in PATH", "default": "mago-mi" }, "env": { "type": "object", "description": "Environment overriding the mago-mi (and in turn also the process) environment", "default": null }, "debugger_args": { "type": "array", "description": "Additional arguments to pass to mago", "default": [] }, "valuesFormatting": { "type": "string", "description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any", "default": "parseText", "enum": [ "disabled", "parseText", "prettyPrinters" ] }, "printCalls": { "type": "boolean", "description": "Prints all mago calls to the console", "default": false }, "showDevDebugOutput": { "type": "boolean", "description": "Prints all mago responses to the console", "default": false }, "autorun": { "type": "array", "description": "mago commands to run when starting to debug", "default": [] } } }, "attach": { "required": [ "target" ], "properties": { "target": { "type": "string", "description": "PID of running program or program name" }, "valuesFormatting": { "type": "string", "description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any", "default": "parseText", "enum": [ "disabled", "parseText", "prettyPrinters" ] }, "printCalls": { "type": "boolean", "description": "Prints all mago calls to the console", "default": false }, "showDevDebugOutput": { "type": "boolean", "description": "Prints all mago responses to the console", "default": false }, "executable": { "type": "string", "description": "Path of executable for debugging symbols" }, "magomipath": { "type": "string", "description": "Path to the mago-mi executable or the command if in PATH", "default": "mago-mi" }, "env": { "type": "object", "description": "Environment overriding the mago-mi (and in turn also the process) environment", "default": null }, "debugger_args": { "type": "array", "description": "Additional arguments to pass to mago", "default": [] }, "cwd": { "type": "string", "description": "project path", "default": "${workspaceRoot}" }, "autorun": { "type": "array", "description": "mago commands to run when starting to debug", "default": [] }, "stopAtConnect": { "type": "boolean", "description": "Whether debugger should stop after connecting to target", "default": false } } } }, "initialConfigurations": [ { "name": "Debug", "type": "mago-mi", "request": "launch", "target": "./bin/executable", "cwd": "${workspaceRoot}", "valuesFormatting": "parseText" } ], "configurationSnippets": [ { "label": "Mago: Launch Program", "description": "Starts the program using mago-mi", "body": { "type": "mago-mi", "request": "launch", "name": "${2:Launch Program}", "target": "${1:./bin/executable}", "cwd": "^\"\\${workspaceRoot}\"", "valuesFormatting": "parseText" } }, { "label": "Mago: Attach to PID", "description": "Attaches to a running program pid using mago-mi", "body": { "type": "mago-mi", "request": "attach", "name": "${2:Attach to PID}", "target": "${1:[PID]}", "cwd": "^\"\\${workspaceRoot}\"", "valuesFormatting": "parseText" } } ] } ] }, "scripts": { "vscode:prepublish": "tsc -p ./", "compile": "tsc -watch -p ./" }, "dependencies": { "ssh2": "^1.6.0", "vscode-debugadapter": "^1.45.1", "vscode-debugprotocol": "^1.45.0", "node-interval-tree": "^1.3.3", "json-stream-stringify": "^2.0.4", "stream-json": "^1.7.3" }, "devDependencies": { "@types/mocha": "^5.2.6", "@types/node": "^11.11.3", "@types/vscode": "^1.54.0", "mocha": "^9.1.3", "tslint": "^5.20.1", "typescript": "^3.9.3", "vscode-test": "1.3.0" } }