brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 7abf2f8 Raw
128 lines · c
1//===-- ItaniumABILanguageRuntime.h -----------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_ITANIUMABI_ITANIUMABILANGUAGERUNTIME_H10#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_ITANIUMABI_ITANIUMABILANGUAGERUNTIME_H11 12#include <map>13#include <mutex>14#include <vector>15 16#include "lldb/Breakpoint/BreakpointResolver.h"17#include "lldb/Core/Value.h"18#include "lldb/Symbol/Type.h"19#include "lldb/Target/LanguageRuntime.h"20#include "lldb/lldb-private.h"21 22#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"23 24namespace lldb_private {25 26class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime {27public:28  ~ItaniumABILanguageRuntime() override = default;29 30  // Static Functions31  static void Initialize();32 33  static void Terminate();34 35  static lldb_private::LanguageRuntime *36  CreateInstance(Process *process, lldb::LanguageType language);37 38  static llvm::StringRef GetPluginNameStatic() { return "itanium"; }39 40  static char ID;41 42  bool isA(const void *ClassID) const override {43    return ClassID == &ID || CPPLanguageRuntime::isA(ClassID);44  }45 46  static bool classof(const LanguageRuntime *runtime) {47    return runtime->isA(&ID);48  }49 50 51  llvm::Expected<LanguageRuntime::VTableInfo>52  GetVTableInfo(ValueObject &in_value, bool check_type) override;53 54  bool GetDynamicTypeAndAddress(ValueObject &in_value,55                                lldb::DynamicValueType use_dynamic,56                                TypeAndOrName &class_type_or_name,57                                Address &address, Value::ValueType &value_type,58                                llvm::ArrayRef<uint8_t> &local_buffer) override;59 60  TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,61                                 ValueObject &static_value) override;62 63  bool CouldHaveDynamicValue(ValueObject &in_value) override;64 65  void SetExceptionBreakpoints() override;66 67  void ClearExceptionBreakpoints() override;68 69  bool ExceptionBreakpointsAreSet() override;70 71  bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;72 73  lldb::BreakpointResolverSP74  CreateExceptionResolver(const lldb::BreakpointSP &bkpt,75                          bool catch_bp, bool throw_bp) override;76 77  lldb::SearchFilterSP CreateExceptionSearchFilter() override;78 79  lldb::ValueObjectSP GetExceptionObjectForThread(80      lldb::ThreadSP thread_sp) override;81 82  // PluginInterface protocol83  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }84 85protected:86  lldb::BreakpointResolverSP87  CreateExceptionResolver(const lldb::BreakpointSP &bkpt,88                          bool catch_bp, bool throw_bp, bool for_expressions);89 90  lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp,91                                               bool for_expressions,92                                               bool is_internal);93 94private:95  typedef std::map<lldb_private::Address, TypeAndOrName> DynamicTypeCache;96  typedef std::map<lldb_private::Address, VTableInfo> VTableInfoCache;97 98  ItaniumABILanguageRuntime(Process *process)99      : // Call CreateInstance instead.100        lldb_private::CPPLanguageRuntime(process) {}101 102  lldb::BreakpointSP m_cxx_exception_bp_sp;103  DynamicTypeCache m_dynamic_type_map;104  VTableInfoCache m_vtable_info_map;105  std::mutex m_mutex;106 107  TypeAndOrName GetTypeInfo(ValueObject &in_value,108                            const VTableInfo &vtable_info);109 110  TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);111 112  void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,113                          const TypeAndOrName &type_info);114 115  // Check if a compiler type has a vtable.116  //117  // If the compiler type is a pointer or a reference, this function will check118  // if the pointee type has a vtable, else it will check the type passed in.119  //120  // Returns an error if the type of the value doesn't have a vtable with an121  // explanation why, or returns an Error::success() if the type has a vtable.122  llvm::Error TypeHasVTable(CompilerType compiler_type);123};124 125} // namespace lldb_private126 127#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_ITANIUMABI_ITANIUMABILANGUAGERUNTIME_H128