/bash

How to Debug bash with VS Code

Primary LanguageShellCreative Commons Zero v1.0 UniversalCC0-1.0

How to Debug Bash with VS Code

Summary

Basic

Spec

  • OS
    • MacOS
    • Windows
    • Linux
  • Break Point
    • ✅ break point
    • condition break point : able to set, but not working
    • function breakpoint
  • Step Execution
    • Step Over
    • Step Into
    • Step Out
    • Continue
    • Step Back
    • Move To
    • Pause
  • Variables>
    • ✅ variables views
    • ✅ watch variables
  • Call Stack
    • ✅ call stack
  • Evaluation
    • eval expression to show variables
    • eval expression to change variables
  • Type of Execution
    • debug executable package
    • remote debugging

Instruction

MacOS

brew install bash

Linux(Ubuntu 20.04)

no additional installation

Windows

debugging executable file

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Bash-Debug (hardcoded script name)",
      "type": "bashdb",
      "request": "launch",
      "program": "${workspaceRoot}/bubbleSort.sh",
      "commandLineArguments": "4 3 2 1"
    }
  ]
}