Core/Crash reporting: Better handle max nesting level setting

Fix wheaty exception report counting reference symbols as 2 nesting levels, not logging child objects in some cases, i.e. spell id in SpellEvent crash.

(cherry picked from commit 284dd6b80d)
This commit is contained in:
jackpoz
2016-07-03 13:16:06 +02:00
parent 37fedcc8f6
commit bceb385773
2 changed files with 11 additions and 12 deletions

View File

@@ -901,7 +901,7 @@ unsigned /*cbBuffer*/)
// will return true.
bool bHandled;
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, pSym->ModBase, pSym->TypeIndex,
0, pVariable, bHandled, pSym->Name, "", false, true);
pVariable, bHandled, pSym->Name, "", false, true);
if (!bHandled)
{
@@ -934,7 +934,6 @@ char * WheatyExceptionReport::DumpTypeIndex(
char * pszCurrBuffer,
DWORD64 modBase,
DWORD dwTypeIndex,
unsigned nestingLevel,
DWORD_PTR offset,
bool & bHandled,
const char* Name,
@@ -1022,14 +1021,14 @@ bool logChildren)
FormatOutputValue(buffer, btVoid, sizeof(PVOID), (PVOID)offset, sizeof(buffer));
symbolDetails.top().Value = buffer;
if (nestingLevel >= WER_MAX_NESTING_LEVEL)
if (symbolDetails.size() >= WER_MAX_NESTING_LEVEL)
logChildren = false;
// no need to log any children since the address is invalid anyway
if (address == NULL || address == DWORD_PTR(-1))
logChildren = false;
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID,
address, bHandled, Name, addressStr, false, logChildren);
if (!bHandled)
@@ -1074,19 +1073,19 @@ bool logChildren)
switch (innerTypeTag)
{
case SymTagUDT:
if (nestingLevel >= WER_MAX_NESTING_LEVEL)
if (symbolDetails.size() >= WER_MAX_NESTING_LEVEL)
logChildren = false;
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID,
offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
break;
case SymTagPointerType:
if (Name != NULL && Name[0] != '\0')
symbolDetails.top().Name = Name;
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID,
offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
break;
case SymTagArrayType:
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID,
offset, bHandled, symbolDetails.top().Name.c_str(), "", false, logChildren);
break;
default:
@@ -1100,7 +1099,7 @@ bool logChildren)
symbolDetails.top().HasChildren = true;
BasicType basicType = btNoType;
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID, nestingLevel + 1,
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, innerTypeID,
offset, bHandled, Name, "", false, false);
// Set Value back to an empty string since the Array object itself has no value, only its elements have
@@ -1222,7 +1221,7 @@ bool logChildren)
DWORD_PTR dwFinalOffset = offset + dwMemberOffset;
pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase,
children.ChildId[i], nestingLevel+1,
children.ChildId[i],
dwFinalOffset, bHandled2, ""/*Name */, "", true, true);
// If the child wasn't a UDT, format it appropriately

View File

@@ -13,7 +13,7 @@
#define countof _countof
#define WER_MAX_ARRAY_ELEMENTS_COUNT 10
#define WER_MAX_NESTING_LEVEL 5
#define WER_MAX_NESTING_LEVEL 4
#define WER_LARGE_BUFFER_SIZE 1024 * 128
enum BasicType // Stolen from CVCONST.H in the DIA 2.0 SDK
@@ -173,7 +173,7 @@ class WheatyExceptionReport
static bool FormatSymbolValue(PSYMBOL_INFO, STACKFRAME64 *, char * pszBuffer, unsigned cbBuffer);
static char * DumpTypeIndex(char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool &, const char*, char*, bool, bool);
static char * DumpTypeIndex(char *, DWORD64, DWORD, DWORD_PTR, bool &, const char*, char*, bool, bool);
static void FormatOutputValue(char * pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, size_t bufferSize, size_t countOverride = 0);