View Single Post
Author Message
Garey
Member
Join Date: Feb 2008
Location: Russian Federation
Old 12-17-2021 , 04:22   [SourcePawn] Debug Server + VSCode Extension
Reply With Quote #1

SourcePawn Debug Adapter and Server for VSCode

An extension for Visual Studio Code that adds support debugging in SourcePawn vm.


Features
  • Breakpoints.
  • Step Into.
  • Step Over.
  • Step Out.
  • Pause.
  • Continue.
  • Show local/global variables.
  • Show callstack.
  • Support multiple sessions.

Installation Instructions
- Download last sm-debugger from github releases:https://github.com/Garey27/sm-debugger/releases
- Unpack the contents of the archive on the destination game server.
- Open VSCode, install the extension. VSCode marketplace
- Open the project in VSCode, configure the sourcepawn Debugger configuration by clicking on the appropriate button in the "Run and Debug" section.
- Connect to the server by pressing the F5 button.

Configuration
Extension both on the game server and in VSCode, allow you to change the port for communication with each other. This can be useful if you are debugging several projects at once on different game servers, but on the same host. To do this, in /addons/sourcemod/configs/core.cfg, you can add the DebuggerPort parameter, which will indicate which port the debug server should use (by default, port 12345 is occupied).
It is also possible to set a delay between the start of the debug server and the continuation of the work of SRCDS itself (it can be useful if you need to debug OnPluginStart () exactly when the server starts). To do this, in the same file, specify the DebuggerDelay variable with the value you need (float).


Note that the extension currently "listens" for connections from all network interfaces, and does not have any authorization to connect to the debug server. Use on a production server at your own risk!


Example screenshot of debugger session:


Source codes:
Debug Server
VSCode Extension
__________________
Sorry for my bad english

Last edited by Garey; 01-02-2022 at 07:18.
Garey is offline
Send a message via ICQ to Garey