18#include "llvm/ADT/STLExtras.h"
19#include "llvm/DebugInfo/DIContext.h"
20#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
21#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
61 const uint8_t *
opcodes, uint32_t len) {
70 const uint8_t *
opcodes, uint32_t len) {
76static std::optional<std::pair<lldb::ByteOrder, uint32_t>>
80 ProcessSP process_sp = thread->GetProcess();
83 ArchSpec arch = process_sp->GetTarget().GetArchitecture();
90 order_and_width->second);
91 llvm::DWARFExpression E(data, order_and_width->second,
92 llvm::dwarf::DWARF32);
93 printDwarfExpression(&E, s.
AsRawOstream(), llvm::DIDumpOptions(),
nullptr);
100 Thread *thread,
bool verbose)
const {
166 Thread *thread, uint32_t reg_num) {
171 s.
Printf(
"reg(%u)", reg_num);
253 const bool verbose =
false;
254 idx->second.Dump(s, unwind_plan,
this, thread, verbose);
266 register_location = pos->second;
314 uint32_t reg_num,
bool can_replace,
bool can_replace_only_if_unspecified) {
321 if (can_replace_only_if_unspecified && !pos->second.IsUnspecified())
342 uint32_t other_reg_num,
365 uint32_t reg_num,
const uint8_t *opcodes, uint32_t len,
bool can_replace) {
416 assert(it->GetOffset() == row.
GetOffset());
417 if (replace_existing)
418 *it = std::move(row);
430 return &*std::prev(it);
441 "error: UnwindPlan::GetRowAtIndex(idx = {0}) invalid index "
442 "(number rows is {1})",
450 "UnwindPlan::GetLastRow() when rows are empty");
464 "UnwindPlan is invalid -- no unwind rows for UnwindPlan "
465 "'%s' at address %s",
469 "UnwindPlan is invalid -- no unwind rows for UnwindPlan '%s'",
487 "UnwindPlan is invalid -- no CFA register defined in row 0 "
488 "for UnwindPlan '%s' at address %s",
492 "UnwindPlan is invalid -- no CFA register defined in row 0 "
493 "for UnwindPlan '%s'",
513 s.
Printf(
"This UnwindPlan originally sourced from %s\n",
516 s.
Printf(
"This UnwindPlan is sourced from the compiler: ");
525 s.
Printf(
"not specified.\n");
528 s.
Printf(
"This UnwindPlan is valid at all instruction locations: ");
537 s.
Printf(
"not specified.\n");
540 s.
Printf(
"This UnwindPlan is for a trap handler function: ");
549 s.
Printf(
"not specified.\n");
553 s.
PutCString(
"Address range of this UnwindPlan: ");
554 TargetSP target_sp(thread->CalculateTarget());
559 for (
const auto &[index, row] : llvm::enumerate(
m_row_list)) {
560 s.
Format(
"row[{0}]: ", index);
561 row.Dump(s,
this, thread, base_addr);
573 uint32_t unwind_reg)
const {
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
static std::optional< std::pair< lldb::ByteOrder, uint32_t > > GetByteOrderAndAddrSize(Thread *thread)
static void DumpRegisterName(Stream &s, const UnwindPlan *unwind_plan, Thread *thread, uint32_t reg_num)
static void DumpDWARFExpr(Stream &s, llvm::ArrayRef< uint8_t > expr, Thread *thread)
A section + offset based address range class.
bool ContainsFileAddress(const Address &so_addr) const
Check if a section offset address is contained in this range.
A section + offset based address class.
@ DumpStyleSectionNameOffset
Display as the section name + offset.
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX, bool all_ranges=false, std::optional< Stream::HighlightSettings > settings=std::nullopt) const
Dump a description of this object to a Stream.
bool IsValid() const
Check if the object state is valid.
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
A uniqued constant string class.
virtual uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num)
Convert from a given register numbering scheme to the lldb register numbering scheme.
virtual const RegisterInfo * GetRegisterInfoAtIndex(size_t reg)=0
const char * GetData() const
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
void SetIsConstant(uint64_t value)
union lldb_private::UnwindPlan::Row::AbstractRegisterLocation::@225201031247227020145212152105175123074115111335 m_location
void SetIsDWARFExpression(const uint8_t *opcodes, uint32_t len)
void SetAtCFAPlusOffset(int32_t offset)
void Dump(Stream &s, const UnwindPlan *unwind_plan, const UnwindPlan::Row *row, Thread *thread, bool verbose) const
struct lldb_private::UnwindPlan::Row::AbstractRegisterLocation::@225201031247227020145212152105175123074115111335::@274041013243136340101366216255135217113225313354 expr
void SetInRegister(uint32_t reg_num)
bool operator==(const AbstractRegisterLocation &rhs) const
void SetIsCFAPlusOffset(int32_t offset)
void SetAtDWARFExpression(const uint8_t *opcodes, uint32_t len)
void Dump(Stream &s, const UnwindPlan *unwind_plan, Thread *thread) const
bool operator==(const FAValue &rhs) const
union lldb_private::UnwindPlan::Row::FAValue::@131017011041341220266230364377327125216211117206 m_value
struct lldb_private::UnwindPlan::Row::FAValue::@131017011041341220266230364377327125216211117206::@302167274322137005337330072303015152064264174351 expr
struct lldb_private::UnwindPlan::Row::FAValue::@131017011041341220266230364377327125216211117206::@224067032354375070144176053364000367340265231113 reg
ValueType GetValueType() const
bool SetRegisterLocationToIsConstant(uint32_t reg_num, uint64_t constant, bool can_replace)
bool SetRegisterLocationToIsCFAPlusOffset(uint32_t reg_num, int32_t offset, bool can_replace)
bool SetRegisterLocationToSame(uint32_t reg_num, bool must_replace)
bool SetRegisterLocationToIsDWARFExpression(uint32_t reg_num, const uint8_t *opcodes, uint32_t len, bool can_replace)
This method does not make a copy of the opcodes memory, it is assumed to have the same lifetime as th...
bool SetRegisterLocationToAtCFAPlusOffset(uint32_t reg_num, int32_t offset, bool can_replace)
int64_t GetOffset() const
const FAValue & GetCFAValue() const
collection m_register_locations
bool m_unspecified_registers_are_undefined
bool GetRegisterInfo(uint32_t reg_num, AbstractRegisterLocation ®ister_location) const
bool SetRegisterLocationToRegister(uint32_t reg_num, uint32_t other_reg_num, bool can_replace)
void Dump(Stream &s, const UnwindPlan *unwind_plan, Thread *thread, lldb::addr_t base_addr) const
bool SetRegisterLocationToUnspecified(uint32_t reg_num, bool can_replace)
void RemoveRegisterInfo(uint32_t reg_num)
bool operator==(const Row &rhs) const
bool SetRegisterLocationToUndefined(uint32_t reg_num, bool can_replace, bool can_replace_only_if_unspecified)
void SetRegisterInfo(uint32_t reg_num, const AbstractRegisterLocation register_location)
std::vector< Row > m_row_list
lldb::RegisterKind m_register_kind
UnwindPlan(lldb::RegisterKind reg_kind)
const RegisterInfo * GetRegisterInfo(Thread *thread, uint32_t reg_num) const
lldb_private::LazyBool m_plan_is_for_signal_trap
bool IsValidRowIndex(uint32_t idx) const
void InsertRow(Row row, bool replace_existing=false)
lldb_private::LazyBool m_plan_is_valid_at_all_instruction_locations
std::vector< AddressRange > m_plan_valid_ranges
const UnwindPlan::Row * GetRowForFunctionOffset(std::optional< int64_t > offset) const
bool PlanValidAtAddress(Address addr) const
lldb_private::ConstString m_source_name
const UnwindPlan::Row * GetLastRow() const
void SetSourceName(const char *)
void Dump(Stream &s, Thread *thread, lldb::addr_t base_addr) const
lldb_private::ConstString GetSourceName() const
const UnwindPlan::Row * GetRowAtIndex(uint32_t idx) const
lldb_private::LazyBool m_plan_is_sourced_from_compiler
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_REGNUM
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.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Target > TargetSP
@ eRegisterKindLLDB
lldb's internal register numbers
bool operator()(const UnwindPlan::Row &a, int64_t b) const
bool operator()(int64_t a, const UnwindPlan::Row &b) const
Every register is described in detail including its name, alternate name (optional),...
const char * name
Name of this register, can't be NULL.