1e2411fabSZachary Turner //===-- FunctionCaller.cpp ---------------------------------------*- C++-*-===// 2151c032cSJim Ingham // 3*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 5*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6151c032cSJim Ingham // 7151c032cSJim Ingham //===----------------------------------------------------------------------===// 8151c032cSJim Ingham 9151c032cSJim Ingham 10579e70c9SSean Callanan #include "lldb/Expression/FunctionCaller.h" 11151c032cSJim Ingham #include "lldb/Core/Module.h" 12151c032cSJim Ingham #include "lldb/Core/ValueObject.h" 13151c032cSJim Ingham #include "lldb/Core/ValueObjectList.h" 14579e70c9SSean Callanan #include "lldb/Expression/DiagnosticManager.h" 15151c032cSJim Ingham #include "lldb/Expression/IRExecutionUnit.h" 16151c032cSJim Ingham #include "lldb/Interpreter/CommandReturnObject.h" 17151c032cSJim Ingham #include "lldb/Symbol/Function.h" 18151c032cSJim Ingham #include "lldb/Symbol/Type.h" 19151c032cSJim Ingham #include "lldb/Target/ExecutionContext.h" 20151c032cSJim Ingham #include "lldb/Target/Process.h" 21151c032cSJim Ingham #include "lldb/Target/RegisterContext.h" 22151c032cSJim Ingham #include "lldb/Target/Target.h" 23151c032cSJim Ingham #include "lldb/Target/Thread.h" 24151c032cSJim Ingham #include "lldb/Target/ThreadPlan.h" 25151c032cSJim Ingham #include "lldb/Target/ThreadPlanCallFunction.h" 26666cc0b2SZachary Turner #include "lldb/Utility/DataExtractor.h" 276f9e6901SZachary Turner #include "lldb/Utility/Log.h" 28d821c997SPavel Labath #include "lldb/Utility/State.h" 29151c032cSJim Ingham 30151c032cSJim Ingham using namespace lldb_private; 31151c032cSJim Ingham 32151c032cSJim Ingham //---------------------------------------------------------------------- 33151c032cSJim Ingham // FunctionCaller constructor 34151c032cSJim Ingham //---------------------------------------------------------------------- 35b9c1b51eSKate Stone FunctionCaller::FunctionCaller(ExecutionContextScope &exe_scope, 36151c032cSJim Ingham const CompilerType &return_type, 37151c032cSJim Ingham const Address &functionAddress, 38151c032cSJim Ingham const ValueList &arg_value_list, 39b9c1b51eSKate Stone const char *name) 40b9c1b51eSKate Stone : Expression(exe_scope), m_execution_unit_sp(), m_parser(), 41b9c1b51eSKate Stone m_jit_module_wp(), m_name(name ? name : "<unknown>"), 42b9c1b51eSKate Stone m_function_ptr(NULL), m_function_addr(functionAddress), 43151c032cSJim Ingham m_function_return_type(return_type), 44151c032cSJim Ingham m_wrapper_function_name("__lldb_caller_function"), 45b9c1b51eSKate Stone m_wrapper_struct_name("__lldb_caller_struct"), m_wrapper_args_addrs(), 46a6922415SJason Molenda m_struct_valid(false), m_arg_values(arg_value_list), m_compiled(false), 47a6922415SJason Molenda m_JITted(false) { 48151c032cSJim Ingham m_jit_process_wp = lldb::ProcessWP(exe_scope.CalculateProcess()); 49151c032cSJim Ingham // Can't make a FunctionCaller without a process. 50151c032cSJim Ingham assert(m_jit_process_wp.lock()); 51151c032cSJim Ingham } 52151c032cSJim Ingham 53151c032cSJim Ingham //---------------------------------------------------------------------- 54151c032cSJim Ingham // Destructor 55151c032cSJim Ingham //---------------------------------------------------------------------- 56b9c1b51eSKate Stone FunctionCaller::~FunctionCaller() { 57151c032cSJim Ingham lldb::ProcessSP process_sp(m_jit_process_wp.lock()); 58b9c1b51eSKate Stone if (process_sp) { 59151c032cSJim Ingham lldb::ModuleSP jit_module_sp(m_jit_module_wp.lock()); 60151c032cSJim Ingham if (jit_module_sp) 61151c032cSJim Ingham process_sp->GetTarget().GetImages().Remove(jit_module_sp); 62151c032cSJim Ingham } 63151c032cSJim Ingham } 64151c032cSJim Ingham 65b9c1b51eSKate Stone bool FunctionCaller::WriteFunctionWrapper( 66b9c1b51eSKate Stone ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager) { 67151c032cSJim Ingham Process *process = exe_ctx.GetProcessPtr(); 68151c032cSJim Ingham 69151c032cSJim Ingham if (!process) 70151c032cSJim Ingham return false; 71151c032cSJim Ingham 72151c032cSJim Ingham lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock()); 73151c032cSJim Ingham 74151c032cSJim Ingham if (process != jit_process_sp.get()) 75151c032cSJim Ingham return false; 76151c032cSJim Ingham 77151c032cSJim Ingham if (!m_compiled) 78151c032cSJim Ingham return false; 79151c032cSJim Ingham 80151c032cSJim Ingham if (m_JITted) 81151c032cSJim Ingham return true; 82151c032cSJim Ingham 83151c032cSJim Ingham bool can_interpret = false; // should stay that way 84151c032cSJim Ingham 8597206d57SZachary Turner Status jit_error(m_parser->PrepareForExecution( 86b9c1b51eSKate Stone m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx, 87b9c1b51eSKate Stone can_interpret, eExecutionPolicyAlways)); 88151c032cSJim Ingham 890d231f71SJim Ingham if (!jit_error.Success()) { 900d231f71SJim Ingham diagnostic_manager.Printf(eDiagnosticSeverityError, 910d231f71SJim Ingham "Error in PrepareForExecution: %s.", 920d231f71SJim Ingham jit_error.AsCString()); 93151c032cSJim Ingham return false; 940d231f71SJim Ingham } 95151c032cSJim Ingham 96b9c1b51eSKate Stone if (m_parser->GetGenerateDebugInfo()) { 97151c032cSJim Ingham lldb::ModuleSP jit_module_sp(m_execution_unit_sp->GetJITModule()); 98151c032cSJim Ingham 99b9c1b51eSKate Stone if (jit_module_sp) { 100151c032cSJim Ingham ConstString const_func_name(FunctionName()); 101151c032cSJim Ingham FileSpec jit_file; 102151c032cSJim Ingham jit_file.GetFilename() = const_func_name; 103151c032cSJim Ingham jit_module_sp->SetFileSpecAndObjectName(jit_file, ConstString()); 104151c032cSJim Ingham m_jit_module_wp = jit_module_sp; 105151c032cSJim Ingham process->GetTarget().GetImages().Append(jit_module_sp); 106151c032cSJim Ingham } 107151c032cSJim Ingham } 108151c032cSJim Ingham if (process && m_jit_start_addr) 109151c032cSJim Ingham m_jit_process_wp = process->shared_from_this(); 110151c032cSJim Ingham 111151c032cSJim Ingham m_JITted = true; 112151c032cSJim Ingham 113151c032cSJim Ingham return true; 114151c032cSJim Ingham } 115151c032cSJim Ingham 116b9c1b51eSKate Stone bool FunctionCaller::WriteFunctionArguments( 117b9c1b51eSKate Stone ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, 118b9c1b51eSKate Stone DiagnosticManager &diagnostic_manager) { 119b9c1b51eSKate Stone return WriteFunctionArguments(exe_ctx, args_addr_ref, m_arg_values, 120b9c1b51eSKate Stone diagnostic_manager); 121151c032cSJim Ingham } 122151c032cSJim Ingham 123b9c1b51eSKate Stone // FIXME: Assure that the ValueList we were passed in is consistent with the one 124b9c1b51eSKate Stone // that defined this function. 125151c032cSJim Ingham 126b9c1b51eSKate Stone bool FunctionCaller::WriteFunctionArguments( 127b9c1b51eSKate Stone ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, 128b9c1b51eSKate Stone ValueList &arg_values, DiagnosticManager &diagnostic_manager) { 129151c032cSJim Ingham // All the information to reconstruct the struct is provided by the 130151c032cSJim Ingham // StructExtractor. 131b9c1b51eSKate Stone if (!m_struct_valid) { 132e2411fabSZachary Turner diagnostic_manager.PutString(eDiagnosticSeverityError, 133b9c1b51eSKate Stone "Argument information was not correctly " 134b9c1b51eSKate Stone "parsed, so the function cannot be called."); 135151c032cSJim Ingham return false; 136151c032cSJim Ingham } 137151c032cSJim Ingham 13897206d57SZachary Turner Status error; 139151c032cSJim Ingham lldb::ExpressionResults return_value = lldb::eExpressionSetupError; 140151c032cSJim Ingham 141151c032cSJim Ingham Process *process = exe_ctx.GetProcessPtr(); 142151c032cSJim Ingham 143151c032cSJim Ingham if (process == NULL) 144151c032cSJim Ingham return return_value; 145151c032cSJim Ingham 146151c032cSJim Ingham lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock()); 147151c032cSJim Ingham 148151c032cSJim Ingham if (process != jit_process_sp.get()) 149151c032cSJim Ingham return false; 150151c032cSJim Ingham 151b9c1b51eSKate Stone if (args_addr_ref == LLDB_INVALID_ADDRESS) { 152b9c1b51eSKate Stone args_addr_ref = process->AllocateMemory( 153b9c1b51eSKate Stone m_struct_size, lldb::ePermissionsReadable | lldb::ePermissionsWritable, 154b9c1b51eSKate Stone error); 155151c032cSJim Ingham if (args_addr_ref == LLDB_INVALID_ADDRESS) 156151c032cSJim Ingham return false; 157151c032cSJim Ingham m_wrapper_args_addrs.push_back(args_addr_ref); 158b9c1b51eSKate Stone } else { 159151c032cSJim Ingham // Make sure this is an address that we've already handed out. 160b9c1b51eSKate Stone if (find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(), 161b9c1b51eSKate Stone args_addr_ref) == m_wrapper_args_addrs.end()) { 162151c032cSJim Ingham return false; 163151c032cSJim Ingham } 164151c032cSJim Ingham } 165151c032cSJim Ingham 166151c032cSJim Ingham // TODO: verify fun_addr needs to be a callable address 167b9c1b51eSKate Stone Scalar fun_addr( 168b9c1b51eSKate Stone m_function_addr.GetCallableLoadAddress(exe_ctx.GetTargetPtr())); 169151c032cSJim Ingham uint64_t first_offset = m_member_offsets[0]; 170b9c1b51eSKate Stone process->WriteScalarToMemory(args_addr_ref + first_offset, fun_addr, 171b9c1b51eSKate Stone process->GetAddressByteSize(), error); 172151c032cSJim Ingham 173151c032cSJim Ingham // FIXME: We will need to extend this for Variadic functions. 174151c032cSJim Ingham 17597206d57SZachary Turner Status value_error; 176151c032cSJim Ingham 177151c032cSJim Ingham size_t num_args = arg_values.GetSize(); 178b9c1b51eSKate Stone if (num_args != m_arg_values.GetSize()) { 179b9c1b51eSKate Stone diagnostic_manager.Printf( 180b9c1b51eSKate Stone eDiagnosticSeverityError, 181579e70c9SSean Callanan "Wrong number of arguments - was: %" PRIu64 " should be: %" PRIu64 "", 182579e70c9SSean Callanan (uint64_t)num_args, (uint64_t)m_arg_values.GetSize()); 183151c032cSJim Ingham return false; 184151c032cSJim Ingham } 185151c032cSJim Ingham 186b9c1b51eSKate Stone for (size_t i = 0; i < num_args; i++) { 187151c032cSJim Ingham // FIXME: We should sanity check sizes. 188151c032cSJim Ingham 189151c032cSJim Ingham uint64_t offset = m_member_offsets[i + 1]; // Clang sizes are in bytes. 190151c032cSJim Ingham Value *arg_value = arg_values.GetValueAtIndex(i); 191151c032cSJim Ingham 192151c032cSJim Ingham // FIXME: For now just do scalars: 193151c032cSJim Ingham 194b9c1b51eSKate Stone // Special case: if it's a pointer, don't do anything (the ABI supports 195b9c1b51eSKate Stone // passing cstrings) 196151c032cSJim Ingham 197151c032cSJim Ingham if (arg_value->GetValueType() == Value::eValueTypeHostAddress && 198151c032cSJim Ingham arg_value->GetContextType() == Value::eContextTypeInvalid && 199151c032cSJim Ingham arg_value->GetCompilerType().IsPointerType()) 200151c032cSJim Ingham continue; 201151c032cSJim Ingham 202151c032cSJim Ingham const Scalar &arg_scalar = arg_value->ResolveValue(&exe_ctx); 203151c032cSJim Ingham 204b9c1b51eSKate Stone if (!process->WriteScalarToMemory(args_addr_ref + offset, arg_scalar, 205b9c1b51eSKate Stone arg_scalar.GetByteSize(), error)) 206151c032cSJim Ingham return false; 207151c032cSJim Ingham } 208151c032cSJim Ingham 209151c032cSJim Ingham return true; 210151c032cSJim Ingham } 211151c032cSJim Ingham 212b9c1b51eSKate Stone bool FunctionCaller::InsertFunction(ExecutionContext &exe_ctx, 213b9c1b51eSKate Stone lldb::addr_t &args_addr_ref, 214b9c1b51eSKate Stone DiagnosticManager &diagnostic_manager) { 2156896b355SJim Ingham if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0) 216151c032cSJim Ingham return false; 217579e70c9SSean Callanan if (!WriteFunctionWrapper(exe_ctx, diagnostic_manager)) 218151c032cSJim Ingham return false; 219579e70c9SSean Callanan if (!WriteFunctionArguments(exe_ctx, args_addr_ref, diagnostic_manager)) 220151c032cSJim Ingham return false; 221151c032cSJim Ingham 222151c032cSJim Ingham Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); 223151c032cSJim Ingham if (log) 224b9c1b51eSKate Stone log->Printf("Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n", 225b9c1b51eSKate Stone m_jit_start_addr, args_addr_ref); 226151c032cSJim Ingham 227151c032cSJim Ingham return true; 228151c032cSJim Ingham } 229151c032cSJim Ingham 230b9c1b51eSKate Stone lldb::ThreadPlanSP FunctionCaller::GetThreadPlanToCallFunction( 231b9c1b51eSKate Stone ExecutionContext &exe_ctx, lldb::addr_t args_addr, 232151c032cSJim Ingham const EvaluateExpressionOptions &options, 233b9c1b51eSKate Stone DiagnosticManager &diagnostic_manager) { 234b9c1b51eSKate Stone Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | 235b9c1b51eSKate Stone LIBLLDB_LOG_STEP)); 236151c032cSJim Ingham 237151c032cSJim Ingham if (log) 238b9c1b51eSKate Stone log->Printf("-- [FunctionCaller::GetThreadPlanToCallFunction] Creating " 239b9c1b51eSKate Stone "thread plan to call function \"%s\" --", 240b9c1b51eSKate Stone m_name.c_str()); 241151c032cSJim Ingham 242151c032cSJim Ingham // FIXME: Use the errors Stream for better error reporting. 243151c032cSJim Ingham Thread *thread = exe_ctx.GetThreadPtr(); 244b9c1b51eSKate Stone if (thread == NULL) { 245e2411fabSZachary Turner diagnostic_manager.PutString( 246b9c1b51eSKate Stone eDiagnosticSeverityError, 247b9c1b51eSKate Stone "Can't call a function without a valid thread."); 248151c032cSJim Ingham return NULL; 249151c032cSJim Ingham } 250151c032cSJim Ingham 251151c032cSJim Ingham // Okay, now run the function: 252151c032cSJim Ingham 253151c032cSJim Ingham Address wrapper_address(m_jit_start_addr); 254151c032cSJim Ingham 255151c032cSJim Ingham lldb::addr_t args = {args_addr}; 256151c032cSJim Ingham 257b9c1b51eSKate Stone lldb::ThreadPlanSP new_plan_sp(new ThreadPlanCallFunction( 258b9c1b51eSKate Stone *thread, wrapper_address, CompilerType(), args, options)); 259151c032cSJim Ingham new_plan_sp->SetIsMasterPlan(true); 260151c032cSJim Ingham new_plan_sp->SetOkayToDiscard(false); 261151c032cSJim Ingham return new_plan_sp; 262151c032cSJim Ingham } 263151c032cSJim Ingham 264b9c1b51eSKate Stone bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx, 265b9c1b51eSKate Stone lldb::addr_t args_addr, 266b9c1b51eSKate Stone Value &ret_value) { 267151c032cSJim Ingham // Read the return value - it is the last field in the struct: 268b9c1b51eSKate Stone // FIXME: How does clang tell us there's no return value? We need to handle 269b9c1b51eSKate Stone // that case. 270b9c1b51eSKate Stone // FIXME: Create our ThreadPlanCallFunction with the return CompilerType, and 271b9c1b51eSKate Stone // then use GetReturnValueObject 272151c032cSJim Ingham // to fetch the value. That way we can fetch any values we need. 273151c032cSJim Ingham 274b9c1b51eSKate Stone Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | 275b9c1b51eSKate Stone LIBLLDB_LOG_STEP)); 276151c032cSJim Ingham 277151c032cSJim Ingham if (log) 278b9c1b51eSKate Stone log->Printf("-- [FunctionCaller::FetchFunctionResults] Fetching function " 279b9c1b51eSKate Stone "results for \"%s\"--", 280b9c1b51eSKate Stone m_name.c_str()); 281151c032cSJim Ingham 282151c032cSJim Ingham Process *process = exe_ctx.GetProcessPtr(); 283151c032cSJim Ingham 284151c032cSJim Ingham if (process == NULL) 285151c032cSJim Ingham return false; 286151c032cSJim Ingham 287151c032cSJim Ingham lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock()); 288151c032cSJim Ingham 289151c032cSJim Ingham if (process != jit_process_sp.get()) 290151c032cSJim Ingham return false; 291151c032cSJim Ingham 29297206d57SZachary Turner Status error; 293b9c1b51eSKate Stone ret_value.GetScalar() = process->ReadUnsignedIntegerFromMemory( 294b9c1b51eSKate Stone args_addr + m_return_offset, m_return_size, 0, error); 295151c032cSJim Ingham 296151c032cSJim Ingham if (error.Fail()) 297151c032cSJim Ingham return false; 298151c032cSJim Ingham 299151c032cSJim Ingham ret_value.SetCompilerType(m_function_return_type); 300151c032cSJim Ingham ret_value.SetValueType(Value::eValueTypeScalar); 301151c032cSJim Ingham return true; 302151c032cSJim Ingham } 303151c032cSJim Ingham 304b9c1b51eSKate Stone void FunctionCaller::DeallocateFunctionResults(ExecutionContext &exe_ctx, 305b9c1b51eSKate Stone lldb::addr_t args_addr) { 306151c032cSJim Ingham std::list<lldb::addr_t>::iterator pos; 307b9c1b51eSKate Stone pos = std::find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(), 308b9c1b51eSKate Stone args_addr); 309151c032cSJim Ingham if (pos != m_wrapper_args_addrs.end()) 310151c032cSJim Ingham m_wrapper_args_addrs.erase(pos); 311151c032cSJim Ingham 312151c032cSJim Ingham exe_ctx.GetProcessRef().DeallocateMemory(args_addr); 313151c032cSJim Ingham } 314151c032cSJim Ingham 315b9c1b51eSKate Stone lldb::ExpressionResults FunctionCaller::ExecuteFunction( 316b9c1b51eSKate Stone ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr, 317b9c1b51eSKate Stone const EvaluateExpressionOptions &options, 318b9c1b51eSKate Stone DiagnosticManager &diagnostic_manager, Value &results) { 319151c032cSJim Ingham lldb::ExpressionResults return_value = lldb::eExpressionSetupError; 320151c032cSJim Ingham 32105097246SAdrian Prantl // FunctionCaller::ExecuteFunction execution is always just to get the 32205097246SAdrian Prantl // result. Do make sure we ignore breakpoints, unwind on error, and don't try 32305097246SAdrian Prantl // to debug it. 324151c032cSJim Ingham EvaluateExpressionOptions real_options = options; 325151c032cSJim Ingham real_options.SetDebug(false); 326151c032cSJim Ingham real_options.SetUnwindOnError(true); 327151c032cSJim Ingham real_options.SetIgnoreBreakpoints(true); 328151c032cSJim Ingham 329151c032cSJim Ingham lldb::addr_t args_addr; 330151c032cSJim Ingham 331151c032cSJim Ingham if (args_addr_ptr != NULL) 332151c032cSJim Ingham args_addr = *args_addr_ptr; 333151c032cSJim Ingham else 334151c032cSJim Ingham args_addr = LLDB_INVALID_ADDRESS; 335151c032cSJim Ingham 3366896b355SJim Ingham if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0) 337151c032cSJim Ingham return lldb::eExpressionSetupError; 338151c032cSJim Ingham 339b9c1b51eSKate Stone if (args_addr == LLDB_INVALID_ADDRESS) { 340579e70c9SSean Callanan if (!InsertFunction(exe_ctx, args_addr, diagnostic_manager)) 341151c032cSJim Ingham return lldb::eExpressionSetupError; 342151c032cSJim Ingham } 343151c032cSJim Ingham 344b9c1b51eSKate Stone Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | 345b9c1b51eSKate Stone LIBLLDB_LOG_STEP)); 346151c032cSJim Ingham 347151c032cSJim Ingham if (log) 348b9c1b51eSKate Stone log->Printf( 349b9c1b51eSKate Stone "== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==", 350b9c1b51eSKate Stone m_name.c_str()); 351151c032cSJim Ingham 352b9c1b51eSKate Stone lldb::ThreadPlanSP call_plan_sp = GetThreadPlanToCallFunction( 353b9c1b51eSKate Stone exe_ctx, args_addr, real_options, diagnostic_manager); 354151c032cSJim Ingham if (!call_plan_sp) 355151c032cSJim Ingham return lldb::eExpressionSetupError; 356151c032cSJim Ingham 357b9c1b51eSKate Stone // We need to make sure we record the fact that we are running an expression 35805097246SAdrian Prantl // here otherwise this fact will fail to be recorded when fetching an 35905097246SAdrian Prantl // Objective-C object description 360151c032cSJim Ingham if (exe_ctx.GetProcessPtr()) 361151c032cSJim Ingham exe_ctx.GetProcessPtr()->SetRunningUserExpression(true); 362151c032cSJim Ingham 363b9c1b51eSKate Stone return_value = exe_ctx.GetProcessRef().RunThreadPlan( 364b9c1b51eSKate Stone exe_ctx, call_plan_sp, real_options, diagnostic_manager); 365151c032cSJim Ingham 366b9c1b51eSKate Stone if (log) { 367b9c1b51eSKate Stone if (return_value != lldb::eExpressionCompleted) { 368b9c1b51eSKate Stone log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" " 369b9c1b51eSKate Stone "completed abnormally ==", 370b9c1b51eSKate Stone m_name.c_str()); 371b9c1b51eSKate Stone } else { 372b9c1b51eSKate Stone log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" " 373b9c1b51eSKate Stone "completed normally ==", 374b9c1b51eSKate Stone m_name.c_str()); 375151c032cSJim Ingham } 376151c032cSJim Ingham } 377151c032cSJim Ingham 378151c032cSJim Ingham if (exe_ctx.GetProcessPtr()) 379151c032cSJim Ingham exe_ctx.GetProcessPtr()->SetRunningUserExpression(false); 380151c032cSJim Ingham 381151c032cSJim Ingham if (args_addr_ptr != NULL) 382151c032cSJim Ingham *args_addr_ptr = args_addr; 383151c032cSJim Ingham 384151c032cSJim Ingham if (return_value != lldb::eExpressionCompleted) 385151c032cSJim Ingham return return_value; 386151c032cSJim Ingham 387151c032cSJim Ingham FetchFunctionResults(exe_ctx, args_addr, results); 388151c032cSJim Ingham 389151c032cSJim Ingham if (args_addr_ptr == NULL) 390151c032cSJim Ingham DeallocateFunctionResults(exe_ctx, args_addr); 391151c032cSJim Ingham 392151c032cSJim Ingham return lldb::eExpressionCompleted; 393151c032cSJim Ingham } 394