mirror of
https://github.com/FirestormViewer/phoenix-firestorm.git
synced 2026-08-14 17:02:33 +00:00
Replace remaining BOOL with bool in llcommon and remove dead code
This commit is contained in:
committed by
Andrey Lihatskiy
parent
13bf5a2442
commit
364bd17304
@@ -292,10 +292,10 @@ public:
|
||||
free(m_szSymPath);
|
||||
m_szSymPath = NULL;
|
||||
}
|
||||
BOOL Init(LPCSTR szSymPath)
|
||||
bool Init(LPCSTR szSymPath)
|
||||
{
|
||||
if (m_parent == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
// Dynamically load the Entry-Points for dbghelp.dll:
|
||||
// First try to load the newsest one from
|
||||
TCHAR szTemp[4096];
|
||||
@@ -364,7 +364,7 @@ public:
|
||||
if (m_hDbhHelp == NULL) // if not already loaded, try to load a default-one
|
||||
m_hDbhHelp = LoadLibrary( _T("dbghelp.dll") );
|
||||
if (m_hDbhHelp == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
pSI = (tSI) GetProcAddress(m_hDbhHelp, "SymInitialize" );
|
||||
pSC = (tSC) GetProcAddress(m_hDbhHelp, "SymCleanup" );
|
||||
|
||||
@@ -388,7 +388,7 @@ public:
|
||||
FreeLibrary(m_hDbhHelp);
|
||||
m_hDbhHelp = NULL;
|
||||
pSC = NULL;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// SymInitialize
|
||||
@@ -415,7 +415,7 @@ public:
|
||||
GetUserNameA(szUserName, &dwSize);
|
||||
this->m_parent->OnSymInit(buf, symOptions, szUserName);
|
||||
|
||||
return TRUE;
|
||||
return false;
|
||||
}
|
||||
|
||||
StackWalker *m_parent;
|
||||
@@ -555,7 +555,7 @@ private:
|
||||
typedef MODULEENTRY32 * LPMODULEENTRY32;
|
||||
#pragma pack( pop )
|
||||
|
||||
BOOL GetModuleListTH32(HANDLE hProcess, DWORD pid)
|
||||
bool GetModuleListTH32(HANDLE hProcess, DWORD pid)
|
||||
{
|
||||
// CreateToolhelp32Snapshot()
|
||||
typedef HANDLE (__stdcall *tCT32S)(DWORD dwFlags, DWORD th32ProcessID);
|
||||
@@ -592,13 +592,13 @@ private:
|
||||
}
|
||||
|
||||
if (hToolhelp == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
hSnap = pCT32S( TH32CS_SNAPMODULE, pid );
|
||||
if (hSnap == (HANDLE) -1)
|
||||
{
|
||||
FreeLibrary(hToolhelp);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
keepGoing = !!pM32F( hSnap, &me );
|
||||
@@ -612,8 +612,8 @@ private:
|
||||
CloseHandle(hSnap);
|
||||
FreeLibrary(hToolhelp);
|
||||
if (cnt <= 0)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
return false;
|
||||
return true;
|
||||
} // GetModuleListTH32
|
||||
|
||||
// **************************************** PSAPI ************************
|
||||
@@ -623,7 +623,7 @@ private:
|
||||
LPVOID EntryPoint;
|
||||
} MODULEINFO, *LPMODULEINFO;
|
||||
|
||||
BOOL GetModuleListPSAPI(HANDLE hProcess)
|
||||
bool GetModuleListPSAPI(HANDLE hProcess)
|
||||
{
|
||||
// EnumProcessModules()
|
||||
typedef BOOL (__stdcall *tEPM)(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded );
|
||||
@@ -652,7 +652,7 @@ private:
|
||||
|
||||
hPsapi = LoadLibrary( _T("psapi.dll") );
|
||||
if (hPsapi == NULL)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
pEPM = (tEPM) GetProcAddress( hPsapi, "EnumProcessModules" );
|
||||
pGMFNE = (tGMFNE) GetProcAddress( hPsapi, "GetModuleFileNameExA" );
|
||||
@@ -662,7 +662,7 @@ private:
|
||||
{
|
||||
// we couldn't find all functions
|
||||
FreeLibrary(hPsapi);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
hMods = (HMODULE*) malloc(sizeof(HMODULE) * (TTBUFLEN / sizeof(HMODULE)));
|
||||
@@ -797,7 +797,7 @@ private:
|
||||
return result;
|
||||
}
|
||||
public:
|
||||
BOOL LoadModules(HANDLE hProcess, DWORD dwProcessId)
|
||||
bool LoadModules(HANDLE hProcess, DWORD dwProcessId)
|
||||
{
|
||||
// first try toolhelp32
|
||||
if (GetModuleListTH32(hProcess, dwProcessId))
|
||||
@@ -807,13 +807,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
BOOL GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V3 *pModuleInfo)
|
||||
bool GetModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULE64_V3 *pModuleInfo)
|
||||
{
|
||||
memset(pModuleInfo, 0, sizeof(IMAGEHLP_MODULE64_V3));
|
||||
if(this->pSGMI == NULL)
|
||||
{
|
||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
// First try to use the larger ModuleInfo-Structure
|
||||
pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V3);
|
||||
@@ -821,7 +821,7 @@ public:
|
||||
if (pData == NULL)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
memcpy(pData, pModuleInfo, sizeof(IMAGEHLP_MODULE64_V3));
|
||||
static bool s_useV3Version = true;
|
||||
@@ -833,7 +833,7 @@ public:
|
||||
memcpy(pModuleInfo, pData, sizeof(IMAGEHLP_MODULE64_V3));
|
||||
pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V3);
|
||||
free(pData);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
s_useV3Version = false; // to prevent unneccessarry calls with the larger struct...
|
||||
}
|
||||
@@ -847,11 +847,11 @@ public:
|
||||
memcpy(pModuleInfo, pData, sizeof(IMAGEHLP_MODULE64_V2));
|
||||
pModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE64_V2);
|
||||
free(pData);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
free(pData);
|
||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -860,7 +860,7 @@ StackWalker::StackWalker(DWORD dwProcessId, HANDLE hProcess)
|
||||
{
|
||||
this->m_verbose = true;
|
||||
this->m_options = OptionsAll;
|
||||
this->m_modulesLoaded = FALSE;
|
||||
this->m_modulesLoaded = false;
|
||||
this->m_hProcess = hProcess;
|
||||
this->m_sw = new StackWalkerInternal(this, this->m_hProcess);
|
||||
this->m_dwProcessId = dwProcessId;
|
||||
@@ -871,7 +871,7 @@ StackWalker::StackWalker(bool verbose, int options, LPCSTR szSymPath, DWORD dwPr
|
||||
{
|
||||
this->m_verbose = verbose;
|
||||
this->m_options = options;
|
||||
this->m_modulesLoaded = FALSE;
|
||||
this->m_modulesLoaded = false;
|
||||
this->m_hProcess = hProcess;
|
||||
this->m_sw = new StackWalkerInternal(this, this->m_hProcess);
|
||||
this->m_dwProcessId = dwProcessId;
|
||||
@@ -895,15 +895,15 @@ StackWalker::~StackWalker()
|
||||
this->m_sw = NULL;
|
||||
}
|
||||
|
||||
BOOL StackWalker::LoadModules()
|
||||
bool StackWalker::LoadModules()
|
||||
{
|
||||
if (this->m_sw == NULL)
|
||||
{
|
||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (m_modulesLoaded != FALSE)
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
// Build the sym-path:
|
||||
char *szSymPath = NULL;
|
||||
@@ -914,7 +914,7 @@ BOOL StackWalker::LoadModules()
|
||||
if (szSymPath == NULL)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
szSymPath[0] = 0;
|
||||
// Now first add the (optional) provided sympath:
|
||||
@@ -994,18 +994,18 @@ BOOL StackWalker::LoadModules()
|
||||
} // if SymBuildPath
|
||||
|
||||
// First Init the whole stuff...
|
||||
BOOL bRet = this->m_sw->Init(szSymPath);
|
||||
bool bRet = this->m_sw->Init(szSymPath);
|
||||
if (szSymPath != NULL) free(szSymPath); szSymPath = NULL;
|
||||
if (bRet == FALSE)
|
||||
if (!bRet)
|
||||
{
|
||||
this->OnDbgHelpErr("Error while initializing dbghelp.dll", 0, 0);
|
||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
bRet = this->m_sw->LoadModules(this->m_hProcess, this->m_dwProcessId);
|
||||
if (bRet != FALSE)
|
||||
m_modulesLoaded = TRUE;
|
||||
if (bRet)
|
||||
m_modulesLoaded = true;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ BOOL StackWalker::LoadModules()
|
||||
static StackWalker::PReadProcessMemoryRoutine s_readMemoryFunction = NULL;
|
||||
static LPVOID s_readMemoryFunction_UserData = NULL;
|
||||
|
||||
BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *context, PReadProcessMemoryRoutine readMemoryFunction, LPVOID pUserData)
|
||||
bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *context, PReadProcessMemoryRoutine readMemoryFunction, LPVOID pUserData)
|
||||
{
|
||||
m_verbose = verbose;
|
||||
CONTEXT c;
|
||||
@@ -1029,13 +1029,13 @@ BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con
|
||||
bool bLastEntryCalled = true;
|
||||
int curRecursionCount = 0;
|
||||
|
||||
if (m_modulesLoaded == FALSE)
|
||||
if (!m_modulesLoaded)
|
||||
this->LoadModules(); // ignore the result...
|
||||
|
||||
if (this->m_sw->m_hDbhHelp == NULL)
|
||||
{
|
||||
SetLastError(ERROR_DLL_INIT_FAILED);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
s_readMemoryFunction = readMemoryFunction;
|
||||
@@ -1062,7 +1062,7 @@ BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con
|
||||
if (GetThreadContext(hThread, &c) == FALSE)
|
||||
{
|
||||
ResumeThread(hThread);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1262,7 +1262,7 @@ BOOL StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con
|
||||
if (context == NULL)
|
||||
ResumeThread(hThread);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL __stdcall StackWalker::myReadProcMem(
|
||||
|
||||
@@ -112,9 +112,9 @@ public:
|
||||
LPVOID pUserData // optional data, which was passed in "ShowCallstack"
|
||||
);
|
||||
|
||||
BOOL LoadModules();
|
||||
bool LoadModules();
|
||||
|
||||
BOOL ShowCallstack(
|
||||
bool ShowCallstack(
|
||||
bool verbose,
|
||||
HANDLE hThread = GetCurrentThread(),
|
||||
const CONTEXT *context = NULL,
|
||||
@@ -159,7 +159,7 @@ protected:
|
||||
StackWalkerInternal *m_sw;
|
||||
HANDLE m_hProcess;
|
||||
DWORD m_dwProcessId;
|
||||
BOOL m_modulesLoaded;
|
||||
bool m_modulesLoaded;
|
||||
LPSTR m_szSymPath;
|
||||
|
||||
bool m_verbose;
|
||||
|
||||
+8
-116
@@ -52,15 +52,7 @@
|
||||
|
||||
//
|
||||
// Signal handling
|
||||
//
|
||||
// Windows uses structured exceptions, so it's handled a bit differently.
|
||||
//
|
||||
#if LL_WINDOWS
|
||||
#include "windows.h"
|
||||
|
||||
LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop);
|
||||
BOOL ConsoleCtrlHandler(DWORD fdwCtrlType);
|
||||
#else
|
||||
#ifndef LL_WINDOWS
|
||||
# include <signal.h>
|
||||
# include <unistd.h> // for fork()
|
||||
void setup_signals();
|
||||
@@ -87,24 +79,24 @@ S32 LL_HEARTBEAT_SIGNAL = SIGUSR2;
|
||||
S32 LL_SMACKDOWN_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-1) : SIGUSR1;
|
||||
S32 LL_HEARTBEAT_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-0) : SIGUSR2;
|
||||
# endif // LL_DARWIN
|
||||
#endif // LL_WINDOWS
|
||||
#endif // !LL_WINDOWS
|
||||
|
||||
// the static application instance
|
||||
LLApp* LLApp::sApplication = NULL;
|
||||
|
||||
// Allows the generation of core files for post mortem under gdb
|
||||
// and disables crashlogger
|
||||
BOOL LLApp::sDisableCrashlogger = FALSE;
|
||||
bool LLApp::sDisableCrashlogger = false;
|
||||
|
||||
// Local flag for whether or not to do logging in signal handlers.
|
||||
//static
|
||||
BOOL LLApp::sLogInSignal = FALSE;
|
||||
bool LLApp::sLogInSignal = false;
|
||||
|
||||
// static
|
||||
// Keeps track of application status
|
||||
LLScalarCond<LLApp::EAppStatus> LLApp::sStatus{LLApp::APP_STATUS_STOPPED};
|
||||
LLAppErrorHandler LLApp::sErrorHandler = NULL;
|
||||
BOOL LLApp::sErrorThreadRunning = FALSE;
|
||||
bool LLApp::sErrorThreadRunning = false;
|
||||
|
||||
|
||||
LLApp::LLApp()
|
||||
@@ -327,33 +319,6 @@ void LLApp::stepFrame()
|
||||
mRunner.run();
|
||||
}
|
||||
|
||||
#if LL_WINDOWS
|
||||
//The following code is needed for 32-bit apps on 64-bit windows to keep it from eating
|
||||
//crashes. It is a lovely undocumented 'feature' in SP1 of Windows 7. An excellent
|
||||
//in-depth article on the issue may be found here: http://randomascii.wordpress.com/2012/07/05/when-even-crashing-doesn-work/
|
||||
void EnableCrashingOnCrashes()
|
||||
{
|
||||
typedef BOOL (WINAPI *tGetPolicy)(LPDWORD lpFlags);
|
||||
typedef BOOL (WINAPI *tSetPolicy)(DWORD dwFlags);
|
||||
const DWORD EXCEPTION_SWALLOWING = 0x1;
|
||||
|
||||
HMODULE kernel32 = LoadLibraryA("kernel32.dll");
|
||||
tGetPolicy pGetPolicy = (tGetPolicy)GetProcAddress(kernel32,
|
||||
"GetProcessUserModeExceptionPolicy");
|
||||
tSetPolicy pSetPolicy = (tSetPolicy)GetProcAddress(kernel32,
|
||||
"SetProcessUserModeExceptionPolicy");
|
||||
if (pGetPolicy && pSetPolicy)
|
||||
{
|
||||
DWORD dwFlags;
|
||||
if (pGetPolicy(&dwFlags))
|
||||
{
|
||||
// Turn off the filter
|
||||
pSetPolicy(dwFlags & ~EXCEPTION_SWALLOWING);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void LLApp::setupErrorHandling(bool second_instance)
|
||||
{
|
||||
// Error handling is done by starting up an error handling thread, which just sleeps and
|
||||
@@ -504,13 +469,13 @@ bool LLApp::isExiting()
|
||||
|
||||
void LLApp::disableCrashlogger()
|
||||
{
|
||||
sDisableCrashlogger = TRUE;
|
||||
sDisableCrashlogger = true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLApp::isCrashloggerDisabled()
|
||||
{
|
||||
return (sDisableCrashlogger == TRUE);
|
||||
return (sDisableCrashlogger == true);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -523,77 +488,7 @@ int LLApp::getPid()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LL_WINDOWS
|
||||
LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop)
|
||||
{
|
||||
// Translate the signals/exceptions into cross-platform stuff
|
||||
// Windows implementation
|
||||
|
||||
// Make sure the user sees something to indicate that the app crashed.
|
||||
LONG retval;
|
||||
|
||||
if (LLApp::isError())
|
||||
{
|
||||
LL_WARNS() << "Got another fatal signal while in the error handler, die now!" << LL_ENDL;
|
||||
retval = EXCEPTION_EXECUTE_HANDLER;
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Flag status to error, so thread_error starts its work
|
||||
LLApp::setError();
|
||||
|
||||
// Block in the exception handler until the app has stopped
|
||||
// This is pretty sketchy, but appears to work just fine
|
||||
while (!LLApp::isStopped())
|
||||
{
|
||||
ms_sleep(10);
|
||||
}
|
||||
|
||||
//
|
||||
// Generate a minidump if we can.
|
||||
//
|
||||
// TODO: This needs to be ported over form the viewer-specific
|
||||
// LLWinDebug class
|
||||
|
||||
//
|
||||
// At this point, we always want to exit the app. There's no graceful
|
||||
// recovery for an unhandled exception.
|
||||
//
|
||||
// Just kill the process.
|
||||
retval = EXCEPTION_EXECUTE_HANDLER;
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Win32 doesn't support signals. This is used instead.
|
||||
BOOL ConsoleCtrlHandler(DWORD fdwCtrlType)
|
||||
{
|
||||
switch (fdwCtrlType)
|
||||
{
|
||||
case CTRL_BREAK_EVENT:
|
||||
case CTRL_LOGOFF_EVENT:
|
||||
case CTRL_SHUTDOWN_EVENT:
|
||||
case CTRL_CLOSE_EVENT: // From end task or the window close button.
|
||||
case CTRL_C_EVENT: // from CTRL-C on the keyboard
|
||||
// Just set our state to quitting, not error
|
||||
if (LLApp::isQuitting() || LLApp::isError())
|
||||
{
|
||||
// We're already trying to die, just ignore this signal
|
||||
if (LLApp::sLogInSignal)
|
||||
{
|
||||
LL_INFOS() << "Signal handler - Already trying to quit, ignoring signal!" << LL_ENDL;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
LLApp::setQuitting();
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#else //!LL_WINDOWS
|
||||
|
||||
#ifndef LL_WINDOWS
|
||||
void setup_signals()
|
||||
{
|
||||
//
|
||||
@@ -811,9 +706,6 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *)
|
||||
}
|
||||
}
|
||||
|
||||
#if LL_LINUX
|
||||
#endif
|
||||
|
||||
bool unix_post_minidump_callback(const char *dump_dir,
|
||||
const char *minidump_id,
|
||||
void *context, bool succeeded)
|
||||
|
||||
@@ -291,8 +291,8 @@ protected:
|
||||
|
||||
static void setStatus(EAppStatus status); // Use this to change the application status.
|
||||
static LLScalarCond<EAppStatus> sStatus; // Reflects current application status
|
||||
static BOOL sErrorThreadRunning; // Set while the error thread is running
|
||||
static BOOL sDisableCrashlogger; // Let the OS handle crashes for us.
|
||||
static bool sErrorThreadRunning; // Set while the error thread is running
|
||||
static bool sDisableCrashlogger; // Let the OS handle crashes for us.
|
||||
std::wstring mCrashReportPipeStr; //Name of pipe to use for crash reporting.
|
||||
|
||||
std::string mDumpPath; //output path for google breakpad. Dependency workaround.
|
||||
@@ -337,7 +337,7 @@ private:
|
||||
#endif
|
||||
|
||||
public:
|
||||
static BOOL sLogInSignal;
|
||||
static bool sLogInSignal;
|
||||
};
|
||||
|
||||
#endif // LL_LLAPP_H
|
||||
|
||||
Reference in New Issue
Block a user