#include "ABISysV_riscv.h"
#include <array>
#include <limits>
#include <sstream>
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/DerivedTypes.h"
#include "Utility/RISCV_DWARF_Registers.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/RegisterValue.h"
#define DEFINE_REG_NAME(reg_num) …
#define DEFINE_REG_NAME_STR(reg_name) …
#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) …
#define DEFINE_REGISTER_STUB(dwarf_num, str_name) …
usingnamespacelldb;
usingnamespacelldb_private;
LLDB_PLUGIN_DEFINE_ADV(ABISysV_riscv, ABIRISCV)
namespace {
namespace dwarf {
enum regnums { … };
static const std::array<RegisterInfo, 33> g_register_infos = …;
}
}
static constexpr size_t g_regs_for_args_count = …;
const RegisterInfo *ABISysV_riscv::GetRegisterInfoArray(uint32_t &count) { … }
ABISP
ABISysV_riscv::CreateInstance(ProcessSP process_sp, const ArchSpec &arch) { … }
static inline size_t AugmentArgSize(bool is_rv64, size_t size_in_bytes) { … }
static size_t
TotalArgsSizeInWords(bool is_rv64,
const llvm::ArrayRef<ABI::CallArgument> &args) { … }
static bool UpdateRegister(RegisterContext *reg_ctx,
const lldb::RegisterKind reg_kind,
const uint32_t reg_num, const addr_t value) { … }
static void LogInitInfo(Log &log, const Thread &thread, addr_t sp,
addr_t func_addr, addr_t return_addr,
const llvm::ArrayRef<addr_t> args) { … }
bool ABISysV_riscv::PrepareTrivialCall(Thread &thread, addr_t sp,
addr_t func_addr, addr_t return_addr,
llvm::ArrayRef<addr_t> args) const { … }
bool ABISysV_riscv::PrepareTrivialCall(
Thread &thread, addr_t sp, addr_t pc, addr_t ra, llvm::Type &prototype,
llvm::ArrayRef<ABI::CallArgument> args) const { … }
bool ABISysV_riscv::GetArgumentValues(Thread &thread, ValueList &values) const { … }
Status ABISysV_riscv::SetReturnValueObject(StackFrameSP &frame_sp,
ValueObjectSP &new_value_sp) { … }
template <typename T>
static void SetInteger(Scalar &scalar, uint64_t raw_value, bool is_signed) { … }
static bool SetSizedInteger(Scalar &scalar, uint64_t raw_value,
uint8_t size_in_bytes, bool is_signed) { … }
static bool SetSizedFloat(Scalar &scalar, uint64_t raw_value,
uint8_t size_in_bytes) { … }
static ValueObjectSP GetValObjFromIntRegs(Thread &thread,
const RegisterContextSP ®_ctx,
llvm::Triple::ArchType machine,
uint32_t type_flags,
uint32_t byte_size) { … }
static ValueObjectSP
GetValObjFromFPRegs(Thread &thread, const RegisterContextSP ®_ctx,
llvm::Triple::ArchType machine, uint32_t arch_fp_flags,
uint32_t type_flags, uint32_t byte_size) { … }
ValueObjectSP
ABISysV_riscv::GetReturnValueObjectSimple(Thread &thread,
CompilerType &compiler_type) const { … }
ValueObjectSP
ABISysV_riscv::GetReturnValueObjectImpl(lldb_private::Thread &thread,
llvm::Type &type) const { … }
ValueObjectSP ABISysV_riscv::GetReturnValueObjectImpl(
Thread &thread, CompilerType &return_compiler_type) const { … }
bool ABISysV_riscv::CreateFunctionEntryUnwindPlan(UnwindPlan &unwind_plan) { … }
bool ABISysV_riscv::CreateDefaultUnwindPlan(UnwindPlan &unwind_plan) { … }
bool ABISysV_riscv::RegisterIsVolatile(const RegisterInfo *reg_info) { … }
bool ABISysV_riscv::RegisterIsCalleeSaved(const RegisterInfo *reg_info) { … }
void ABISysV_riscv::Initialize() { … }
void ABISysV_riscv::Terminate() { … }
static uint32_t GetGenericNum(llvm::StringRef name) { … }
void ABISysV_riscv::AugmentRegisterInfo(
std::vector<lldb_private::DynamicRegisterInfo::Register> ®s) { … }