diff --git a/core/logic/smn_core.cpp b/core/logic/smn_core.cpp index 58c16e0d..611d026b 100644 --- a/core/logic/smn_core.cpp +++ b/core/logic/smn_core.cpp @@ -940,9 +940,8 @@ static cell_t FrameIterator_GetFilePath(IPluginContext *pContext, const cell_t * static cell_t LogStackTrace(IPluginContext *pContext, const cell_t *params) { char buffer[512]; - g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 1); - + IFrameIterator *it = pContext->CreateFrameIterator(); ke::Vector arr = g_DbgReporter.GetStackTrace(it); pContext->DestroyFrameIterator(it); @@ -951,7 +950,7 @@ static cell_t LogStackTrace(IPluginContext *pContext, const cell_t *params) g_Logger.LogError("[SM] Stack trace requested: %s", buffer); g_Logger.LogError("[SM] Called from: %s", pPlugin->GetFilename()); - for (size_t i = 0; i < arr.length(); i) + for (size_t i = 0; i < arr.length(); ++i) { g_Logger.LogError("%s", arr[i].chars()); } diff --git a/plugins/include/sourcemod.inc b/plugins/include/sourcemod.inc index 3b188630..66cb9aae 100644 --- a/plugins/include/sourcemod.inc +++ b/plugins/include/sourcemod.inc @@ -312,6 +312,16 @@ native void SetFailState(const char[] string, any ...); */ native void ThrowError(const char[] fmt, any ...); +/** + * Logs a stack trace from the current function call. Code + * execution continues after the call + * + * @param fmt Format string to send with the stack trace. + * @param ... Format arguments. + * @error Always logs a stack trace. + */ +native void LogStackTrace(const char[] fmt, any ...); + /** * Gets the system time as a unix timestamp. *