Change int return values to BOOL for coreclr delegates (dotnet/coreclr#6551)
authorEvgeny Pavlov <lucenticus@gmail.com>
Tue, 2 Aug 2016 01:53:15 +0000 (04:53 +0300)
committerJan Kotas <jkotas@microsoft.com>
Tue, 2 Aug 2016 01:53:15 +0000 (18:53 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/3208afd28dc879f4de845d052ca90423a8bcb5ca

src/coreclr/src/ToolBox/SOS/Strike/util.cpp
src/coreclr/src/ToolBox/SOS/Strike/util.h
src/coreclr/src/vm/gdbjit.cpp
src/coreclr/src/vm/gdbjithelpers.h

index 16c382d..3e1ab71 100644 (file)
@@ -6325,7 +6325,7 @@ HRESULT SymbolReader::LoadCoreCLR()
     {
         return E_OUTOFMEMORY;
     }
-    if (SUCCEEDED(getLineByILOffsetDelegate(szModuleName, MethodToken, IlOffset, pLinenum, &wszFileName)))
+    if (getLineByILOffsetDelegate(szModuleName, MethodToken, IlOffset, pLinenum, &wszFileName) == TRUE)
     {
         WideCharToMultiByte(CP_ACP, 0, wszFileName, (int) (_wcslen(wszFileName) + 1),
                             lpszFileName, cbFileName, NULL, NULL);
@@ -6334,7 +6334,10 @@ HRESULT SymbolReader::LoadCoreCLR()
             *pLinenum = -1;
             Status = E_FAIL;
         }
-
+    }
+    else
+    {
+        Status = E_FAIL;
     }
     SysFreeString(wszFileName);
 
@@ -6422,7 +6425,9 @@ HRESULT SymbolReader::LoadSymbols(IMetaDataImport * pMD, ULONG64 baseAddress, __
 
     WideCharToMultiByte(CP_ACP, 0, pModuleName, (int) (_wcslen(pModuleName) + 1),
             m_szModuleName, mdNameLen, NULL, NULL);
-    return !loadSymbolsForModuleDelegate(m_szModuleName);
+    if (loadSymbolsForModuleDelegate(m_szModuleName) == FALSE)
+        return E_FAIL;
+    return Status;
 #endif // FEATURE_PAL
 }
 
@@ -6443,26 +6448,24 @@ HRESULT SymbolReader::GetNamedLocalVariable(ISymUnmanagedScope * pScope, ICorDeb
     {
         return E_OUTOFMEMORY;
     }
-    int ret = getLocalVariableNameDelegate(m_szModuleName, methodToken,
-                                       localIndex, &wszParamName);
-    if (ret)
+    if (getLocalVariableNameDelegate(m_szModuleName, methodToken, localIndex, &wszParamName) == FALSE)
     {
-        wcscpy_s(paramName, _wcslen(wszParamName) + 1, wszParamName);
-        paramNameLen = _wcslen(paramName);
         SysFreeString(wszParamName);
-
-        if (SUCCEEDED(pILFrame->GetLocalVariable(localIndex, ppValue)) && (*ppValue != NULL))
-        {
-            return S_OK;
-        }
-        else
-        {
-            *ppValue = NULL;
-            return E_FAIL;
-        }
+        return E_FAIL;
     }
+    wcscpy_s(paramName, _wcslen(wszParamName) + 1, wszParamName);
+    paramNameLen = _wcslen(paramName);
     SysFreeString(wszParamName);
-    return E_FAIL;
+
+    if (SUCCEEDED(pILFrame->GetLocalVariable(localIndex, ppValue)) && (*ppValue != NULL))
+    {
+        return S_OK;
+    }
+    else
+    {
+        *ppValue = NULL;
+        return E_FAIL;
+    }
 
 #else
     if(pScope == NULL)
@@ -6636,9 +6639,9 @@ HRESULT SymbolReader::ResolveSequencePoint(__in_z WCHAR* pFilename, ULONG32 line
     FileNameForModule(mod, FileNameW);
 
     WideCharToMultiByte(CP_ACP, 0, FileNameW, (int) (_wcslen(FileNameW) + 1), FileName, MAX_LONGPATH, NULL, NULL);
-    Status = resolveSequencePointDelegate(FileName, szName, lineNumber, pToken, pIlOffset);
-
-    return Status;
+    if (resolveSequencePointDelegate(FileName, szName, lineNumber, pToken, pIlOffset) == FALSE)
+        return E_FAIL;
+    return S_OK;
 #endif // FEATURE_PAL
 }
 
index a875e4b..f44579a 100644 (file)
@@ -2356,10 +2356,10 @@ private:
 #endif // !FEATURE_PAL
 
 #ifdef FEATURE_PAL
-typedef  int (*ResolveSequencePointDelegate)(const char*, const char*, unsigned int, unsigned int*, unsigned int*);
-typedef  int (*LoadSymbolsForModuleDelegate)(const char*);
-typedef  int (*GetLocalVariableName)(const char*, int, int, BSTR*);
-typedef  int (*GetLineByILOffsetDelegate)(const char*, mdMethodDef, ULONG64, ULONG *, BSTR*);
+typedef  BOOL (*ResolveSequencePointDelegate)(const char*, const char*, unsigned int, unsigned int*, unsigned int*);
+typedef  BOOL (*LoadSymbolsForModuleDelegate)(const char*);
+typedef  BOOL (*GetLocalVariableName)(const char*, int, int, BSTR*);
+typedef  BOOL (*GetLineByILOffsetDelegate)(const char*, mdMethodDef, ULONG64, ULONG *, BSTR*);
 static const char *SymbolReaderDllName = "System.Diagnostics.Debug.SymbolReader";
 static const char *SymbolReaderClassName = "System.Diagnostics.Debug.SymbolReader.SymbolReader";
 #endif //FEATURE_PAL
index 435dec4..4d7640a 100644 (file)
@@ -110,7 +110,7 @@ GetDebugInfoFromPDB(MethodDesc* MethodDescPtr, SymbolsInfo** symInfo, unsigned i
         return E_OUTOFMEMORY;
     methodDebugInfo->size = numMap;
 
-    if (!getInfoForMethodDelegate(szModName, MethodDescPtr->GetMemberDef(), *methodDebugInfo))
+    if (getInfoForMethodDelegate(szModName, MethodDescPtr->GetMemberDef(), *methodDebugInfo) == FALSE)
         return E_FAIL;
 
     symInfoLen = methodDebugInfo->size;
index 1fa5d46..1298141 100644 (file)
@@ -25,7 +25,7 @@ struct MethodDebugInfo
     int size;
 };
 
-typedef int (*GetInfoForMethodDelegate)(const char*, unsigned int, MethodDebugInfo& methodDebugInfo);
+typedef BOOL (*GetInfoForMethodDelegate)(const char*, unsigned int, MethodDebugInfo& methodDebugInfo);
 extern GetInfoForMethodDelegate getInfoForMethodDelegate;
 
 #endif // !__GDBJITHELPERS_H__