diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Expression/UtilityFunction.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Expression/UtilityFunction.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/contrib/llvm/tools/lldb/source/Expression/UtilityFunction.cpp b/contrib/llvm/tools/lldb/source/Expression/UtilityFunction.cpp index f93e358..2ff77f0 100644 --- a/contrib/llvm/tools/lldb/source/Expression/UtilityFunction.cpp +++ b/contrib/llvm/tools/lldb/source/Expression/UtilityFunction.cpp @@ -20,10 +20,11 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Expression/FunctionCaller.h" -#include "lldb/Expression/UtilityFunction.h" +#include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/ExpressionSourceCode.h" +#include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/IRExecutionUnit.h" +#include "lldb/Expression/UtilityFunction.h" #include "lldb/Host/Host.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -69,14 +70,17 @@ UtilityFunction::~UtilityFunction () // FIXME: We should check that every time this is called it is called with the same return type & arguments... FunctionCaller * -UtilityFunction::MakeFunctionCaller (const CompilerType &return_type, const ValueList &arg_value_list, Error &error) +UtilityFunction::MakeFunctionCaller (const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP thread_to_use_sp, Error &error) { if (m_caller_up) return m_caller_up.get(); ProcessSP process_sp = m_jit_process_wp.lock(); if (!process_sp) + { + error.SetErrorString("Can't make a function caller without a process."); return nullptr; + } Address impl_code_address; impl_code_address.SetOffset(StartAddress()); @@ -96,26 +100,24 @@ UtilityFunction::MakeFunctionCaller (const CompilerType &return_type, const Valu } if (m_caller_up) { - StreamString errors; - errors.Clear(); - unsigned num_errors = m_caller_up->CompileFunction(errors); + DiagnosticManager diagnostics; + + unsigned num_errors = m_caller_up->CompileFunction(thread_to_use_sp, diagnostics); if (num_errors) { - error.SetErrorStringWithFormat ("Error compiling %s caller function: \"%s\".", - m_function_name.c_str(), - errors.GetData()); + error.SetErrorStringWithFormat("Error compiling %s caller function: \"%s\".", m_function_name.c_str(), + diagnostics.GetString().c_str()); m_caller_up.reset(); return nullptr; } - - errors.Clear(); + + diagnostics.Clear(); ExecutionContext exe_ctx(process_sp); - - if (!m_caller_up->WriteFunctionWrapper(exe_ctx, errors)) + + if (!m_caller_up->WriteFunctionWrapper(exe_ctx, diagnostics)) { - error.SetErrorStringWithFormat ("Error inserting caller function for %s: \"%s\".", - m_function_name.c_str(), - errors.GetData()); + error.SetErrorStringWithFormat("Error inserting caller function for %s: \"%s\".", m_function_name.c_str(), + diagnostics.GetString().c_str()); m_caller_up.reset(); return nullptr; } |