20#include "llvm/MC/TargetRegistry.h"
31 for (uint32_t idx = 0;
35 abi_sp = create_callback(process_sp, arch);
50 if (register_info_array) {
52 for (i = 0; i < count; ++i) {
53 const char *reg_name = register_info_array[i].
name;
54 if (reg_name == name) {
55 info = register_info_array[i];
59 for (i = 0; i < count; ++i) {
60 const char *reg_alt_name = register_info_array[i].
alt_name;
61 if (reg_alt_name == name) {
62 info = register_info_array[i];
71 bool persistent)
const {
78 if (!return_valobj_sp)
79 return return_valobj_sp;
93 if (!persistent_expression_state)
102 if (return_valobj_sp->GetIsConstant()) {
103 const_valobj_sp = return_valobj_sp;
104 const_valobj_sp->SetName(persistent_variable_name);
107 return_valobj_sp->CreateConstantValue(persistent_variable_name);
111 return_valobj_sp = const_valobj_sp;
117 assert(expr_variable_sp);
121 const Value &result_value = live_valobj_sp->GetValue();
131 expr_variable_sp->m_flags |=
133 expr_variable_sp->m_flags |=
135 expr_variable_sp->m_flags |=
139 expr_variable_sp->m_live_sp = live_valobj_sp;
140 expr_variable_sp->m_flags |=
145 return_valobj_sp = expr_variable_sp->GetValueObject();
147 return return_valobj_sp;
153 addr_t mask = process_sp->GetCodeAddressMask();
163 bool is_highmem =
pc & (1ULL << 63);
164 return is_highmem ?
pc | mask :
pc & (~mask);
169 addr_t mask = process_sp->GetDataAddressMask();
179 bool is_highmem =
pc & (1ULL << 63);
180 return is_highmem ?
pc | mask :
pc & (~mask);
184 bool persistent)
const {
187 return return_valobj_sp;
195 llvm::Type &ir_type)
const {
200 return return_valobj_sp;
206 llvm::ArrayRef<ABI::CallArgument> args)
const {
208 llvm_unreachable(
"Should never get here!");
235 std::string triple = arch.
GetTriple().getTriple();
236 std::string lookup_error;
237 const llvm::Target *target =
238 llvm::TargetRegistry::lookupTarget(triple, lookup_error);
241 "Failed to create an llvm target for {0}: {1}", triple,
245 std::unique_ptr<llvm::MCRegisterInfo> info_up(
246 target->createMCRegInfo(triple));
252 std::vector<DynamicRegisterInfo::Register> ®s) {
272 std::vector<DynamicRegisterInfo::Register> ®s) {
278 info.regnum_ehframe = eh;
280 info.regnum_dwarf =
dwarf;
282 info.regnum_generic =
GetGenericNum(info.name.GetStringRef());
286std::pair<uint32_t, uint32_t>
288 std::string mc_name =
GetMCName(name.str());
289 for (
char &c : mc_name)
306 llvm::StringRef to_prefix) {
307 llvm::StringRef name_ref = name;
308 if (!name_ref.consume_front(from_prefix))
311 if (name_ref.empty() || to_integer(name_ref, _, 10))
312 name = (to_prefix + name_ref).str();
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
virtual bool GetFallbackRegisterLocation(const RegisterInfo *reg_info, UnwindPlan::Row::AbstractRegisterLocation &unwind_regloc)
virtual lldb::ValueObjectSP GetReturnValueObjectImpl(Thread &thread, CompilerType &ast_type) const =0
static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch)
virtual bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp, lldb::addr_t functionAddress, lldb::addr_t returnAddress, llvm::ArrayRef< lldb::addr_t > args) const =0
lldb::ValueObjectSP GetReturnValueObject(Thread &thread, CompilerType &type, bool persistent=true) const
static std::unique_ptr< llvm::MCRegisterInfo > MakeMCRegisterInfo(const ArchSpec &arch)
Utility function to construct a MCRegisterInfo using the ArchSpec triple.
virtual bool RegisterIsVolatile(const RegisterInfo *reg_info)=0
std::unique_ptr< llvm::MCRegisterInfo > m_mc_register_info_up
virtual lldb::addr_t FixCodeAddress(lldb::addr_t pc)
Some targets might use bits in a code address to indicate a mode switch.
lldb::ProcessSP GetProcessSP() const
Request to get a Process shared pointer.
virtual lldb::addr_t FixDataAddress(lldb::addr_t pc)
An architecture specification class.
llvm::Triple & GetTriple()
Architecture triple accessor.
Generic representation of a type in a programming language.
lldb::LanguageType GetMinimumLanguage()
A uniqued constant string class.
@ EVIsLLDBAllocated
This variable is resident in a location specifically allocated for it by LLDB in the target process.
@ EVNeedsAllocation
Space for this variable has yet to be allocated in the target process.
@ EVIsProgramReference
This variable is a reference to a (possibly invalid) area managed by the target program.
@ EVIsFreezeDried
This variable's authoritative version is in m_frozen_sp (for example, for statically-computed results...
virtual std::string GetMCName(std::string reg)
For the given (capitalized) lldb register name, return the name of this register in the MCRegisterInf...
void AugmentRegisterInfo(std::vector< DynamicRegisterInfo::Register > ®s) override
virtual uint32_t GetGenericNum(llvm::StringRef reg)=0
Return the generic number of the given register.
virtual std::pair< uint32_t, uint32_t > GetEHAndDWARFNums(llvm::StringRef reg)
Return eh_frame and dwarf numbers for the given register.
static void MapRegisterName(std::string ®, llvm::StringRef from_prefix, llvm::StringRef to_prefix)
If the register name is of the form "<from_prefix>[<number>]" then change the name to "<to_prefix>[<n...
virtual lldb::ExpressionVariableSP CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp)=0
virtual ConstString GetNextPersistentVariableName(bool is_error=false)=0
Return a new persistent variable name with the specified prefix.
static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx)
bool GetRegisterInfoByName(llvm::StringRef name, RegisterInfo &info)
virtual const RegisterInfo * GetRegisterInfoArray(uint32_t &count)=0
void AugmentRegisterInfo(std::vector< DynamicRegisterInfo::Register > ®s) override
PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language)
lldb::TargetSP CalculateTarget() override
void SetIsCFAPlusOffset(int32_t offset)
@ HostAddress
A host address value (for memory in the process that < A is using liblldb).
@ FileAddress
A file address value.
@ LoadAddress
A load address value.
@ Scalar
A raw scalar value.
ValueType GetValueType() const
#define LLDB_INVALID_ADDRESS_MASK
Address Mask Bits not used for addressing are set to 1 in the mask; all mask bits set is an invalid v...
#define LLDB_REGNUM_GENERIC_SP
#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.
lldb::ABISP(* ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch)
std::shared_ptr< lldb_private::ABI > ABISP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
std::shared_ptr< lldb_private::Process > ProcessSP
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindDWARF
the register numbers seen DWARF
@ eRegisterKindEHFrame
the register numbers seen in eh_frame
Every register is described in detail including its name, alternate name (optional),...
const char * alt_name
Alternate name of this register, can be NULL.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
const char * name
Name of this register, can't be NULL.