[Lldb-commits] [lldb] r216309 - Initialize LLVM when LLDB is initialized, and
Sean Callanan
scallanan at apple.com
Fri Aug 22 17:47:22 PDT 2014
Author: spyffe
Date: Fri Aug 22 19:47:22 2014
New Revision: 216309
URL: http://llvm.org/viewvc/llvm-project?rev=216309&view=rev
Log:
Initialize LLVM when LLDB is initialized, and
install a crash handler.
<rdar://problem/18083226>
Modified:
lldb/trunk/source/Expression/ClangExpressionParser.cpp
lldb/trunk/source/lldb.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=216309&r1=216308&r2=216309&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Fri Aug 22 19:47:22 2014
@@ -103,16 +103,6 @@ ClangExpressionParser::ClangExpressionPa
m_compiler (),
m_code_generator ()
{
- // Initialize targets first, so that --version shows registered targets.
- static struct InitializeLLVM {
- InitializeLLVM() {
- llvm::InitializeAllTargets();
- llvm::InitializeAllAsmPrinters();
- llvm::InitializeAllTargetMCs();
- llvm::InitializeAllDisassemblers();
- }
- } InitializeLLVM;
-
// 1. Create a new compiler instance.
m_compiler.reset(new CompilerInstance());
Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=216309&r1=216308&r2=216309&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Fri Aug 22 19:47:22 2014
@@ -25,6 +25,7 @@
#include "lldb/Target/Thread.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/TargetSelect.h"
#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
@@ -95,6 +96,12 @@
using namespace lldb;
using namespace lldb_private;
+static void fatal_error_handler(void *user_data, const std::string& reason,
+ bool gen_crash_diag) {
+ Host::SetCrashDescription(reason.c_str());
+ ::abort();
+}
+
void
lldb_private::Initialize ()
{
@@ -110,7 +117,15 @@ lldb_private::Initialize ()
HostInfo::Initialize();
Timer::Initialize ();
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
-
+
+ // Initialize LLVM and Clang
+ llvm::InitializeAllTargets();
+ llvm::InitializeAllAsmPrinters();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllDisassemblers();
+ llvm::install_fatal_error_handler(fatal_error_handler, 0);
+
+ // Initialize plug-ins
ABIMacOSX_i386::Initialize();
ABIMacOSX_arm::Initialize();
ABIMacOSX_arm64::Initialize();
More information about the lldb-commits
mailing list