16 #include "llvm/ADT/StringRef.h" 39 CPPLanguageRuntime::~CPPLanguageRuntime() {}
41 CPPLanguageRuntime::CPPLanguageRuntime(
Process *process)
74 lldb::ValueObjectSP &valobj_sp) {
112 ValueObjectSP member__f_(
113 valobj_sp->GetChildMemberWithName(
ConstString(
"__f_"),
true));
116 ValueObjectSP sub_member__f_(
117 member__f_->GetChildMemberWithName(
ConstString(
"__f_"),
true));
120 member__f_ = sub_member__f_;
123 lldb::addr_t member__f_pointer_value = member__f_->GetValueAsUnsigned(0);
128 Process *process = exe_ctx.GetProcessPtr();
130 if (process ==
nullptr)
131 return optional_info;
133 uint32_t address_size = process->GetAddressByteSize();
139 process->ReadPointerFromMemory(member__f_pointer_value, status);
142 return optional_info;
144 lldb::addr_t address_after_vtable = member__f_pointer_value + address_size;
148 process->ReadPointerFromMemory(address_after_vtable, status);
151 return optional_info;
153 Target &target = process->GetTarget();
156 return optional_info;
163 vtable_addr_resolved))
164 return optional_info;
167 vtable_addr_resolved, eSymbolContextEverything, sc);
170 if (symbol ==
nullptr)
171 return optional_info;
174 bool found_expected_start_string =
175 vtable_name.startswith(
"vtable for std::__1::__function::__func<");
177 if (!found_expected_start_string)
178 return optional_info;
189 size_t first_open_angle_bracket = vtable_name.find(
'<') + 1;
190 size_t first_comma = vtable_name.find(
',');
192 llvm::StringRef first_template_parameter =
193 vtable_name.slice(first_open_angle_bracket, first_comma);
195 Address function_address_resolved;
201 possible_function_address, function_address_resolved)) {
203 function_address_resolved, eSymbolContextEverything, sc);
207 auto get_name = [&first_template_parameter, &symbol]() {
213 if (first_template_parameter.contains(
"$_"))
214 return llvm::Regex::escape(first_template_parameter.str()) +
215 R
"(::operator\(\)\(.*\))"; 217 if (symbol != NULL &&
221 size_t pos2 = symbol_name.find_last_of(
':');
228 std::string lambda_operator =
229 llvm::Regex::escape(symbol_name.slice(0, pos2 + 1).str()) +
230 R
"(operator\(\)\(.*\))"; 232 return lambda_operator;
236 return first_template_parameter.str() + R
"(::operator\(\)\(.*\))"; 240 std::string func_to_match = get_name(); 262 if (first_template_parameter.contains(
"$_") ||
263 (symbol !=
nullptr &&
276 return optional_info;
287 return optional_info;
290 return optional_info;
296 ThreadPlanSP ret_plan_sp;
302 if (target_sp->GetSectionLoadList().IsEmpty())
309 if (!target_sp->GetSectionLoadList().ResolveLoadAddress(curr_pc,
313 target_sp->GetImages().ResolveSymbolContextForAddress(
314 pc_addr_resolved, eSymbolContextEverything, sc);
317 if (symbol ==
nullptr)
328 bool found_expected_start_string =
329 function_name.startswith(
"std::__1::function<");
331 if (!found_expected_start_string)
335 sc.
GetAddressRange(eSymbolContextEverything, 0,
false, range_of_curr_func);
340 ValueObjectSP value_sp = frame->FindVariable(g_this);
346 value_sp->GetValueIsValid()) {
349 ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
356 ret_plan_sp = std::make_shared<ThreadPlanStepInRange>(
lldb::addr_t GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code load address.
A line table entry class.
lldb::addr_t member__f_pointer_value
Defines a list of symbol context objects.
Enumerations for broadcasting.
A stream class that can stream formatted output to a file.
static bool IsWhitelistedRuntimeValue(ConstString name)
Check whether the name is "self" or "_cmd" and should show up in "frame variable".
Defines a symbol context baton that can be handed other debug core functions.
ConstString GetName() const
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others)
Obtain a ThreadPlan to get us into C++ constructs such as std::function.
"lldb/Utility/RegularExpression.h" A C++ wrapper class for regex.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
LibCppStdFunctionCallableCase callable_case
Symbol * symbol
The Symbol for a given query.
uint32_t GetSize() const
Get accessor for a symbol context list size.
bool IsRuntimeSupportValue(ValueObject &valobj) override
Identify whether a value is a language implementation detaul that should be hidden from the user inte...
static ConstString g_this
virtual lldb::VariableSP GetVariable()
SectionLoadList & GetSectionLoadList()
lldb::TargetSP CalculateTarget() override
virtual lldb::RegisterContextSP GetRegisterContext()=0
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
A plug-in interface definition class for debugging a process.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
LibCppStdFunctionCallableInfo FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp)
LineEntry callable_line_entry
A section + offset based address class.
uint32_t ResolveSymbolContextForAddress(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) const
Resolve the symbol context for the given address. (const Address
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const
const ModuleList & GetImages() const
Get accessor for the images for this process.
A uniqued constant string class.
bool Fail() const
Test for error condition.
const char * GetCString() const
Get the string value as a C string.
ConstString GetName() const
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.
Address & GetBaseAddress()
Get accessor for the base address of the range.
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
size_t FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask, bool include_symbols, bool include_inlines, bool append, SymbolContextList &sc_list) const
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
A section + offset based address range class.
bool GetObjectDescription(Stream &str, ValueObject &object) override