diff options
author | emaste <emaste@FreeBSD.org> | 2015-02-06 22:25:21 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2015-02-06 22:25:21 +0000 |
commit | fa0e7b41694bc598cd3df2405d0384ea29d7537e (patch) | |
tree | 5e5b6a0774e0d93bb4cfa2f9f83b9c41b38c4448 /contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp | |
parent | d2b9c88b24f95cd9f8e7bd621cfa454ce759c687 (diff) | |
parent | 0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531 (diff) | |
download | FreeBSD-src-fa0e7b41694bc598cd3df2405d0384ea29d7537e.zip FreeBSD-src-fa0e7b41694bc598cd3df2405d0384ea29d7537e.tar.gz |
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp | 128 |
1 files changed, 13 insertions, 115 deletions
diff --git a/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp b/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp index 7695608..76cd7a8 100644 --- a/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp +++ b/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp @@ -13,6 +13,7 @@ #include "llvm/Support/SourceMgr.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataExtractor.h" +#include "lldb/Core/Debugger.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" @@ -199,6 +200,11 @@ IRExecutionUnit::DisassembleFunction (Stream &stream, InstructionList &instruction_list = disassembler_sp->GetInstructionList(); const uint32_t max_opcode_byte_size = instruction_list.GetMaxOpcocdeByteSize(); + const char *disassemble_format = "${addr-file-or-load}: "; + if (exe_ctx.HasTargetScope()) + { + disassemble_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat(); + } for (size_t instruction_index = 0, num_instructions = instruction_list.GetSize(); instruction_index < num_instructions; @@ -209,7 +215,10 @@ IRExecutionUnit::DisassembleFunction (Stream &stream, max_opcode_byte_size, true, true, - &exe_ctx); + &exe_ctx, + NULL, + NULL, + disassemble_format); stream.PutChar('\n'); } // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions. @@ -300,11 +309,9 @@ IRExecutionUnit::GetRunnableInfo(Error &error, builder.setEngineKind(llvm::EngineKind::JIT) .setErrorStr(&error_string) .setRelocationModel(relocModel) - .setJITMemoryManager(new MemoryManager(*this)) - .setOptLevel(llvm::CodeGenOpt::Less) - .setAllocateGVsWithCode(true) + .setMCJITMemoryManager(std::unique_ptr<MemoryManager>(new MemoryManager(*this))) .setCodeModel(codeModel) - .setUseMCJIT(true); + .setOptLevel(llvm::CodeGenOpt::Less); llvm::StringRef mArch; llvm::StringRef mCPU; @@ -429,7 +436,7 @@ IRExecutionUnit::~IRExecutionUnit () } IRExecutionUnit::MemoryManager::MemoryManager (IRExecutionUnit &parent) : - m_default_mm_ap (llvm::JITMemoryManager::CreateDefaultMemManager()), + m_default_mm_ap (new llvm::SectionMemoryManager()), m_parent (parent) { } @@ -437,60 +444,6 @@ IRExecutionUnit::MemoryManager::MemoryManager (IRExecutionUnit &parent) : IRExecutionUnit::MemoryManager::~MemoryManager () { } -void -IRExecutionUnit::MemoryManager::setMemoryWritable () -{ - m_default_mm_ap->setMemoryWritable(); -} - -void -IRExecutionUnit::MemoryManager::setMemoryExecutable () -{ - m_default_mm_ap->setMemoryExecutable(); -} - - -uint8_t * -IRExecutionUnit::MemoryManager::startFunctionBody(const llvm::Function *F, - uintptr_t &ActualSize) -{ - return m_default_mm_ap->startFunctionBody(F, ActualSize); -} - -uint8_t * -IRExecutionUnit::MemoryManager::allocateStub(const llvm::GlobalValue* F, - unsigned StubSize, - unsigned Alignment) -{ - Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - - uint8_t *return_value = m_default_mm_ap->allocateStub(F, StubSize, Alignment); - - m_parent.m_records.push_back(AllocationRecord((uintptr_t)return_value, - lldb::ePermissionsReadable | lldb::ePermissionsWritable, - GetSectionTypeFromSectionName (llvm::StringRef(), AllocationKind::Stub), - StubSize, - Alignment, - eSectionIDInvalid, - NULL)); - - if (log) - { - log->Printf("IRExecutionUnit::allocateStub (F=%p, StubSize=%u, Alignment=%u) = %p", - static_cast<const void*>(F), StubSize, Alignment, - static_cast<void*>(return_value)); - } - - return return_value; -} - -void -IRExecutionUnit::MemoryManager::endFunctionBody(const llvm::Function *F, - uint8_t *FunctionStart, - uint8_t *FunctionEnd) -{ - m_default_mm_ap->endFunctionBody(F, FunctionStart, FunctionEnd); -} lldb::SectionType IRExecutionUnit::GetSectionTypeFromSectionName (const llvm::StringRef &name, IRExecutionUnit::AllocationKind alloc_kind) @@ -602,30 +555,6 @@ IRExecutionUnit::GetSectionTypeFromSectionName (const llvm::StringRef &name, IRE } uint8_t * -IRExecutionUnit::MemoryManager::allocateSpace(intptr_t Size, unsigned Alignment) -{ - Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - - uint8_t *return_value = m_default_mm_ap->allocateSpace(Size, Alignment); - - m_parent.m_records.push_back(AllocationRecord((uintptr_t)return_value, - lldb::ePermissionsReadable | lldb::ePermissionsWritable, - GetSectionTypeFromSectionName (llvm::StringRef(), AllocationKind::Bytes), - Size, - Alignment, - eSectionIDInvalid, - NULL)); - - if (log) - { - log->Printf("IRExecutionUnit::allocateSpace(Size=%" PRIu64 ", Alignment=%u) = %p", - (uint64_t)Size, Alignment, return_value); - } - - return return_value; -} - -uint8_t * IRExecutionUnit::MemoryManager::allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, @@ -679,37 +608,6 @@ IRExecutionUnit::MemoryManager::allocateDataSection(uintptr_t Size, return return_value; } -uint8_t * -IRExecutionUnit::MemoryManager::allocateGlobal(uintptr_t Size, - unsigned Alignment) -{ - Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - - uint8_t *return_value = m_default_mm_ap->allocateGlobal(Size, Alignment); - - m_parent.m_records.push_back(AllocationRecord((uintptr_t)return_value, - lldb::ePermissionsReadable | lldb::ePermissionsWritable, - GetSectionTypeFromSectionName (llvm::StringRef(), AllocationKind::Global), - Size, - Alignment, - eSectionIDInvalid, - NULL)); - - if (log) - { - log->Printf("IRExecutionUnit::allocateGlobal(Size=0x%" PRIx64 ", Alignment=%u) = %p", - (uint64_t)Size, Alignment, return_value); - } - - return return_value; -} - -void -IRExecutionUnit::MemoryManager::deallocateFunctionBody(void *Body) -{ - m_default_mm_ap->deallocateFunctionBody(Body); -} - lldb::addr_t IRExecutionUnit::GetRemoteAddressForLocal (lldb::addr_t local_address) { |