From d5f33a86f0ee245a04718e774c990fb242ecd091 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Thu, 1 Mar 2012 02:03:47 +0000 Subject: [PATCH] Updated LLVM to take a new MC JIT that supports allocations by section. We install these sections in the target process and inform the JIT of their new locations. Also removed some unused variable warnings. llvm-svn: 151789 --- .../lldb/Expression/RecordingMemoryManager.h | 10 ++++++++++ lldb/scripts/build-llvm.pl | 4 ++-- lldb/source/Core/StreamCallback.cpp | 3 +-- lldb/source/Expression/ClangExpressionParser.cpp | 3 ++- lldb/source/Expression/ClangUserExpression.cpp | 11 ----------- lldb/source/Expression/RecordingMemoryManager.cpp | 15 +++++++++++++++ lldb/source/Symbol/ClangASTContext.cpp | 1 + lldb/source/Symbol/ClangASTType.cpp | 1 - 8 files changed, 31 insertions(+), 17 deletions(-) diff --git a/lldb/include/lldb/Expression/RecordingMemoryManager.h b/lldb/include/lldb/Expression/RecordingMemoryManager.h index b6bf61f36836..b4167940e557 100644 --- a/lldb/include/lldb/Expression/RecordingMemoryManager.h +++ b/lldb/include/lldb/Expression/RecordingMemoryManager.h @@ -327,6 +327,16 @@ public: bool CommitAllocations (Process &process); + //------------------------------------------------------------------ + /// [Convenience method for ClangExpressionParser] Report all committed + /// allocations to the execution engine. + /// + /// @param[in] engine + /// The execution engine to notify. + //------------------------------------------------------------------ + void + ReportAllocations (llvm::ExecutionEngine &engine); + //------------------------------------------------------------------ /// [Convenience method for ClangExpressionParser] Write the contents /// of all allocations to the process. diff --git a/lldb/scripts/build-llvm.pl b/lldb/scripts/build-llvm.pl index ba69a1baabc3..35d5108d261d 100644 --- a/lldb/scripts/build-llvm.pl +++ b/lldb/scripts/build-llvm.pl @@ -21,8 +21,8 @@ our ($llvm_clang_basename, $llvm_clang_dirname) = fileparse ($llvm_clang_outfile our $llvm_configuration = $ENV{LLVM_CONFIGURATION}; -our $llvm_revision = "151267"; -our $clang_revision = "151267"; +our $llvm_revision = "151777"; +our $clang_revision = "151777"; our $SRCROOT = "$ENV{SRCROOT}"; our $llvm_dstroot_zip = "$SRCROOT/llvm.zip"; diff --git a/lldb/source/Core/StreamCallback.cpp b/lldb/source/Core/StreamCallback.cpp index b6545d5932e6..edce04e8ed8f 100644 --- a/lldb/source/Core/StreamCallback.cpp +++ b/lldb/source/Core/StreamCallback.cpp @@ -36,8 +36,7 @@ StreamString & StreamCallback::FindStreamForThread(lldb::tid_t cur_tid) { Mutex::Locker (m_collection_mutex); - collection::iterator iter, end_iter = m_accumulated_data.end(); - iter = m_accumulated_data.find (cur_tid); + collection::iterator iter = m_accumulated_data.find (cur_tid); if (iter == m_accumulated_data.end()) { std::pair ret; diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp index fe1a6ac923d6..311914649ca6 100644 --- a/lldb/source/Expression/ClangExpressionParser.cpp +++ b/lldb/source/Expression/ClangExpressionParser.cpp @@ -363,7 +363,7 @@ ClangExpressionParser::Parse (Stream &stream) diag_buf->FlushDiagnostics (m_compiler->getDiagnostics()); MemoryBuffer *memory_buffer = MemoryBuffer::getMemBufferCopy(m_expr.Text(), __FUNCTION__); - FileID memory_buffer_file_id = m_compiler->getSourceManager().createMainFileIDForMemBuffer (memory_buffer); + m_compiler->getSourceManager().createMainFileIDForMemBuffer (memory_buffer); diag_buf->BeginSourceFile(m_compiler->getLangOpts(), &m_compiler->getPreprocessor()); @@ -626,6 +626,7 @@ ClangExpressionParser::PrepareForExecution (lldb::addr_t &func_allocation_addr, } jit_memory_manager->CommitAllocations(*process); + jit_memory_manager->ReportAllocations(*execution_engine); jit_memory_manager->WriteData(*process); std::vector::iterator pos, end = m_jitted_functions.end(); diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 7a2541d9173f..664854f1facf 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -156,17 +156,6 @@ ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Error &err) m_cplusplus = true; m_needs_object_ptr = true; - - do { - clang::QualType this_type = method_decl->getThisType(decl_context->getParentASTContext()); - - const clang::PointerType *this_pointer_type = this_type->getAs(); - - if (!this_pointer_type) - break; - - clang::QualType this_pointee_type = this_pointer_type->getPointeeType(); - } while (0); } } else if (clang::ObjCMethodDecl *method_decl = llvm::dyn_cast(decl_context)) diff --git a/lldb/source/Expression/RecordingMemoryManager.cpp b/lldb/source/Expression/RecordingMemoryManager.cpp index 3d0cda327452..5b9e33f79c7e 100644 --- a/lldb/source/Expression/RecordingMemoryManager.cpp +++ b/lldb/source/Expression/RecordingMemoryManager.cpp @@ -10,6 +10,7 @@ // C Includes // C++ Includes // Other libraries and framework includes +#include "llvm/ExecutionEngine/ExecutionEngine.h" // Project includes #include "lldb/Expression/RecordingMemoryManager.h" @@ -276,6 +277,20 @@ RecordingMemoryManager::CommitAllocations (Process &process) return ret; } +void +RecordingMemoryManager::ReportAllocations (llvm::ExecutionEngine &engine) +{ + for (AllocationList::iterator ai = m_allocations.begin(), ae = m_allocations.end(); + ai != ae; + ++ai) + { + if (!ai->m_allocated) + continue; + + engine.mapSectionAddress((void*)ai->m_local_start, ai->m_remote_start); + } +} + bool RecordingMemoryManager::WriteData (Process &process) { diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 7c744fbde058..d45d22f40401 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -2284,6 +2284,7 @@ ClangASTContext::AddObjCClassProperty SourceLocation(), // Source Location &identifier_table->get(property_name), SourceLocation(), //Source Location for AT + SourceLocation(), //Source location for ( prop_type_source ); if (property_decl) diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp index ea9ab99186c0..b4fbda7dc6dc 100644 --- a/lldb/source/Symbol/ClangASTType.cpp +++ b/lldb/source/Symbol/ClangASTType.cpp @@ -1135,7 +1135,6 @@ ClangASTType::DumpSummary ) { uint32_t length = 0; - clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type)); if (ClangASTContext::IsCStringType (clang_type, length)) { if (exe_ctx)