LLDB mainline
CPPLanguageRuntime.cpp
Go to the documentation of this file.
1//===-- CPPLanguageRuntime.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#include <cstring>
10#include <iostream>
11
12#include <memory>
13
14#include "CPPLanguageRuntime.h"
17
18#include "llvm/ADT/StringRef.h"
19
20#include "lldb/Symbol/Block.h"
23
27#include "lldb/Target/ABI.h"
35#include "lldb/Utility/Timer.h"
36
37using namespace lldb;
38using namespace lldb_private;
39
41
43// Artificial coroutine-related variables emitted by clang.
44static ConstString g_promise = ConstString("__promise");
45static ConstString g_coro_frame = ConstString("__coro_frame");
46
47char CPPLanguageRuntime::ID = 0;
48
49/// A frame recognizer that is installed to hide libc++ implementation
50/// details from the backtrace.
52 std::array<RegularExpression, 2> m_hidden_regex;
54
56 bool ShouldHide() override { return true; }
57 };
58
59public:
62 // internal implementation details in the `std::` namespace
63 // std::__1::__function::__alloc_func<void (*)(), std::__1::allocator<void (*)()>, void ()>::operator()[abi:ne200000]
64 // std::__1::__function::__func<void (*)(), std::__1::allocator<void (*)()>, void ()>::operator()
65 // std::__1::__function::__value_func<void ()>::operator()[abi:ne200000]() const
66 // std::__2::__function::__policy_invoker<void (int, int)>::__call_impl[abi:ne200000]<std::__2::__function::__default_alloc_func<int (*)(int, int), int (int, int)>>
67 // std::__1::__invoke[abi:ne200000]<void (*&)()>
68 // std::__1::__invoke_void_return_wrapper<void, true>::__call[abi:ne200000]<void (*&)()>
69 RegularExpression{R"(^std::__[^:]*::__)"},
70 // internal implementation details in the `std::ranges` namespace
71 // std::__1::ranges::__sort::__sort_fn_impl[abi:ne200000]<std::__1::__wrap_iter<int*>, std::__1::__wrap_iter<int*>, bool (*)(int, int), std::__1::identity>
72 RegularExpression{R"(^std::__[^:]*::ranges::__)"},
73 },
75
76 std::string GetName() override { return "libc++ frame recognizer"; }
77
80 if (!frame_sp)
81 return {};
82 const auto &sc = frame_sp->GetSymbolContext(lldb::eSymbolContextFunction);
83 if (!sc.function)
84 return {};
85
86 // Check if we have a regex match
88 if (!r.Execute(sc.function->GetNameNoArguments()))
89 continue;
90
91 // Only hide this frame if the immediate caller is also within libc++.
92 lldb::ThreadSP thread_sp = frame_sp->GetThread();
93 if (!thread_sp)
94 return {};
95 lldb::StackFrameSP parent_frame_sp =
96 thread_sp->GetStackFrameAtIndex(frame_sp->GetFrameIndex() + 1);
97 if (!parent_frame_sp)
98 return {};
99 const auto &parent_sc =
100 parent_frame_sp->GetSymbolContext(lldb::eSymbolContextFunction);
101 if (!parent_sc.function)
102 return {};
103 if (parent_sc.function->GetNameNoArguments().GetStringRef().starts_with(
104 "std::"))
105 return m_hidden_frame;
106 }
107
108 return {};
109 }
110};
111
113 : LanguageRuntime(process), m_itanium_runtime(process) {
114 if (process) {
117 std::make_shared<RegularExpression>("^std::__[^:]*::"),
118 /*mangling_preference=*/Mangled::ePreferDemangledWithoutArguments,
119 /*first_instruction_only=*/false);
120
122 }
123}
124
126 return name == g_this || name == g_promise || name == g_coro_frame;
127}
128
130 ValueObject &object) {
131 // C++ has no generic way to do this.
132 return llvm::createStringError("C++ does not support object descriptions");
133}
134
135llvm::Error
137 ExecutionContextScope *exe_scope) {
138 // C++ has no generic way to do this.
139 return llvm::createStringError("C++ does not support object descriptions");
140}
141
142bool contains_lambda_identifier(llvm::StringRef &str_ref) {
143 return str_ref.contains("$_") || str_ref.contains("'lambda'");
144}
145
147line_entry_helper(Target &target, const SymbolContext &sc, Symbol *symbol,
148 llvm::StringRef first_template_param_sref, bool has_invoke) {
149
151
152 Address address = sc.GetFunctionOrSymbolAddress();
153
154 Address addr;
155 if (target.ResolveLoadAddress(address.GetCallableLoadAddress(&target),
156 addr)) {
157 LineEntry line_entry;
158 addr.CalculateSymbolContextLineEntry(line_entry);
159
160 if (contains_lambda_identifier(first_template_param_sref) || has_invoke) {
161 // Case 1 and 2
162 optional_info.callable_case = lldb_private::CPPLanguageRuntime::
163 LibCppStdFunctionCallableCase::Lambda;
164 } else {
165 // Case 3
166 optional_info.callable_case = lldb_private::CPPLanguageRuntime::
167 LibCppStdFunctionCallableCase::CallableObject;
168 }
169
170 optional_info.callable_symbol = *symbol;
171 optional_info.callable_line_entry = line_entry;
172 optional_info.callable_address = addr;
173 }
174
175 return optional_info;
176}
177
180 lldb::ValueObjectSP &valobj_sp) {
182
183 LibCppStdFunctionCallableInfo optional_info;
184
185 if (!valobj_sp)
186 return optional_info;
187
188 // Member __f_ has type __base*, the contents of which will hold:
189 // 1) a vtable entry which may hold type information needed to discover the
190 // lambda being called
191 // 2) possibly hold a pointer to the callable object
192 // e.g.
193 //
194 // (lldb) frame var -R f_display
195 // (std::__1::function<void (int)>) f_display = {
196 // __buf_ = {
197 // …
198 // }
199 // __f_ = 0x00007ffeefbffa00
200 // }
201 // (lldb) memory read -fA 0x00007ffeefbffa00
202 // 0x7ffeefbffa00: ... `vtable for std::__1::__function::__func<void (*) ...
203 // 0x7ffeefbffa08: ... `print_num(int) at std_function_cppreference_exam ...
204 //
205 // We will be handling five cases below, std::function is wrapping:
206 //
207 // 1) a lambda we know at compile time. We will obtain the name of the lambda
208 // from the first template pameter from __func's vtable. We will look up
209 // the lambda's operator()() and obtain the line table entry.
210 // 2) a lambda we know at runtime. A pointer to the lambdas __invoke method
211 // will be stored after the vtable. We will obtain the lambdas name from
212 // this entry and lookup operator()() and obtain the line table entry.
213 // 3) a callable object via operator()(). We will obtain the name of the
214 // object from the first template parameter from __func's vtable. We will
215 // look up the objects operator()() and obtain the line table entry.
216 // 4) a member function. A pointer to the function will stored after the
217 // we will obtain the name from this pointer.
218 // 5) a free function. A pointer to the function will stored after the vtable
219 // we will obtain the name from this pointer.
220 ValueObjectSP member_f_(valobj_sp->GetChildMemberWithName("__f_"));
221
222 if (member_f_) {
223 ValueObjectSP sub_member_f_(member_f_->GetChildMemberWithName("__f_"));
224
225 if (sub_member_f_)
226 member_f_ = sub_member_f_;
227 }
228
229 if (!member_f_)
230 return optional_info;
231
232 lldb::addr_t member_f_pointer_value = member_f_->GetValueAsUnsigned(0);
233
234 optional_info.member_f_pointer_value = member_f_pointer_value;
235
236 if (!member_f_pointer_value)
237 return optional_info;
238
239 ExecutionContext exe_ctx(valobj_sp->GetExecutionContextRef());
240 Process *process = exe_ctx.GetProcessPtr();
241
242 if (process == nullptr)
243 return optional_info;
244
245 uint32_t address_size = process->GetAddressByteSize();
246 Status status;
247
248 // First item pointed to by __f_ should be the pointer to the vtable for
249 // a __base object.
250 lldb::addr_t vtable_address =
251 process->ReadPointerFromMemory(member_f_pointer_value, status);
252
253 ABISP abi_sp = process->GetABI();
254 if (abi_sp)
255 vtable_address = abi_sp->FixCodeAddress(vtable_address);
256
257 if (status.Fail())
258 return optional_info;
259
260 lldb::addr_t vtable_address_first_entry =
261 process->ReadPointerFromMemory(vtable_address + address_size, status);
262
263 if (abi_sp)
264 vtable_address_first_entry =
265 abi_sp->FixCodeAddress(vtable_address_first_entry);
266
267 if (status.Fail())
268 return optional_info;
269
270 lldb::addr_t address_after_vtable = member_f_pointer_value + address_size;
271 // As commented above we may not have a function pointer but if we do we will
272 // need it.
273 lldb::addr_t possible_function_address =
274 process->ReadPointerFromMemory(address_after_vtable, status);
275
276 if (abi_sp)
277 possible_function_address =
278 abi_sp->FixCodeAddress(possible_function_address);
279
280 if (status.Fail())
281 return optional_info;
282
283 Target &target = process->GetTarget();
284
285 if (!target.HasLoadedSections())
286 return optional_info;
287
288 Address vtable_first_entry_resolved;
289
290 if (!target.ResolveLoadAddress(vtable_address_first_entry,
291 vtable_first_entry_resolved))
292 return optional_info;
293
294 Address vtable_addr_resolved;
295 SymbolContext sc;
296 Symbol *symbol = nullptr;
297
298 if (!target.ResolveLoadAddress(vtable_address, vtable_addr_resolved))
299 return optional_info;
300
302 vtable_addr_resolved, eSymbolContextEverything, sc);
303 symbol = sc.symbol;
304
305 if (symbol == nullptr)
306 return optional_info;
307
308 llvm::StringRef vtable_name(symbol->GetName().GetStringRef());
309 bool found_expected_start_string =
310 vtable_name.starts_with("vtable for std::__1::__function::__func<");
311
312 if (!found_expected_start_string)
313 return optional_info;
314
315 // Given case 1 or 3 we have a vtable name, we are want to extract the first
316 // template parameter
317 //
318 // ... __func<main::$_0, std::__1::allocator<main::$_0> ...
319 // ^^^^^^^^^
320 //
321 // We could see names such as:
322 // main::$_0
323 // Bar::add_num2(int)::'lambda'(int)
324 // Bar
325 //
326 // We do this by find the first < and , and extracting in between.
327 //
328 // This covers the case of the lambda known at compile time.
329 size_t first_open_angle_bracket = vtable_name.find('<') + 1;
330 size_t first_comma = vtable_name.find(',');
331
332 llvm::StringRef first_template_parameter =
333 vtable_name.slice(first_open_angle_bracket, first_comma);
334
335 Address function_address_resolved;
336
337 // Setup for cases 2, 4 and 5 we have a pointer to a function after the
338 // vtable. We will use a process of elimination to drop through each case
339 // and obtain the data we need.
340 if (target.ResolveLoadAddress(possible_function_address,
341 function_address_resolved)) {
343 function_address_resolved, eSymbolContextEverything, sc);
344 symbol = sc.symbol;
345 }
346
347 // These conditions are used several times to simplify statements later on.
348 bool has_invoke =
349 (symbol ? symbol->GetName().GetStringRef().contains("__invoke") : false);
350 auto calculate_symbol_context_helper = [](auto &t,
351 SymbolContextList &sc_list) {
352 SymbolContext sc;
353 t->CalculateSymbolContext(&sc);
354 sc_list.Append(sc);
355 };
356
357 // Case 2
358 if (has_invoke) {
360 calculate_symbol_context_helper(symbol, scl);
361
362 return line_entry_helper(target, scl[0], symbol, first_template_parameter,
363 has_invoke);
364 }
365
366 // Case 4 or 5
367 if (symbol && !symbol->GetName().GetStringRef().starts_with("vtable for") &&
368 !contains_lambda_identifier(first_template_parameter) && !has_invoke) {
369 optional_info.callable_case =
371 optional_info.callable_address = function_address_resolved;
372 optional_info.callable_symbol = *symbol;
373
374 return optional_info;
375 }
376
377 std::string func_to_match = first_template_parameter.str();
378
379 auto it = CallableLookupCache.find(func_to_match);
380 if (it != CallableLookupCache.end())
381 return it->second;
382
384
385 CompileUnit *vtable_cu =
386 vtable_first_entry_resolved.CalculateSymbolContextCompileUnit();
387 llvm::StringRef name_to_use = func_to_match;
388
389 // Case 3, we have a callable object instead of a lambda
390 //
391 // TODO
392 // We currently don't support this case a callable object may have multiple
393 // operator()() varying on const/non-const and number of arguments and we
394 // don't have a way to currently distinguish them so we will bail out now.
395 if (!contains_lambda_identifier(name_to_use))
396 return optional_info;
397
398 if (vtable_cu && !has_invoke) {
399 lldb::FunctionSP func_sp =
400 vtable_cu->FindFunction([name_to_use](const FunctionSP &f) {
401 auto name = f->GetName().GetStringRef();
402 if (name.starts_with(name_to_use) && name.contains("operator"))
403 return true;
404
405 return false;
406 });
407
408 if (func_sp) {
409 calculate_symbol_context_helper(func_sp, scl);
410 }
411 }
412
413 if (symbol == nullptr)
414 return optional_info;
415
416 // Case 1 or 3
417 if (scl.GetSize() >= 1) {
418 optional_info = line_entry_helper(target, scl[0], symbol,
419 first_template_parameter, has_invoke);
420 }
421
422 CallableLookupCache[func_to_match] = optional_info;
423
424 return optional_info;
425}
426
429 bool stop_others) {
430 ThreadPlanSP ret_plan_sp;
431
432 lldb::addr_t curr_pc = thread.GetRegisterContext()->GetPC();
433
434 TargetSP target_sp(thread.CalculateTarget());
435
436 if (!target_sp->HasLoadedSections())
437 return ret_plan_sp;
438
439 Address pc_addr_resolved;
440 SymbolContext sc;
441 Symbol *symbol;
442
443 if (!target_sp->ResolveLoadAddress(curr_pc, pc_addr_resolved))
444 return ret_plan_sp;
445
446 target_sp->GetImages().ResolveSymbolContextForAddress(
447 pc_addr_resolved, eSymbolContextEverything, sc);
448 symbol = sc.symbol;
449
450 if (symbol == nullptr)
451 return ret_plan_sp;
452
453 llvm::StringRef function_name(symbol->GetName().GetCString());
454
455 // Handling the case where we are attempting to step into std::function.
456 // The behavior will be that we will attempt to obtain the wrapped
457 // callable via FindLibCppStdFunctionCallableInfo() and if we find it we
458 // will return a ThreadPlanRunToAddress to the callable. Therefore we will
459 // step into the wrapped callable.
460 //
461 bool found_expected_start_string =
462 function_name.starts_with("std::__1::function<");
463
464 if (!found_expected_start_string)
465 return ret_plan_sp;
466
467 AddressRange range_of_curr_func;
468 sc.GetAddressRange(eSymbolContextEverything, 0, false, range_of_curr_func);
469
470 StackFrameSP frame = thread.GetStackFrameAtIndex(0);
471
472 if (frame) {
473 ValueObjectSP value_sp = frame->FindVariable(g_this);
474
477
479 value_sp->GetValueIsValid()) {
480 // We found the std::function wrapped callable and we have its address.
481 // We now create a ThreadPlan to run to the callable.
482 ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(
483 thread, callable_info.callable_address, stop_others);
484 return ret_plan_sp;
485 } else {
486 // We are in std::function but we could not obtain the callable.
487 // We create a ThreadPlan to keep stepping through using the address range
488 // of the current function.
489 ret_plan_sp = std::make_shared<ThreadPlanStepInRange>(
490 thread, range_of_curr_func, sc, nullptr, eOnlyThisThread,
492 return ret_plan_sp;
493 }
494 }
495
496 return ret_plan_sp;
497}
498
500 llvm::StringRef mangled_name =
502 // Virtual function overriding from a non-virtual base use a "Th" prefix.
503 // Virtual function overriding from a virtual base must use a "Tv" prefix.
504 // Virtual function overriding thunks with covariant returns use a "Tc"
505 // prefix.
506 return mangled_name.starts_with("_ZTh") || mangled_name.starts_with("_ZTv") ||
507 mangled_name.starts_with("_ZTc");
508}
509
511 const bool check_cxx = true;
512 const bool check_objc = false;
513 return in_value.GetCompilerType().IsPossibleDynamicType(nullptr, check_cxx,
514 check_objc);
515}
516
518 ValueObject &in_value, lldb::DynamicValueType use_dynamic,
519 TypeAndOrName &class_type_or_name, Address &dynamic_address,
520 Value::ValueType &value_type, llvm::ArrayRef<uint8_t> &local_buffer) {
521 class_type_or_name.Clear();
522 value_type = Value::ValueType::Scalar;
523
524 if (!CouldHaveDynamicValue(in_value))
525 return false;
526
527 return m_itanium_runtime.GetDynamicTypeAndAddress(
528 in_value, use_dynamic, class_type_or_name, dynamic_address, value_type);
529}
530
533 ValueObject &static_value) {
534 CompilerType static_type(static_value.GetCompilerType());
535 Flags static_type_flags(static_type.GetTypeInfo());
536
537 TypeAndOrName ret(type_and_or_name);
538 if (type_and_or_name.HasType()) {
539 // The type will always be the type of the dynamic object. If our parent's
540 // type was a pointer, then our type should be a pointer to the type of the
541 // dynamic object. If a reference, then the original type should be
542 // okay...
543 CompilerType orig_type = type_and_or_name.GetCompilerType();
544 CompilerType corrected_type = orig_type;
545 if (static_type_flags.AllSet(eTypeIsPointer))
546 corrected_type = orig_type.GetPointerType();
547 else if (static_type_flags.AllSet(eTypeIsReference))
548 corrected_type = orig_type.GetLValueReferenceType();
549 ret.SetCompilerType(corrected_type);
550 } else {
551 // If we are here we need to adjust our dynamic type name to include the
552 // correct & or * symbol
553 std::string corrected_name(type_and_or_name.GetName().GetCString());
554 if (static_type_flags.AllSet(eTypeIsPointer))
555 corrected_name.append(" *");
556 else if (static_type_flags.AllSet(eTypeIsReference))
557 corrected_name.append(" &");
558 // the parent type should be a correctly pointer'ed or referenc'ed type
559 ret.SetCompilerType(static_type);
560 ret.SetName(corrected_name.c_str());
561 }
562 return ret;
563}
564
567 lldb::LanguageType language) {
568 if (language == eLanguageTypeC_plus_plus ||
569 language == eLanguageTypeC_plus_plus_03 ||
570 language == eLanguageTypeC_plus_plus_11 ||
571 language == eLanguageTypeC_plus_plus_14)
572 return new CPPLanguageRuntime(process);
573 else
574 return nullptr;
575}
576
579 GetPluginNameStatic(), "C++ language runtime", CreateInstance,
580 [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {
581 return CommandObjectSP(new CommandObjectCPlusPlus(interpreter));
582 });
583}
584
588
589llvm::Expected<LanguageRuntime::VTableInfo>
591 return m_itanium_runtime.GetVTableInfo(in_value, check_type);
592}
593
596 bool catch_bp, bool throw_bp) {
597 return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false);
598}
599
602 bool catch_bp, bool throw_bp,
603 bool for_expressions) {
604 std::vector<const char *> exception_names;
605 m_itanium_runtime.AppendExceptionBreakpointFunctions(
606 exception_names, catch_bp, throw_bp, for_expressions);
607
609 bkpt, exception_names.data(), exception_names.size(),
610 eFunctionNameTypeBase, eLanguageTypeUnknown, 0, eLazyBoolNo));
611
612 return resolver_sp;
613}
614
616 Target &target = m_process->GetTarget();
617
618 FileSpecList filter_modules;
619 m_itanium_runtime.AppendExceptionBreakpointFilterModules(filter_modules,
620 target);
621 return target.GetSearchFilterForModuleList(&filter_modules);
622}
623
625 bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal) {
626 Target &target = m_process->GetTarget();
627 FileSpecList filter_modules;
628 BreakpointResolverSP exception_resolver_sp =
629 CreateExceptionResolver(nullptr, catch_bp, throw_bp, for_expressions);
631 const bool hardware = false;
632 const bool resolve_indirect_functions = false;
633 return target.CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal,
634 hardware, resolve_indirect_functions);
635}
636
638 if (!m_process)
639 return;
640
641 const bool catch_bp = false;
642 const bool throw_bp = true;
643 const bool is_internal = true;
644 const bool for_expressions = true;
645
646 // For the exception breakpoints set by the Expression parser, we'll be a
647 // little more aggressive and stop at exception allocation as well.
648
650 m_cxx_exception_bp_sp->SetEnabled(true);
651 } else {
653 catch_bp, throw_bp, for_expressions, is_internal);
655 m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception");
656 }
657}
658
660 if (!m_process)
661 return;
662
664 m_cxx_exception_bp_sp->SetEnabled(false);
665 }
666}
667
671
673 lldb::StopInfoSP stop_reason) {
674 if (!m_process)
675 return false;
676
677 if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
678 return false;
679
680 uint64_t break_site_id = stop_reason->GetValue();
681 return m_process->GetBreakpointSiteList().StopPointSiteContainsBreakpoint(
682 break_site_id, m_cxx_exception_bp_sp->GetID());
683}
684
687 return m_itanium_runtime.GetExceptionObjectForThread(std::move(thread_sp));
688}
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)
static char ID
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
#define LLDB_SCOPED_TIMER()
Definition Timer.h:83
A frame recognizer that is installed to hide libc++ implementation details from the backtrace.
lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame_sp) override
RecognizedStackFrameSP m_hidden_frame
std::array< RegularExpression, 2 > m_hidden_regex
std::string GetName() override
A section + offset based address range class.
A section + offset based address class.
Definition Address.h:62
lldb::addr_t GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code load address.
Definition Address.cpp:326
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const
Definition Address.cpp:901
CompileUnit * CalculateSymbolContextCompileUnit() const
Definition Address.cpp:845
"lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on a given function name,...
llvm::Expected< LanguageRuntime::VTableInfo > GetVTableInfo(ValueObject &in_value, bool check_type) override
Get the vtable information for a given value.
TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override
bool CouldHaveDynamicValue(ValueObject &in_value) override
lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal)
static lldb_private::LanguageRuntime * CreateInstance(Process *process, lldb::LanguageType language)
llvm::Error GetObjectDescription(Stream &str, ValueObject &object) override
lldb::SearchFilterSP CreateExceptionSearchFilter() override
lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp) override
bool IsSymbolARuntimeThunk(const Symbol &symbol) 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.
lldb::BreakpointResolverSP CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp) override
OperatorStringToCallableInfoMap CallableLookupCache
static llvm::StringRef GetPluginNameStatic()
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type, llvm::ArrayRef< uint8_t > &local_buffer) override
This call should return true if it could set the name and/or the type Sets address to the address of ...
bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override
A class that describes a compilation unit.
Definition CompileUnit.h:43
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.
Generic representation of a type in a programming language.
bool IsPossibleDynamicType(CompilerType *target_type, bool check_cplusplus, bool check_objc) const
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
A uniqued constant string class.
Definition ConstString.h:40
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.
A file collection class.
A class to manage flags.
Definition Flags.h:22
bool AllSet(ValueType mask) const
Test if all bits in mask are 1 in the current flags.
Definition Flags.h:83
@ ePreferDemangledWithoutArguments
Definition Mangled.h:39
ConstString GetMangledName() const
Mangled name get accessor.
Definition Mangled.h:152
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&)
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A plug-in interface definition class for debugging a process.
Definition Process.h:354
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
Definition Process.cpp:2329
uint32_t GetAddressByteSize() const
Definition Process.cpp:3720
const lldb::ABISP & GetABI()
Definition Process.cpp:1452
Target & GetTarget()
Get the target object pointer for this module.
Definition Process.h:1250
This class provides extra information about a stack frame that was provided by a specific stack frame...
Process * m_process
Definition Runtime.h:29
void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, ConstString module, llvm::ArrayRef< ConstString > symbols, Mangled::NamePreference symbol_mangling, bool first_instruction_only=true)
Add a new recognizer that triggers on a given symbol name.
A base class for frame recognizers.
An error handling class.
Definition Status.h:118
bool Fail() const
Test for error condition.
Definition Status.cpp:293
A stream class that can stream formatted output to a file.
Definition Stream.h:28
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.
Address GetFunctionOrSymbolAddress() const
Get the address of the function or symbol represented by this symbol context.
Mangled & GetMangled()
Definition Symbol.h:147
ConstString GetName() const
Definition Symbol.cpp:511
lldb::SearchFilterSP GetSearchFilterForModuleList(const FileSpecList *containingModuleList)
Definition Target.cpp:690
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
Definition Target.cpp:3328
StackFrameRecognizerManager & GetFrameRecognizerManager()
Definition Target.h:1701
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition Target.cpp:489
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition Target.h:1140
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition Type.h:779
void SetName(ConstString type_name)
Definition Type.cpp:902
CompilerType GetCompilerType() const
Definition Type.h:793
ConstString GetName() const
Definition Type.cpp:894
void SetCompilerType(CompilerType compiler_type)
Definition Type.cpp:922
bool HasType() const
Definition Type.h:811
CompilerType GetCompilerType()
ValueType
Type that describes Value::m_value.
Definition Value.h:41
@ Scalar
A raw scalar value.
Definition Value.h:45
A class that represents a running process on the host machine.
void RegisterVerboseTrapFrameRecognizer(Process &process)
std::shared_ptr< lldb_private::Function > FunctionSP
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::RecognizedStackFrame > RecognizedStackFrameSP
std::shared_ptr< lldb_private::SearchFilter > SearchFilterSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus_14
ISO C++:2014.
@ eLanguageTypeC_plus_plus_03
ISO C++:2003.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC_plus_plus_11
ISO C++:2011.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::StackFrameRecognizer > StackFrameRecognizerSP
std::shared_ptr< lldb_private::StopInfo > StopInfoSP
uint64_t addr_t
Definition lldb-types.h:80
@ eStopReasonBreakpoint
std::shared_ptr< lldb_private::Target > TargetSP
bool ShouldHide() override
Controls whether this frame should be filtered out when displaying backtraces, for example.
A line table entry class.
Definition LineEntry.h:21