diff options
author | emaste <emaste@FreeBSD.org> | 2013-11-12 17:25:33 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2013-11-12 17:25:33 +0000 |
commit | 9dd6dd992f8bed9a53bf0653fc1eff3fb4ccd46e (patch) | |
tree | b9aa1d1064fb25a0f2313d9a7964c862c0b7b354 /contrib/llvm/tools/lldb/source/Expression/IRInterpreter.cpp | |
parent | 4372cfee12af5dfa890561beb0fecc90957ba058 (diff) | |
parent | c727fe695d28799acb499e9961f11ec07d4f9fe2 (diff) | |
download | FreeBSD-src-9dd6dd992f8bed9a53bf0653fc1eff3fb4ccd46e.zip FreeBSD-src-9dd6dd992f8bed9a53bf0653fc1eff3fb4ccd46e.tar.gz |
Update LLDB to upstream r194122 snapshot
ludes minor changes relative to upstream, for compatibility with
FreeBSD's in-tree LLVM 3.3:
- Reverted LLDB r191806, restoring use of previous API.
- Reverted part of LLDB r189317, restoring previous enum names.
- Work around missing LLVM r192504, using previous registerEHFrames API
(limited functionality).
- Removed PlatformWindows header include and init/terminate calls.
Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Expression/IRInterpreter.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Expression/IRInterpreter.cpp | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/contrib/llvm/tools/lldb/source/Expression/IRInterpreter.cpp b/contrib/llvm/tools/lldb/source/Expression/IRInterpreter.cpp index dcbf584..71ef8d6 100644 --- a/contrib/llvm/tools/lldb/source/Expression/IRInterpreter.cpp +++ b/contrib/llvm/tools/lldb/source/Expression/IRInterpreter.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Expression/IRInterpreter.h" +#include "lldb/Host/Endian.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DataLayout.h" @@ -321,13 +322,19 @@ public: if (!ResolveConstantValue(resolved_value, constant)) return false; - const uint64_t *raw_data = resolved_value.getRawData(); - + lldb_private::StreamString buffer (lldb_private::Stream::eBinary, + m_memory_map.GetAddressByteSize(), + m_memory_map.GetByteOrder()); + size_t constant_size = m_target_data.getTypeStoreSize(constant->getType()); + const uint64_t *raw_data = resolved_value.getRawData(); + + buffer.PutRawBytes(raw_data, constant_size, lldb::endian::InlHostByteOrder()); + lldb_private::Error write_error; - m_memory_map.WriteMemory(process_address, (uint8_t*)raw_data, constant_size, write_error); + m_memory_map.WriteMemory(process_address, (const uint8_t*)buffer.GetData(), constant_size, write_error); return write_error.Success(); } @@ -517,6 +524,7 @@ IRInterpreter::CanInterpret (llvm::Module &module, case Instruction::SRem: case Instruction::Store: case Instruction::Sub: + case Instruction::Trunc: case Instruction::UDiv: case Instruction::URem: case Instruction::Xor: @@ -1162,6 +1170,42 @@ IRInterpreter::Interpret (llvm::Module &module, } } break; + case Instruction::Trunc: + { + const TruncInst *trunc_inst = dyn_cast<TruncInst>(inst); + + if (!trunc_inst) + { + if (log) + log->Printf("getOpcode() returns Trunc, but instruction is not a TruncInst"); + error.SetErrorToGenericError(); + error.SetErrorString(interpreter_internal_error); + return false; + } + + Value *src_operand = trunc_inst->getOperand(0); + + lldb_private::Scalar I; + + if (!frame.EvaluateValue(I, src_operand, module)) + { + if (log) + log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str()); + error.SetErrorToGenericError(); + error.SetErrorString(bad_value_error); + return false; + } + + frame.AssignValue(inst, I, module); + + if (log) + { + log->Printf("Interpreted a Trunc"); + log->Printf(" Src : %s", frame.SummarizeValue(src_operand).c_str()); + log->Printf(" = : %s", frame.SummarizeValue(inst).c_str()); + } + } + break; case Instruction::Load: { const LoadInst *load_inst = dyn_cast<LoadInst>(inst); |