Automatic setup
gm_rdb is a binary module that runs inside SRCDS and exposes Lua state for debugging.
Using the setup wizard (recommended)
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:- Open the Command Palette (
Ctrl+Shift+P) - Run GLua: Setup Debugger
- Follow the wizard steps. It will download the correct
gm_rdbbinary for your server’s OS and architecture, then guide you through placing the files
Manual installation
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
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 alaunch.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..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.
sourceFileMap.
Addon example:
Launch a server
Step 3: Start debugging
- Start your SRCDS server
- In VS Code, open the Run & Debug panel (
Ctrl+Shift+D) - Select your launch configuration from the dropdown
- Press F5 (or click the green play button)
Configuration reference
Attach configuration
Launch configuration (server process)
Includes the above, plus:Changing the default port
To makegm_rdb listen on a different port, change this line in debug.lua:
garrysmod/lua/autorun/debug.lua
"port" in your launch.json to match.
Remote debugging
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
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_activatepauses on activation and resumes after 60 seconds if no debugger connects.-rdb_pause_on_activate 120pauses on activation with a 120-second timeout.-rdb_pause_on_activate 0pauses until a debugger connects.
If you enable this option on the client, any server could activate the debugger and freeze your game.