aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared')
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp32
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.h2
2 files changed, 27 insertions, 7 deletions
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index f4da4093dfa..b4d57f065b0 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -62,6 +62,13 @@ WheatyExceptionReport::WheatyExceptionReport() // Constructor
// Install the unhandled exception filter function
m_previousFilter = SetUnhandledExceptionFilter(WheatyUnhandledExceptionFilter);
m_hProcess = GetCurrentProcess();
+ if (!IsDebuggerPresent())
+ {
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+ }
}
//============
@@ -566,6 +573,9 @@ PVOID addr, PTSTR szModule, DWORD len, DWORD& section, DWORD_PTR& offset)
DWORD_PTR hMod = (DWORD_PTR)mbi.AllocationBase;
+ if (!hMod)
+ return FALSE;
+
if (!GetModuleFileName((HMODULE)hMod, szModule, len))
return FALSE;
@@ -708,7 +718,7 @@ bool bWriteVariables, HANDLE pThreadHandle)
}
// Get the source line for this stack frame entry
- IMAGEHLP_LINE64 lineInfo = { sizeof(IMAGEHLP_LINE) };
+ IMAGEHLP_LINE64 lineInfo = { sizeof(IMAGEHLP_LINE64) };
DWORD dwLineDisplacement;
if (SymGetLineFromAddr64(m_hProcess, sf.AddrPC.Offset,
&dwLineDisplacement, &lineInfo))
@@ -746,11 +756,11 @@ ULONG /*SymbolSize*/,
PVOID UserContext)
{
- char szBuffer[2048];
+ char szBuffer[4092];
__try
{
- if (FormatSymbolValue(pSymInfo, (STACKFRAME*)UserContext,
+ if (FormatSymbolValue(pSymInfo, (STACKFRAME64*)UserContext,
szBuffer, sizeof(szBuffer)))
_tprintf(_T("\t%s\r\n"), szBuffer);
}
@@ -769,7 +779,7 @@ PVOID UserContext)
//////////////////////////////////////////////////////////////////////////////
bool WheatyExceptionReport::FormatSymbolValue(
PSYMBOL_INFO pSym,
-STACKFRAME * sf,
+STACKFRAME64 * sf,
char * pszBuffer,
unsigned /*cbBuffer*/)
{
@@ -782,7 +792,7 @@ unsigned /*cbBuffer*/)
pszCurrBuffer += sprintf(pszCurrBuffer, "Local ");
// If it's a function, don't do anything.
- if (pSym->Tag == 5) // SymTagFunction from CVCONST.H from the DIA SDK
+ if (pSym->Tag == SymTagFunction) // SymTagFunction from CVCONST.H from the DIA SDK
return false;
DWORD_PTR pVariable = 0; // Will point to the variable's data in memory
@@ -791,7 +801,11 @@ unsigned /*cbBuffer*/)
{
// if (pSym->Register == 8) // EBP is the value 8 (in DBGHELP 5.1)
{ // This may change!!!
+#ifdef _M_IX86
pVariable = sf->AddrFrame.Offset;
+#elif _M_X64
+ pVariable = sf->AddrStack.Offset;
+#endif
pVariable += (DWORD_PTR)pSym->Address;
}
// else
@@ -889,6 +903,12 @@ char* /*Name*/)
// Iterate through each of the children
for (unsigned i = 0; i < dwChildrenCount; i++)
{
+ DWORD symTag;
+ SymGetTypeInfo(m_hProcess, modBase, children.ChildId[i], TI_GET_SYMTAG, &symTag);
+
+ if (symTag == SymTagFunction || symTag == SymTagTypedef)
+ continue;
+
// Add appropriate indentation level (since this routine is recursive)
for (unsigned j = 0; j <= nestingLevel+1; j++)
pszCurrBuffer += sprintf(pszCurrBuffer, "\t");
@@ -1017,7 +1037,7 @@ WheatyExceptionReport::GetBasicType(DWORD typeIndex, DWORD64 modBase)
//============================================================================
int __cdecl WheatyExceptionReport::_tprintf(const TCHAR * format, ...)
{
- TCHAR szBuff[1024];
+ TCHAR szBuff[4092];
int retValue;
DWORD cbWritten;
va_list argptr;
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.h b/src/server/shared/Debugging/WheatyExceptionReport.h
index 582f1f157b8..a4ba69d3ff3 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.h
+++ b/src/server/shared/Debugging/WheatyExceptionReport.h
@@ -98,7 +98,7 @@ class WheatyExceptionReport
static BOOL CALLBACK EnumerateSymbolsCallback(PSYMBOL_INFO, ULONG, PVOID);
- static bool FormatSymbolValue(PSYMBOL_INFO, STACKFRAME *, char * pszBuffer, unsigned cbBuffer);
+ static bool FormatSymbolValue(PSYMBOL_INFO, STACKFRAME64 *, char * pszBuffer, unsigned cbBuffer);
static char * DumpTypeIndex(char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool &, char*);