Skip to main content
The debugger connects VS Code to a running Garry’s Mod dedicated server (SRCDS) through a small binary module called gm_rdb. It is meant for local development servers.
Do not install gm_rdb on a public or production server. It lets a connected debugger run any Lua on the server.

Set up with the wizard

1

Start the wizard

Click GLuaLS in the status bar and choose Setup Debugger, or run GLuaLS: Configure Debugger from the Command Palette (Ctrl+Shift+P).
2

Answer the prompts

The wizard asks for your SRCDS folder (it usually finds it for you), the server’s platform, and how your project maps to the server’s files. It then:
  • Installs gm_rdb into garrysmod/lua/bin/
  • Adds garrysmod/lua/autorun/debug.lua, which starts the debugger when the server loads
  • Adds a [SERVER] Attach to SRCDS entry to .vscode/launch.json
3

Restart the server

Restart SRCDS so it loads the module.
4

Connect

Open Run and Debug (Ctrl+Shift+D), pick [SERVER] Attach to SRCDS and press F5.
The extension keeps gm_rdb and debug.lua up to date and asks before installing an update.

Debug the client

The wizard can also install the client module (rdb_client) into your own Garry’s Mod install. It then adds a [CLIENT] Attach to Gmod entry to launch.json. Join your server with that game install, then start [CLIENT] Attach to Gmod. The client part of debug.lua comes from the server, so the server needs to be set up first.
With the client module installed, any server you join that runs a matching debug.lua could start the debugger in your game. Remove the module when you are not using it.

launch.json options

The wizard writes these for you. You only need to edit them if your layout changes. If breakpoints never hit, sourceFileMap is usually wrong. Each entry should map your project folder to the same folder as seen from garrysmod/.

Manual setup

Use this only if the wizard fails.
  1. Download the module for your server from the GitHub releases: gmsv_rdb_win64.dll, gmsv_rdb_win32.dll, gmsv_rdb_linux64.dll or gmsv_rdb_linux.dll.
  2. Put it in garrysmod/lua/bin/ on the server. Create the folder if it does not exist.
  3. Create garrysmod/lua/autorun/debug.lua:
    garrysmod/lua/autorun/debug.lua
  4. Add an attach entry to .vscode/launch.json:
    .vscode/launch.json
This minimal debug.lua is enough for breakpoints and stepping. Run Lua on the client and Refresh GLua File need the full file the wizard writes.

Server launch options

Add these to the SRCDS command line only if you need them:
Only use -rdb_allow_remote on a network you trust, and open the debugger port in the firewall only for your own machine.