summaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/lldb/source/Expression/ExpressionVariable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Expression/ExpressionVariable.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Expression/ExpressionVariable.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/contrib/llvm/tools/lldb/source/Expression/ExpressionVariable.cpp b/contrib/llvm/tools/lldb/source/Expression/ExpressionVariable.cpp
index 8bef60fdf1d7..5567ee286aa9 100644
--- a/contrib/llvm/tools/lldb/source/Expression/ExpressionVariable.cpp
+++ b/contrib/llvm/tools/lldb/source/Expression/ExpressionVariable.cpp
@@ -7,7 +7,9 @@
//
//===----------------------------------------------------------------------===//
+#include "lldb/Core/Log.h"
#include "lldb/Expression/ExpressionVariable.h"
+#include "lldb/Expression/IRExecutionUnit.h"
using namespace lldb_private;
@@ -34,3 +36,55 @@ ExpressionVariable::GetValueBytes()
PersistentExpressionState::~PersistentExpressionState ()
{
}
+
+lldb::addr_t
+PersistentExpressionState::LookupSymbol (const ConstString &name)
+{
+ SymbolMap::iterator si = m_symbol_map.find(name.GetCString());
+
+ if (si != m_symbol_map.end())
+ return si->second;
+ else
+ return LLDB_INVALID_ADDRESS;
+}
+
+
+void
+PersistentExpressionState::RegisterExecutionUnit (lldb::IRExecutionUnitSP &execution_unit_sp)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+ m_execution_units.insert(execution_unit_sp);
+
+ if (log)
+ log->Printf ("Registering JITted Functions:\n");
+
+ for (const IRExecutionUnit::JittedFunction &jitted_function : execution_unit_sp->GetJittedFunctions())
+ {
+ if (jitted_function.m_external &&
+ jitted_function.m_name != execution_unit_sp->GetFunctionName() &&
+ jitted_function.m_remote_addr != LLDB_INVALID_ADDRESS)
+ {
+ m_symbol_map[jitted_function.m_name.GetCString()] = jitted_function.m_remote_addr;
+ if (log)
+ log->Printf (" Function: %s at 0x%" PRIx64 ".", jitted_function.m_name.GetCString(), jitted_function.m_remote_addr);
+ }
+ }
+
+ if (log)
+ log->Printf ("Registering JIIted Symbols:\n");
+
+ for (const IRExecutionUnit::JittedGlobalVariable &global_var : execution_unit_sp->GetJittedGlobalVariables())
+ {
+ if (global_var.m_remote_addr != LLDB_INVALID_ADDRESS)
+ {
+ // Demangle the name before inserting it, so that lookups by the ConstStr of the demangled name
+ // will find the mangled one (needed for looking up metadata pointers.)
+ Mangled mangler(global_var.m_name);
+ mangler.GetDemangledName(lldb::eLanguageTypeUnknown);
+ m_symbol_map[global_var.m_name.GetCString()] = global_var.m_remote_addr;
+ if (log)
+ log->Printf (" Symbol: %s at 0x%" PRIx64 ".", global_var.m_name.GetCString(), global_var.m_remote_addr);
+ }
+ }
+}