LLDB  mainline
FunctionCaller.cpp
Go to the documentation of this file.
1 //===-- FunctionCaller.cpp ------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 
11 #include "lldb/Core/Module.h"
12 #include "lldb/Core/ValueObject.h"
17 #include "lldb/Symbol/Function.h"
18 #include "lldb/Symbol/Type.h"
20 #include "lldb/Target/Process.h"
22 #include "lldb/Target/Target.h"
23 #include "lldb/Target/Thread.h"
24 #include "lldb/Target/ThreadPlan.h"
27 #include "lldb/Utility/Log.h"
28 #include "lldb/Utility/State.h"
29 
30 using namespace lldb_private;
31 
33 
34 // FunctionCaller constructor
36  const CompilerType &return_type,
37  const Address &functionAddress,
38  const ValueList &arg_value_list,
39  const char *name)
40  : Expression(exe_scope), m_execution_unit_sp(), m_parser(),
41  m_jit_module_wp(), m_name(name ? name : "<unknown>"),
42  m_function_ptr(nullptr), m_function_addr(functionAddress),
43  m_function_return_type(return_type),
44  m_wrapper_function_name("__lldb_caller_function"),
45  m_wrapper_struct_name("__lldb_caller_struct"), m_wrapper_args_addrs(),
46  m_struct_valid(false), m_arg_values(arg_value_list), m_compiled(false),
47  m_JITted(false) {
48  m_jit_process_wp = lldb::ProcessWP(exe_scope.CalculateProcess());
49  // Can't make a FunctionCaller without a process.
50  assert(m_jit_process_wp.lock());
51 }
52 
53 // Destructor
55  lldb::ProcessSP process_sp(m_jit_process_wp.lock());
56  if (process_sp) {
57  lldb::ModuleSP jit_module_sp(m_jit_module_wp.lock());
58  if (jit_module_sp)
59  process_sp->GetTarget().GetImages().Remove(jit_module_sp);
60  }
61 }
62 
64  ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager) {
65  Process *process = exe_ctx.GetProcessPtr();
66 
67  if (!process)
68  return false;
69 
70  lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
71 
72  if (process != jit_process_sp.get())
73  return false;
74 
75  if (!m_compiled)
76  return false;
77 
78  if (m_JITted)
79  return true;
80 
81  bool can_interpret = false; // should stay that way
82 
83  Status jit_error(m_parser->PrepareForExecution(
85  can_interpret, eExecutionPolicyAlways));
86 
87  if (!jit_error.Success()) {
88  diagnostic_manager.Printf(eDiagnosticSeverityError,
89  "Error in PrepareForExecution: %s.",
90  jit_error.AsCString());
91  return false;
92  }
93 
94  if (m_parser->GetGenerateDebugInfo()) {
95  lldb::ModuleSP jit_module_sp(m_execution_unit_sp->GetJITModule());
96 
97  if (jit_module_sp) {
98  ConstString const_func_name(FunctionName());
99  FileSpec jit_file;
100  jit_file.GetFilename() = const_func_name;
101  jit_module_sp->SetFileSpecAndObjectName(jit_file, ConstString());
102  m_jit_module_wp = jit_module_sp;
103  process->GetTarget().GetImages().Append(jit_module_sp,
104  true /* notify */);
105  }
106  }
107  if (process && m_jit_start_addr)
108  m_jit_process_wp = process->shared_from_this();
109 
110  m_JITted = true;
111 
112  return true;
113 }
114 
116  ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
117  DiagnosticManager &diagnostic_manager) {
118  return WriteFunctionArguments(exe_ctx, args_addr_ref, m_arg_values,
119  diagnostic_manager);
120 }
121 
122 // FIXME: Assure that the ValueList we were passed in is consistent with the one
123 // that defined this function.
124 
126  ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
127  ValueList &arg_values, DiagnosticManager &diagnostic_manager) {
128  // All the information to reconstruct the struct is provided by the
129  // StructExtractor.
130  if (!m_struct_valid) {
131  diagnostic_manager.PutString(eDiagnosticSeverityError,
132  "Argument information was not correctly "
133  "parsed, so the function cannot be called.");
134  return false;
135  }
136 
137  Status error;
139 
140  Process *process = exe_ctx.GetProcessPtr();
141 
142  if (process == nullptr)
143  return return_value;
144 
145  lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
146 
147  if (process != jit_process_sp.get())
148  return false;
149 
150  if (args_addr_ref == LLDB_INVALID_ADDRESS) {
151  args_addr_ref = process->AllocateMemory(
152  m_struct_size, lldb::ePermissionsReadable | lldb::ePermissionsWritable,
153  error);
154  if (args_addr_ref == LLDB_INVALID_ADDRESS)
155  return false;
156  m_wrapper_args_addrs.push_back(args_addr_ref);
157  } else {
158  // Make sure this is an address that we've already handed out.
159  if (find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(),
160  args_addr_ref) == m_wrapper_args_addrs.end()) {
161  return false;
162  }
163  }
164 
165  // TODO: verify fun_addr needs to be a callable address
166  Scalar fun_addr(
168  uint64_t first_offset = m_member_offsets[0];
169  process->WriteScalarToMemory(args_addr_ref + first_offset, fun_addr,
170  process->GetAddressByteSize(), error);
171 
172  // FIXME: We will need to extend this for Variadic functions.
173 
174  Status value_error;
175 
176  size_t num_args = arg_values.GetSize();
177  if (num_args != m_arg_values.GetSize()) {
178  diagnostic_manager.Printf(
180  "Wrong number of arguments - was: %" PRIu64 " should be: %" PRIu64 "",
181  (uint64_t)num_args, (uint64_t)m_arg_values.GetSize());
182  return false;
183  }
184 
185  for (size_t i = 0; i < num_args; i++) {
186  // FIXME: We should sanity check sizes.
187 
188  uint64_t offset = m_member_offsets[i + 1]; // Clang sizes are in bytes.
189  Value *arg_value = arg_values.GetValueAtIndex(i);
190 
191  // FIXME: For now just do scalars:
192 
193  // Special case: if it's a pointer, don't do anything (the ABI supports
194  // passing cstrings)
195 
196  if (arg_value->GetValueType() == Value::ValueType::HostAddress &&
198  arg_value->GetCompilerType().IsPointerType())
199  continue;
200 
201  const Scalar &arg_scalar = arg_value->ResolveValue(&exe_ctx);
202 
203  if (!process->WriteScalarToMemory(args_addr_ref + offset, arg_scalar,
204  arg_scalar.GetByteSize(), error))
205  return false;
206  }
207 
208  return true;
209 }
210 
212  lldb::addr_t &args_addr_ref,
213  DiagnosticManager &diagnostic_manager) {
214  if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0)
215  return false;
216  if (!WriteFunctionWrapper(exe_ctx, diagnostic_manager))
217  return false;
218  if (!WriteFunctionArguments(exe_ctx, args_addr_ref, diagnostic_manager))
219  return false;
220 
222  LLDB_LOGF(log, "Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n",
223  m_jit_start_addr, args_addr_ref);
224 
225  return true;
226 }
227 
229  ExecutionContext &exe_ctx, lldb::addr_t args_addr,
230  const EvaluateExpressionOptions &options,
231  DiagnosticManager &diagnostic_manager) {
234 
235  LLDB_LOGF(log,
236  "-- [FunctionCaller::GetThreadPlanToCallFunction] Creating "
237  "thread plan to call function \"%s\" --",
238  m_name.c_str());
239 
240  // FIXME: Use the errors Stream for better error reporting.
241  Thread *thread = exe_ctx.GetThreadPtr();
242  if (thread == nullptr) {
243  diagnostic_manager.PutString(
245  "Can't call a function without a valid thread.");
246  return nullptr;
247  }
248 
249  // Okay, now run the function:
250 
251  Address wrapper_address(m_jit_start_addr);
252 
253  lldb::addr_t args = {args_addr};
254 
255  lldb::ThreadPlanSP new_plan_sp(new ThreadPlanCallFunction(
256  *thread, wrapper_address, CompilerType(), args, options));
257  new_plan_sp->SetIsMasterPlan(true);
258  new_plan_sp->SetOkayToDiscard(false);
259  return new_plan_sp;
260 }
261 
263  lldb::addr_t args_addr,
264  Value &ret_value) {
265  // Read the return value - it is the last field in the struct:
266  // FIXME: How does clang tell us there's no return value? We need to handle
267  // that case.
268  // FIXME: Create our ThreadPlanCallFunction with the return CompilerType, and
269  // then use GetReturnValueObject
270  // to fetch the value. That way we can fetch any values we need.
271 
274 
275  LLDB_LOGF(log,
276  "-- [FunctionCaller::FetchFunctionResults] Fetching function "
277  "results for \"%s\"--",
278  m_name.c_str());
279 
280  Process *process = exe_ctx.GetProcessPtr();
281 
282  if (process == nullptr)
283  return false;
284 
285  lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
286 
287  if (process != jit_process_sp.get())
288  return false;
289 
290  Status error;
291  ret_value.GetScalar() = process->ReadUnsignedIntegerFromMemory(
292  args_addr + m_return_offset, m_return_size, 0, error);
293 
294  if (error.Fail())
295  return false;
296 
299  return true;
300 }
301 
303  lldb::addr_t args_addr) {
304  std::list<lldb::addr_t>::iterator pos;
305  pos = std::find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(),
306  args_addr);
307  if (pos != m_wrapper_args_addrs.end())
308  m_wrapper_args_addrs.erase(pos);
309 
310  exe_ctx.GetProcessRef().DeallocateMemory(args_addr);
311 }
312 
314  ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr,
315  const EvaluateExpressionOptions &options,
316  DiagnosticManager &diagnostic_manager, Value &results) {
318 
319  // FunctionCaller::ExecuteFunction execution is always just to get the
320  // result. Unless explicitly asked for, ignore breakpoints and unwind on
321  // error.
322  const bool enable_debugging =
323  exe_ctx.GetTargetPtr() &&
325  EvaluateExpressionOptions real_options = options;
326  real_options.SetDebug(false); // This halts the expression for debugging.
327  real_options.SetGenerateDebugInfo(enable_debugging);
328  real_options.SetUnwindOnError(!enable_debugging);
329  real_options.SetIgnoreBreakpoints(!enable_debugging);
330 
331  lldb::addr_t args_addr;
332 
333  if (args_addr_ptr != nullptr)
334  args_addr = *args_addr_ptr;
335  else
336  args_addr = LLDB_INVALID_ADDRESS;
337 
338  if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0)
340 
341  if (args_addr == LLDB_INVALID_ADDRESS) {
342  if (!InsertFunction(exe_ctx, args_addr, diagnostic_manager))
344  }
345 
348 
349  LLDB_LOGF(log,
350  "== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==",
351  m_name.c_str());
352 
353  lldb::ThreadPlanSP call_plan_sp = GetThreadPlanToCallFunction(
354  exe_ctx, args_addr, real_options, diagnostic_manager);
355  if (!call_plan_sp)
357 
358  // We need to make sure we record the fact that we are running an expression
359  // here otherwise this fact will fail to be recorded when fetching an
360  // Objective-C object description
361  if (exe_ctx.GetProcessPtr())
362  exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
363 
364  return_value = exe_ctx.GetProcessRef().RunThreadPlan(
365  exe_ctx, call_plan_sp, real_options, diagnostic_manager);
366 
367  if (log) {
368  if (return_value != lldb::eExpressionCompleted) {
369  LLDB_LOGF(log,
370  "== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
371  "completed abnormally: %s ==",
372  m_name.c_str(),
373  Process::ExecutionResultAsCString(return_value));
374  } else {
375  LLDB_LOGF(log,
376  "== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
377  "completed normally ==",
378  m_name.c_str());
379  }
380  }
381 
382  if (exe_ctx.GetProcessPtr())
383  exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
384 
385  if (args_addr_ptr != nullptr)
386  *args_addr_ptr = args_addr;
387 
388  if (return_value != lldb::eExpressionCompleted)
389  return return_value;
390 
391  FetchFunctionResults(exe_ctx, args_addr, results);
392 
393  if (args_addr_ptr == nullptr)
394  DeallocateFunctionResults(exe_ctx, args_addr);
395 
397 }
lldb_private::Value::ValueType::Scalar
@ Scalar
A raw scalar value.
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::ExecutionContext::GetThreadSP
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
Definition: ExecutionContext.h:464
lldb_private::Process::AllocateMemory
lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error)
The public interface to allocating memory in the process.
Definition: Process.cpp:2261
lldb_private::Process::DeallocateMemory
Status DeallocateMemory(lldb::addr_t ptr)
The public interface to deallocating memory in the process.
Definition: Process.cpp:2332
FunctionCaller.h
lldb_private::Process::SetRunningUserExpression
void SetRunningUserExpression(bool on)
Definition: Process.cpp:1429
lldb_private::Value
Definition: Value.h:38
lldb_private::Value::SetValueType
void SetValueType(ValueType value_type)
Definition: Value.h:89
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:208
lldb_private::FunctionCaller::m_return_offset
uint64_t m_return_offset
The offset of the result variable in the struct, in bytes.
Definition: FunctionCaller.h:327
lldb_private::Value::GetValueType
ValueType GetValueType() const
Definition: Value.cpp:109
lldb::ExpressionResults
ExpressionResults
The results of expression evaluation.
Definition: lldb-enumerations.h:270
lldb_private::ValueList::GetValueAtIndex
Value * GetValueAtIndex(size_t idx)
Definition: Value.cpp:679
lldb_private::FunctionCaller::WriteFunctionWrapper
bool WriteFunctionWrapper(ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager)
Insert the default function wrapper (using the JIT)
Definition: FunctionCaller.cpp:63
lldb_private::Expression::m_jit_process_wp
lldb::ProcessWP m_jit_process_wp
Expression's always have to have a target...
Definition: Expression.h:93
lldb_private::Scalar
Definition: Scalar.h:34
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
lldb_private::Process
Definition: Process.h:341
Module.h
lldb_private::FunctionCaller::m_name
std::string m_name
The name of this clang function - for debugging purposes.
Definition: FunctionCaller.h:299
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1194
lldb_private::EvaluateExpressionOptions
Definition: Target.h:253
lldb_private::FunctionCaller::m_jit_module_wp
lldb::ModuleWP m_jit_module_wp
Definition: FunctionCaller.h:297
lldb::eExpressionSetupError
@ eExpressionSetupError
Definition: lldb-enumerations.h:272
lldb_private::Expression::m_jit_start_addr
lldb::addr_t m_jit_start_addr
An expression might have a process, but it doesn't need to (e.g.
Definition: Expression.h:96
lldb_private::ValueList
Definition: Value.h:157
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::eExecutionPolicyAlways
@ eExecutionPolicyAlways
Definition: lldb-private-enumerations.h:147
CommandReturnObject.h
lldb_private::ValueList::GetSize
size_t GetSize()
Definition: Value.cpp:677
lldb_private::ExecutionContext::GetThreadPtr
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
Definition: ExecutionContext.h:399
lldb_private::ExecutionContext::GetProcessRef
Process & GetProcessRef() const
Returns a reference to the process object.
Definition: ExecutionContext.cpp:231
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:919
Process.h
lldb_private::Value::ContextType::Invalid
@ Invalid
Undefined.
lldb_private::ThreadPlanCallFunction
Definition: ThreadPlanCallFunction.h:20
lldb_private::Value::SetCompilerType
void SetCompilerType(const CompilerType &compiler_type)
Definition: Value.cpp:254
lldb_private::FunctionCaller::DeallocateFunctionResults
void DeallocateFunctionResults(ExecutionContext &exe_ctx, lldb::addr_t args_addr)
Deallocate the arguments structure.
Definition: FunctionCaller.cpp:302
Target.h
lldb_private::Value::GetScalar
const Scalar & GetScalar() const
Definition: Value.h:112
LIBLLDB_LOG_EXPRESSIONS
#define LIBLLDB_LOG_EXPRESSIONS
Definition: Logging.h:22
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::Status::Success
bool Success() const
Test for success condition.
Definition: Status.cpp:288
lldb_private::eDiagnosticSeverityError
@ eDiagnosticSeverityError
Definition: DiagnosticManager.h:32
lldb_private::FunctionCaller::WriteFunctionArguments
bool WriteFunctionArguments(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, DiagnosticManager &diagnostic_manager)
Insert the default function argument struct.
Definition: FunctionCaller.cpp:115
Log.h
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::FunctionCaller::InsertFunction
bool InsertFunction(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, DiagnosticManager &diagnostic_manager)
Insert the default function wrapper and its default argument struct.
Definition: FunctionCaller.cpp:211
lldb_private::Thread
Definition: Thread.h:62
lldb_private::FunctionCaller::m_struct_size
size_t m_struct_size
These values are populated by the ASTStructExtractor.
Definition: FunctionCaller.h:323
lldb_private::FunctionCaller::m_return_size
uint64_t m_return_size
The size of the result variable, in bytes.
Definition: FunctionCaller.h:326
lldb_private::Address::GetCallableLoadAddress
lldb::addr_t GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code load address.
Definition: Address.cpp:335
lldb_private::Expression::m_jit_end_addr
lldb::addr_t m_jit_end_addr
The address of the JITted function within the JIT allocation.
Definition: Expression.h:99
lldb::eExpressionCompleted
@ eExpressionCompleted
Definition: lldb-enumerations.h:271
lldb_private::FunctionCaller::m_execution_unit_sp
std::shared_ptr< IRExecutionUnit > m_execution_unit_sp
Definition: FunctionCaller.h:291
lldb_private::Process::ExecutionResultAsCString
static const char * ExecutionResultAsCString(lldb::ExpressionResults result)
Definition: Process.cpp:5400
Type.h
lldb_private::Process::GetAddressByteSize
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3300
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::GetLogIfAllCategoriesSet
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:58
lldb_private::FunctionCaller::m_arg_values
ValueList m_arg_values
The default values of the arguments.
Definition: FunctionCaller.h:330
lldb_private::Scalar::GetByteSize
size_t GetByteSize() const
Definition: Scalar.cpp:131
IRExecutionUnit.h
lldb_private::EvaluateExpressionOptions::SetUnwindOnError
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:300
Thread.h
ThreadPlanCallFunction.h
lldb_private::FunctionCaller::FetchFunctionResults
bool FetchFunctionResults(ExecutionContext &exe_ctx, lldb::addr_t args_addr, Value &ret_value)
Get the result of the function from its struct.
Definition: FunctionCaller.cpp:262
ValueObject.h
lldb_private::Value::ResolveValue
Scalar & ResolveValue(ExecutionContext *exe_ctx)
Definition: Value.cpp:563
ThreadPlan.h
lldb_private::EvaluateExpressionOptions::SetIgnoreBreakpoints
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:304
lldb_private::TargetProperties::GetDebugUtilityExpression
bool GetDebugUtilityExpression() const
Definition: Target.cpp:4368
lldb_private::FunctionCaller::CompileFunction
virtual unsigned CompileFunction(lldb::ThreadSP thread_to_use_sp, DiagnosticManager &diagnostic_manager)=0
Compile the wrapper function.
lldb_private::Status
Definition: Status.h:44
lldb_private::FunctionCaller::FunctionCaller
FunctionCaller(ExecutionContextScope &exe_scope, const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, const char *name)
Constructor.
Definition: FunctionCaller.cpp:35
lldb_private::Address
Definition: Address.h:59
lldb_private::DiagnosticManager::PutString
size_t void PutString(DiagnosticSeverity severity, llvm::StringRef str)
Definition: DiagnosticManager.cpp:73
lldb_private::CompilerType::IsPointerType
bool IsPointerType(CompilerType *pointee_type=nullptr) const
Definition: CompilerType.cpp:157
lldb_private::Value::ValueType::HostAddress
@ HostAddress
A host address value (for memory in the process that < A is using liblldb).
lldb_private::FunctionCaller::~FunctionCaller
~FunctionCaller() override
Destructor.
Definition: FunctionCaller.cpp:54
lldb_private::FunctionCaller::m_wrapper_args_addrs
std::list< lldb::addr_t > m_wrapper_args_addrs
The addresses of the arguments to the wrapper function.
Definition: FunctionCaller.h:315
lldb_private::FunctionCaller::m_parser
std::unique_ptr< ExpressionParser > m_parser
The parser responsible for compiling the function.
Definition: FunctionCaller.h:293
lldb_private::DiagnosticManager
Definition: DiagnosticManager.h:93
lldb_private::Value::GetContextType
ContextType GetContextType() const
Definition: Value.h:87
lldb_private::EvaluateExpressionOptions::SetGenerateDebugInfo
void SetGenerateDebugInfo(bool b)
Definition: Target.h:349
lldb_private::FunctionCaller::m_member_offsets
std::vector< uint64_t > m_member_offsets
The offset of each member in the struct, in bytes.
Definition: FunctionCaller.h:325
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
DataExtractor.h
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
Function.h
lldb_private::Value::GetCompilerType
const CompilerType & GetCompilerType()
Definition: Value.cpp:225
lldb_private::Process::WriteScalarToMemory
size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar, size_t size, Status &error)
Write all or part of a scalar value to memory.
Definition: Process.cpp:2201
DiagnosticManager.h
lldb_private::FunctionCaller::m_function_return_type
CompilerType m_function_return_type
The opaque clang qual type for the function return type.
Definition: FunctionCaller.h:306
lldb_private::FunctionCaller::m_function_addr
Address m_function_addr
If we don't have the FunctionSP, we at least need the address & return type.
Definition: FunctionCaller.h:304
lldb_private::ExecutionContextScope::CalculateProcess
virtual lldb::ProcessSP CalculateProcess()=0
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::FunctionCaller::ID
static char ID
Definition: FunctionCaller.h:58
lldb_private::FunctionCaller::ExecuteFunction
lldb::ExpressionResults ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager, Value &results)
Run the function this FunctionCaller was created with.
Definition: FunctionCaller.cpp:313
LIBLLDB_LOG_STEP
#define LIBLLDB_LOG_STEP
Definition: Logging.h:21
lldb_private::FunctionCaller::m_JITted
bool m_JITted
True if the wrapper function has already been JIT-compiled.
Definition: FunctionCaller.h:334
lldb_private::FunctionCaller::GetThreadPlanToCallFunction
lldb::ThreadPlanSP GetThreadPlanToCallFunction(ExecutionContext &exe_ctx, lldb::addr_t args_addr, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager)
Get a thread plan to run the function this FunctionCaller was created with.
Definition: FunctionCaller.cpp:228
lldb_private::EvaluateExpressionOptions::SetDebug
void SetDebug(bool b)
Definition: Target.h:341
State.h
lldb_private::Process::ReadUnsignedIntegerFromMemory
uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Status &error)
Reads an unsigned integer of the specified byte size from process memory.
Definition: Process.cpp:2064
lldb_private::FunctionCaller::m_compiled
bool m_compiled
True if the wrapper function has already been parsed.
Definition: FunctionCaller.h:332
lldb_private::Log
Definition: Log.h:49
lldb_private::GetLogIfAnyCategoriesSet
Log * GetLogIfAnyCategoriesSet(uint32_t mask)
Definition: Logging.cpp:62
lldb_private::FunctionCaller::FunctionName
const char * FunctionName() override
Return the function name that should be used for executing the expression.
Definition: FunctionCaller.h:272
lldb_private::Process::RunThreadPlan
lldb::ExpressionResults RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager)
Definition: Process.cpp:4611
lldb_private::Expression
Definition: Expression.h:33
ValueObjectList.h
RegisterContext.h
lldb_private::FileSpec::GetFilename
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:341
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:200
ExecutionContext.h
lldb_private::ModuleList::Append
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
lldb_private::DiagnosticManager::Printf
size_t Printf(DiagnosticSeverity severity, const char *format,...) __attribute__((format(printf
Definition: DiagnosticManager.cpp:59
lldb_private::Status::AsCString
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:131
lldb_private::FunctionCaller::m_struct_valid
bool m_struct_valid
True if the ASTStructExtractor has populated the variables below.
Definition: FunctionCaller.h:319