Path: blob/main/contrib/llvm-project/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
39688 views
//===-- ItaniumABILanguageRuntime.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_LANGUAGERUNTIME_CPLUSPLUS_ITANIUMABI_ITANIUMABILANGUAGERUNTIME_H9#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_ITANIUMABI_ITANIUMABILANGUAGERUNTIME_H1011#include <map>12#include <mutex>13#include <vector>1415#include "lldb/Breakpoint/BreakpointResolver.h"16#include "lldb/Core/Value.h"17#include "lldb/Symbol/Type.h"18#include "lldb/Target/LanguageRuntime.h"19#include "lldb/lldb-private.h"2021#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"2223namespace lldb_private {2425class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime {26public:27~ItaniumABILanguageRuntime() override = default;2829// Static Functions30static void Initialize();3132static void Terminate();3334static lldb_private::LanguageRuntime *35CreateInstance(Process *process, lldb::LanguageType language);3637static llvm::StringRef GetPluginNameStatic() { return "itanium"; }3839static char ID;4041bool isA(const void *ClassID) const override {42return ClassID == &ID || CPPLanguageRuntime::isA(ClassID);43}4445static bool classof(const LanguageRuntime *runtime) {46return runtime->isA(&ID);47}484950llvm::Expected<LanguageRuntime::VTableInfo>51GetVTableInfo(ValueObject &in_value, bool check_type) override;5253bool GetDynamicTypeAndAddress(ValueObject &in_value,54lldb::DynamicValueType use_dynamic,55TypeAndOrName &class_type_or_name,56Address &address,57Value::ValueType &value_type) override;5859TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,60ValueObject &static_value) override;6162bool CouldHaveDynamicValue(ValueObject &in_value) override;6364void SetExceptionBreakpoints() override;6566void ClearExceptionBreakpoints() override;6768bool ExceptionBreakpointsAreSet() override;6970bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;7172lldb::BreakpointResolverSP73CreateExceptionResolver(const lldb::BreakpointSP &bkpt,74bool catch_bp, bool throw_bp) override;7576lldb::SearchFilterSP CreateExceptionSearchFilter() override;7778lldb::ValueObjectSP GetExceptionObjectForThread(79lldb::ThreadSP thread_sp) override;8081// PluginInterface protocol82llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }8384protected:85lldb::BreakpointResolverSP86CreateExceptionResolver(const lldb::BreakpointSP &bkpt,87bool catch_bp, bool throw_bp, bool for_expressions);8889lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp,90bool for_expressions,91bool is_internal);9293private:94typedef std::map<lldb_private::Address, TypeAndOrName> DynamicTypeCache;95typedef std::map<lldb_private::Address, VTableInfo> VTableInfoCache;9697ItaniumABILanguageRuntime(Process *process)98: // Call CreateInstance instead.99lldb_private::CPPLanguageRuntime(process) {}100101lldb::BreakpointSP m_cxx_exception_bp_sp;102DynamicTypeCache m_dynamic_type_map;103VTableInfoCache m_vtable_info_map;104std::mutex m_mutex;105106TypeAndOrName GetTypeInfo(ValueObject &in_value,107const VTableInfo &vtable_info);108109TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);110111void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,112const TypeAndOrName &type_info);113114// Check if a compiler type has a vtable.115//116// If the compiler type is a pointer or a reference, this function will check117// if the pointee type has a vtable, else it will check the type passed in.118//119// Returns an error if the type of the value doesn't have a vtable with an120// explanation why, or returns an Error::success() if the type has a vtable.121llvm::Error TypeHasVTable(CompilerType compiler_type);122};123124} // namespace lldb_private125126#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_ITANIUMABI_ITANIUMABILANGUAGERUNTIME_H127128129