LLDB mainline
CommonABIRuntime.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_COMMONABIRUNTIME_H
10#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_CPLUSPLUS_COMMONABIRUNTIME_H
11
13#include "lldb/Target/Process.h"
15
16#include <map>
17#include <mutex>
18
19namespace lldb_private {
20
22public:
23 virtual ~CommonABIRuntime() = default;
24
25 virtual llvm::StringRef GetName() const = 0;
26
27 virtual bool IsVTableSymbol(Mangled &mangled) const { return false; }
28
30 ValueObject &in_value, lldb::DynamicValueType use_dynamic,
31 const LanguageRuntime::VTableInfo &vtable_info,
32 TypeAndOrName &class_type_or_name, Address &dynamic_address) {
33 return false;
34 }
35
36 virtual void
37 AppendExceptionBreakpointFunctions(std::vector<const char *> &names,
38 bool catch_bp, bool throw_bp,
39 bool for_expressions) {}
40
42 const Target &target) {}
43
46 return {};
47 }
48
49protected:
50 CommonABIRuntime(Process *process);
51
52 /// Find a type by its name, preferably in `preferred_module`.
53 ///
54 /// `any_found` will be set to `true` if any type with the name is found.
55 /// Even if a type with the name was found, this function may return an empty
56 /// `TypeSP` if the type is not a C++ type.
57 lldb::TypeSP LookupTypeByName(llvm::StringRef type_name,
58 lldb::ModuleSP preferred_module,
59 bool &any_found) const;
60
62
63 void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,
64 const TypeAndOrName &type_info);
65
66protected:
68 std::mutex m_mutex;
69
70private:
71 using DynamicTypeCache = std::map<Address, TypeAndOrName>;
72
74};
75
76} // namespace lldb_private
77
78#endif
A section + offset based address class.
Definition Address.h:62
virtual void AppendExceptionBreakpointFilterModules(FileSpecList &list, const Target &target)
std::map< Address, TypeAndOrName > DynamicTypeCache
virtual bool IsVTableSymbol(Mangled &mangled) const
void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info)
virtual bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, const LanguageRuntime::VTableInfo &vtable_info, TypeAndOrName &class_type_or_name, Address &dynamic_address)
virtual lldb::ValueObjectSP GetExceptionObjectForThread(lldb::ThreadSP thread_sp)
virtual ~CommonABIRuntime()=default
lldb::TypeSP LookupTypeByName(llvm::StringRef type_name, lldb::ModuleSP preferred_module, bool &any_found) const
Find a type by its name, preferably in preferred_module.
virtual llvm::StringRef GetName() const =0
virtual void AppendExceptionBreakpointFunctions(std::vector< const char * > &names, bool catch_bp, bool throw_bp, bool for_expressions)
TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr)
A file collection class.
A class that handles mangled names.
Definition Mangled.h:34
A plug-in interface definition class for debugging a process.
Definition Process.h:359
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition Type.h:780
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Module > ModuleSP