Path: blob/main/contrib/llvm-project/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
39644 views
//===-- CPPLanguageRuntime.h1//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_CPPLANGUAGERUNTIME_H9#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_CPPLANGUAGERUNTIME_H1011#include <vector>1213#include "llvm/ADT/StringMap.h"1415#include "lldb/Core/PluginInterface.h"16#include "lldb/Target/LanguageRuntime.h"17#include "lldb/lldb-private.h"1819namespace lldb_private {2021class CPPLanguageRuntime : public LanguageRuntime {22public:23enum class LibCppStdFunctionCallableCase {24Lambda = 0,25CallableObject,26FreeOrMemberFunction,27Invalid28};2930struct LibCppStdFunctionCallableInfo {31Symbol callable_symbol;32Address callable_address;33LineEntry callable_line_entry;34lldb::addr_t member_f_pointer_value = 0u;35LibCppStdFunctionCallableCase callable_case =36LibCppStdFunctionCallableCase::Invalid;37};3839LibCppStdFunctionCallableInfo40FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp);4142static char ID;4344bool isA(const void *ClassID) const override {45return ClassID == &ID || LanguageRuntime::isA(ClassID);46}4748static bool classof(const LanguageRuntime *runtime) {49return runtime->isA(&ID);50}5152lldb::LanguageType GetLanguageType() const override {53return lldb::eLanguageTypeC_plus_plus;54}5556static CPPLanguageRuntime *Get(Process &process) {57return llvm::cast_or_null<CPPLanguageRuntime>(58process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus));59}6061llvm::Error GetObjectDescription(Stream &str, ValueObject &object) override;6263llvm::Error GetObjectDescription(Stream &str, Value &value,64ExecutionContextScope *exe_scope) override;6566/// Obtain a ThreadPlan to get us into C++ constructs such as std::function.67///68/// \param[in] thread69/// Current thrad of execution.70///71/// \param[in] stop_others72/// True if other threads should pause during execution.73///74/// \return75/// A ThreadPlan Shared pointer76lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,77bool stop_others) override;7879bool IsAllowedRuntimeValue(ConstString name) override;80protected:81// Classes that inherit from CPPLanguageRuntime can see and modify these82CPPLanguageRuntime(Process *process);8384private:85using OperatorStringToCallableInfoMap =86llvm::StringMap<CPPLanguageRuntime::LibCppStdFunctionCallableInfo>;8788OperatorStringToCallableInfoMap CallableLookupCache;89};9091} // namespace lldb_private9293#endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_CPPLANGUAGERUNTIME_H949596