diff options
author | Mike McLaughlin <mikem@microsoft.com> | 2015-04-21 15:25:24 -0700 |
---|---|---|
committer | Mike McLaughlin <mikem@microsoft.com> | 2015-04-24 19:09:33 -0700 |
commit | fa416704b3de7c57589284d6f20b59cee4908d83 (patch) | |
tree | 9a1c6176417c9caa33d5e6f4b8978fed56a66d07 /src/ToolBox | |
parent | 6f92fc4a8691a82423e7a8e9550a30712ca413f7 (diff) | |
download | coreclr-fa416704b3de7c57589284d6f20b59cee4908d83.tar.gz coreclr-fa416704b3de7c57589284d6f20b59cee4908d83.tar.bz2 coreclr-fa416704b3de7c57589284d6f20b59cee4908d83.zip |
Implemented hardware exception chaining.
Test CLR hosting under a debugger (lldb). In order to test the debugger modules and coreclr running together in the same process, add the test command "corerun" to the lldb plugin that uses the CLR hosting apis to run managed code in the lldb process.
Fixed a problem where the dac module was picking up an constructor in the coreclr module instead of using the dac version. This is because the corerun code was dlopen'ing coreclr with RTLD_GLOBAL which exposed all the symbols to the reset of the dynamic modules loaded. Changing it to RTLD_LOCAL (the default) fixes this problem.
Changed from an ASSERT to an ERROR in the hardware exception handler because ASSERT does an SIGTRAP (DebugBreak) that keeps recursively being hit.
Removed all signals that installed a fatal_signal_handler especially SIGINT which was interfering with lldb's. The rest of the signals, the default action should be good enough.
Checked if the EE was started in the VM's hardware exception handler just to make sure everything is ready before the managed exception chain is called.
Cleanup signal thread masking. Only wait for SIGINT/SIGQUIT explicitly instead of trying to mask all the signals we don't want to wait on.
Diffstat (limited to 'src/ToolBox')
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/coreruncommand.cpp | 48 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/sosplugin.cpp | 4 | ||||
-rw-r--r-- | src/ToolBox/SOS/lldbplugin/sosplugin.h | 5 |
4 files changed, 57 insertions, 2 deletions
diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt index 6448bc6734..ee781a4d2e 100644 --- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt +++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt @@ -59,7 +59,9 @@ include_directories(${CLR_DIR}/src/inc) set(SOURCES sosplugin.cpp soscommand.cpp + coreruncommand.cpp debugclient.cpp + ${CLR_DIR}/src/coreclr/hosts/unixcorerun/corerun.cpp ) add_library(sosplugin SHARED ${SOURCES}) diff --git a/src/ToolBox/SOS/lldbplugin/coreruncommand.cpp b/src/ToolBox/SOS/lldbplugin/coreruncommand.cpp new file mode 100644 index 0000000000..a047488a0b --- /dev/null +++ b/src/ToolBox/SOS/lldbplugin/coreruncommand.cpp @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + +#include "sosplugin.h" +#include <dlfcn.h> +#include <string> + +extern int corerun(const int argc, const char* argv[]); + +class corerunCommand : public lldb::SBCommandPluginInterface +{ +public: + corerunCommand() + { + } + + virtual bool + DoExecute (lldb::SBDebugger debugger, + char** arguments, + lldb::SBCommandReturnObject &result) + { + if (arguments) + { + int argc = 0; + char **argv = arguments; + for (const char* arg = *arguments; arg; arg = *(++arguments)) + { + ++argc; + } + int exitcode = corerun((const int)argc, (const char**)argv); + if (exitcode != 0) + { + result.SetError("corerun failed"); + } + } + return result.Succeeded(); + } +}; + +bool +corerunCommandInitialize(lldb::SBDebugger debugger) +{ + lldb::SBCommandInterpreter interpreter = debugger.GetCommandInterpreter(); + interpreter.AddCommand("corerun", new corerunCommand(), "run a managed app inside the debugger"); + return true; +} diff --git a/src/ToolBox/SOS/lldbplugin/sosplugin.cpp b/src/ToolBox/SOS/lldbplugin/sosplugin.cpp index 90a009277b..a6111b6186 100644 --- a/src/ToolBox/SOS/lldbplugin/sosplugin.cpp +++ b/src/ToolBox/SOS/lldbplugin/sosplugin.cpp @@ -12,5 +12,7 @@ namespace lldb { bool lldb::PluginInitialize (lldb::SBDebugger debugger) { - return sosCommandInitialize(debugger); + corerunCommandInitialize(debugger); + sosCommandInitialize(debugger); + return true; }
\ No newline at end of file diff --git a/src/ToolBox/SOS/lldbplugin/sosplugin.h b/src/ToolBox/SOS/lldbplugin/sosplugin.h index 993d7227b6..e031660f7f 100644 --- a/src/ToolBox/SOS/lldbplugin/sosplugin.h +++ b/src/ToolBox/SOS/lldbplugin/sosplugin.h @@ -11,4 +11,7 @@ typedef HRESULT (*CommandFunc)(PDEBUG_CLIENT client, const char *args); bool -sosCommandInitialize(lldb::SBDebugger debugger);
\ No newline at end of file +sosCommandInitialize(lldb::SBDebugger debugger); + +bool +corerunCommandInitialize(lldb::SBDebugger debugger);
\ No newline at end of file |