diff options
-rw-r--r-- | src/ToolBox/SOS/Strike/util.cpp | 13 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/mstypes.h | 5 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/soscommand.cpp | 35 | ||||
-rw-r--r-- | src/dlls/mscordac/CMakeLists.txt | 12 |
5 files changed, 34 insertions, 34 deletions
diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp index 314044f5ca..146656fe9f 100644 --- a/src/ToolBox/SOS/Strike/util.cpp +++ b/src/ToolBox/SOS/Strike/util.cpp @@ -64,7 +64,9 @@ const char * const CorElementTypeNamespace[ELEMENT_TYPE_MAX]= IXCLRDataProcess *g_clrData = NULL; ISOSDacInterface *g_sos = NULL; -#ifndef FEATURE_PAL +#ifdef FEATURE_PAL +BOOL g_palInitialized = FALSE; +#else ICorDebugProcess * g_pCorDebugProcess = NULL; #endif // FEATURE_PAL @@ -4154,7 +4156,6 @@ void ResetGlobals(void) HRESULT LoadClrDebugDll(void) { #ifdef FEATURE_PAL - static BOOL g_palInitialized = FALSE; if (!g_palInitialized) { int err = PAL_Initialize(0, NULL); @@ -4174,20 +4175,19 @@ HRESULT LoadClrDebugDll(void) PFN_CLRDataCreateInstance pCLRDataCreateInstance = (PFN_CLRDataCreateInstance)GetProcAddress(hdac, "CLRDataCreateInstance"); if (pCLRDataCreateInstance == NULL) { + FreeLibrary(hdac); return E_FAIL; } ICLRDataTarget *target = new DataTarget(); HRESULT hr = pCLRDataCreateInstance(__uuidof(IXCLRDataProcess), target, reinterpret_cast<void**>(&g_clrData)); if (FAILED(hr)) { + FreeLibrary(hdac); g_clrData = NULL; return hr; } } - else - { - g_clrData->AddRef(); - } + g_clrData->AddRef(); #else WDBGEXTS_CLR_DATA_INTERFACE Query; @@ -4202,7 +4202,6 @@ HRESULT LoadClrDebugDll(void) if (FAILED(g_clrData->QueryInterface(__uuidof(ISOSDacInterface), (void**)&g_sos))) { - g_clrData = NULL; g_sos = NULL; return E_FAIL; } diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt index ca0d4c9842..4b4b7d6a11 100644 --- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt +++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt @@ -5,9 +5,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(LLDB_SRC_DIR $ENV{LLDB_SRC_DIR}) set(LLVM_BUILD_DIR $ENV{LLVM_BUILD_DIR}) -message(LLDB_SRC_DIR='$ENV{LLDB_SRC_DIR}') -message(LLVM_BUILD_DIR='$ENV{LLVM_BUILD_DIR}') - if((NOT ${LLDB_SRC_DIR} STREQUAL "") AND (NOT ${LLVM_BUILD_DIR} STREQUAL "")) add_compile_options(-Wno-delete-non-virtual-dtor) diff --git a/src/ToolBox/SOS/lldbplugin/mstypes.h b/src/ToolBox/SOS/lldbplugin/mstypes.h index f3ec2ff51c..97b0aa376a 100644 --- a/src/ToolBox/SOS/lldbplugin/mstypes.h +++ b/src/ToolBox/SOS/lldbplugin/mstypes.h @@ -33,7 +33,6 @@ typedef int HRESULT; // Platform-specific library naming // -#ifdef PLATFORM_UNIX #ifdef __APPLE__ #define MAKEDLLNAME_W(name) u"lib" name u".dylib" #define MAKEDLLNAME_A(name) "lib" name ".dylib" @@ -47,7 +46,3 @@ typedef int HRESULT; #define MAKEDLLNAME_W(name) u"lib" name u".so" #define MAKEDLLNAME_A(name) "lib" name ".so" #endif -#else -#define MAKEDLLNAME_W(name) name L".dll" -#define MAKEDLLNAME_A(name) name ".dll" -#endif diff --git a/src/ToolBox/SOS/lldbplugin/soscommand.cpp b/src/ToolBox/SOS/lldbplugin/soscommand.cpp index 91250c0a0e..91e13a926c 100644 --- a/src/ToolBox/SOS/lldbplugin/soscommand.cpp +++ b/src/ToolBox/SOS/lldbplugin/soscommand.cpp @@ -9,7 +9,14 @@ class sosCommand : public lldb::SBCommandPluginInterface { + void *m_sosHandle; + public: + sosCommand() + { + m_sosHandle = NULL; + } + virtual bool DoExecute (lldb::SBDebugger debugger, char** arguments, @@ -19,18 +26,26 @@ public: { DebugClient* client = new DebugClient(debugger, result); const char* sosCommand = *arguments++; - const char* sosLibrary = "/ssd/coreclr/binaries/Product/amd64/debug/" MAKEDLLNAME_A("sos"); HRESULT hr = E_FAIL; - void *dl_handle = dlopen(sosLibrary, RTLD_LAZY); - if (dl_handle) + if (m_sosHandle == NULL) + { + const char* sosLibrary = "/ssd/coreclr/binaries/Product/amd64/debug/" MAKEDLLNAME_A("sos"); + m_sosHandle = dlopen(sosLibrary, RTLD_LAZY); + if (m_sosHandle == NULL) + { + client->Output(DEBUG_OUTPUT_ERROR, "dlopen(%s) failed %s\n", sosLibrary, dlerror()); + } + } + + if (m_sosHandle) { - CommandFunc commandFunc = (CommandFunc)dlsym(dl_handle, sosCommand); + CommandFunc commandFunc = (CommandFunc)dlsym(m_sosHandle, sosCommand); if (commandFunc) { std::string str; for (const char* arg = *arguments; arg; arg = *(++arguments)) - { + { str.append(arg); str.append(" "); } @@ -46,18 +61,12 @@ public: { client->Output(DEBUG_OUTPUT_ERROR, "SOS command '%s' not found %s\n", sosCommand, dlerror()); } - - dlclose(dl_handle); - } - else - { - client->Output(DEBUG_OUTPUT_ERROR, "dlopen(%s) failed %s\n", sosLibrary, dlerror()); } delete client; - return result.Succeeded(); } - return false; + + return result.Succeeded(); } }; diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt index 10f7161c32..fc0836f528 100644 --- a/src/dlls/mscordac/CMakeLists.txt +++ b/src/dlls/mscordac/CMakeLists.txt @@ -47,17 +47,17 @@ add_library(mscordaccore SHARED ${CLR_DAC_SOURCES}) # library. set(COREDAC_LIBRARIES ${START_LIBRARY_GROUP} # Start group of libraries that have circular references - utilcode_dac - cordbee_dac cee_dac - mdcompiler_dac - mdruntime_dac - mdruntimerw_dac - mdhotdata_dac + cordbee_dac corguids daccess dbgutil + mdcompiler_dac + mdhotdata_dac + mdruntime_dac + mdruntimerw_dac strongname_dac + utilcode_dac unwinder_dac ${END_LIBRARY_GROUP} # End group of libraries that have circular references ) |