Skip to content

Commit

Permalink
Add "EnableLineDebugging" core.cfg option
Browse files Browse the repository at this point in the history
Allow extensions to register a debug break handler in the SourcePawn VM.

Enable line debugging support in the VM before any plugin is loaded through a core.cfg option.
  • Loading branch information
peace-maker committed Jan 5, 2025
1 parent a44cfe1 commit 85156de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions configs/core.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,11 @@
* "jitdump" - Generate extended perf metadata (Linux only - function names, bytecode, and source information)
*/
"JITMetadata" "default"

/**
* Setup the SourcePawn VM to enable extensions to use a debugging API to step through
* plugins line by line. This heavily decreases server performance and should NEVER be
* used on a production server, but ONLY during plugin development.
*/
"EnableLineDebugging" "no"
}
6 changes: 6 additions & 0 deletions core/sourcemod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ void SourceModBase::StartSourceMod(bool late)
g_pSourcePawn2->InstallWatchdogTimer(atoi(timeout) * 1000);
}

const char *linedebugger = GetCoreConfigValue("EnableLineDebugging");
if (linedebugger != NULL && strcasecmp(linedebugger, "yes") == 0)
{
g_pPawnEnv->EnableDebugBreak();
}

SH_ADD_HOOK(IServerGameDLL, Think, gamedll, SH_MEMBER(logicore.callbacks, &IProviderCallbacks::OnThink), false);
}

Expand Down

0 comments on commit 85156de

Please sign in to comment.