Better sos message for runtime not initialized
authorMike McLaughlin <mikem@microsoft.com>
Fri, 8 Apr 2016 20:45:28 +0000 (13:45 -0700)
committerMike McLaughlin <mikem@microsoft.com>
Fri, 8 Apr 2016 20:45:28 +0000 (13:45 -0700)
Also fixed the corerun sos command checked build problem.

src/ToolBox/SOS/Strike/exts.h
src/ToolBox/SOS/Strike/util.cpp
src/ToolBox/SOS/lldbplugin/CMakeLists.txt

index 2669ff3..baef6d7 100644 (file)
@@ -218,8 +218,15 @@ inline void DACMessage(HRESULT Status)
     ExtOut("If you are debugging a minidump, you need to make sure that your executable\n");
     ExtOut("path is pointing to coreclr.dll as well.\n");
 #else // FEATURE_PAL
-    ExtOut("You can run the debugger command 'setclrpath' to control the load of %s.\n", MAKEDLLNAME_A("mscordaccore"));
-    ExtOut("If that succeeds, the SOS command should work on retry.\n");
+    if (Status == CORDBG_E_MISSING_DEBUGGER_EXPORTS)
+    {
+        ExtOut("You can run the debugger command 'setclrpath' to control the load of %s.\n", MAKEDLLNAME_A("mscordaccore"));
+        ExtOut("If that succeeds, the SOS command should work on retry.\n");
+    }
+    else
+    {
+        ExtOut("Can not load or initialize %s. The target runtime may not be initialized.\n", MAKEDLLNAME_A("mscordaccore"));
+    }
 #endif // FEATURE_PAL
 }
 
index c26bae4..6f115b0 100644 (file)
@@ -4160,7 +4160,7 @@ HRESULT LoadClrDebugDll(void)
         int err = PAL_InitializeDLL();
         if(err != 0)
         {
-            return E_FAIL;
+            return CORDBG_E_UNSUPPORTED;
         }
         char dacModulePath[MAX_LONGPATH];
         strcpy_s(dacModulePath, _countof(dacModulePath), g_ExtServices->GetCoreClrDirectory());
@@ -4169,13 +4169,13 @@ HRESULT LoadClrDebugDll(void)
         HMODULE hdac = LoadLibraryA(dacModulePath);
         if (hdac == NULL)
         {
-            return E_FAIL;
+            return CORDBG_E_MISSING_DEBUGGER_EXPORTS;
         }
         PFN_CLRDataCreateInstance pCLRDataCreateInstance = (PFN_CLRDataCreateInstance)GetProcAddress(hdac, "CLRDataCreateInstance");
         if (pCLRDataCreateInstance == NULL)
         {
             FreeLibrary(hdac);
-            return E_FAIL;
+            return CORDBG_E_MISSING_DEBUGGER_EXPORTS;
         }
         ICLRDataTarget *target = new DataTarget();
         hr = pCLRDataCreateInstance(__uuidof(IXCLRDataProcess), target, (void**)&s_clrDataProcess);
index 438ae33..75840e5 100644 (file)
@@ -77,13 +77,13 @@ set(SOURCES
     services.cpp
 )
 
-if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
+if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
     list(APPEND SOURCES
         coreruncommand.cpp
         ${CLR_DIR}/src/coreclr/hosts/unixcorerun/corerun.cpp
         ${CLR_DIR}/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
     )
-endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG)
+endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
 
 add_library(sosplugin SHARED ${SOURCES})
 add_dependencies(sosplugin sos)