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/LLDBLog.h"
28 #include "lldb/Utility/Log.h"
29 #include "lldb/Utility/State.h"
30 
31 using namespace lldb_private;
32 
34 
35 // FunctionCaller constructor
37  const CompilerType &return_type,
38  const Address &functionAddress,
39  const ValueList &arg_value_list,
40  const char *name)
41  : Expression(exe_scope), m_execution_unit_sp(), m_parser(),
42  m_jit_module_wp(), m_name(name ? name : "<unknown>"),
43  m_function_ptr(nullptr), m_function_addr(functionAddress),
44  m_function_return_type(return_type),
45  m_wrapper_function_name("__lldb_caller_function"),
46  m_wrapper_struct_name("__lldb_caller_struct"), m_wrapper_args_addrs(),
47  m_struct_valid(false), m_struct_size(0), m_return_size(0),
48  m_return_offset(0), m_arg_values(arg_value_list), m_compiled(false),
49  m_JITted(false) {
50  m_jit_process_wp = lldb::ProcessWP(exe_scope.CalculateProcess());
51  // Can't make a FunctionCaller without a process.
52  assert(m_jit_process_wp.lock());
53 }
54 
55 // Destructor
57  lldb::ProcessSP process_sp(m_jit_process_wp.lock());
58  if (process_sp) {
59  lldb::ModuleSP jit_module_sp(m_jit_module_wp.lock());
60  if (jit_module_sp)
61  process_sp->GetTarget().GetImages().Remove(jit_module_sp);
62  }
63 }
64 
66  ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager) {
67  Process *process = exe_ctx.GetProcessPtr();
68 
69  if (!process)
70  return false;
71 
72  lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
73 
74  if (process != jit_process_sp.get())
75  return false;
76 
77  if (!m_compiled)
78  return false;
79 
80  if (m_JITted)
81  return true;
82 
83  bool can_interpret = false; // should stay that way
84 
85  Status jit_error(m_parser->PrepareForExecution(
87  can_interpret, eExecutionPolicyAlways));
88 
89  if (!jit_error.Success()) {
90  diagnostic_manager.Printf(eDiagnosticSeverityError,
91  "Error in PrepareForExecution: %s.",
92  jit_error.AsCString());
93  return false;
94  }
95 
96  if (m_parser->GetGenerateDebugInfo()) {
97  lldb::ModuleSP jit_module_sp(m_execution_unit_sp->GetJITModule());
98 
99  if (jit_module_sp) {
100  ConstString const_func_name(FunctionName());
101  FileSpec jit_file;
102  jit_file.SetFilename(const_func_name);
103  jit_module_sp->SetFileSpecAndObjectName(jit_file, ConstString());
104  m_jit_module_wp = jit_module_sp;
105  process->GetTarget().GetImages().Append(jit_module_sp,
106  true /* notify */);
107  }
108  }
109  if (process && m_jit_start_addr)
110  m_jit_process_wp = process->shared_from_this();
111 
112  m_JITted = true;
113 
114  return true;
115 }
116 
118  ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
119  DiagnosticManager &diagnostic_manager) {
120  return WriteFunctionArguments(exe_ctx, args_addr_ref, m_arg_values,
121  diagnostic_manager);
122 }
123 
124 // FIXME: Assure that the ValueList we were passed in is consistent with the one
125 // that defined this function.
126 
128  ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
129  ValueList &arg_values, DiagnosticManager &diagnostic_manager) {
130  // All the information to reconstruct the struct is provided by the
131  // StructExtractor.
132  if (!m_struct_valid) {
133  diagnostic_manager.PutString(eDiagnosticSeverityError,
134  "Argument information was not correctly "
135  "parsed, so the function cannot be called.");
136  return false;
137  }
138 
139  Status error;
141 
142  Process *process = exe_ctx.GetProcessPtr();
143 
144  if (process == nullptr)
145  return return_value;
146 
147  lldb::ProcessSP jit_process_sp(m_jit_process_wp.lock());
148 
149  if (process != jit_process_sp.get())
150  return false;
151 
152  if (args_addr_ref == LLDB_INVALID_ADDRESS) {
153  args_addr_ref = process->AllocateMemory(
154  m_struct_size, lldb::ePermissionsReadable | lldb::ePermissionsWritable,
155  error);
156  if (args_addr_ref == LLDB_INVALID_ADDRESS)
157  return false;
158  m_wrapper_args_addrs.push_back(args_addr_ref);
159  } else {
160  // Make sure this is an address that we've already handed out.
161  if (find(m_wrapper_args_addrs.begin(), m_wrapper_args_addrs.end(),
162  args_addr_ref) == m_wrapper_args_addrs.end()) {
163  return false;
164  }
165  }
166 
167  // TODO: verify fun_addr needs to be a callable address
168  Scalar fun_addr(
170  uint64_t first_offset = m_member_offsets[0];
171  process->WriteScalarToMemory(args_addr_ref + first_offset, fun_addr,
172  process->GetAddressByteSize(), error);
173 
174  // FIXME: We will need to extend this for Variadic functions.
175 
176  Status value_error;
177 
178  size_t num_args = arg_values.GetSize();
179  if (num_args != m_arg_values.GetSize()) {
180  diagnostic_manager.Printf(
182  "Wrong number of arguments - was: %" PRIu64 " should be: %" PRIu64 "",
183  (uint64_t)num_args, (uint64_t)m_arg_values.GetSize());
184  return false;
185  }
186 
187  for (size_t i = 0; i < num_args; i++) {
188  // FIXME: We should sanity check sizes.
189 
190  uint64_t offset = m_member_offsets[i + 1]; // Clang sizes are in bytes.
191  Value *arg_value = arg_values.GetValueAtIndex(i);
192 
193  // FIXME: For now just do scalars:
194 
195  // Special case: if it's a pointer, don't do anything (the ABI supports
196  // passing cstrings)
197 
198  if (arg_value->GetValueType() == Value::ValueType::HostAddress &&
200  arg_value->GetCompilerType().IsPointerType())
201  continue;
202 
203  const Scalar &arg_scalar = arg_value->ResolveValue(&exe_ctx);
204 
205  if (!process->WriteScalarToMemory(args_addr_ref + offset, arg_scalar,
206  arg_scalar.GetByteSize(), error))
207  return false;
208  }
209 
210  return true;
211 }
212 
214  lldb::addr_t &args_addr_ref,
215  DiagnosticManager &diagnostic_manager) {
216  if (CompileFunction(exe_ctx.GetThreadSP(), diagnostic_manager) != 0)
217  return false;
218  if (!WriteFunctionWrapper(exe_ctx, diagnostic_manager))
219  return false;
220  if (!WriteFunctionArguments(exe_ctx, args_addr_ref, diagnostic_manager))
221  return false;
222 
223  Log *log = GetLog(LLDBLog::Step);
224  LLDB_LOGF(log, "Call Address: 0x%" PRIx64 " Struct Address: 0x%" PRIx64 ".\n",
225  m_jit_start_addr, args_addr_ref);
226 
227  return true;
228 }
229 
231  ExecutionContext &exe_ctx, lldb::addr_t args_addr,
232  const EvaluateExpressionOptions &options,
233  DiagnosticManager &diagnostic_manager) {
235 
236  LLDB_LOGF(log,
237  "-- [FunctionCaller::GetThreadPlanToCallFunction] Creating "
238  "thread plan to call function \"%s\" --",
239  m_name.c_str());
240 
241  // FIXME: Use the errors Stream for better error reporting.
242  Thread *thread = exe_ctx.GetThreadPtr();
243  if (thread == nullptr) {
244  diagnostic_manager.PutString(
246  "Can't call a function without a valid thread.");
247  return nullptr;
248  }
249 
250  // Okay, now run the function:
251 
252  Address wrapper_address(m_jit_start_addr);
253 
254  lldb::addr_t args = {args_addr};
255 
256  lldb::ThreadPlanSP new_plan_sp(new ThreadPlanCallFunction(
257  *thread, wrapper_address, CompilerType(), args, options));
258  new_plan_sp->SetIsControllingPlan(true);
259  new_plan_sp->SetOkayToDiscard(false);
260  return new_plan_sp;
261 }
262 
264  lldb::addr_t args_addr,
265  Value &ret_value) {
266  // Read the return value - it is the last field in the struct:
267  // FIXME: How does clang tell us there's no return value? We need to handle
268  // that case.
269  // FIXME: Create our ThreadPlanCallFunction with the return CompilerType, and
270  // then use GetReturnValueObject
271  // to fetch the value. That way we can fetch any values we need.
272 
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 
347 
348  LLDB_LOGF(log,
349  "== [FunctionCaller::ExecuteFunction] Executing function \"%s\" ==",
350  m_name.c_str());
351 
352  lldb::ThreadPlanSP call_plan_sp = GetThreadPlanToCallFunction(
353  exe_ctx, args_addr, real_options, diagnostic_manager);
354  if (!call_plan_sp)
356 
357  // We need to make sure we record the fact that we are running an expression
358  // here otherwise this fact will fail to be recorded when fetching an
359  // Objective-C object description
360  if (exe_ctx.GetProcessPtr())
361  exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
362 
363  return_value = exe_ctx.GetProcessRef().RunThreadPlan(
364  exe_ctx, call_plan_sp, real_options, diagnostic_manager);
365 
366  if (log) {
367  if (return_value != lldb::eExpressionCompleted) {
368  LLDB_LOGF(log,
369  "== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
370  "completed abnormally: %s ==",
371  m_name.c_str(),
372  Process::ExecutionResultAsCString(return_value));
373  } else {
374  LLDB_LOGF(log,
375  "== [FunctionCaller::ExecuteFunction] Execution of \"%s\" "
376  "completed normally ==",
377  m_name.c_str());
378  }
379  }
380 
381  if (exe_ctx.GetProcessPtr())
382  exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
383 
384  if (args_addr_ptr != nullptr)
385  *args_addr_ptr = args_addr;
386 
387  if (return_value != lldb::eExpressionCompleted)
388  return return_value;
389 
390  FetchFunctionResults(exe_ctx, args_addr, results);
391 
392  if (args_addr_ptr == nullptr)
393  DeallocateFunctionResults(exe_ctx, args_addr);
394 
396 }
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:2263
lldb_private::Process::DeallocateMemory
Status DeallocateMemory(lldb::addr_t ptr)
The public interface to deallocating memory in the process.
Definition: Process.cpp:2334
FunctionCaller.h
lldb_private::Process::SetRunningUserExpression
void SetRunningUserExpression(bool on)
Definition: Process.cpp:1473
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:206
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:106
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:669
lldb_private::FunctionCaller::WriteFunctionWrapper
bool WriteFunctionWrapper(ExecutionContext &exe_ctx, DiagnosticManager &diagnostic_manager)
Insert the default function wrapper (using the JIT)
Definition: FunctionCaller.cpp:65
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:344
lldb_private::Process
Definition: Process.h:338
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:1219
lldb_private::EvaluateExpressionOptions
Definition: Target.h:277
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:141
CommandReturnObject.h
lldb_private::ValueList::GetSize
size_t GetSize()
Definition: Value.cpp:667
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:229
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:947
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:251
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
lldb_private::FileSpec
Definition: FileSpec.h:55
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:287
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:117
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:213
lldb_private::Thread
Definition: Thread.h:61
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:336
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:5463
Type.h
lldb_private::Process::GetAddressByteSize
uint32_t GetAddressByteSize() const
Definition: Process.cpp:3366
lldb_private::ConstString
Definition: ConstString.h:39
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:324
Thread.h
lldb_private::LLDBLog::Step
@ Step
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:263
ValueObject.h
lldb_private::Value::ResolveValue
Scalar & ResolveValue(ExecutionContext *exe_ctx)
Definition: Value.cpp:560
ThreadPlan.h
lldb_private::FileSpec::SetFilename
void SetFilename(ConstString filename)
Filename string set accessor.
Definition: FileSpec.cpp:342
lldb_private::EvaluateExpressionOptions::SetIgnoreBreakpoints
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:328
lldb_private::TargetProperties::GetDebugUtilityExpression
bool GetDebugUtilityExpression() const
Definition: Target.cpp:4682
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:36
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:56
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:373
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:74
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:222
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:2203
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
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:230
lldb_private::EvaluateExpressionOptions::SetDebug
void SetDebug(bool b)
Definition: Target.h:365
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:2063
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:115
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:4675
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb_private::LLDBLog::Expressions
@ Expressions
lldb_private::Expression
Definition: Expression.h:33
ValueObjectList.h
RegisterContext.h
LLDBLog.h
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:198
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:130
lldb_private::FunctionCaller::m_struct_valid
bool m_struct_valid
True if the ASTStructExtractor has populated the variables below.
Definition: FunctionCaller.h:319