Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
39654 views
//===-- ABISysV_arm64.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_AARCH64_ABISYSV_ARM64_H9#define LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABISYSV_ARM64_H1011#include "Plugins/ABI/AArch64/ABIAArch64.h"12#include "lldb/lldb-private.h"1314class ABISysV_arm64 : public ABIAArch64 {15public:16~ABISysV_arm64() 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;3132bool33CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;3435bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;3637bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;3839// The arm64 ABI requires that stack frames be 16 byte aligned.40// When there is a trap handler on the stack, e.g. _sigtramp in userland41// code, we've seen that the stack pointer is often not aligned properly42// before the handler is invoked. This means that lldb will stop the unwind43// early -- before the function which caused the trap.44//45// To work around this, we relax that alignment to be just word-size46// (8-bytes).47// Allowing the trap handlers for user space would be easy (_sigtramp) but48// in other environments there can be a large number of different functions49// involved in async traps.50bool CallFrameAddressIsValid(lldb::addr_t cfa) override {51// Make sure the stack call frame addresses are 8 byte aligned52if (cfa & (8ull - 1ull))53return false; // Not 8 byte aligned54if (cfa == 0)55return false; // Zero is not a valid stack address56return true;57}5859bool CodeAddressIsValid(lldb::addr_t pc) override {60if (pc & (4ull - 1ull))61return false; // Not 4 byte aligned6263// Anything else if fair game..64return true;65}6667bool GetPointerReturnRegister(const char *&name) override;6869lldb::addr_t FixAddress(lldb::addr_t pc, lldb::addr_t mask) override;7071// Static Functions7273static void Initialize();7475static void Terminate();7677static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);7879static llvm::StringRef GetPluginNameStatic() { return "SysV-arm64"; }8081// PluginInterface protocol8283llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }8485lldb::addr_t FixCodeAddress(lldb::addr_t pc) override;86lldb::addr_t FixDataAddress(lldb::addr_t pc) override;8788protected:89lldb::ValueObjectSP90GetReturnValueObjectImpl(lldb_private::Thread &thread,91lldb_private::CompilerType &ast_type) const override;9293private:94using ABIAArch64::ABIAArch64; // Call CreateInstance instead.95};9697#endif // LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABISYSV_ARM64_H9899100