39 std::string text, std::string name,
40 bool enable_debugging)
41 :
Expression(exe_scope), m_execution_unit_sp(), m_jit_module_wp(),
42 m_function_text(std::move(text)), m_function_name(std::move(name)) {}
49 process_sp->GetTarget().GetImages().Remove(jit_module_sp);
64 error.SetErrorString(
"Can't make a function caller without a process.");
70 error.SetErrorStringWithFormatv(
71 "Can't make a function caller while the process is {0}: the process "
72 "must be stopped to allocate memory.",
80 name.append(
"-caller");
82 m_caller_up.reset(process_sp->GetTarget().GetFunctionCallerForLanguage(
83 Language().AsLanguageType(), return_type, impl_code_address,
84 arg_value_list, name.c_str(),
error));
93 m_caller_up->CompileFunction(thread_to_use_sp, diagnostics);
95 error.SetErrorStringWithFormat(
96 "Error compiling %s caller function: \"%s\".",
105 if (!
m_caller_up->WriteFunctionWrapper(exe_ctx, diagnostics)) {
106 error.SetErrorStringWithFormat(
107 "Error inserting caller function for %s: \"%s\".",
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
Generic representation of a type in a programming language.
std::string GetString(char separator='\n')
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Encapsulates a single expression for use in lldb.
lldb::ProcessWP m_jit_process_wp
Expression's always have to have a target...
lldb::addr_t StartAddress()
Return the address of the function's JIT-compiled code, or LLDB_INVALID_ADDRESS if the function is no...
Encapsulates a function that can be called.
UtilityFunction(ExecutionContextScope &exe_scope, std::string text, std::string name, bool enable_debugging)
Constructor.
FunctionCaller * MakeFunctionCaller(const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP compilation_thread, Status &error)
std::string m_function_name
The name of the function.
~UtilityFunction() override
lldb::ModuleWP m_jit_module_wp
std::unique_ptr< FunctionCaller > m_caller_up
A class that represents a running process on the host machine.
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
std::shared_ptr< lldb_private::Thread > ThreadSP
@ eStateStopped
Process or thread is stopped and can be examined.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Module > ModuleSP