Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h
39646 views
//===-- ABISysV_mips64.h ----------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_ABI_MIPS_ABISYSV_MIPS64_H9#define LLDB_SOURCE_PLUGINS_ABI_MIPS_ABISYSV_MIPS64_H1011#include "lldb/Target/ABI.h"12#include "lldb/lldb-private.h"1314class ABISysV_mips64 : public lldb_private::RegInfoBasedABI {15public:16~ABISysV_mips64() override = default;1718size_t GetRedZoneSize() const override;1920bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,21lldb::addr_t functionAddress,22lldb::addr_t returnAddress,23llvm::ArrayRef<lldb::addr_t> args) const override;2425bool GetArgumentValues(lldb_private::Thread &thread,26lldb_private::ValueList &values) const override;2728lldb_private::Status29SetReturnValueObject(lldb::StackFrameSP &frame_sp,30lldb::ValueObjectSP &new_value) override;3132lldb::ValueObjectSP33GetReturnValueObjectImpl(lldb_private::Thread &thread,34lldb_private::CompilerType &type) const override;3536bool37CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;3839bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;4041bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;4243bool IsSoftFloat(uint32_t fp_flag) const;4445// The SysV mips ABI requires that stack frames be 16 byte aligned.46// When there is a trap handler on the stack, e.g. _sigtramp in userland47// code, we've seen that the stack pointer is often not aligned properly48// before the handler is invoked. This means that lldb will stop the unwind49// early -- before the function which caused the trap.50//51// To work around this, we relax that alignment to be just word-size52// (8-bytes).53// Allowing the trap handlers for user space would be easy (_sigtramp) but54// in other environments there can be a large number of different functions55// involved in async traps.56bool CallFrameAddressIsValid(lldb::addr_t cfa) override {57// Make sure the stack call frame addresses are 8 byte aligned58if (cfa & (8ull - 1ull))59return false; // Not 8 byte aligned60if (cfa == 0)61return false; // Zero is not a valid stack address62return true;63}6465bool CodeAddressIsValid(lldb::addr_t pc) override {66if (pc & (4ull - 1ull))67return false; // Not 4 byte aligned6869// Anything else if fair game..70return true;71}7273const lldb_private::RegisterInfo *74GetRegisterInfoArray(uint32_t &count) override;7576// Static Functions7778static void Initialize();7980static void Terminate();8182static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);8384static llvm::StringRef GetPluginNameStatic() { return "sysv-mips64"; }8586// PluginInterface protocol8788llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }8990protected:91void CreateRegisterMapIfNeeded();9293lldb::ValueObjectSP94GetReturnValueObjectSimple(lldb_private::Thread &thread,95lldb_private::CompilerType &ast_type) const;9697bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info);9899private:100using lldb_private::RegInfoBasedABI::RegInfoBasedABI; // Call CreateInstance instead.101};102103#endif // LLDB_SOURCE_PLUGINS_ABI_MIPS_ABISYSV_MIPS64_H104105106