diff options
Diffstat (limited to 'src/common/Debugging')
| -rw-r--r-- | src/common/Debugging/WheatyExceptionReport.cpp | 59 | 
1 files changed, 28 insertions, 31 deletions
diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp index 74ea5b003d4..b18e6c3f104 100644 --- a/src/common/Debugging/WheatyExceptionReport.cpp +++ b/src/common/Debugging/WheatyExceptionReport.cpp @@ -23,11 +23,11 @@ inline LPTSTR ErrorMessage(DWORD dw)      DWORD formatResult = FormatMessage(                              FORMAT_MESSAGE_ALLOCATE_BUFFER |                              FORMAT_MESSAGE_FROM_SYSTEM, -                            NULL, +                            nullptr,                              dw,                              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),                              (LPTSTR) &lpMsgBuf, -                            0, NULL); +                            0, nullptr);      if (formatResult != 0)          return (LPTSTR)lpMsgBuf;      else @@ -111,7 +111,7 @@ PEXCEPTION_POINTERS pExceptionInfo)          stackOverflowException = true;      TCHAR module_folder_name[MAX_PATH]; -    GetModuleFileName(0, module_folder_name, MAX_PATH); +    GetModuleFileName(nullptr, module_folder_name, MAX_PATH);      TCHAR* pos = _tcsrchr(module_folder_name, '\\');      if (!pos)          return 0; @@ -120,7 +120,7 @@ PEXCEPTION_POINTERS pExceptionInfo)      TCHAR crash_folder_path[MAX_PATH];      sprintf_s(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder); -    if (!CreateDirectory(crash_folder_path, NULL)) +    if (!CreateDirectory(crash_folder_path, nullptr))      {          if (GetLastError() != ERROR_ALREADY_EXISTS)              return 0; @@ -137,18 +137,18 @@ PEXCEPTION_POINTERS pExceptionInfo)      m_hDumpFile = CreateFile(m_szDumpFileName,          GENERIC_WRITE,          0, -        0, +        nullptr,          OPEN_ALWAYS,          FILE_FLAG_WRITE_THROUGH, -        0); +        nullptr);      m_hReportFile = CreateFile(m_szLogFileName,          GENERIC_WRITE,          0, -        0, +        nullptr,          OPEN_ALWAYS,          FILE_FLAG_WRITE_THROUGH, -        0); +        nullptr);      if (m_hDumpFile)      { @@ -171,19 +171,19 @@ PEXCEPTION_POINTERS pExceptionInfo)          }          MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), -            m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, &additionalStreamInfo, 0); +            m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, &additionalStreamInfo, nullptr);          CloseHandle(m_hDumpFile);      }      if (m_hReportFile)      { -        SetFilePointer(m_hReportFile, 0, 0, FILE_END); +        SetFilePointer(m_hReportFile, 0, nullptr, FILE_END);          GenerateExceptionReport(pExceptionInfo);          CloseHandle(m_hReportFile); -        m_hReportFile = 0; +        m_hReportFile = nullptr;      }      if (m_previousFilter) @@ -210,7 +210,7 @@ BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxco          return FALSE;      TCHAR szTmp[2048];      DWORD cntBytes = sizeof(szTmp); -    lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), NULL, NULL, +    lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), nullptr, nullptr,          (LPBYTE)szTmp, &cntBytes);      if (lRet != ERROR_SUCCESS)          return FALSE; @@ -564,7 +564,7 @@ PEXCEPTION_POINTERS pExceptionInfo)          SymSetOptions(SYMOPT_DEFERRED_LOADS);          // Initialize DbgHelp -        if (!SymInitialize(GetCurrentProcess(), 0, TRUE)) +        if (!SymInitialize(GetCurrentProcess(), nullptr, TRUE))          {              Log(_T("\n\rCRITICAL ERROR.\n\r Couldn't initialize the symbol handler for process.\n\rError [%s].\n\r\n\r"),                  ErrorMessage(GetLastError())); @@ -646,7 +646,7 @@ PEXCEPTION_POINTERS pExceptionInfo)          CONTEXT trashableContext = *pCtx; -        WriteStackDetails(&trashableContext, false, NULL); +        WriteStackDetails(&trashableContext, false, nullptr);          printTracesForAllThreads(false);          //    #ifdef _M_IX86                                          // X86 Only! @@ -655,7 +655,7 @@ PEXCEPTION_POINTERS pExceptionInfo)          Log(_T("Local Variables And Parameters\r\n"));          trashableContext = *pCtx; -        WriteStackDetails(&trashableContext, true, NULL); +        WriteStackDetails(&trashableContext, true, nullptr);          printTracesForAllThreads(true);          SymCleanup(GetCurrentProcess()); @@ -710,7 +710,7 @@ LPCTSTR WheatyExceptionReport::GetExceptionString(DWORD dwCode)      FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE,          GetModuleHandle(_T("NTDLL.DLL")), -        dwCode, 0, szBuffer, sizeof(szBuffer), 0); +        dwCode, 0, szBuffer, sizeof(szBuffer), nullptr);      return szBuffer;  } @@ -829,13 +829,13 @@ bool bWriteVariables, HANDLE pThreadHandle)          // Get the next stack frame          if (! StackWalk64(dwMachineType,              m_hProcess, -            pThreadHandle != NULL ? pThreadHandle : GetCurrentThread(), +            pThreadHandle != nullptr ? pThreadHandle : GetCurrentThread(),              &sf,              pContext, -            0, +            nullptr,              SymFunctionTableAccess64,              SymGetModuleBase64, -            0)) +            nullptr))              break;          if (0 == sf.AddrFrame.Offset)                     // Basic sanity check to make sure              break;                                          // the frame is OK.  Bail if not. @@ -893,10 +893,10 @@ bool bWriteVariables, HANDLE pThreadHandle)              // Use SymSetContext to get just the locals/params for this frame              IMAGEHLP_STACK_FRAME imagehlpStackFrame;              imagehlpStackFrame.InstructionOffset = sf.AddrPC.Offset; -            SymSetContext(m_hProcess, &imagehlpStackFrame, 0); +            SymSetContext(m_hProcess, &imagehlpStackFrame, nullptr);              // Enumerate the locals/parameters -            SymEnumSymbols(m_hProcess, 0, 0, EnumerateSymbolsCallback, &sf); +            SymEnumSymbols(m_hProcess, 0, nullptr, EnumerateSymbolsCallback, &sf);              Log(_T("\r\n"));          } @@ -1037,7 +1037,7 @@ bool logChildren)              char buffer[50];              FormatOutputValue(buffer, btStdString, 0, (PVOID)offset, sizeof(buffer));              symbolDetails.top().Value = buffer; -            if (Name != NULL && Name[0] != '\0') +            if (Name != nullptr && Name[0] != '\0')                  symbolDetails.top().Name = Name;              bHandled = true;              return; @@ -1046,7 +1046,7 @@ bool logChildren)          char buffer[WER_SMALL_BUFFER_SIZE];          wcstombs(buffer, pwszTypeName, sizeof(buffer));          buffer[WER_SMALL_BUFFER_SIZE - 1] = '\0'; -        if (Name != NULL && Name[0] != '\0') +        if (Name != nullptr && Name[0] != '\0')          {              symbolDetails.top().Type = buffer;              symbolDetails.top().Name = Name; @@ -1056,7 +1056,7 @@ bool logChildren)          LocalFree(pwszTypeName);      } -    else if (Name != NULL && Name[0] != '\0') +    else if (Name != nullptr && Name[0] != '\0')          symbolDetails.top().Name = Name;      if (!StoreSymbol(dwTypeIndex, offset)) @@ -1073,7 +1073,7 @@ bool logChildren)          case SymTagPointerType:              if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_TYPEID, &innerTypeID))              { -                if (Name != NULL && Name[0] != '\0') +                if (Name != nullptr && Name[0] != '\0')                      symbolDetails.top().Name = Name;                  BOOL isReference; @@ -1151,7 +1151,7 @@ bool logChildren)                              offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);                          break;                      case SymTagPointerType: -                        if (Name != NULL && Name[0] != '\0') +                        if (Name != nullptr && Name[0] != '\0')                              symbolDetails.top().Name = Name;                          DumpTypeIndex(modBase, innerTypeID,                              offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren); @@ -1342,7 +1342,6 @@ bool logChildren)      }      bHandled = true; -    return;  }  void WheatyExceptionReport::FormatOutputValue(char * pszCurrBuffer, @@ -1490,7 +1489,7 @@ int __cdecl WheatyExceptionReport::StackLog(const TCHAR * format, va_list argptr      TCHAR szBuff[WER_LARGE_BUFFER_SIZE];      retValue = vsprintf(szBuff, format, argptr); -    WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0); +    WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, nullptr);      return retValue;  } @@ -1503,7 +1502,7 @@ int __cdecl WheatyExceptionReport::HeapLog(const TCHAR * format, va_list argptr)      if (szBuff != nullptr)      {          retValue = vsprintf(szBuff, format, argptr); -        WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0); +        WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, nullptr);          free(szBuff);      } @@ -1549,8 +1548,6 @@ void WheatyExceptionReport::PrintSymbolDetail()          Log(_T("\t"));      Log(_T("%s\r\n"), symbolDetails.top().ToString().c_str()); - -    return;  }  std::string SymbolDetail::ToString()  | 
