Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
39654 views
//===-- ABIMacOSX_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_ABIMACOSX_ARM64_H9#define LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABIMACOSX_ARM64_H1011#include "Plugins/ABI/AArch64/ABIAArch64.h"12#include "lldb/Utility/ConstString.h"13#include "lldb/lldb-private.h"1415class ABIMacOSX_arm64 : public ABIAArch64 {16public:17~ABIMacOSX_arm64() override = default;1819size_t GetRedZoneSize() const override;2021bool PrepareTrivialCall(lldb_private::Thread &thread, lldb::addr_t sp,22lldb::addr_t functionAddress,23lldb::addr_t returnAddress,24llvm::ArrayRef<lldb::addr_t> args) const override;2526bool GetArgumentValues(lldb_private::Thread &thread,27lldb_private::ValueList &values) const override;2829bool30CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;3132bool CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;3334bool RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;3536// The arm64 ABI requires that stack frames be 16 byte aligned.37// When there is a trap handler on the stack, e.g. _sigtramp in userland38// code, we've seen that the stack pointer is often not aligned properly39// before the handler is invoked. This means that lldb will stop the unwind40// early -- before the function which caused the trap.41//42// To work around this, we relax that alignment to be just word-size43// (8-bytes).44// Allowing the trap handlers for user space would be easy (_sigtramp) but45// in other environments there can be a large number of different functions46// involved in async traps.47bool CallFrameAddressIsValid(lldb::addr_t cfa) override {48// Make sure the stack call frame addresses are 8 byte aligned49if (cfa & (8ull - 1ull))50return false; // Not 8 byte aligned51if (cfa == 0)52return false; // Zero is not a valid stack address53return true;54}5556bool CodeAddressIsValid(lldb::addr_t pc) override {57if (pc & (4ull - 1ull))58return false; // Not 4 byte aligned5960// Anything else if fair game..61return true;62}6364lldb::addr_t FixCodeAddress(lldb::addr_t pc) override;65lldb::addr_t FixDataAddress(lldb::addr_t pc) override;6667// Static Functions6869static void Initialize();7071static void Terminate();7273static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch);7475// PluginInterface protocol7677static llvm::StringRef GetPluginNameStatic() { return "ABIMacOSX_arm64"; }7879llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }8081lldb_private::Status82SetReturnValueObject(lldb::StackFrameSP &frame_sp,83lldb::ValueObjectSP &new_value) override;8485protected:86lldb::ValueObjectSP87GetReturnValueObjectImpl(lldb_private::Thread &thread,88lldb_private::CompilerType &ast_type) const override;8990private:91using ABIAArch64::ABIAArch64; // Call CreateInstance instead.92};9394#endif // LLDB_SOURCE_PLUGINS_ABI_AARCH64_ABIMACOSX_ARM64_H959697