Debugger Support

Binaries as well as shared-libraries compiled with lrc support debugging via Debuggers that target Lua code. One example is the Local Lua Debugger extension for Visual Studio Code.

In order to setup your debugger for compiled executables, simply set it as Lua interpreter exectuable.

An example of how to do this for the Local Lua Debugger in VScode is shown below:

Local Lua Debugger

IDE: Visual Studio Code

Create a file named .vscode/launch.json with the following contents:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug Executable 'program'",
      "type": "lua-local",
      "request": "launch",
      "program": {
        "command": "${workspaceFolder}/bin/program"  // Your compiled executable here
      }
    }
  ]
}

Make sure to include the debugger snippet in your entrypoint lua file:

-- program.lua

if os.getenv 'LOCAL_LUA_DEBUGGER_VSCODE' == '1' then
  require 'lldebugger'.start()
end

You may now compile your executable using lrc and launch debugging to step through and analyze the code!