diff options
| author | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
|---|---|---|
| committer | Michael Sartain <[email protected]> | 2014-10-02 08:25:55 -0700 |
| commit | 55ed12f8d1eb6887d348be03aee5573d44177ffb (patch) | |
| tree | 3686f7ca78c780cd9a3d367b79a9d9250c1be7c0 /mp/src/tier1/interface.cpp | |
| parent | * Added support for Visual C++ 2013 Express to VPC (diff) | |
| download | source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.tar.xz source-sdk-2013-55ed12f8d1eb6887d348be03aee5573d44177ffb.zip | |
Updated the SDK with the latest code from the TF and HL2 branches.
Diffstat (limited to 'mp/src/tier1/interface.cpp')
| -rw-r--r-- | mp/src/tier1/interface.cpp | 25 |
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 + |