112 lines · c
1//===-- GNUstepObjCRuntime.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_OBJC_GNUSTEPOBJCRUNTIME_GNUSTEPOBJCRUNTIME_H10#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_GNUSTEPOBJCRUNTIME_GNUSTEPOBJCRUNTIME_H11 12#include "lldb/Target/LanguageRuntime.h"13#include "lldb/lldb-private.h"14 15#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"16 17#include "llvm/ADT/StringRef.h"18#include "llvm/Support/Error.h"19 20#include <optional>21 22namespace lldb_private {23 24class GNUstepObjCRuntime : public lldb_private::ObjCLanguageRuntime {25public:26 ~GNUstepObjCRuntime() override;27 28 //29 // PluginManager, PluginInterface and LLVM RTTI implementation30 //31 32 static char ID;33 34 static void Initialize();35 36 static void Terminate();37 38 static lldb_private::LanguageRuntime *39 CreateInstance(Process *process, lldb::LanguageType language);40 41 static llvm::StringRef GetPluginNameStatic() {42 return "gnustep-objc-libobjc2";43 }44 45 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }46 47 void ModulesDidLoad(const ModuleList &module_list) override;48 49 bool isA(const void *ClassID) const override {50 return ClassID == &ID || ObjCLanguageRuntime::isA(ClassID);51 }52 53 static bool classof(const LanguageRuntime *runtime) {54 return runtime->isA(&ID);55 }56 57 //58 // LanguageRuntime implementation59 //60 llvm::Error GetObjectDescription(Stream &str, Value &value,61 ExecutionContextScope *exe_scope) override;62 63 llvm::Error GetObjectDescription(Stream &str, ValueObject &object) override;64 65 bool CouldHaveDynamicValue(ValueObject &in_value) override;66 67 bool GetDynamicTypeAndAddress(ValueObject &in_value,68 lldb::DynamicValueType use_dynamic,69 TypeAndOrName &class_type_or_name,70 Address &address, Value::ValueType &value_type,71 llvm::ArrayRef<uint8_t> &local_buffer) override;72 73 TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,74 ValueObject &static_value) override;75 76 lldb::BreakpointResolverSP77 CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp,78 bool throw_bp) override;79 80 lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,81 bool stop_others) override;82 83 //84 // ObjCLanguageRuntime implementation85 //86 87 bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override;88 89 bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override;90 91 bool HasReadObjCLibrary() override { return m_objc_module_sp != nullptr; }92 93 llvm::Expected<std::unique_ptr<UtilityFunction>>94 CreateObjectChecker(std::string name, ExecutionContext &exe_ctx) override;95 96 ObjCRuntimeVersions GetRuntimeVersion() const override {97 return ObjCRuntimeVersions::eGNUstep_libobjc2;98 }99 100 void UpdateISAToDescriptorMapIfNeeded() override;101 102protected:103 // Call CreateInstance instead.104 GNUstepObjCRuntime(Process *process);105 106 lldb::ModuleSP m_objc_module_sp;107};108 109} // namespace lldb_private110 111#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_GNUSTEPOBJCRUNTIME_GNUSTEPOBJCRUNTIME_H112