Skip to main content

Automatic setup

gm_rdb is a binary module that runs inside SRCDS and exposes Lua state for debugging. Use the built-in setup wizard. The walkthrough should appear when you install the extension for the first time. You can also start it yourself:
  1. Open the Command Palette (Ctrl+Shift+P)
  2. Run GLua: Setup Debugger
  3. Follow the wizard steps. It will download the correct gm_rdb binary for your server’s OS and architecture, then guide you through placing the files
You can also click GLuaLS in the status bar to start the setup wizard.

Manual installation

The VS Code extension can set up the debugger for you. Use manual setup only if the extension setup fails.

Step 1: Download and install gm_rdb

Download the correct binary for your server from the GitHub releases page: Place the binary in garrysmod/lua/bin/ on your server. Create the bin folder if it does not exist. The final path should be garrysmod/lua/bin/gmsv_rdb_*.dll. Create garrysmod/lua/autorun/debug.lua:
garrysmod/lua/autorun/debug.lua
This is enough to attach to and debug the server. Use the setup wizard when you also need its current client-execution and file-refresh helpers.

Runtime launch flags

gm_rdb reads these command-line flags when the module loads. You can skip them unless you need the listed behavior. Add these CLI flags to your Garry’s Mod or SRCDS launch options.

Step 2: Configure VS Code

Create a launch.json in your .vscode/ folder (or use the VS Code Run & Debug panel → Create a launch.json file):

Attach to a running server

Use attach when the server is already running. Most addon development uses this option.
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.vscode/launch.json
  • “sourceRoot”: should point to your garrysmod folder (one level up from scrds)
  • “sourceFileMap” should map workspace folders to their corresponding paths, going from the sourceRoot folder.
Edit the configuration above to match your workspace structure. Most setups only need one new line in sourceFileMap. Addon example:
Gamemode example:
This example covers common addon and gamemode layouts. You can use hardcoded paths, but other developers will need to edit them before using your config.

Launch a server

The launch option is unsupported and may not work on all systems. Use attach instead.

Step 3: Start debugging

  1. Start your SRCDS server
  2. In VS Code, open the Run & Debug panel (Ctrl+Shift+D)
  3. Select your launch configuration from the dropdown
  4. Press F5 (or click the green play button)
When VS Code connects, the debug toolbar appears at the top of the screen. The Debug Console opens in the bottom panel.

Configuration reference

Attach configuration

Launch configuration (server process)

The launch option is unsupported and may not work on all systems. Use attach instead.
Includes the above, plus:

Changing the default port

To make gm_rdb listen on a different port, change this line in debug.lua:
garrysmod/lua/autorun/debug.lua
Update "port" in your launch.json to match.

Remote debugging

Do not use the debugger on untrusted or public networks. Use remote debugging only if you understand and accept the risk.
If debugging a remote server, start SRCDS with -rdb_allow_remote, open the gm_rdb port (default 21111) in your server’s firewall, and set host in your launch.json to the server’s reachable address. Without -rdb_allow_remote, gm_rdb only accepts loopback connections, so remote attach fails.
Do not enable this option unless you understand and accept the risk. If you enable this option on the client and expose your local port, any server could activate the debugger through clientside Lua.

Pause on activation

Do not use the debugger on untrusted or public networks. This option pauses execution once loaded (usually during startup/initial join). If no timeout is provided, execution resumes automatically after 60 seconds if no debugger connects.
rdb.activate(...) does not pause execution by default. The debugger may miss the server or client startup sequence unless you connect fast. To pause on the next hook event after rdb.activate(...) runs, add -rdb_pause_on_activate to the server startup arguments or client Steam launch options. You can provide a timeout in seconds.
  • -rdb_pause_on_activate pauses on activation and resumes after 60 seconds if no debugger connects.
  • -rdb_pause_on_activate 120 pauses on activation with a 120-second timeout.
  • -rdb_pause_on_activate 0 pauses until a debugger connects.
Use this when you need to capture the server or client startup sequence.
If you enable this option on the client, any server could activate the debugger and freeze your game.