Skip to content

Instantly share code, notes, and snippets.

@faustinoaq
Last active October 29, 2019 16:58
Show Gist options
  • Save faustinoaq/a6c4a008841400f5dbb9b94cb1b37e4f to your computer and use it in GitHub Desktop.
Save faustinoaq/a6c4a008841400f5dbb9b94cb1b37e4f to your computer and use it in GitHub Desktop.
Guide to debug amber application on VSCode.

Amber Debug

Debugging an Amber project on VSCode with GDB and Native Debug.

Requisites

Steps

  1. task.json to compile the main file with debug support
{
  "version": "2.0.0",
  "tasks": [
    {
      "taskName": "amber",
      "command": "crystal build -d -p src/app.cr",
      "type": "shell",
      "presentation": {
        "echo": true,
        "reveal": "never",
        "focus": false,
        "panel": "shared"
      }
    }
  ]
}
  1. launch.json configuration to debug binary
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug",
      "type": "gdb",
      "request": "launch",
      "target": "./app",
      "cwd": "${workspaceRoot}",
      "preLaunchTask": "amber"
    }
  ]
}
  1. Then hit the green play button and whoala!

set breakpoint

change variable value

Native Debug allows to set breakpoints, watch variables and execute GDB commands inside VSCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment