15#include "llvm/ADT/StringRef.h"
53 return llvm::createStringError(
"C++ does not support object descriptions");
60 return llvm::createStringError(
"C++ does not support object descriptions");
64 return str_ref.contains(
"$_") || str_ref.contains(
"'lambda'");
69 llvm::StringRef first_template_param_sref,
100 return optional_info;
111 return optional_info;
145 ValueObjectSP member_f_(valobj_sp->GetChildMemberWithName(
"__f_"));
148 ValueObjectSP sub_member_f_(member_f_->GetChildMemberWithName(
"__f_"));
151 member_f_ = sub_member_f_;
155 return optional_info;
157 lldb::addr_t member_f_pointer_value = member_f_->GetValueAsUnsigned(0);
161 if (!member_f_pointer_value)
162 return optional_info;
167 if (process ==
nullptr)
168 return optional_info;
179 return optional_info;
185 return optional_info;
187 lldb::addr_t address_after_vtable = member_f_pointer_value + address_size;
194 return optional_info;
199 return optional_info;
201 Address vtable_first_entry_resolved;
204 vtable_address_first_entry, vtable_first_entry_resolved))
205 return optional_info;
212 vtable_addr_resolved))
213 return optional_info;
216 vtable_addr_resolved, eSymbolContextEverything, sc);
219 if (symbol ==
nullptr)
220 return optional_info;
223 bool found_expected_start_string =
224 vtable_name.starts_with(
"vtable for std::__1::__function::__func<");
226 if (!found_expected_start_string)
227 return optional_info;
243 size_t first_open_angle_bracket = vtable_name.find(
'<') + 1;
244 size_t first_comma = vtable_name.find(
',');
246 llvm::StringRef first_template_parameter =
247 vtable_name.slice(first_open_angle_bracket, first_comma);
249 Address function_address_resolved;
255 possible_function_address, function_address_resolved)) {
257 function_address_resolved, eSymbolContextEverything, sc);
264 auto calculate_symbol_context_helper = [](
auto &t,
267 t->CalculateSymbolContext(&sc);
274 calculate_symbol_context_helper(symbol, scl);
288 return optional_info;
291 std::string func_to_match = first_template_parameter.str();
301 llvm::StringRef name_to_use = func_to_match;
310 return optional_info;
312 if (vtable_cu && !has_invoke) {
315 auto name = f->GetName().GetStringRef();
316 if (name.starts_with(name_to_use) && name.contains(
"operator"))
323 calculate_symbol_context_helper(func_sp, scl);
327 if (symbol ==
nullptr)
328 return optional_info;
333 first_template_parameter, has_invoke);
338 return optional_info;
350 if (target_sp->GetSectionLoadList().IsEmpty())
357 if (!target_sp->GetSectionLoadList().ResolveLoadAddress(curr_pc,
361 target_sp->GetImages().ResolveSymbolContextForAddress(
362 pc_addr_resolved, eSymbolContextEverything, sc);
365 if (symbol ==
nullptr)
376 bool found_expected_start_string =
377 function_name.starts_with(
"std::__1::function<");
379 if (!found_expected_start_string)
383 sc.
GetAddressRange(eSymbolContextEverything, 0,
false, range_of_curr_func);
394 value_sp->GetValueIsValid()) {
397 ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
404 ret_plan_sp = std::make_shared<ThreadPlanStepInRange>(
static ConstString g_promise
static ConstString g_coro_frame
bool contains_lambda_identifier(llvm::StringRef &str_ref)
static ConstString g_this
CPPLanguageRuntime::LibCppStdFunctionCallableInfo line_entry_helper(Target &target, const SymbolContext &sc, Symbol *symbol, llvm::StringRef first_template_param_sref, bool has_invoke)
#define LLDB_SCOPED_TIMER()
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
A section + offset based address class.
lldb::addr_t GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code load address.
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const
CompileUnit * CalculateSymbolContextCompileUnit() const
llvm::Error GetObjectDescription(Stream &str, ValueObject &object) override
bool IsAllowedRuntimeValue(ConstString name) override
Identify whether a name is a runtime value that should not be hidden by from the user interface.
LibCppStdFunctionCallableInfo FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp)
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) override
Obtain a ThreadPlan to get us into C++ constructs such as std::function.
OperatorStringToCallableInfoMap CallableLookupCache
CPPLanguageRuntime(Process *process)
A class that describes a compilation unit.
lldb::FunctionSP FindFunction(llvm::function_ref< bool(const lldb::FunctionSP &)> matching_lambda)
Find a function in the compile unit based on the predicate matching_lambda.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
"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.
Process * GetProcessPtr() const
Returns a pointer to the process object.
uint32_t ResolveSymbolContextForAddress(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) const
Resolve the symbol context for the given address. (const Address&,uint32_t,SymbolContext&)
A plug-in interface definition class for debugging a process.
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
uint32_t GetAddressByteSize() const
Target & GetTarget()
Get the target object pointer for this module.
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
bool Fail() const
Test for error condition.
A stream class that can stream formatted output to a file.
Defines a list of symbol context objects.
uint32_t GetSize() const
Get accessor for a symbol context list size.
Defines a symbol context baton that can be handed other debug core functions.
bool GetAddressRange(uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const
Get the address range contained within a symbol context.
Symbol * symbol
The Symbol for a given query.
ConstString GetName() const
SectionLoadList & GetSectionLoadList()
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
const ModuleList & GetImages() const
Get accessor for the images for this process.
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
virtual lldb::RegisterContextSP GetRegisterContext()=0
lldb::TargetSP CalculateTarget() override
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Function > FunctionSP
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Target > TargetSP
lldb::addr_t member_f_pointer_value
LineEntry callable_line_entry
LibCppStdFunctionCallableCase callable_case
A line table entry class.