diff options
author | Sean Callanan <scallanan@apple.com> | 2013-04-13 02:25:02 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2013-04-13 02:25:02 +0000 |
commit | 2f1edcd7583fcdf25361b3e0ffd7ccb5a4002d42 (patch) | |
tree | d32f4f99f9b537875684069bb3c0607c6cd6a321 | |
parent | a6bbde5839eab307c66a5fd8925cf7a1fc467fa1 (diff) | |
download | bcm5719-llvm-2f1edcd7583fcdf25361b3e0ffd7ccb5a4002d42.tar.gz bcm5719-llvm-2f1edcd7583fcdf25361b3e0ffd7ccb5a4002d42.zip |
Added symbol materialization support to the new
Materializer.
llvm-svn: 179445
-rw-r--r-- | lldb/source/Expression/Materializer.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index bd64ee3b92f..7a1560dbf9e 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -569,11 +569,42 @@ public: virtual void Materialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, Error &err) { + Address &sym_address = m_symbol.GetAddress(); + + ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope(); + + lldb::TargetSP target_sp; + + if (exe_scope) + target_sp = map.GetBestExecutionContextScope()->CalculateTarget(); + + if (!target_sp) + { + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't resolve symbol %s because there is no target", m_symbol.GetName().AsCString()); + return; + } + + lldb::addr_t resolved_address = sym_address.GetLoadAddress(target_sp.get()); + + if (resolved_address == LLDB_INVALID_ADDRESS) + resolved_address = sym_address.GetFileAddress(); + + Error pointer_write_error; + + map.WritePointerToMemory(process_address + m_offset, resolved_address, pointer_write_error); + + if (!pointer_write_error.Success()) + { + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the address of symbol %s: %s", m_symbol.GetName().AsCString(), pointer_write_error.AsCString()); + } } virtual void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err) { + // no work needs to be done } private: Symbol m_symbol; |