2016-11-13 03:12:56 +08:00
|
|
|
//===-- FunctionCaller.cpp ---------------------------------------*- C++-*-===//
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
|
|
|
|
// Project includes
|
2016-03-19 08:03:59 +08:00
|
|
|
#include "lldb/Expression/FunctionCaller.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/DataExtractor.h"
|
2014-03-25 07:10:19 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
|
|
|
#include "lldb/Core/Module.h"
|
2010-11-17 10:32:00 +08:00
|
|
|
#include "lldb/Core/State.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/ValueObject.h"
|
|
|
|
#include "lldb/Core/ValueObjectList.h"
|
2016-03-19 08:03:59 +08:00
|
|
|
#include "lldb/Expression/DiagnosticManager.h"
|
2014-03-25 07:10:19 +08:00
|
|
|
#include "lldb/Expression/IRExecutionUnit.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Interpreter/CommandReturnObject.h"
|
|
|
|
#include "lldb/Symbol/Function.h"
|
2014-03-25 07:10:19 +08:00
|
|
|
#include "lldb/Symbol/Type.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
2010-07-23 08:16:21 +08:00
|
|
|
#include "lldb/Target/RegisterContext.h"
|
2011-02-16 05:59:32 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
#include "lldb/Target/ThreadPlan.h"
|
|
|
|
#include "lldb/Target/ThreadPlanCallFunction.h"
|
|
|
|
|
|
|
|
using namespace lldb_private;
|
This is a major refactoring of the expression parser.
The goal is to separate the parser's data from the data
belonging to the parser's clients. This allows clients
to use the parser to obtain (for example) a JIT compiled
function or some DWARF code, and then discard the parser
state.
Previously, parser state was held in ClangExpression and
used liberally by ClangFunction, which inherited from
ClangExpression. The main effects of this refactoring
are:
- reducing ClangExpression to an abstract class that
declares methods that any client must expose to the
expression parser,
- moving the code specific to implementing the "expr"
command from ClangExpression and
CommandObjectExpression into ClangUserExpression,
a new class,
- moving the common parser interaction code from
ClangExpression into ClangExpressionParser, a new
class, and
- making ClangFunction rely only on
ClangExpressionParser and not depend on the
internal implementation of ClangExpression.
Side effects include:
- the compiler interaction code has been factored
out of ClangFunction and is now in an AST pass
(ASTStructExtractor),
- the header file for ClangFunction is now fully
documented,
- several bugs that only popped up when Clang was
deallocated (which never happened, since the
lifetime of the compiler was essentially infinite)
are now fixed, and
- the developer-only "call" command has been
disabled.
I have tested the expr command and the Objective-C
step-into code, which use ClangUserExpression and
ClangFunction, respectively, and verified that they
work. Please let me know if you encounter bugs or
poor documentation.
llvm-svn: 112249
2010-08-27 09:01:44 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
//----------------------------------------------------------------------
|
2015-09-16 05:13:50 +08:00
|
|
|
// FunctionCaller constructor
|
2010-06-09 00:52:24 +08:00
|
|
|
//----------------------------------------------------------------------
|
2016-09-07 04:57:50 +08:00
|
|
|
FunctionCaller::FunctionCaller(ExecutionContextScope &exe_scope,
|
|
|
|
const CompilerType &return_type,
|
|
|
|
const Address &functionAddress,
|
|
|
|
const ValueList &arg_value_list,
|
|
|
|
const char *name)
|
|
|
|
: Expression(exe_scope), m_execution_unit_sp(), m_parser(),
|
|
|
|
m_jit_module_wp(), m_name(name ? name : "<unknown>"),
|
|
|
|
m_function_ptr(NULL), m_function_addr(functionAddress),
|
|
|
|
m_function_return_type(return_type),
|
|
|
|
m_wrapper_function_name("__lldb_caller_function"),
|
|
|
|
m_wrapper_struct_name("__lldb_caller_struct"), m_wrapper_args_addrs(),
|
|
|
|
m_arg_values(arg_value_list), m_compiled(false), m_JITted(false) {
|
|
|
|
m_jit_process_wp = lldb::ProcessWP(exe_scope.CalculateProcess());
|
|
|
|
// Can't make a FunctionCaller without a process.
|
|
|
|
assert(m_jit_process_wp.lock());
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Destructor
|
|
|
|
//----------------------------------------------------------------------
|
2016-09-07 04:57:50 +08:00
|
|
|
FunctionCaller::~FunctionCaller() {
|
|
|
|
lldb::ProcessSP process_sp(m_jit_process_wp.lock());
|
|
|
|
if (process_sp) {
|
|
|
|
lldb::ModuleSP jit_module_sp(m_jit_module_wp.lock());
|
|
|
|
if (jit_module_sp)
|
|
|
|
process_sp->GetTarget().GetImages().Remove(jit_module_sp);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool FunctionCaller::WriteFunctionWrapper(
|
|
|
|
ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager) {
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
|
|
|
|
if (!process)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
|
|
|
|
|
|
|
|
if (process != jit_process_sp.get())
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (!m_compiled)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (m_JITted)
|
2010-06-09 00:52:24 +08:00
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
bool can_interpret = false; // should stay that way
|
|
|
|
|
|
|
|
Error jit_error(m_parser->PrepareForExecution(
|
|
|
|
m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx,
|
|
|
|
can_interpret, eExecutionPolicyAlways));
|
|
|
|
|
|
|
|
if (!jit_error.Success())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (m_parser->GetGenerateDebugInfo()) {
|
|
|
|
lldb::ModuleSP jit_module_sp(m_execution_unit_sp->GetJITModule());
|
|
|
|
|
|
|
|
if (jit_module_sp) {
|
|
|
|
ConstString const_func_name(FunctionName());
|
|
|
|
FileSpec jit_file;
|
|
|
|
jit_file.GetFilename() = const_func_name;
|
|
|
|
jit_module_sp->SetFileSpecAndObjectName(jit_file, ConstString());
|
|
|
|
m_jit_module_wp = jit_module_sp;
|
|
|
|
process->GetTarget().GetImages().Append(jit_module_sp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (process && m_jit_start_addr)
|
|
|
|
m_jit_process_wp = process->shared_from_this();
|
|
|
|
|
|
|
|
m_JITted = true;
|
|
|
|
|
|
|
|
return true;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool FunctionCaller::WriteFunctionArguments(
|
|
|
|
ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
|
|
|
|
DiagnosticManager &diagnostic_manager) {
|
|
|
|
return WriteFunctionArguments(exe_ctx, args_addr_ref, m_arg_values,
|
|
|
|
diagnostic_manager);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// FIXME: Assure that the ValueList we were passed in is consistent with the one
|
|
|
|
// that defined this function.
|
|
|
|
|
|
|
|
bool FunctionCaller::WriteFunctionArguments(
|
|
|
|
ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
|
|
|
|
ValueList &arg_values, DiagnosticManager &diagnostic_manager) {
|
|
|
|
// All the information to reconstruct the struct is provided by the
|
|
|
|
// StructExtractor.
|
|
|
|
if (!m_struct_valid) {
|
2016-11-13 03:12:56 +08:00
|
|
|
diagnostic_manager.PutString(eDiagnosticSeverityError,
|
|
|
|
"Argument information was not correctly "
|
|
|
|
"parsed, so the function cannot be called.");
|
2016-09-07 04:57:50 +08:00
|
|
|
return false;
|
|
|
|
}
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
Error error;
|
|
|
|
lldb::ExpressionResults return_value = lldb::eExpressionSetupError;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (process == NULL)
|
|
|
|
return return_value;
|
2011-03-18 04:02:56 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
|
|
|
|
|
|
|
|
if (process != jit_process_sp.get())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (args_addr_ref == LLDB_INVALID_ADDRESS) {
|
|
|
|
args_addr_ref = process->AllocateMemory(
|
|
|
|
m_struct_size, lldb::ePermissionsReadable | lldb::ePermissionsWritable,
|
|
|
|
error);
|
2010-06-09 00:52:24 +08:00
|
|
|
if (args_addr_ref == LLDB_INVALID_ADDRESS)
|
2016-09-07 04:57:50 +08:00
|
|
|
return false;
|
|
|
|
m_wrapper_args_addrs.push_back(args_addr_ref);
|
|
|
|
} else {
|
|
|
|
// Make sure this is an address that we've already handed out.
|
|
|
|
if (find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(),
|
|
|
|
args_addr_ref) == m_wrapper_args_addrs.end()) {
|
|
|
|
return false;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// TODO: verify fun_addr needs to be a callable address
|
|
|
|
Scalar fun_addr(
|
|
|
|
m_function_addr.GetCallableLoadAddress(exe_ctx.GetTargetPtr()));
|
|
|
|
uint64_t first_offset = m_member_offsets[0];
|
|
|
|
process->WriteScalarToMemory(args_addr_ref + first_offset, fun_addr,
|
|
|
|
process->GetAddressByteSize(), error);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// FIXME: We will need to extend this for Variadic functions.
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
Error value_error;
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t num_args = arg_values.GetSize();
|
|
|
|
if (num_args != m_arg_values.GetSize()) {
|
|
|
|
diagnostic_manager.Printf(
|
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"Wrong number of arguments - was: %" PRIu64 " should be: %" PRIu64 "",
|
|
|
|
(uint64_t)num_args, (uint64_t)m_arg_values.GetSize());
|
|
|
|
return false;
|
|
|
|
}
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
for (size_t i = 0; i < num_args; i++) {
|
|
|
|
// FIXME: We should sanity check sizes.
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint64_t offset = m_member_offsets[i + 1]; // Clang sizes are in bytes.
|
|
|
|
Value *arg_value = arg_values.GetValueAtIndex(i);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// FIXME: For now just do scalars:
|
|
|
|
|
|
|
|
// Special case: if it's a pointer, don't do anything (the ABI supports
|
|
|
|
// passing cstrings)
|
|
|
|
|
|
|
|
if (arg_value->GetValueType() == Value::eValueTypeHostAddress &&
|
|
|
|
arg_value->GetContextType() == Value::eContextTypeInvalid &&
|
|
|
|
arg_value->GetCompilerType().IsPointerType())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
const Scalar &arg_scalar = arg_value->ResolveValue(&exe_ctx);
|
|
|
|
|
|
|
|
if (!process->WriteScalarToMemory(args_addr_ref + offset, arg_scalar,
|
|
|
|
arg_scalar.GetByteSize(), error))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool FunctionCaller::InsertFunction(ExecutionContext &exe_ctx,
|
|
|
|
lldb::addr_t &args_addr_ref,
|
|
|
|
DiagnosticManager &diagnostic_manager) {
|
|
|
|
if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0)
|
|
|
|
return false;
|
|
|
|
if (!WriteFunctionWrapper(exe_ctx, diagnostic_manager))
|
|
|
|
return false;
|
|
|
|
if (!WriteFunctionArguments(exe_ctx, args_addr_ref, diagnostic_manager))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
|
|
|
if (log)
|
|
|
|
log->Printf("Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n",
|
|
|
|
m_jit_start_addr, args_addr_ref);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::ThreadPlanSP FunctionCaller::GetThreadPlanToCallFunction(
|
|
|
|
ExecutionContext &exe_ctx, lldb::addr_t args_addr,
|
|
|
|
const EvaluateExpressionOptions &options,
|
|
|
|
DiagnosticManager &diagnostic_manager) {
|
|
|
|
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
|
|
|
|
LIBLLDB_LOG_STEP));
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
log->Printf("-- [FunctionCaller::GetThreadPlanToCallFunction] Creating "
|
|
|
|
"thread plan to call function \"%s\" --",
|
|
|
|
m_name.c_str());
|
|
|
|
|
|
|
|
// FIXME: Use the errors Stream for better error reporting.
|
|
|
|
Thread *thread = exe_ctx.GetThreadPtr();
|
|
|
|
if (thread == NULL) {
|
2016-11-13 03:12:56 +08:00
|
|
|
diagnostic_manager.PutString(
|
2016-09-07 04:57:50 +08:00
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"Can't call a function without a valid thread.");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Okay, now run the function:
|
|
|
|
|
|
|
|
Address wrapper_address(m_jit_start_addr);
|
|
|
|
|
|
|
|
lldb::addr_t args = {args_addr};
|
|
|
|
|
|
|
|
lldb::ThreadPlanSP new_plan_sp(new ThreadPlanCallFunction(
|
|
|
|
*thread, wrapper_address, CompilerType(), args, options));
|
|
|
|
new_plan_sp->SetIsMasterPlan(true);
|
|
|
|
new_plan_sp->SetOkayToDiscard(false);
|
|
|
|
return new_plan_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx,
|
|
|
|
lldb::addr_t args_addr,
|
|
|
|
Value &ret_value) {
|
|
|
|
// Read the return value - it is the last field in the struct:
|
|
|
|
// FIXME: How does clang tell us there's no return value? We need to handle
|
|
|
|
// that case.
|
|
|
|
// FIXME: Create our ThreadPlanCallFunction with the return CompilerType, and
|
|
|
|
// then use GetReturnValueObject
|
|
|
|
// to fetch the value. That way we can fetch any values we need.
|
|
|
|
|
|
|
|
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
|
|
|
|
LIBLLDB_LOG_STEP));
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
log->Printf("-- [FunctionCaller::FetchFunctionResults] Fetching function "
|
|
|
|
"results for \"%s\"--",
|
|
|
|
m_name.c_str());
|
|
|
|
|
|
|
|
Process *process = exe_ctx.GetProcessPtr();
|
|
|
|
|
|
|
|
if (process == NULL)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
|
|
|
|
|
|
|
|
if (process != jit_process_sp.get())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Error error;
|
|
|
|
ret_value.GetScalar() = process->ReadUnsignedIntegerFromMemory(
|
|
|
|
args_addr + m_return_offset, m_return_size, 0, error);
|
|
|
|
|
|
|
|
if (error.Fail())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
ret_value.SetCompilerType(m_function_return_type);
|
|
|
|
ret_value.SetValueType(Value::eValueTypeScalar);
|
|
|
|
return true;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FunctionCaller::DeallocateFunctionResults(ExecutionContext &exe_ctx,
|
|
|
|
lldb::addr_t args_addr) {
|
|
|
|
std::list<lldb::addr_t>::iterator pos;
|
|
|
|
pos = std::find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(),
|
|
|
|
args_addr);
|
|
|
|
if (pos != m_wrapper_args_addrs.end())
|
|
|
|
m_wrapper_args_addrs.erase(pos);
|
|
|
|
|
|
|
|
exe_ctx.GetProcessRef().DeallocateMemory(args_addr);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::ExpressionResults FunctionCaller::ExecuteFunction(
|
|
|
|
ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr,
|
|
|
|
const EvaluateExpressionOptions &options,
|
|
|
|
DiagnosticManager &diagnostic_manager, Value &results) {
|
|
|
|
lldb::ExpressionResults return_value = lldb::eExpressionSetupError;
|
|
|
|
|
|
|
|
// FunctionCaller::ExecuteFunction execution is always just to get the result.
|
|
|
|
// Do make sure we ignore
|
|
|
|
// breakpoints, unwind on error, and don't try to debug it.
|
|
|
|
EvaluateExpressionOptions real_options = options;
|
|
|
|
real_options.SetDebug(false);
|
|
|
|
real_options.SetUnwindOnError(true);
|
|
|
|
real_options.SetIgnoreBreakpoints(true);
|
|
|
|
|
|
|
|
lldb::addr_t args_addr;
|
|
|
|
|
|
|
|
if (args_addr_ptr != NULL)
|
|
|
|
args_addr = *args_addr_ptr;
|
|
|
|
else
|
|
|
|
args_addr = LLDB_INVALID_ADDRESS;
|
|
|
|
|
|
|
|
if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0)
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
|
|
|
|
if (args_addr == LLDB_INVALID_ADDRESS) {
|
|
|
|
if (!InsertFunction(exe_ctx, args_addr, diagnostic_manager))
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
|
|
|
|
|
|
|
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
|
|
|
|
LIBLLDB_LOG_STEP));
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
log->Printf(
|
|
|
|
"== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==",
|
|
|
|
m_name.c_str());
|
|
|
|
|
|
|
|
lldb::ThreadPlanSP call_plan_sp = GetThreadPlanToCallFunction(
|
|
|
|
exe_ctx, args_addr, real_options, diagnostic_manager);
|
|
|
|
if (!call_plan_sp)
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
|
|
|
|
// We need to make sure we record the fact that we are running an expression
|
|
|
|
// here
|
|
|
|
// otherwise this fact will fail to be recorded when fetching an Objective-C
|
|
|
|
// object description
|
|
|
|
if (exe_ctx.GetProcessPtr())
|
|
|
|
exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
|
|
|
|
|
|
|
|
return_value = exe_ctx.GetProcessRef().RunThreadPlan(
|
|
|
|
exe_ctx, call_plan_sp, real_options, diagnostic_manager);
|
|
|
|
|
|
|
|
if (log) {
|
|
|
|
if (return_value != lldb::eExpressionCompleted) {
|
|
|
|
log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
|
|
|
"completed abnormally ==",
|
|
|
|
m_name.c_str());
|
|
|
|
} else {
|
|
|
|
log->Printf("== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
|
|
|
|
"completed normally ==",
|
|
|
|
m_name.c_str());
|
2013-11-07 08:11:47 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (exe_ctx.GetProcessPtr())
|
|
|
|
exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
|
2013-03-07 03:57:25 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (args_addr_ptr != NULL)
|
|
|
|
*args_addr_ptr = args_addr;
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (return_value != lldb::eExpressionCompleted)
|
|
|
|
return return_value;
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
FetchFunctionResults(exe_ctx, args_addr, results);
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (args_addr_ptr == NULL)
|
|
|
|
DeallocateFunctionResults(exe_ctx, args_addr);
|
2016-03-19 08:03:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return lldb::eExpressionCompleted;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|