From b9c4214079929094d36fa9afdf8b9d34b6eeae6c Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Fri, 8 Apr 2016 13:45:28 -0700 Subject: [PATCH] Better sos message for runtime not initialized Also fixed the corerun sos command checked build problem. --- src/ToolBox/SOS/Strike/exts.h | 11 +++++++++-- src/ToolBox/SOS/Strike/util.cpp | 6 +++--- src/ToolBox/SOS/lldbplugin/CMakeLists.txt | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/ToolBox/SOS/Strike/exts.h b/src/ToolBox/SOS/Strike/exts.h index 2669ff3..baef6d7 100644 --- a/src/ToolBox/SOS/Strike/exts.h +++ b/src/ToolBox/SOS/Strike/exts.h @@ -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 } diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp index c26bae4..6f115b0 100644 --- a/src/ToolBox/SOS/Strike/util.cpp +++ b/src/ToolBox/SOS/Strike/util.cpp @@ -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); diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt index 438ae33..75840e5 100644 --- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt +++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt @@ -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) -- 2.7.4