mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Debugging: Added wheaty everywhere and modified it to always reliably report issues during static initialization
This commit is contained in:
@@ -12,17 +12,9 @@ CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Platform
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
# Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in common project
|
||||
# It needs to be included both in authserver and worldserver for the static global variable to be properly initialized
|
||||
# and to handle crash logs on windows
|
||||
list(APPEND PRIVATE_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Errors.h)
|
||||
|
||||
if (USE_COREPCH)
|
||||
set(PRIVATE_PCH_HEADER PrecompiledHeaders/commonPCH.h)
|
||||
set(PRIVATE_PCH_SOURCE PrecompiledHeaders/commonPCH.cpp)
|
||||
|
||||
@@ -50,8 +50,11 @@ inline LPTSTR ErrorMessage(DWORD dw)
|
||||
//============================== Global Variables =============================
|
||||
|
||||
//
|
||||
// Declare the static variables of the WheatyExceptionReport class
|
||||
// Declare the static variables of the WheatyExceptionReport class and force their initialization before any other static in the program
|
||||
//
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4073) // C4073: initializers put in library initialization area
|
||||
#pragma init_seg(lib)
|
||||
TCHAR WheatyExceptionReport::m_szLogFileName[MAX_PATH];
|
||||
TCHAR WheatyExceptionReport::m_szDumpFileName[MAX_PATH];
|
||||
LPTOP_LEVEL_EXCEPTION_FILTER WheatyExceptionReport::m_previousFilter;
|
||||
@@ -65,9 +68,9 @@ bool WheatyExceptionReport::alreadyCrashed;
|
||||
std::mutex WheatyExceptionReport::alreadyCrashedLock;
|
||||
WheatyExceptionReport::pRtlGetVersion WheatyExceptionReport::RtlGetVersion;
|
||||
|
||||
|
||||
// Declare global instance of class
|
||||
WheatyExceptionReport g_WheatyExceptionReport;
|
||||
#pragma warning(pop)
|
||||
|
||||
//============================== Class Methods =============================
|
||||
|
||||
@@ -1460,3 +1463,8 @@ char* WheatyExceptionReport::PrintSymbolDetail(char* pszCurrBuffer)
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
void InitializeCrashHandler()
|
||||
{
|
||||
// dummy call to make the linker not discard the compilation unit
|
||||
}
|
||||
|
||||
@@ -210,5 +210,8 @@ class WheatyExceptionReport
|
||||
|
||||
extern WheatyExceptionReport g_WheatyExceptionReport; // global instance of class
|
||||
#endif // _WIN32
|
||||
|
||||
// dummy call to make the linker not discard the compilation unit
|
||||
void InitializeCrashHandler();
|
||||
#endif // _WHEATYEXCEPTIONREPORT_
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
set(sources_windows
|
||||
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h
|
||||
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp
|
||||
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h
|
||||
)
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "SslContext.h"
|
||||
#include "DatabaseLoader.h"
|
||||
#include "LoginRESTService.h"
|
||||
#include "WheatyExceptionReport.h"
|
||||
#include <iostream>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
@@ -77,6 +78,7 @@ static uint32 _banExpiryCheckInterval;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
InitializeCrashHandler();
|
||||
signal(SIGABRT, &Trinity::AbortHandler);
|
||||
|
||||
auto configFile = fs::absolute(_TRINITY_BNET_CONFIG);
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "DatabaseLoader.h"
|
||||
#include "AppenderDB.h"
|
||||
#include "Metric.h"
|
||||
#include "WheatyExceptionReport.h"
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
@@ -99,6 +100,7 @@ variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, s
|
||||
/// Launch the Trinity server
|
||||
extern int main(int argc, char** argv)
|
||||
{
|
||||
InitializeCrashHandler();
|
||||
signal(SIGABRT, &Trinity::AbortHandler);
|
||||
|
||||
auto configFile = fs::absolute(_TRINITY_CORE_CONFIG);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "Banner.h"
|
||||
#include "CompilerDefs.h"
|
||||
#include "WheatyExceptionReport.h"
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
@@ -128,6 +129,7 @@ namespace Connection_Patcher
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
InitializeCrashHandler();
|
||||
using namespace Connection_Patcher;
|
||||
|
||||
try
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "MapBuilder.h"
|
||||
#include "Timer.h"
|
||||
#include "Banner.h"
|
||||
#include "WheatyExceptionReport.h"
|
||||
|
||||
using namespace MMAP;
|
||||
|
||||
@@ -242,6 +243,7 @@ int finish(const char* message, int returnValue)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
InitializeCrashHandler();
|
||||
Trinity::Banner::Show("MMAP generator", [](char const* text) { printf("%s\n", text); }, nullptr);
|
||||
|
||||
int threads = 3, mapnum = -1;
|
||||
|
||||
@@ -21,13 +21,15 @@
|
||||
|
||||
#include "TileAssembler.h"
|
||||
#include "Banner.h"
|
||||
#include "WheatyExceptionReport.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
InitializeCrashHandler();
|
||||
Trinity::Banner::Show("VMAP assembler", [](char const* text) { std::cout << text << std::endl; }, nullptr);
|
||||
|
||||
std::string src = "Buildings";
|
||||
std::string dest = "vmaps";
|
||||
std::string dest = "vmaps";
|
||||
|
||||
if (argc > 3)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#include "vmapexport.h"
|
||||
#include "Banner.h"
|
||||
#include "WheatyExceptionReport.h"
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
@@ -491,6 +492,7 @@ bool processArgv(int argc, char ** argv, const char *versionString)
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
InitializeCrashHandler();
|
||||
Trinity::Banner::Show("VMAP data extractor", [](char const* text) { printf("%s\n", text); }, nullptr);
|
||||
|
||||
bool success = true;
|
||||
|
||||
Reference in New Issue
Block a user