### SDK_OnLoad Function Source: https://context7.com/peace-maker/sp-console-debugger/llms.txt Initializes the debugger extension and installs the debug break handler. ```APIDOC ## SDK_ONLOAD FUNCTION ### Description Initializes the debugger extension and installs the debug break handler. ### Signature ```cpp bool ConsoleDebugger::SDK_OnLoad(char *error, size_t maxlength, bool late) ``` ### Parameters * `error` (char *): Buffer to store error messages. * `maxlength` (size_t): Maximum length of the error buffer. * `late` (bool): Flag indicating if the extension is loaded late. ### Return Value * `true` on success, `false` on failure (error message set in `error` buffer). ### Implementation Details * Checks for VM debugging API version (>= 5). * Initializes the debugger map. * Installs the `OnDebugBreak` handler. * Registers console commands and plugin listener. ``` -------------------------------- ### SDK_OnLoad Function (C++) Source: https://context7.com/peace-maker/sp-console-debugger/llms.txt Initializes the SourceMod console debugger extension by checking VM compatibility, setting up internal mappings, and installing the debug break handler. It also registers console commands and plugin listeners. ```cpp bool ConsoleDebugger::SDK_OnLoad(char *error, size_t maxlength, bool late) { // Check VM supports debugging (API version 5+) if (smutils->GetScriptingEngine()->GetEngineAPIVersion() < 5) { ke::SafeStrcpy(error, maxlength, "This SourcePawn VM doesn't support line debugging."); return false; } // Initialize debugger map for tracking plugin instances if (!debugger_map_.init()) { ke::SafeStrcpy(error, maxlength, "Failed to setup plugin -> debugger instance map."); return false; } // Install debug break handler in SourcePawn VM if (smutils->GetScriptingEngine()->SetDebugBreakHandler(OnDebugBreak) != SP_ERROR_NONE) { ke::SafeStrcpy(error, maxlength, "Failed to install debugger in the SourcePawn VM."); return false; } // Register console commands and plugin listener plsys->AddPluginsListener(this); rootconsole->AddRootConsoleCommand3("debug", "Debug Plugins", this); return true; } // Returns true on success, false on failure with error message set ``` -------------------------------- ### SourceMod Debug Console Commands Source: https://github.com/peace-maker/sp-console-debugger/blob/master/README.md Demonstrates the basic commands available within the SourceMod debug console menu for starting and managing plugin debugging and breakpoints. These commands are accessed via the 'sm debug' command. ```sourcepawn_console sm debug SourceMod Debug Menu: start - Start debugging a plugin next - Start debugging the plugin which is loaded next bp - Handle breakpoints in a plugin sm debug start [SM] Usage: sm debug start <#|file> sm debug bp [SM] Usage: sm debug bp <#|file>