diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Expression')
3 files changed, 29 insertions, 38 deletions
diff --git a/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp b/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp index 94c217e..f0de1ed 100644 --- a/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp +++ b/contrib/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp @@ -52,7 +52,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/PathV1.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/TargetSelect.h" #if defined (USE_STANDARD_JIT) @@ -77,19 +77,16 @@ using namespace lldb_private; //===----------------------------------------------------------------------===// std::string GetBuiltinIncludePath(const char *Argv0) { - llvm::sys::Path P = - llvm::sys::Path::GetMainExecutable(Argv0, - (void*)(intptr_t) GetBuiltinIncludePath); - - if (!P.isEmpty()) { - P.eraseComponent(); // Remove /clang from foo/bin/clang - P.eraseComponent(); // Remove /bin from foo/bin - + SmallString<128> P(llvm::sys::fs::getMainExecutable( + Argv0, (void *)(intptr_t) GetBuiltinIncludePath)); + + if (!P.empty()) { + llvm::sys::path::remove_filename(P); // Remove /clang from foo/bin/clang + llvm::sys::path::remove_filename(P); // Remove /bin from foo/bin + // Get foo/lib/clang/<version>/include - P.appendComponent("lib"); - P.appendComponent("clang"); - P.appendComponent(CLANG_VERSION_STRING); - P.appendComponent("include"); + llvm::sys::path::append(P, "lib", "clang", CLANG_VERSION_STRING, + "include"); } return P.str(); diff --git a/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp b/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp index a2b2594..104732a 100644 --- a/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp +++ b/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp @@ -490,11 +490,12 @@ IRExecutionUnit::MemoryManager::allocateSpace(intptr_t Size, unsigned Alignment) uint8_t * IRExecutionUnit::MemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, - unsigned SectionID) + unsigned SectionID, + llvm::StringRef SectionName) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - uint8_t *return_value = m_default_mm_ap->allocateCodeSection(Size, Alignment, SectionID); + uint8_t *return_value = m_default_mm_ap->allocateCodeSection(Size, Alignment, SectionID, SectionName); m_parent.m_records.push_back(AllocationRecord((uintptr_t)return_value, lldb::ePermissionsReadable | lldb::ePermissionsExecutable, @@ -515,11 +516,12 @@ uint8_t * IRExecutionUnit::MemoryManager::allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, + llvm::StringRef SectionName, bool IsReadOnly) { Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - uint8_t *return_value = m_default_mm_ap->allocateDataSection(Size, Alignment, SectionID, IsReadOnly); + uint8_t *return_value = m_default_mm_ap->allocateDataSection(Size, Alignment, SectionID, SectionName, IsReadOnly); m_parent.m_records.push_back(AllocationRecord((uintptr_t)return_value, lldb::ePermissionsReadable | lldb::ePermissionsWritable, @@ -563,28 +565,6 @@ IRExecutionUnit::MemoryManager::deallocateFunctionBody(void *Body) m_default_mm_ap->deallocateFunctionBody(Body); } -uint8_t* -IRExecutionUnit::MemoryManager::startExceptionTable(const llvm::Function* F, - uintptr_t &ActualSize) -{ - return m_default_mm_ap->startExceptionTable(F, ActualSize); -} - -void -IRExecutionUnit::MemoryManager::endExceptionTable(const llvm::Function *F, - uint8_t *TableStart, - uint8_t *TableEnd, - uint8_t* FrameRegister) -{ - m_default_mm_ap->endExceptionTable(F, TableStart, TableEnd, FrameRegister); -} - -void -IRExecutionUnit::MemoryManager::deallocateExceptionTable(void *ET) -{ - m_default_mm_ap->deallocateExceptionTable (ET); -} - lldb::addr_t IRExecutionUnit::GetRemoteAddressForLocal (lldb::addr_t local_address) { diff --git a/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp b/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp index 792cc50..d68dc00 100644 --- a/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp +++ b/contrib/llvm/tools/lldb/source/Expression/IRForTarget.cpp @@ -357,6 +357,20 @@ IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module) if (value_ptr) *value_ptr = value; + // If we are replacing a function with the nobuiltin attribute, it may + // be called with the builtin attribute on call sites. Remove any such + // attributes since it's illegal to have a builtin call to something + // other than a nobuiltin function. + if (fun->hasFnAttribute(llvm::Attribute::NoBuiltin)) { + llvm::Attribute builtin = llvm::Attribute::get(fun->getContext(), llvm::Attribute::Builtin); + + for (auto u = fun->use_begin(), e = fun->use_end(); u != e; ++u) { + if (auto call = dyn_cast<CallInst>(*u)) { + call->removeAttribute(AttributeSet::FunctionIndex, builtin); + } + } + } + fun->replaceAllUsesWith(value); } |