From 6c7663cf3ffdcca6572a494be31387f18d9ec34f Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Fri, 21 Jul 2017 05:02:48 +0300 Subject: [PATCH] Walk through current class fields before walking the base class --- src/debug/netcoredbg/valuewalk.cpp | 26 +++++++++++++------------- src/debug/netcoredbg/varobj.cpp | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/debug/netcoredbg/valuewalk.cpp b/src/debug/netcoredbg/valuewalk.cpp index 0d66f2f..58fbb91 100644 --- a/src/debug/netcoredbg/valuewalk.cpp +++ b/src/debug/netcoredbg/valuewalk.cpp @@ -200,19 +200,6 @@ static HRESULT WalkMembers(ICorDebugValue *pInputValue, ICorDebugILFrame *pILFra IfFailRet(pModule->GetMetaDataInterface(IID_IMetaDataImport, &pMDUnknown)); IfFailRet(pMDUnknown->QueryInterface(IID_IMetaDataImport, (LPVOID*) &pMD)); - std::string baseTypeName; - ToRelease pBaseType; - if(SUCCEEDED(pType->GetBase(&pBaseType)) && pBaseType != NULL && SUCCEEDED(TypePrinter::GetTypeOfValue(pBaseType, baseTypeName))) - { - if(baseTypeName == "System.Enum") - return S_OK; - else if(baseTypeName != "System.Object" && baseTypeName != "System.ValueType") - { - // Add fields of base class - IfFailRet(WalkMembers(pInputValue, pILFrame, pBaseType, cb)); - } - } - std::string className; TypePrinter::GetTypeOfValue(pType, className); if (className == "decimal") // TODO: implement mechanism for walking over custom type fields @@ -323,6 +310,19 @@ static HRESULT WalkMembers(ICorDebugValue *pInputValue, ICorDebugILFrame *pILFra } pMD->CloseEnum(propEnum); + std::string baseTypeName; + ToRelease pBaseType; + if(SUCCEEDED(pType->GetBase(&pBaseType)) && pBaseType != NULL && SUCCEEDED(TypePrinter::GetTypeOfValue(pBaseType, baseTypeName))) + { + if(baseTypeName == "System.Enum") + return S_OK; + else if(baseTypeName != "System.Object" && baseTypeName != "System.ValueType") + { + // Add fields of base class + IfFailRet(WalkMembers(pInputValue, pILFrame, pBaseType, cb)); + } + } + return S_OK; } diff --git a/src/debug/netcoredbg/varobj.cpp b/src/debug/netcoredbg/varobj.cpp index 9b6cf6c..8f9c972 100644 --- a/src/debug/netcoredbg/varobj.cpp +++ b/src/debug/netcoredbg/varobj.cpp @@ -263,12 +263,12 @@ static HRESULT FetchFieldsAndProperties(ICorDebugValue *pInputValue, static void FixupInheritedFieldNames(std::vector &members) { std::unordered_set names; - for (auto it = members.rbegin(); it != members.rend(); ++it) + for (auto &it : members) { - auto r = names.insert(it->name); + auto r = names.insert(it.name); if (!r.second) { - it->name += " (" + it->owningType + ")"; + it.name += " (" + it.owningType + ")"; } } } -- 2.7.4