58 uint32_t frame_number,
82 m_all_registers_available = true;
87 std::shared_ptr<const UnwindPlan> unwind_plan_sp) {
105 if (unwind_plan_sp->PlanValidAtAddress(pc_minus_one)) {
120 if (reg_ctx_sp.get() ==
nullptr) {
126 addr_t current_pc = reg_ctx_sp->GetPC();
142 current_pc = abi_sp->FixCodeAddress(current_pc);
144 std::shared_ptr<const UnwindPlan> lang_runtime_plan_sp =
147 if (lang_runtime_plan_sp.get()) {
160 UnwindLogMsg(
"using architectural default unwind method");
166 UnwindLogMsg(
"with pc value of 0x%" PRIx64
", symbol name is '%s'",
169 UnwindLogMsg(
"with pc value of 0x%" PRIx64
", function name is '%s'",
173 ", no symbol/function name is known.",
213 if (lang_runtime_plan_sp.get()) {
216 row_register_kind = lang_runtime_plan_sp->GetRegisterKind();
224 active_row->
Dump(active_row_strm, lang_runtime_plan_sp.get(), &
m_thread,
230 "initialized async frame current pc is 0x%" PRIx64
231 " cfa is 0x%" PRIx64
" afa is 0x%" PRIx64,
245 if (active_row && log) {
254 UnwindLogMsg(
"could not find an unwindplan row for this frame's pc");
263 std::shared_ptr<const UnwindPlan> call_site_unwind_plan;
264 bool cfa_status =
false;
268 pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress(
272 if (func_unwinders_sp.get() !=
nullptr)
273 call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(
276 if (call_site_unwind_plan !=
nullptr) {
282 UnwindLogMsg(
"could not read CFA value for first frame.");
291 "could not read CFA or AFA values for first frame, not valid.");
299 UnwindLogMsg(
"initialized frame current pc is 0x%" PRIx64
" cfa is 0x%" PRIx64
300 " afa is 0x%" PRIx64
" using %s UnwindPlan",
314 UnwindLogMsg(
"non-zeroth frame tests positive for IsFrameZero -- that "
315 "shouldn't happen.");
321 UnwindLogMsg(
"Could not get next frame, marking this frame as invalid.");
324 if (!
m_thread.GetRegisterContext()) {
326 UnwindLogMsg(
"Could not get register context for this thread, marking this "
327 "frame as invalid.");
341 std::shared_ptr<const UnwindPlan> lang_runtime_plan_sp =
344 if (lang_runtime_plan_sp.get()) {
359 pc = abi_sp->FixCodeAddress(
pc);
372 bool above_trap_handler =
false;
375 above_trap_handler =
true;
377 if (
pc == 0 ||
pc == 0x1) {
378 if (!above_trap_handler) {
385 const bool allow_section_end =
true;
396 above_trap_handler ==
false) {
397 UnwindLogMsg(
"using architectural default unwind method");
401 uint32_t permissions;
403 (permissions & ePermissionsExecutable) == 0) {
411 UnwindLogMsg(
"had a pc of 0x%" PRIx64
" which is not in executable "
412 "memory but on frame 1 -- "
420 UnwindLogMsg(
"pc is in a non-executable section of memory and this "
421 "isn't the 2nd frame in the stack walk.");
460 (permissions & ePermissionsReadable) == 0) {
463 "the CFA points to a region of memory that is not readable");
467 UnwindLogMsg(
"could not find a row for function offset zero");
475 UnwindLogMsg(
"same CFA address as next frame, assuming the unwind is "
476 "looping - stopping");
485 UnwindLogMsg(
"initialized frame cfa is 0x%" PRIx64
" afa is 0x%" PRIx64,
490 UnwindLogMsg(
"could not find any symbol for this pc, or a default unwind "
491 "plan, to continue unwind.");
498 UnwindLogMsg(
"with pc value of 0x%" PRIx64
", symbol name is '%s'",
pc,
501 UnwindLogMsg(
"with pc value of 0x%" PRIx64
", function name is '%s'",
pc,
505 ", no symbol/function name is known.",
509 bool decr_pc_and_recompute_addr_range;
513 decr_pc_and_recompute_addr_range =
true;
518 decr_pc_and_recompute_addr_range =
false;
524 decr_pc_and_recompute_addr_range =
false;
526 decr_pc_and_recompute_addr_range =
true;
532 decr_pc_and_recompute_addr_range =
false;
534 decr_pc_and_recompute_addr_range =
false;
537 decr_pc_and_recompute_addr_range =
true;
546 if (decr_pc_and_recompute_addr_range) {
548 " by 1 and re-doing symbol lookup; old symbol was %s",
566 if (decr_pc_and_recompute_addr_range &&
597 if (lang_runtime_plan_sp.get()) {
600 row_register_kind = lang_runtime_plan_sp->GetRegisterKind();
608 active_row->
Dump(active_row_strm, lang_runtime_plan_sp.get(), &
m_thread,
614 "initialized async frame current pc is 0x%" PRIx64
615 " cfa is 0x%" PRIx64
" afa is 0x%" PRIx64,
636 if (active_row && log) {
651 if (active_row && log) {
682 UnwindLogMsg(
"same CFA address as next frame, assuming the unwind is "
683 "looping - stopping");
692 UnwindLogMsg(
"initialized frame current pc is 0x%" PRIx64
693 " cfa is 0x%" PRIx64
" afa is 0x%" PRIx64,
716 next_frame->GetNextFrame();
718 if (next_next_frame && next_next_frame->GetCFA(next_next_frame_cfa)) {
719 if (next_next_frame_cfa ==
m_cfa) {
749std::shared_ptr<const UnwindPlan>
754 pc_module_sp->GetObjectFile() ==
nullptr)
761 pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress(
763 if (!func_unwinders_sp)
771 if (std::shared_ptr<const UnwindPlan> unwind_plan_sp =
772 func_unwinders_sp->GetUnwindPlanFastUnwind(
776 return unwind_plan_sp;
791std::shared_ptr<const UnwindPlan>
793 std::shared_ptr<const UnwindPlan> arch_default_unwind_plan_sp;
796 ABI *abi = process ? process->
GetABI().get() :
nullptr;
801 "unable to get architectural default UnwindPlan from ABI plugin");
823 uint32_t permissions;
826 if (current_pc_addr == 0 ||
829 (permissions & ePermissionsExecutable) == 0)) {
840 pc_module_sp->GetObjectFile() ==
nullptr) {
842 return arch_default_unwind_plan_sp;
848 pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress(
857 if (!func_unwinders_sp) {
860 if (!pc_module_sp || !pc_module_sp->GetObjectFile() ||
862 return arch_default_unwind_plan_sp;
867 pc_module_sp->GetUnwindTable().GetEHFrameInfo()) {
868 if (std::unique_ptr<UnwindPlan> plan_up =
874 pc_module_sp->GetUnwindTable().GetArmUnwindInfo();
876 auto unwind_plan_sp =
880 return unwind_plan_sp;
884 pc_module_sp->GetUnwindTable().GetObjectFileUnwindInfo();
885 if (object_file_unwind) {
886 if (std::unique_ptr<UnwindPlan> plan_up =
891 return arch_default_unwind_plan_sp;
902 if (
auto unwind_plan_sp = platform->GetTrapHandlerUnwindPlan(
905 return unwind_plan_sp;
908 auto unwind_plan_sp =
909 func_unwinders_sp->GetEHFrameUnwindPlan(process->
GetTarget());
912 func_unwinders_sp->GetObjectFileUnwindPlan(process->
GetTarget());
913 if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(
m_current_pc) &&
914 unwind_plan_sp->GetSourcedFromCompiler() ==
eLazyBoolYes) {
915 return unwind_plan_sp;
933 auto unwind_plan_sp =
934 func_unwinders_sp->GetEHFrameUnwindPlan(process->
GetTarget());
937 func_unwinders_sp->GetObjectFileUnwindPlan(process->
GetTarget());
938 if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(
m_current_pc)) {
940 "DynamicLoader suggested we prefer it",
941 unwind_plan_sp->GetSourceName().GetCString());
942 return unwind_plan_sp;
949 auto unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite(
951 if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(
m_current_pc)) {
952 if (unwind_plan_sp->GetSourcedFromCompiler() ==
eLazyBoolNo) {
964 std::shared_ptr<const UnwindPlan> call_site_unwind_plan =
965 func_unwinders_sp->GetUnwindPlanAtCallSite(process->
GetTarget(),
967 if (call_site_unwind_plan &&
968 call_site_unwind_plan.get() != unwind_plan_sp.get() &&
969 call_site_unwind_plan->GetSourceName() !=
970 unwind_plan_sp->GetSourceName()) {
977 "is the non-call site unwind plan and this is a "
979 unwind_plan_sp->GetSourceName().GetCString());
980 return unwind_plan_sp;
988 func_unwinders_sp->GetUnwindPlanArchitectureDefaultAtFunctionEntry(
990 if (unwind_plan_sp) {
992 "the first instruction of a function",
993 unwind_plan_sp->GetSourceName().GetCString());
994 return unwind_plan_sp;
999 std::shared_ptr<const UnwindPlan> unwind_plan_sp;
1003 unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtCallSite(
1008 "is the call-site unwind plan",
1009 unwind_plan_sp->GetSourceName().GetCString());
1010 return unwind_plan_sp;
1017 unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite(
1020 if (unwind_plan_sp &&
1021 unwind_plan_sp->GetSourcedFromCompiler() ==
eLazyBoolNo) {
1032 std::shared_ptr<const UnwindPlan> call_site_unwind_plan =
1033 func_unwinders_sp->GetUnwindPlanAtCallSite(process->
GetTarget(),
1035 if (call_site_unwind_plan &&
1036 call_site_unwind_plan.get() != unwind_plan_sp.get() &&
1037 call_site_unwind_plan->GetSourceName() !=
1038 unwind_plan_sp->GetSourceName()) {
1047 "failed to find a call-site unwind plan that would work",
1048 unwind_plan_sp->GetSourceName().GetCString());
1049 return unwind_plan_sp;
1054 if (arch_default_unwind_plan_sp)
1056 "frame uses %s for full UnwindPlan because we are falling back "
1057 "to the arch default plan",
1058 arch_default_unwind_plan_sp->GetSourceName().GetCString());
1061 "Unable to find any UnwindPlan for full unwind of this frame.");
1063 return arch_default_unwind_plan_sp;
1071 return m_thread.GetRegisterContext()->GetRegisterCount();
1075 return m_thread.GetRegisterContext()->GetRegisterInfoAtIndex(reg);
1079 return m_thread.GetRegisterContext()->GetRegisterSetCount();
1083 return m_thread.GetRegisterContext()->GetRegisterSet(reg_set);
1088 return m_thread.GetRegisterContext()->ConvertRegisterKindToRegisterNumber(
1097 bool success =
false;
1099 switch (regloc.
type) {
1104 if (!other_reg_info)
1108 m_thread.GetRegisterContext()->ReadRegister(other_reg_info, value);
1114 if (!other_reg_info)
1119 m_thread.GetRegisterContext()->ReadRegister(other_reg_info, value);
1121 success =
GetNextFrame()->ReadRegister(other_reg_info, value);
1129 if (!other_reg_info)
1134 m_thread.GetRegisterContext()->ReadRegister(other_reg_info, value);
1136 success =
GetNextFrame()->ReadRegister(other_reg_info, value);
1153 llvm_unreachable(
"FIXME debugger inferior function call unwind");
1158 success =
error.Success();
1161 llvm_unreachable(
"Unknown ConcreteRegisterLocation type.");
1172 bool success =
false;
1174 switch (regloc.
type) {
1179 m_thread.GetRegisterContext()->WriteRegister(other_reg_info, value);
1186 m_thread.GetRegisterContext()->WriteRegister(other_reg_info, value);
1188 success =
GetNextFrame()->WriteRegister(other_reg_info, value);
1196 llvm_unreachable(
"FIXME debugger inferior function call unwind");
1201 success =
error.Success();
1204 llvm_unreachable(
"Unknown ConcreteRegisterLocation type.");
1240 const std::vector<ConstString> trap_handler_names(
1241 platform_sp->GetTrapHandlerSymbolNames());
1249 const std::vector<ConstString> user_specified_trap_handler_names(
1251 for (
ConstString name : user_specified_trap_handler_names) {
1293std::optional<UnwindPlan::Row::AbstractRegisterLocation>
1307 UnwindLogMsg(
"could not convert lldb regnum %s (%d) into %d RegisterKind "
1308 "reg numbering scheme",
1323 unwindplan_regloc) &&
1326 "supplying caller's saved %s (%d)'s location using FastUnwindPlan",
1328 return unwindplan_regloc;
1333 bool got_new_full_unwindplan =
false;
1336 got_new_full_unwindplan =
true;
1347 if (got_new_full_unwindplan && active_row && log) {
1359 UnwindLogMsg(
"could not convert lldb regnum %s (%d) into "
1360 "eRegisterKindGeneric reg numbering scheme",
1363 UnwindLogMsg(
"could not convert lldb regnum %s (%d) into %d "
1364 "RegisterKind reg numbering scheme",
1370 if (regnum.
IsValid() && active_row &&
1372 unwindplan_regloc)) {
1374 "supplying caller's saved %s (%d)'s location using %s UnwindPlan",
1377 return unwindplan_regloc;
1406 if (pc_regnum.
IsValid() && pc_regnum == regnum) {
1413 return_address_regnum =
1418 return_address_regnum = arch_default_ra_regnum.
GetAsKind(kind);
1426 return_address_regnum);
1427 UnwindLogMsg(
"requested caller's saved PC but this UnwindPlan uses a "
1428 "RA reg; getting %s (%d) instead",
1435 unwindplan_regloc)) {
1436 UnwindLogMsg(
"supplying caller's saved %s (%d)'s location using "
1444 if (unwindplan_regloc.
IsSame())
1446 return unwindplan_regloc;
1454 return unwindplan_regloc;
1471 ABI *abi = process ? process->
GetABI().get() :
nullptr;
1479 "supplying caller's saved %s (%d)'s location using ABI default",
1484 return unwindplan_regloc;
1491 std::string unwindplan_name;
1493 unwindplan_name +=
"via '";
1495 unwindplan_name +=
"'";
1501 return unwindplan_regloc;
1509 uint32_t lldb_regnum,
1518 regloc = iterator->second;
1519 UnwindLogMsg(
"supplying caller's saved %s (%d)'s location, cached",
1526 std::optional<UnwindPlan::Row::AbstractRegisterLocation> abs_regloc =
1532 if (abs_regloc->IsUndefined()) {
1534 "did not supply reg location for %s (%d) because it is volatile",
1542 if (abs_regloc->IsUnspecified()) {
1546 UnwindLogMsg(
"save location for %s (%d) is unspecified, continue searching",
1551 if (abs_regloc->IsSame()) {
1557 UnwindLogMsg(
"supplying caller's register %s (%d) from the live "
1558 "RegisterContext at frame 0",
1570 UnwindLogMsg(
"register %s (%d) is marked as 'IsSame' - it is a pc or "
1571 "return address reg on a frame which does not have all "
1572 "registers available -- treat as if we have no information",
1581 "supplying caller's register %s (%d) value is unmodified in this frame",
1586 if (abs_regloc->IsCFAPlusOffset()) {
1587 int offset = abs_regloc->GetOffset();
1591 UnwindLogMsg(
"supplying caller's register %s (%d), value is CFA plus "
1592 "offset %d [value is 0x%" PRIx64
"]",
1598 if (abs_regloc->IsAtCFAPlusOffset()) {
1599 int offset = abs_regloc->GetOffset();
1604 UnwindLogMsg(
"supplying caller's register %s (%d) from the stack, saved at "
1605 "CFA plus offset %d [saved at 0x%" PRIx64
"]",
1611 if (abs_regloc->IsAFAPlusOffset()) {
1615 int offset = abs_regloc->GetOffset();
1619 UnwindLogMsg(
"supplying caller's register %s (%d), value is AFA plus "
1620 "offset %d [value is 0x%" PRIx64
"]",
1626 if (abs_regloc->IsAtAFAPlusOffset()) {
1630 int offset = abs_regloc->GetOffset();
1635 UnwindLogMsg(
"supplying caller's register %s (%d) from the stack, saved at "
1636 "AFA plus offset %d [saved at 0x%" PRIx64
"]",
1642 if (abs_regloc->IsInOtherRegister()) {
1644 abs_regloc->GetRegisterNumber());
1646 UnwindLogMsg(
"could not supply caller's %s (%d) location - was saved in "
1647 "another reg but couldn't convert that regnum",
1655 "supplying caller's register %s (%d), saved in register %s (%d)",
1661 if (abs_regloc->IsDWARFExpression() || abs_regloc->IsAtDWARFExpression()) {
1662 DataExtractor dwarfdata(abs_regloc->GetDWARFExpressionBytes(),
1663 abs_regloc->GetDWARFExpressionLength(),
1671 llvm::Expected<Value> result =
1672 dwarfexpr.
Evaluate(&exe_ctx,
this, 0, &cfa_val,
nullptr);
1675 "DWARF expression failed to evaluate: {0}");
1678 val = result->GetScalar().ULongLong();
1679 if (abs_regloc->IsDWARFExpression()) {
1684 UnwindLogMsg(
"supplying caller's register %s (%d) via DWARF expression "
1685 "(IsDWARFExpression)",
1689 regloc.
type = UnwindLLDB::ConcreteRegisterLocation::
1690 eRegisterSavedAtMemoryLocation;
1693 UnwindLogMsg(
"supplying caller's register %s (%d) via DWARF expression "
1694 "(IsAtDWARFExpression)",
1699 UnwindLogMsg(
"tried to use IsDWARFExpression or IsAtDWARFExpression for %s "
1705 if (abs_regloc->IsConstant()) {
1709 UnwindLogMsg(
"supplying caller's register %s (%d) via constant value",
1714 UnwindLogMsg(
"no save location for %s (%d) in this stack frame",
1731 if (
Architecture *arch = process_sp->GetTarget().GetArchitecturePlugin())
1732 arch_override_plan_sp =
1735 if (arch_override_plan_sp) {
1741 "Replacing Full Unwindplan with Architecture UnwindPlan, '%s'",
1749 m_start_pc.GetLoadAddress(&process_sp->GetTarget()));
1813 if (
ABISP abi_sp = process_sp->GetABI())
1814 old_caller_pc_value = abi_sp->FixCodeAddress(old_caller_pc_value);
1833 std::shared_ptr<const UnwindPlan> original_full_unwind_plan_sp =
1853 UnwindLogMsg(
"failed to get cfa with fallback unwindplan");
1874 if (
ABISP abi_sp = process_sp->GetABI())
1875 new_caller_pc_value = abi_sp->FixCodeAddress(new_caller_pc_value);
1882 UnwindLogMsg(
"failed to get a pc value for the caller frame with the "
1883 "fallback unwind plan");
1891 if (old_caller_pc_value == new_caller_pc_value &&
1894 UnwindLogMsg(
"fallback unwind plan got the same values for this frame "
1895 "CFA and caller frame pc, not using");
1901 UnwindLogMsg(
"trying to unwind from this function with the UnwindPlan '%s' "
1902 "because UnwindPlan '%s' failed.",
1904 original_full_unwind_plan_sp->GetSourceName().GetCString());
1938 UnwindLogMsg(
"failed to get cfa with fallback unwindplan");
1955 UnwindLogMsg(
"switched unconditionally to the fallback unwindplan %s",
1963 std::shared_ptr<const UnwindPlan> unwind_plan) {
1964 if (unwind_plan->GetUnwindPlanForSignalTrap() !=
eLazyBoolYes) {
1976 UnwindLogMsg(
"This frame is marked as a trap handler via its UnwindPlan");
1989 UnwindLogMsg(
"Resetting current offset and re-doing symbol lookup; "
1990 "old symbol was %s",
2025 addr_t reg_to_deref_contents;
2026 if (
ReadGPRValue(regnum_to_deref, reg_to_deref_contents)) {
2032 reg_info, reg_to_deref_contents, reg_info->
byte_size, reg_value);
2033 if (
error.Success()) {
2036 "CFA value via dereferencing reg %s (%d): reg has val 0x%" PRIx64
2037 ", CFA value is 0x%" PRIx64,
2040 reg_to_deref_contents, address);
2044 "] but memory read failed.",
2047 reg_to_deref_contents);
2059 cfa_reg_contents == 1) {
2061 "Got an invalid CFA register value - reg %s (%d), value 0x%" PRIx64,
2066 address = cfa_reg_contents + fa.
GetOffset();
2068 "CFA is 0x%" PRIx64
": Register %s (%d) contents are 0x%" PRIx64
2090 llvm::Expected<Value> result =
2091 dwarfexpr.
Evaluate(&exe_ctx,
this, 0,
nullptr,
nullptr);
2093 address = result->GetScalar().ULongLong();
2094 UnwindLogMsg(
"CFA value set by DWARF expression is 0x%" PRIx64,
2098 UnwindLogMsg(
"Failed to set CFA value via DWARF expression: %s",
2099 llvm::toString(result.takeError()).c_str());
2108 const unsigned max_iterations = 256;
2109 for (
unsigned i = 0; i < max_iterations; ++i) {
2116 UnwindLogMsg(
"Cannot read memory at 0x%" PRIx64
": %s", candidate_addr,
2121 uint32_t permissions;
2123 permissions & lldb::ePermissionsExecutable) {
2124 address = candidate_addr;
2125 UnwindLogMsg(
"Heuristically found CFA: 0x%" PRIx64, address);
2134 UnwindLogMsg(
"CFA value set by constant is 0x%" PRIx64, address);
2150 hint = abi_sp->FixCodeAddress(hint);
2152 hint += plan_offset;
2155 if (!next->m_sym_ctx.module_sp || !next->m_sym_ctx.symbol)
2157 if (
auto expected_size =
2158 next->m_sym_ctx.module_sp->GetSymbolFile()->GetParameterStackSize(
2159 *next->m_sym_ctx.symbol))
2160 hint += *expected_size;
2163 llvm::toString(expected_size.takeError()).c_str());
2187 uint32_t regnum,
addr_t &value) {
2191 uint32_t lldb_regnum;
2193 lldb_regnum = regnum;
2194 }
else if (!
m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds(
2203 "Could not find RegisterInfo definition for lldb register number %d",
2210 generic_regnum = regnum;
2212 m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds(
2220 if (
m_thread.GetRegisterContext()->ReadRegister(reg_info, reg_value)) {
2225 value = abi_sp->FixCodeAddress(value);
2232 bool pc_register =
false;
2247 value = abi_sp->FixCodeAddress(value);
2276 return m_thread.GetRegisterContext()->ReadRegister(reg_info, value);
2279 bool is_pc_regnum =
false;
2282 is_pc_regnum =
true;
2297 value = abi_sp->FixCodeAddress(reg_value);
2317 return m_thread.GetRegisterContext()->WriteRegister(reg_info, value);
2373 bool read_successfully =
ReadPC (start_pc);
2374 if (read_successfully)
2379 if (
ABISP abi_sp = process_sp->GetABI())
2380 start_pc = abi_sp->FixCodeAddress(start_pc);
2383 return read_successfully;
2395 bool above_trap_handler =
false;
2398 above_trap_handler =
true;
2409 pc = abi_sp->FixCodeAddress(
pc);
2412 above_trap_handler ==
false && (
pc == 0 ||
pc == 1));
2424 va_start(args, fmt);
2426 llvm::SmallString<0> logmsg;
2441 va_start(args, fmt);
2443 llvm::SmallString<0> logmsg;
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
static ConstString GetSymbolOrFunctionName(const SymbolContext &sym_ctx)
A class to represent register numbers, and able to convert between different register numbering schem...
uint32_t GetAsKind(lldb::RegisterKind kind)
lldb::RegisterKind GetRegisterKind() const
uint32_t GetRegisterNumber() const
void init(lldb_private::Thread &thread, lldb::RegisterKind kind, uint32_t num)
virtual lldb::UnwindPlanSP CreateDefaultUnwindPlan()=0
virtual bool GetFallbackRegisterLocation(const RegisterInfo *reg_info, UnwindPlan::Row::AbstractRegisterLocation &unwind_regloc)
virtual lldb::UnwindPlanSP CreateFunctionEntryUnwindPlan()=0
A section + offset based address class.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
bool ResolveFunctionScope(lldb_private::SymbolContext &sym_ctx)
Resolve this address to its containing function.
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
llvm::Triple & GetTriple()
Architecture triple accessor.
bool GetUnwindPlan(Target &target, const Address &addr, UnwindPlan &unwind_plan)
virtual std::unique_ptr< UnwindPlan > GetUnwindPlan(llvm::ArrayRef< AddressRange > ranges, const Address &addr)=0
A uniqued constant string class.
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
llvm::Expected< Value > Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr) const
DWARFExpression * GetMutableExpressionAtAddress(lldb::addr_t func_load_addr=LLDB_INVALID_ADDRESS, lldb::addr_t load_addr=0)
void SetRegisterKind(lldb::RegisterKind reg_kind)
Set the call-frame-info style register kind.
virtual bool AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx)
Ask if the eh_frame information for the given SymbolContext should be relied on even when it's the fi...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Target * GetTargetPtr() const
Returns a pointer to the target object.
Target & GetTargetRef() const
Returns a reference to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
ConstString GetName() const
static lldb::UnwindPlanSP GetRuntimeUnwindPlan(lldb_private::Thread &thread, lldb_private::RegisterContext *regctx, bool &behaves_like_zeroth_frame)
A language runtime may be able to provide a special UnwindPlan for the frame represented by the regis...
A plug-in interface definition class for debugging a process.
virtual bool GetLoadAddressPermissions(lldb::addr_t load_addr, uint32_t &permissions)
Attempt to get the attributes for a region of memory in the process.
lldb::ByteOrder GetByteOrder() const
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
uint32_t GetAddressByteSize() const
virtual DynamicLoader * GetDynamicLoader()
Get the dynamic loader plug-in for this process.
const lldb::ABISP & GetABI()
Target & GetTarget()
Get the target object pointer for this module.
std::optional< UnwindPlan::Row::AbstractRegisterLocation > GetAbstractRegisterLocation(uint32_t lldb_regnum, lldb::RegisterKind &kind)
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
bool CheckIfLoopingStack()
bool GetCFA(lldb::addr_t &cfa)
void InitializeZerothFrame()
lldb_private::Thread & m_thread
void UnwindLogMsg(const char *fmt,...) __attribute__((format(printf
void PropagateTrapHandlerFlagFromUnwindPlan(std::shared_ptr< const UnwindPlan > unwind_plan)
Check if the given unwind plan indicates a signal trap handler, and update frame type and symbol cont...
lldb_private::Address m_start_pc
void void UnwindLogMsgVerbose(const char *fmt,...) __attribute__((format(printf
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
void InitializeNonZerothFrame()
bool ReadRegisterValueFromRegisterLocation(lldb_private::UnwindLLDB::ConcreteRegisterLocation regloc, const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value)
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) override
bool m_behaves_like_zeroth_frame
std::shared_ptr< RegisterContextUnwind > SharedPtr
bool ReadFrameAddress(lldb::RegisterKind register_kind, const UnwindPlan::Row::FAValue &fa, lldb::addr_t &address)
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
void InvalidateAllRegisters() override
lldb::UnwindPlanSP TryAdoptArchitectureUnwindPlan()
RegisterContextUnwind(lldb_private::Thread &thread, const SharedPtr &next_frame, lldb_private::SymbolContext &sym_ctx, uint32_t frame_number, lldb_private::UnwindLLDB &unwind_lldb)
std::shared_ptr< const UnwindPlan > GetFastUnwindPlanForFrame()
std::shared_ptr< const UnwindPlan > m_fast_unwind_plan_sp
std::map< uint32_t, lldb_private::UnwindLLDB::ConcreteRegisterLocation > m_registers
std::shared_ptr< const UnwindPlan > GetFullUnwindPlanForFrame()
bool ReadPC(lldb::addr_t &start_pc)
bool ForceSwitchToFallbackUnwindPlan()
Switch to the fallback unwind plan unconditionally without any safety checks that it is providing bet...
size_t GetRegisterSetCount() override
lldb_private::UnwindLLDB::RegisterSearchResult SavedLocationForRegister(uint32_t lldb_regnum, lldb_private::UnwindLLDB::ConcreteRegisterLocation ®loc)
bool IsTrapHandlerFrame() const
bool ReadGPRValue(lldb::RegisterKind register_kind, uint32_t regnum, lldb::addr_t &value)
lldb_private::UnwindLLDB & m_parent_unwind
bool WriteRegisterValueToRegisterLocation(lldb_private::UnwindLLDB::ConcreteRegisterLocation regloc, const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value)
bool m_all_registers_available
bool TryFallbackUnwindPlan()
If the unwind has to the caller frame has failed, try something else.
std::optional< int > m_current_offset
How far into the function we've executed.
lldb_private::Address m_current_pc
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
lldb::addr_t GetReturnAddressHint(int32_t plan_offset)
std::optional< int > m_current_offset_backed_up_one
bool IsTrapHandlerSymbol(lldb_private::Process *process, const lldb_private::SymbolContext &m_sym_ctx) const
Determines if a SymbolContext is a trap handler or not.
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
void void bool IsUnwindPlanValidForCurrentPC(std::shared_ptr< const UnwindPlan > unwind_plan_sp)
std::shared_ptr< const UnwindPlan > m_fallback_unwind_plan_sp
lldb_private::SymbolContext & m_sym_ctx
bool BehavesLikeZerothFrame() const override
Indicates that this frame is currently executing code, that the PC value is not a return-pc but an ac...
SharedPtr GetPrevFrame() const
std::shared_ptr< const UnwindPlan > m_full_unwind_plan_sp
SharedPtr GetNextFrame() const
size_t GetRegisterCount() override
bool GetStartPC(lldb::addr_t &start_pc)
virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue ®_value)
RegisterContext(Thread &thread, uint32_t concrete_frame_idx)
lldb::TargetSP CalculateTarget() override
virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value)
bool SetUInt(uint64_t uint, uint32_t byte_size)
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
RegisterValue::Type GetType() const
bool Fail() const
Test for error condition.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
const char * GetData() const
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Symbol * symbol
The Symbol for a given query.
ConstString GetName() const
lldb::PlatformSP GetPlatform()
const ArchSpec & GetArchitecture() const
void SetInRegister(uint32_t reg_num)
int GetDWARFExpressionLength() const
const uint8_t * GetDWARFExpressionBytes() const
int32_t GetOffset() const
ValueType GetValueType() const
uint64_t GetConstant() const
uint32_t GetRegisterNumber() const
const FAValue & GetAFAValue() const
const FAValue & GetCFAValue() const
bool GetRegisterInfo(uint32_t reg_num, AbstractRegisterLocation ®ister_location) const
void Dump(Stream &s, const UnwindPlan *unwind_plan, Thread *thread, lldb::addr_t base_addr) const
@ LoadAddress
A load address value.
void SetValueType(ValueType value_type)
#define LLDB_REGNUM_GENERIC_RA
#define LLDB_REGNUM_GENERIC_SP
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
bool VASprintf(llvm::SmallVectorImpl< char > &buf, const char *fmt, va_list args)
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::Platform > PlatformSP
std::shared_ptr< lldb_private::FuncUnwinders > FuncUnwindersSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::UnwindPlan > UnwindPlanSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
std::shared_ptr< lldb_private::Module > ModuleSP
RegisterKind
Register numbering types.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindLLDB
lldb's internal register numbers
Every register is described in detail including its name, alternate name (optional),...
uint32_t byte_size
Size in bytes of the register.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
Registers are grouped into register sets.
An UnwindPlan::Row::AbstractRegisterLocation, combined with the register context and memory for a spe...
@ eRegisterSavedAtHostMemoryLocation
@ eRegisterIsRegisterPlusOffset
@ eRegisterSavedAtMemoryLocation
@ eRegisterInLiveRegisterContext
lldb::addr_t target_memory_location
struct lldb_private::UnwindLLDB::ConcreteRegisterLocation::@250272047141350077067164323227154322243030206067::@235335143127077156324316317012344113206032105310 reg_plus_offset
union lldb_private::UnwindLLDB::ConcreteRegisterLocation::@250272047141350077067164323227154322243030206067 location