aboutsummaryrefslogtreecommitdiff
path: root/mp/src/tier1/interface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/tier1/interface.cpp')
-rw-r--r--mp/src/tier1/interface.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/mp/src/tier1/interface.cpp b/mp/src/tier1/interface.cpp
index c221ac87..c970e5c6 100644
--- a/mp/src/tier1/interface.cpp
+++ b/mp/src/tier1/interface.cpp
@@ -143,6 +143,7 @@ static void *Sys_GetProcAddress( const char *pModuleName, const char *pName )
#endif
}
+#if !defined(LINUX)
static void *Sys_GetProcAddress( HMODULE hModule, const char *pName )
{
#ifdef WIN32
@@ -151,6 +152,7 @@ static void *Sys_GetProcAddress( HMODULE hModule, const char *pName )
return (void *)dlsym( (void *)hModule, pName );
#endif
}
+#endif
bool Sys_IsDebuggerPresent()
{
@@ -540,3 +542,26 @@ void CDllDemandLoader::Unload()
m_hModule = 0;
}
}
+
+#if defined( STAGING_ONLY ) && defined( _WIN32 )
+
+typedef USHORT( WINAPI RtlCaptureStackBackTrace_FUNC )(
+ ULONG frames_to_skip,
+ ULONG frames_to_capture,
+ PVOID *backtrace,
+ PULONG backtrace_hash );
+
+extern "C" int backtrace( void **buffer, int size )
+{
+ HMODULE hNTDll = GetModuleHandleA( "ntdll.dll" );
+ static RtlCaptureStackBackTrace_FUNC * const pfnRtlCaptureStackBackTrace =
+ ( RtlCaptureStackBackTrace_FUNC * )GetProcAddress( hNTDll, "RtlCaptureStackBackTrace" );
+
+ if ( !pfnRtlCaptureStackBackTrace )
+ return 0;
+
+ return (int)pfnRtlCaptureStackBackTrace( 2, size, buffer, 0 );
+}
+
+#endif // STAGING_ONLY && _WIN32
+